Skip to content

Commit

Permalink
Merge pull request #212 from DefTruth/dev
Browse files Browse the repository at this point in the history
feat(OSX):👋 add prebuilt v0.1.1 lite.ai.toolkit for OSX10.15.x (#211)
  • Loading branch information
DefTruth authored Feb 27, 2022
2 parents 0e124c6 + 0405ac9 commit 0c09a7d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ cmake-build-release
.idea
build-debug.sh
__pycache__
scripts
prebuilt
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.17)
project(lite.ai.toolkit)

set(CMAKE_CXX_STANDARD 11)
set(VERSION_STRING 0.1.0)
set(SOVERSION_STRING 0.1.0)
set(VERSION_STRING 0.1.1)
set(SOVERSION_STRING 0.1.1)
include(cmake/lite.ai.toolkit-platform.cmake) # checking platform

message("==================================== Lite.AI.ToolKit ${VERSION_STRING} =============================")
Expand All @@ -15,16 +15,19 @@ message("Platform Name: ${PLATFORM_NAME}")
message("Root Path: ${CMAKE_SOURCE_DIR}")
message("================================================================================")


# root dir
set(LITE_AI_ROOT_DIR ${CMAKE_SOURCE_DIR})
# dir for built files.
set(BUILD_LITE_AI_DIR ${LITE_AI_ROOT_DIR}/build/lite.ai.toolkit)
# set default build dir for lite.ai.toolkit
if (NOT DEFINED BUILD_LITE_AI_DIR)
set(BUILD_LITE_AI_DIR ${LITE_AI_ROOT_DIR}/build/lite.ai.toolkit)
endif()
set(LIBRARY_OUTPUT_PATH ${BUILD_LITE_AI_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${BUILD_LITE_AI_DIR}/bin)

# options
option(LITE_AI_BUILD_LIB "whether to build shared libraries." ON) # now, ON only
option(LITE_AI_BUILD_TEST "whether to build shared libraries." ON) # now, ON only
option(LITE_AI_BUILD_TEST "whether to build test examples." ON)
option(INCLUDE_OPENCV "whether to include OpenCV into lite.ai.toolkit." ON)
# engine backend: config.h.in -> config.h
option(ENABLE_ONNXRUNTIME "whether to enable ONNXRuntime engine" ON)
Expand Down
17 changes: 10 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/bin/bash
if [ ! -d ./build ]; then
mkdir build

BUILD_DIR=build

if [ ! -d "${BUILD_DIR}" ]; then
mkdir "${BUILD_DIR}"
echo "creating build dir: ${BUILD_DIR} ..."
else
echo "build directory exist! clearing ... "
rm -rf ./build/* && echo "clear built files done ! & rebuilding ... "
echo "build dir: {BUILD_DIR} directory exist! ..."
fi

cd build && cmake \
cd "${BUILD_DIR}" && pwd && cmake .. \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DINCLUDE_OPENCV=ON \
-DENABLE_MNN=OFF \
-DENABLE_NCNN=OFF \
-DENABLE_TNN=OFF \
.. && make -j8
-DENABLE_TNN=OFF &&
make -j8
4 changes: 2 additions & 2 deletions cmake/lite.ai.toolkit-cmd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function(add_lite_ai_toolkit_shared_library version soversion)
set_target_properties(lite.ai.toolkit PROPERTIES VERSION ${version} SOVERSION ${soversion})

message("Installing Lite.AI.ToolKit Headers ...")
file(INSTALL ${LITE_HEAD} DESTINATION ${CMAKE_SOURCE_DIR}/build/lite.ai.toolkit/include/lite)
file(INSTALL ${LITE_HEAD} DESTINATION ${BUILD_LITE_AI_DIR}/include/lite)

message(">>>> Added Shared Library: lite.ai.toolkit !")

Expand Down Expand Up @@ -108,7 +108,7 @@ function(add_lite_ai_toolkit_engines_headers_command)
add_custom_command(TARGET lite.ai.toolkit
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LITE_AI_ROOT_DIR}/ncnn ${BUILD_LITE_AI_DIR}/include/ncnn
COMMAND ${CMAKE_COMMAND} -E echo "Installing NCNN headers to ${BUILD_LITE_AI_DIR}/ncnn ... done!"
COMMAND ${CMAKE_COMMAND} -E echo "Installing NCNN headers to ${BUILD_LITE_AI_DIR}/include/ncnn ... done!"
)
endif()

Expand Down

0 comments on commit 0c09a7d

Please sign in to comment.