-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (49 loc) · 1.68 KB
/
CMakeLists.txt
File metadata and controls
59 lines (49 loc) · 1.68 KB
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
cmake_minimum_required(VERSION 3.11)
project(rlcpp)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 20)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# check if rlcpp is being used directly or via add_subdirectory
if(NOT DEFINED RLCPP_MASTER_PROJECT)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(RLCPP_MASTER_PROJECT ON)
else()
set(RLCPP_MASTER_PROJECT OFF)
endif()
endif()
add_library(rlcpp INTERFACE)
add_library(rlcpp::rlcpp ALIAS rlcpp)
target_include_directories(rlcpp INTERFACE ${CMAKE_CURRENT_LIST_DIR})
## for dynet
set(DYNET_ROOT "/usr/local" CACHE PATH "the dynet installed prefix")
if (NOT EXISTS ${DYNET_ROOT}/include/dynet/dynet.h)
message(FATAL_ERROR "error of DYNET_ROOT, please set with -DDYNET_ROOT=/path/to/dynet: ${DYNET_ROOT}")
endif()
message(STATUS "DYNET_ROOT: ${DYNET_ROOT}")
target_include_directories(rlcpp INTERFACE ${DYNET_ROOT}/include)
target_link_directories(rlcpp INTERFACE ${DYNET_ROOT}/lib)
target_link_libraries(rlcpp INTERFACE dynet)
include(FetchContent)
## find cpptools library
message(STATUS "rlcpp find cpptools library")
include(FetchContent)
FetchContent_Declare(
cpptools
GIT_REPOSITORY https://github.com/ting2938/cpptools.git
GIT_TAG master
)
FetchContent_MakeAvailable(cpptools)
target_link_libraries(rlcpp INTERFACE cpptools::ct)
if (RLCPP_MASTER_PROJECT)
include(fetch_lib)
add_subdirectory(train)
add_subdirectory(tools)
option(RLCPP_BUILD_TEST "whether to build the test progrom" ON)
if(RLCPP_BUILD_TEST)
add_subdirectory(test)
endif()
else()
message(STATUS "load rlcpp::rlcpp done")
endif()