-
Notifications
You must be signed in to change notification settings - Fork 3
/
dependencies.cmake
134 lines (109 loc) · 4.38 KB
/
dependencies.cmake
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Set CMake Policies
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif(POLICY CMP0135)
if(UNIX AND NOT APPLE)
FIND_PACKAGE(Eigen3 REQUIRED)
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR})
#find_package(cppzmq REQUIRED)
#find_package(ZeroMQ REQUIRED)
ADD_COMPILE_OPTIONS(-Werror=return-type -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Woverloaded-virtual)
include(FetchContent)
set(CPPZMQ_BUILD_TESTS OFF CACHE BOOL "" FORCE)
FetchContent_Declare(cppzmq
GIT_REPOSITORY https://github.com/zeromq/cppzmq
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/cppzmq
)
FetchContent_GetProperties(cppzmq)
if(NOT cppzmq_POPULATED)
FetchContent_Populate(cppzmq)
add_subdirectory(${cppzmq_SOURCE_DIR} ${cppzmq_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif()
if(APPLE) #APPLE
INCLUDE_DIRECTORIES(
/usr/local/include/
/usr/local/include/eigen3
# Most recent versions of brew install here
/opt/homebrew/include
/opt/homebrew/include/eigen3
)
ADD_COMPILE_OPTIONS(-Werror=return-type -Wall -Wextra -Wmissing-declarations -Wredundant-decls -Woverloaded-virtual)
# The library is installed here when using the regular cmake ., make, sudo make install
LINK_DIRECTORIES(
/usr/local/lib/
/opt/homebrew/lib/
)
find_package(cppzmq REQUIRED)
find_package(ZeroMQ REQUIRED)
endif()
if(WIN32)
include(C:/vcpkg/scripts/buildsystems/vcpkg.cmake)
set(CMAKE_TOOLCHAIN_FILE C:/vcpkg/scripts/buildsystems/vcpkg.cmake)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
FIND_PACKAGE(Eigen3 CONFIG REQUIRED)
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR})
find_package(cppzmq CONFIG REQUIRED)
set(DQROBOTICS_PATH "C:/Program Files (x86)/dqrobotics")
add_library(dqrobotics SHARED IMPORTED)
set_target_properties(dqrobotics PROPERTIES
IMPORTED_LOCATION ${DQROBOTICS_PATH}/bin/dqrobotics.dll
IMPORTED_IMPLIB ${DQROBOTICS_PATH}/lib/dqrobotics.lib
INTERFACE_INCLUDE_DIRECTORIES ${DQROBOTICS_PATH}/include)
endif()
#-----This works but is super slow--------------#
#set(BOOST_INCLUDE_LIBRARIES thread format filesystem system program_options)
#set(BOOST_ENABLE_CMAKE ON)
# Download and extract the boost library from GitHub
#message(STATUS "Downloading and extracting boost library sources. This will take some time...")
#Set(FETCHCONTENT_QUIET FALSE)
#include(FetchContent)
#FetchContent_Declare(
# Boost
# GIT_REPOSITORY https://github.com/boostorg/boost.git
# GIT_TAG boost-1.84.0
# USES_TERMINAL_DOWNLOAD TRUE
# GIT_PROGRESS TRUE
# GIT_SHALLOW TRUE
#)
#FetchContent_MakeAvailable(Boost)
#-----------------------------------------------
find_package(Boost)
if(Boost_FOUND)
#if (Boost_VERSION_MAJOR LESS_EQUAL 1 AND Boost_VERSION_MINOR LESS_EQUAL 81)
include_directories(${Boost_INCLUDE_DIRS})
message(AUTHOR_WARNING "Local Boost ${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_COUNT} found!")
set(CUSTOM_BOOST_COMPONENTS
${Boost_PROGRAM_FILESYTEM_LIBRARY}
${Boost_PROGRAM_FORMAT_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
#else()
# message(AUTHOR_WARNING "Local Boost ${Boost_VERSION_MAJOR}.${Boost_VERSION_MINOR}.${Boost_VERSION_COUNT} is not compatible. I'm going to download a compatible one!")
#endif()
else()
message(AUTHOR_WARNING "Local Boost not found. I'm going to download it!")
include(boost_dependencies.cmake)
endif()
include(FetchContent)
FetchContent_Declare(jsoncons
GIT_REPOSITORY https://github.com/danielaparker/jsoncons
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/jsoncons
)
FetchContent_GetProperties(jsoncons)
if(NOT jsoncons_POPULATED)
FetchContent_Populate(jsoncons)
#add_subdirectory(${jsoncons_SOURCE_DIR} ${jsoncons_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
message(STATUS "Dependencies ready!")
include(FetchContent)
FetchContent_Declare(
googletest
# Specify the commit you depend on and update it regularly.
#URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)