-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
49 lines (36 loc) · 1.63 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
cmake_minimum_required(VERSION 3.16)
project(lightGBM-serving VERSION "0.1.2" LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(SOURCE_CODE
src/config_parser.cc
src/model.cc
src/server.cc)
set(TEST_CODE
src/config_parser_test.cc
src/model_test.cc
src/server_test.cc)
configure_file(src/config.h.in config.h)
set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Turn off building rapidjson test" FORCE)
add_subdirectory("${PROJECT_SOURCE_DIR}/third_party/LightGBM")
add_subdirectory("${PROJECT_SOURCE_DIR}/third_party/rapidjson")
add_subdirectory("${PROJECT_SOURCE_DIR}/third_party/cpp-httplib")
add_subdirectory("${PROJECT_SOURCE_DIR}/third_party/cxxopts")
include_directories("${PROJECT_SOURCE_DIR}/third_party/rapidjson/include")
include_directories("${PROJECT_SOURCE_DIR}/third_party/cpp-httplib")
include_directories("${PROJECT_SOURCE_DIR}/third_party/cxxopts/include")
include_directories("${PROJECT_SOURCE_DIR}/third_party/LightGBM/include")
include_directories("${PROJECT_SOURCE_DIR}/third_party/spdlog/include")
include_directories("${CMAKE_CURRENT_BINARY_DIR}") # for config.h
add_executable(lightgbm-server ${SOURCE_CODE} src/main.cc)
target_link_libraries(lightgbm-server _lightgbm)
option(BUILD_TEST "Build the tests" OFF)
if(BUILD_TEST)
enable_testing()
add_subdirectory("${PROJECT_SOURCE_DIR}/third_party/googletest")
include_directories(${gtest_SOURCE_DIR}/include)
include_directories(${gmock_SOURCE_DIR}/include)
add_executable(run-test ${TEST_CODE} ${SOURCE_CODE})
target_link_libraries(run-test gtest gmock gtest_main _lightgbm)
add_test(NAME run-test COMMAND ./run-test)
endif()