Skip to content

Commit

Permalink
chroe: 添加CI测试并生成缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
GengGode committed Aug 30, 2024
1 parent 47ede07 commit 1a77f86
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: lukka/run-cmake@v10
with:
configurePreset: ${{ env.BUILD_TYPE }}
configurePresetAdditionalArgs: "['-DBUILD_SHARED_LIBS=${{ env.BUILD_SHARED_LIBS }}']"
configurePresetAdditionalArgs: "['-DBUILD_SHARED_LIBS=${{ env.BUILD_SHARED_LIBS }}', '-DBUILD_TESTING=ON']"

- name: build
run: cmake --build build --config ${{ env.BUILD_TYPE }}
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
#=======================================================================================================================
set(BUILD_TARGET_NAME libocr CACHE STRING "Build target_name" FORCE)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libs")
set(BUILD_TEST OFF CACHE BOOL "Build test")
set(BUILD_TESTING OFF CACHE BOOL "Build test")
set(ENABLE_LINKEDRESOURCE "not embed file" CACHE STRING "embed file status")
#=======================================================================================================================
set(include_dir ${CMAKE_SOURCE_DIR}/include)
Expand Down Expand Up @@ -69,7 +69,7 @@ find_package(OpenCV CONFIG REQUIRED)
#=======================================================================================================================
add_subdirectory(resource)
add_subdirectory(source)
if (BUILD_TEST)
if (BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif ()
Expand All @@ -80,7 +80,7 @@ message(STATUS "Config : ")
message(STATUS " Version : ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
message(STATUS " BUILD_TARGET_NAME : ${BUILD_TARGET_NAME}")
message(STATUS " BUILD_SHARED_LIBS : ${BUILD_SHARED_LIBS}")
message(STATUS " BUILD_TEST : ${BUILD_TEST}")
message(STATUS " BUILD_TESTING : ${BUILD_TESTING}")
message(STATUS "Model : ")
message(STATUS " enable linked resource : ${ENABLE_LINKEDRESOURCE}")
message(STATUS " model_rec_file : ${model_rec_file}")
Expand Down
2 changes: 1 addition & 1 deletion resource/version.ver
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.131
0.3.142
2 changes: 1 addition & 1 deletion resource/version_hash.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
740185a
47ede07
3 changes: 3 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ target_link_libraries(${BUILD_TARGET_NAME} PRIVATE ${BUILD_TARGET_NAME}::resourc

# 编译完成后,install到install目录
install(TARGETS ${BUILD_TARGET_NAME})
if (NOT BUILD_SHARED_LIBS)
install(TARGETS ${BUILD_TARGET_NAME}_resource)
endif()
install(FILES ${include_dir}/libocr/libocr.h DESTINATION include/libocr)
2 changes: 2 additions & 0 deletions test/example_dynamiclink_loadtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/../image/test.png
$<TARGET_FILE_DIR:example_dynamiclink_loadtime>
)

install(TARGETS ${PROJECT_NAME})
2 changes: 2 additions & 0 deletions test/example_dynamiclink_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/../image/test.png
$<TARGET_FILE_DIR:example_dynamiclink_runtime>
)

install(TARGETS ${PROJECT_NAME})
2 changes: 2 additions & 0 deletions test/example_staticlink_compiletime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/../image/test.png
$<TARGET_FILE_DIR:example_staticlink_compiletime>
)

install(TARGETS ${PROJECT_NAME})

0 comments on commit 1a77f86

Please sign in to comment.