Skip to content

Commit

Permalink
static library, lgtm rel linux
Browse files Browse the repository at this point in the history
  • Loading branch information
kuro337 committed Apr 23, 2024
1 parent 814bd21 commit 500edae
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ images
test_images
bulk
tests/bulk_test.cc
CMakebkp.txt
CMakebkp.txt
27 changes: 0 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ if (NOT Leptonica_FOUND)
pkg_check_modules(Leptonica REQUIRED IMPORTED_TARGET lept)
endif()


# gtest
include(FetchContent)
FetchContent_Declare(
Expand All @@ -99,7 +98,6 @@ FetchContent_MakeAvailable(googletest)

# Static Library : 1. Define src folder, add lib, set Include Dir for Static Lib

# include_directories(${CMAKE_SOURCE_DIR}/include) # Make sure the include Headers are included
file(GLOB_RECURSE SRC_FILES "${CMAKE_SOURCE_DIR}/src/*.cc")
add_library(common_lib ${SRC_FILES}) # Creates a static library by default

Expand Down Expand Up @@ -129,21 +127,6 @@ target_include_directories(common_lib PUBLIC "${CMAKE_SOURCE_DIR}/include")
add_executable(main main.cc)
target_link_libraries(main PUBLIC common_lib) # link with common_lib

# target_link_libraries(main
# PUBLIC GTest::gtest_main
# PUBLIC Folly::folly
# PUBLIC OpenSSL::Crypto
# PUBLIC PkgConfig::Tesseract
# PUBLIC PkgConfig::Leptonica
# )

# if(OpenMP_CXX_FOUND)
# message(STATUS "Using OpenMP")
# target_link_libraries(main PUBLIC OpenMP::OpenMP_CXX)
# else()
# message(STATUS "OpenMP not found")
# endif()


if (BENCHMARK)
add_executable(cache_benchmark benchmarks/cache_benchmark.cc)
Expand All @@ -158,9 +141,6 @@ set(TEST_EXECUTABLES)

file(GLOB TEST_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/tests" "tests/*.cc")

# Static Library
# add_library(tesseract_lib STATIC src/tesseract.cc)
# target_link_libraries(${TEST_EXECUTABLE} tesseract_lib) then link this

foreach(TEST_SOURCE IN LISTS TEST_SOURCES)
get_filename_component(TEST_EXECUTABLE ${TEST_SOURCE} NAME_WE)
Expand All @@ -178,13 +158,6 @@ foreach(TEST_SOURCE IN LISTS TEST_SOURCES)
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tests"
)

# if(OpenMP_CXX_FOUND)
# message(STATUS "Using OpenMP for ${TEST_EXECUTABLE}")
# target_link_libraries(${TEST_EXECUTABLE} PUBLIC OpenMP::OpenMP_CXX)
# else()
# message(STATUS "OpenMP not found for ${TEST_EXECUTABLE}")
# endif()

include(GoogleTest)
gtest_discover_tests(${TEST_EXECUTABLE})
endforeach()
Expand Down
Loading

0 comments on commit 500edae

Please sign in to comment.