forked from VowpalWabbit/reinforcement_learning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
118 lines (100 loc) · 4.18 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
if(WIN32)
# Due to needing to configure the CMAKE platform, this needs to be included before the
# top-level project() declaration.
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/platforms/win32.cmake)
message(STATUS "WinSDK Version: ${CMAKE_SYSTEM_VERSION}")
endif()
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING INTERNAL FORCE)
if (NOT CMAKE_BUILD_TYPE AND NOT GENERATOR_IS_MULTI_CONFIG)
message(STATUS "No build type selected, defaulting to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
project(reinforcement_learning)
#set(CMAKE_CXX_STANDARD 11)
# Add support for building library with latest version of C++ supported by your compiler
# Copied from VW
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/")
option(USE_LATEST_STD "Override using C++11 with the latest standard the compiler offers. Default is C++11. " OFF)
include(DetectCXXStandard)
set(RL_CXX_STANDARD 11)
if(USE_LATEST_STD)
DetectCXXStandard(RL_CXX_STANDARD)
endif()
message(STATUS "Using C++ standard: " ${RL_CXX_STANDARD})
set(CMAKE_CXX_STANDARD ${RL_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(RL_BUILD_PYTHON "Build the Python bindings" OFF)
option(RL_USE_ZSTD "Whether to enable usage of zstandard compression" ON)
option(RL_STATIC_DEPS "Only use static dependencies" OFF)
option(RL_BUILD_BENCHMARKS "Build benchmarks" OFF)
option(vw_USE_AZURE_FACTORIES "Whether to compile with the azure factories components" ON)
option(RL_OPENSSL_SYS_DEP "Use system-wide openssl library" ON)
option(RL_CPPRESTSDK_SYS_DEP "Use system-wide cpprestsdk library" ON)
option(RL_BUILD_NUGET "Build the Nuget package" OFF)
# For Nuget package don't use system libraries, use vendored ones in ext_libs instead
if(RL_BUILD_NUGET)
set(RAPIDJSON_SYS_DEP OFF CACHE BOOL "" FORCE)
set(FMT_SYS_DEP OFF CACHE BOOL "" FORCE)
set(SPDLOG_SYS_DEP OFF CACHE BOOL "" FORCE)
set(VW_ZLIB_SYS_DEP OFF CACHE BOOL "" FORCE)
set(VW_BOOST_MATH_SYS_DEP OFF CACHE BOOL "" FORCE)
set(RL_OPENSSL_SYS_DEP OFF CACHE BOOL "" FORCE)
set(RL_CPPRESTSDK_SYS_DEP OFF CACHE BOOL "" FORCE)
set(RL_STATIC_DEPS ON)
endif()
if(RL_STATIC_DEPS)
if(WIN32)
set(STATIC_LIB_SUFFIXES ".lib" ".a")
else()
set(STATIC_LIB_SUFFIXES ".a")
endif()
set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(STATIC_LINK_VW_JAVA ON CACHE BOOL "")
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ${STATIC_LIB_SUFFIXES})
endif()
# We also require Boost::uuid, but that is a header-only dependency and is unable to be found
# using find_package as a component, which means it is possible to have a successfully configured
# build that will nonetheless not work due to missing dependencies.
find_package(Boost COMPONENTS unit_test_framework system program_options thread REQUIRED)
# On MacOS, Boost::thread needs to be linked separately.
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_package(Boost COMPONENTS thread REQUIRED)
endif()
include(ProcessorCount)
ProcessorCount(NumProcessors)
message("Number of processors: ${NumProcessors}")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/nprocs.txt ${NumProcessors})
# This provides the variables such as CMAKE_INSTALL_LIBDIR for installation paths.
include(GNUInstallDirs)
include(ext_libs/ext_libs.cmake)
add_subdirectory(rlclientlib)
add_subdirectory(rlclientlib/extensions)
add_subdirectory(examples)
add_subdirectory(test_tools/joiner)
add_subdirectory(test_tools/sender_test)
add_subdirectory(test_tools/example_gen)
# enable_testing should be run after ext_libs so that the vw unit tests arent turned on.
enable_testing()
# Since bindings will add tests, if appropriate, it needs to be included after enable_testing().
add_subdirectory(bindings)
add_subdirectory(unit_test)
add_subdirectory(unit_test/extensions)
if(RL_BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
# Add the nuget subdirectory last
if(RL_BUILD_NUGET)
if(WIN32)
add_subdirectory(nuget)
else()
message(FATAL_ERROR "Nuget package must be built on Windows")
endif()
endif()