diff --git a/.gitignore b/.gitignore index 4ebc17a7..db1c7203 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ cmake-build-release .idea build-debug.sh __pycache__ +scripts +prebuilt \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f74d6395..683455dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} =============================") @@ -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) diff --git a/build.sh b/build.sh index 1f3413aa..f612f188 100644 --- a/build.sh +++ b/build.sh @@ -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 diff --git a/cmake/lite.ai.toolkit-cmd.cmake b/cmake/lite.ai.toolkit-cmd.cmake index b2ab4a48..aebf8601 100644 --- a/cmake/lite.ai.toolkit-cmd.cmake +++ b/cmake/lite.ai.toolkit-cmd.cmake @@ -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 !") @@ -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()