Skip to content

Commit c712553

Browse files
committed
Merge remote-tracking branch 'origin/master' into inconsistent_lookup
2 parents 4f8ca54 + 4ad7168 commit c712553

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
2222
option(STRATEGY_GetDependencies "Fetch external dependencies from web." ON)
2323

2424
if (STRATEGY_GetDependencies)
25-
ExternalProject_add(ptrie-ext
25+
ExternalProject_add(ptrie
2626
URL https://github.com/petergjoel/ptrie/archive/v1.1.1.zip
2727
URL_HASH SHA512=5435D6F8132D273B50ECCD721790D559F7DC67FFDADA75FEC315F4C53705199F31F1DDC80DDA0CB86F883DB27076FA6D324D28516B442FECCE3FFA51213AEF4E
2828
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
2929
)
3030

31-
ExternalProject_add(json-ext
31+
ExternalProject_add(nlohmann_json
3232
URL https://github.com/nlohmann/json/archive/v3.7.3.zip
3333
URL_HASH SHA512=b47a07de9a071cce645a173d084df5dd31f7669154fc00f6c99e0506474d30e8376acaee1d3c79a50def4f25a36042951bfa4fca9a704687e59c368d05053158
34-
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DJSON_BuildTests=OFF
34+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DJSON_BuildTests=OFF -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
3535
)
3636

3737
include_directories(${EXTERNAL_INSTALL_LOCATION}/include)
3838
link_directories(${EXTERNAL_INSTALL_LOCATION}/lib)
39+
else (STRATEGY_GetDependencies)
40+
find_package(nlohmann_json 3.7.3 REQUIRED)
41+
find_package(ptrie 1.1.1 REQUIRED)
3942
endif (STRATEGY_GetDependencies)
4043

4144
# Unset Boost_ROOT here if set, not needed for JSON or source of strategy

src/CMakeLists.txt

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,33 @@ set(CMAKE_CXX_STANDARD 17)
44
set(CMAKE_INCLUDE_CURRENT_DIR ON)
55
option(LIBSTRATEGY_OnlyLibrary "Build only as library." OFF)
66

7-
add_library(strategy SHARED ${HEADER_FILES} ZonotopStrategy.cpp SimpleTree.cpp)
8-
add_dependencies(strategy ptrie-ext json-ext)
9-
target_include_directories (strategy PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
10-
11-
add_library(strategyStatic STATIC ${HEADER_FILES} ZonotopStrategy.cpp SimpleTree.cpp)
12-
add_dependencies(strategyStatic ptrie-ext json-ext)
13-
target_include_directories (strategyStatic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
14-
set_target_properties(strategyStatic PROPERTIES OUTPUT_NAME strategy)
15-
167
if(NOT LIBSTRATEGY_OnlyLibrary)
178
cmake_policy(SET CMP0069 NEW)
189
cmake_policy(SET CMP0074 NEW)
1910

2011
find_package(Boost 1.66 COMPONENTS program_options REQUIRED)
21-
2212
include_directories(${Boost_INCLUDE_DIR})
23-
add_executable(z2s ${HEADER_FILES} main.cpp)
24-
add_dependencies(z2s ptrie-ext json-ext)
25-
target_link_libraries(z2s PRIVATE strategyStatic stdc++fs ${Boost_LIBRARIES})
13+
endif()
14+
15+
add_library(strategy SHARED ${HEADER_FILES} libz2s.cpp ZonotopStrategy.cpp SimpleTree.cpp)
16+
if (STRATEGY_GetDependencies)
17+
add_dependencies(strategy ptrie json)
18+
endif (STRATEGY_GetDependencies)
19+
target_include_directories (strategy PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
20+
21+
add_library(strategyStatic STATIC ${HEADER_FILES} libz2s.cpp ZonotopStrategy.cpp SimpleTree.cpp)
22+
if (STRATEGY_GetDependencies)
23+
add_dependencies(strategyStatic ptrie json)
24+
endif (STRATEGY_GetDependencies)
25+
target_include_directories (strategyStatic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
26+
set_target_properties(strategyStatic PROPERTIES OUTPUT_NAME strategy)
27+
28+
if(NOT LIBSTRATEGY_OnlyLibrary)
29+
add_executable(z2s ${HEADER_FILES} main.cpp ZonotopStrategy.cpp SimpleTree.cpp)
30+
if (STRATEGY_GetDependencies)
31+
add_dependencies(z2s ptrie json)
32+
endif (STRATEGY_GetDependencies)
33+
target_link_libraries(z2s PRIVATE stdc++fs ${Boost_LIBRARIES})
2634
endif()
2735

2836

0 commit comments

Comments
 (0)