-
Notifications
You must be signed in to change notification settings - Fork 199
/
CMakeLists.txt
74 lines (64 loc) · 1.59 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
include(FindPkgConfig)
if(NOT PKG_CONFIG_FOUND)
message(STATUS "pkgconf not found")
return()
endif()
pkg_check_modules(ZMQ libzmq)
if(NOT ZMQ_FOUND)
message(STATUS "zeromq not found")
return()
endif()
find_package(Protobuf REQUIRED)
if(NOT Protobuf_FOUND)
message(STATUS "protobuf not found")
return()
endif()
set(proto_source_files
model/messages.proto
)
set(source_files
helper/opengym-helper.cc
model/container.cc
model/opengym_env.cc
model/opengym_interface.cc
model/spaces.cc
${proto_source_files}
)
set(header_files
helper/opengym-helper.h
model/container.h
model/opengym_env.h
model/opengym_interface.h
model/spaces.h
)
build_lib(
LIBNAME opengym
SOURCE_FILES ${source_files}
HEADER_FILES ${header_files}
LIBRARIES_TO_LINK
${libcore}
${ZMQ_LIBRARIES}
protobuf::libprotobuf
TEST_SOURCES
test/opengym-test-suite.cc
)
# need protobuf_generate func to generate messages
check_function_exists(protobuf_generate protobuf_generate_exists)
if(${protobuf_generate_exists})
message(STATUS "protobuf_generate command found")
else()
message(STATUS "protobuf_generate command not found -> use a local copy from ${CMAKE_CURRENT_SOURCE_DIR}/protobuf-generate.cmake")
include(${CMAKE_CURRENT_SOURCE_DIR}/protobuf-generate.cmake)
endif()
protobuf_generate(
TARGET ${libopengym-obj}
IMPORT_DIRS model/
LANGUAGE cpp
PROTOC_OUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/model
)
protobuf_generate(
TARGET ${libopengym-obj}
IMPORT_DIRS model/
LANGUAGE python
PROTOC_OUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/model/ns3gym/ns3gym
)