Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 1 | # Disable in-source builds to prevent source tree corruption. |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 2 | if(" ${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL " ${CMAKE_CURRENT_BINARY_DIR}") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 3 | message(FATAL_ERROR " |
| 4 | FATAL: In-source builds are not allowed. |
| 5 | You should create a separate directory for build files. |
| 6 | ") |
| 7 | endif() |
| 8 | |
Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 9 | if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") |
| 10 | set(CMAKE_SYSTEM_VERSION 10.0.18362.0 CACHE STRING INTERNAL FORCE) |
| 11 | set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION 10.0.18362.0 CACHE STRING INTERNAL FORCE) |
| 12 | endif() |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 13 | |
| 14 | project(allwpilib) |
| 15 | cmake_minimum_required(VERSION 3.3.0) |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 16 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") |
| 17 | |
Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 18 | message(STATUS "Platform version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") |
| 19 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 20 | set(WPILIB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 21 | |
| 22 | INCLUDE(CPack) |
| 23 | |
| 24 | set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) |
| 25 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
| 26 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 27 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib) |
| 28 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib) |
| 29 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/bin) |
| 30 | set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${WPILIB_BINARY_DIR}/jar) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 31 | |
| 32 | # use, i.e. don't skip the full RPATH for the build tree |
| 33 | SET(CMAKE_SKIP_BUILD_RPATH FALSE) |
| 34 | |
| 35 | # when building, don't use the install RPATH already |
| 36 | # (but later on when installing) |
| 37 | SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) |
| 38 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 39 | SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 40 | |
| 41 | # add the automatically determined parts of the RPATH |
| 42 | # which point to directories outside the build tree to the install RPATH |
| 43 | SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) |
| 44 | |
| 45 | # the RPATH to be used when installing, but only if it's not a system directory |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 46 | LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 47 | IF("${isSystemDir}" STREQUAL "-1") |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 48 | SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 49 | ENDIF("${isSystemDir}" STREQUAL "-1") |
| 50 | |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 51 | # Options for building certain parts of the repo. Everything is built by default. |
| 52 | option(BUILD_SHARED_LIBS "Build with shared libs (needed for JNI)" ON) |
| 53 | option(WITH_JAVA "Include java and JNI in the build" ON) |
| 54 | option(WITH_CSCORE "Build cscore (needs OpenCV)" ON) |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 55 | option(WITH_NTCORE "Build ntcore" ON) |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 56 | option(WITH_WPIMATH "Build wpimath" ON) |
| 57 | option(WITH_WPILIB "Build hal, wpilibc/j, and myRobot (needs OpenCV)" ON) |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 58 | option(WITH_EXAMPLES "Build examples" OFF) |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 59 | option(WITH_TESTS "Build unit tests (requires internet connection)" ON) |
| 60 | option(WITH_GUI "Build GUI items" ON) |
| 61 | option(WITH_SIMULATION_MODULES "Build simulation modules" ON) |
| 62 | |
| 63 | # Options for external HAL. |
| 64 | option(WITH_EXTERNAL_HAL "Use a separately built HAL" OFF) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 65 | set(EXTERNAL_HAL_FILE "" CACHE FILEPATH "Location to look for an external HAL CMake File") |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 66 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 67 | # Options for using a package manager (e.g., vcpkg) for certain dependencies. |
| 68 | option(USE_SYSTEM_FMTLIB "Use system fmtlib" OFF) |
| 69 | option(USE_SYSTEM_LIBUV "Use system libuv" OFF) |
| 70 | option(USE_SYSTEM_EIGEN "Use system eigen" OFF) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 71 | |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 72 | # Options for installation. |
| 73 | option(WITH_FLAT_INSTALL "Use a flat install directory" OFF) |
| 74 | |
| 75 | # Options for location of OpenCV Java. |
| 76 | set(OPENCV_JAVA_INSTALL_DIR "" CACHE PATH "Location to search for the OpenCV jar file") |
| 77 | |
| 78 | # Set default build type to release with debug info (i.e. release mode optimizations |
| 79 | # are performed, but debug info still exists). |
| 80 | if (NOT CMAKE_BUILD_TYPE) |
| 81 | set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE) |
| 82 | endif() |
| 83 | |
| 84 | # We always want flat install with MSVC. |
| 85 | if (MSVC) |
| 86 | set(WITH_FLAT_INSTALL ON) |
| 87 | endif() |
| 88 | |
| 89 | if (WITH_JAVA AND NOT BUILD_SHARED_LIBS) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 90 | message(FATAL_ERROR " |
| 91 | FATAL: Cannot build static libs with Java enabled. |
| 92 | Static libs requires both BUILD_SHARED_LIBS=OFF and |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 93 | WITH_JAVA=OFF |
| 94 | ") |
| 95 | endif() |
| 96 | |
| 97 | if (WITH_SIMULATION_MODULES AND NOT BUILD_SHARED_LIBS) |
| 98 | message(FATAL_ERROR " |
| 99 | FATAL: Cannot build static libs with simulation modules enabled. |
| 100 | Static libs requires both BUILD_SHARED_LIBS=OFF and |
| 101 | WITH_SIMULATION_MODULES=OFF |
| 102 | ") |
| 103 | endif() |
| 104 | |
| 105 | if (NOT WITH_JAVA OR NOT WITH_CSCORE) |
| 106 | if(NOT "${OPENCV_JAVA_INSTALL_DIR}" STREQUAL "") |
| 107 | message(WARNING " |
| 108 | WARNING: OpenCV Java dir set but java is not enabled! |
| 109 | It will be ignored. |
| 110 | ") |
| 111 | endif() |
| 112 | endif() |
| 113 | |
| 114 | if (NOT WITH_WPILIB AND WITH_SIMULATION_MODULES) |
| 115 | message(FATAL_ERROR " |
| 116 | FATAL: Cannot build simulation modules with wpilib disabled. |
| 117 | Enable wpilib by setting WITH_WPILIB=ON |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 118 | ") |
| 119 | endif() |
| 120 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 121 | if (NOT WITH_NTCORE AND WITH_CSCORE) |
| 122 | message(FATAL_ERROR " |
| 123 | FATAL: Cannot build cameraserver without ntcore. |
| 124 | Enable ntcore by setting WITH_NTCORE=ON |
| 125 | ") |
| 126 | endif() |
| 127 | |
| 128 | if (NOT WITH_NTCORE AND WITH_GUI) |
| 129 | message(FATAL_ERROR " |
| 130 | FATAL: Cannot build GUI modules without ntcore. |
| 131 | Enable ntcore by setting WITH_NTCORE=ON |
| 132 | ") |
| 133 | endif() |
| 134 | |
| 135 | if (NOT WITH_NTCORE AND WITH_SIMULATION_MODULES) |
| 136 | message(FATAL_ERROR " |
| 137 | FATAL: Cannot build simulation modules without ntcore. |
| 138 | Enable ntcore by setting WITH_NTCORE=ON |
| 139 | ") |
| 140 | endif() |
| 141 | |
| 142 | if (NOT WITH_NTCORE AND WITH_WPILIB) |
| 143 | message(FATAL_ERROR " |
| 144 | FATAL: Cannot build wpilib without ntcore. |
| 145 | Enable ntcore by setting WITH_NTCORE=ON |
| 146 | ") |
| 147 | endif() |
| 148 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 149 | if (NOT WITH_WPIMATH AND WITH_WPILIB) |
| 150 | message(FATAL_ERROR " |
| 151 | FATAL: Cannot build wpilib without wpimath. |
| 152 | Enable wpimath by setting WITH_WPIMATH=ON |
| 153 | ") |
| 154 | endif() |
| 155 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 156 | set( wpilib_dest "") |
| 157 | set( include_dest include ) |
| 158 | set( main_lib_dest lib ) |
| 159 | set( java_lib_dest java ) |
| 160 | set( jni_lib_dest jni ) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 161 | |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 162 | if (WITH_FLAT_INSTALL) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 163 | set (wpilib_config_dir ${wpilib_dest}) |
| 164 | else() |
| 165 | set (wpilib_config_dir share/wpilib) |
| 166 | endif() |
| 167 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 168 | if (USE_SYSTEM_LIBUV) |
| 169 | set (LIBUV_SYSTEM_REPLACE " |
| 170 | find_package(PkgConfig REQUIRED) |
| 171 | pkg_check_modules(libuv REQUIRED IMPORTED_TARGET libuv) |
| 172 | ") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 173 | endif() |
| 174 | |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 175 | if (USE_SYSTEM_EIGEN) |
| 176 | set (EIGEN_SYSTEM_REPLACE "find_package(Eigen3 CONFIG)") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 177 | endif() |
| 178 | |
Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 179 | find_package(LIBSSH 0.7.1) |
| 180 | |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 181 | if (WITH_FLAT_INSTALL) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 182 | set(WPIUTIL_DEP_REPLACE "include($\{SELF_DIR\}/wpiutil-config.cmake)") |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 183 | set(WPINET_DEP_REPLACE "include($\{SELF_DIR\}/wpinet-config.cmake)") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 184 | set(NTCORE_DEP_REPLACE "include($\{SELF_DIR\}/ntcore-config.cmake)") |
| 185 | set(CSCORE_DEP_REPLACE_IMPL "include(\${SELF_DIR}/cscore-config.cmake)") |
| 186 | set(CAMERASERVER_DEP_REPLACE_IMPL "include(\${SELF_DIR}/cameraserver-config.cmake)") |
| 187 | set(HAL_DEP_REPLACE_IMPL "include(\${SELF_DIR}/hal-config.cmake)") |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 188 | set(WPIMATH_DEP_REPLACE "include($\{SELF_DIR\}/wpimath-config.cmake)") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 189 | set(WPILIBC_DEP_REPLACE_IMPL "include(\${SELF_DIR}/wpilibc-config.cmake)") |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 190 | set(WPILIBNEWCOMMANDS_DEP_REPLACE "include(\${SELF_DIR}/wpilibNewcommands-config.cmake)") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 191 | else() |
| 192 | set(WPIUTIL_DEP_REPLACE "find_dependency(wpiutil)") |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 193 | set(WPINET_DEP_REPLACE "find_dependency(wpinet)") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 194 | set(NTCORE_DEP_REPLACE "find_dependency(ntcore)") |
| 195 | set(CSCORE_DEP_REPLACE_IMPL "find_dependency(cscore)") |
| 196 | set(CAMERASERVER_DEP_REPLACE_IMPL "find_dependency(cameraserver)") |
| 197 | set(HAL_DEP_REPLACE_IMPL "find_dependency(hal)") |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 198 | set(WPIMATH_DEP_REPLACE "find_dependency(wpimath)") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 199 | set(WPILIBC_DEP_REPLACE_IMPL "find_dependency(wpilibc)") |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 200 | set(WPILIBNEWCOMMANDS_DEP_REPLACE "find_dependency(wpilibNewCommands)") |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 201 | endif() |
| 202 | |
| 203 | set(FILENAME_DEP_REPLACE "get_filename_component(SELF_DIR \"$\{CMAKE_CURRENT_LIST_FILE\}\" PATH)") |
| 204 | set(SELF_DIR "$\{SELF_DIR\}") |
| 205 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 206 | get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) |
| 207 | |
| 208 | if(isMultiConfig) |
| 209 | if(NOT "Asan" IN_LIST CMAKE_CONFIGURATION_TYPES) |
| 210 | list(APPEND CMAKE_CONFIGURATION_TYPES Asan) |
| 211 | endif() |
| 212 | if(NOT "Tsan" IN_LIST CMAKE_CONFIGURATION_TYPES) |
| 213 | list(APPEND CMAKE_CONFIGURATION_TYPES Tsan) |
| 214 | endif() |
| 215 | if(NOT "Ubsan" IN_LIST CMAKE_CONFIGURATION_TYPES) |
| 216 | list(APPEND CMAKE_CONFIGURATION_TYPES Ubsan) |
| 217 | endif() |
| 218 | else() |
| 219 | set(allowedBuildTypes Asan Tsan Ubsan Debug Release RelWithDebInfo MinSizeRel) |
| 220 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowedBuildTypes}") |
| 221 | |
| 222 | if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE IN_LIST allowedBuildTypes) |
| 223 | message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}") |
| 224 | endif() |
| 225 | endif() |
| 226 | |
| 227 | set(CMAKE_C_FLAGS_ASAN |
| 228 | "${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING |
| 229 | "Flags used by the C compiler for Asan build type or configuration." FORCE) |
| 230 | |
| 231 | set(CMAKE_CXX_FLAGS_ASAN |
| 232 | "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING |
| 233 | "Flags used by the C++ compiler for Asan build type or configuration." FORCE) |
| 234 | |
| 235 | set(CMAKE_EXE_LINKER_FLAGS_ASAN |
| 236 | "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" CACHE STRING |
| 237 | "Linker flags to be used to create executables for Asan build type." FORCE) |
| 238 | |
| 239 | set(CMAKE_SHARED_LINKER_FLAGS_ASAN |
| 240 | "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" CACHE STRING |
| 241 | "Linker lags to be used to create shared libraries for Asan build type." FORCE) |
| 242 | |
| 243 | set(CMAKE_C_FLAGS_TSAN |
| 244 | "${CMAKE_C_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer" CACHE STRING |
| 245 | "Flags used by the C compiler for Tsan build type or configuration." FORCE) |
| 246 | |
| 247 | set(CMAKE_CXX_FLAGS_TSAN |
| 248 | "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer" CACHE STRING |
| 249 | "Flags used by the C++ compiler for Tsan build type or configuration." FORCE) |
| 250 | |
| 251 | set(CMAKE_EXE_LINKER_FLAGS_TSAN |
| 252 | "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread" CACHE STRING |
| 253 | "Linker flags to be used to create executables for Tsan build type." FORCE) |
| 254 | |
| 255 | set(CMAKE_SHARED_LINKER_FLAGS_TSAN |
| 256 | "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread" CACHE STRING |
| 257 | "Linker lags to be used to create shared libraries for Tsan build type." FORCE) |
| 258 | |
| 259 | set(CMAKE_C_FLAGS_UBSAN |
| 260 | "${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" CACHE STRING |
| 261 | "Flags used by the C compiler for Ubsan build type or configuration." FORCE) |
| 262 | |
| 263 | set(CMAKE_CXX_FLAGS_UBSAN |
| 264 | "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" CACHE STRING |
| 265 | "Flags used by the C++ compiler for Ubsan build type or configuration." FORCE) |
| 266 | |
| 267 | set(CMAKE_EXE_LINKER_FLAGS_UBSAN |
| 268 | "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all" CACHE STRING |
| 269 | "Linker flags to be used to create executables for Ubsan build type." FORCE) |
| 270 | |
| 271 | set(CMAKE_SHARED_LINKER_FLAGS_UBSAN |
| 272 | "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined" CACHE STRING |
| 273 | "Linker lags to be used to create shared libraries for Ubsan build type." FORCE) |
| 274 | |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 275 | if (WITH_TESTS) |
| 276 | enable_testing() |
| 277 | add_subdirectory(googletest) |
| 278 | include(GoogleTest) |
| 279 | endif() |
| 280 | |
| 281 | add_subdirectory(wpiutil) |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 282 | |
| 283 | if (WITH_NTCORE) |
| 284 | add_subdirectory(wpinet) |
| 285 | add_subdirectory(ntcore) |
| 286 | endif() |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 287 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 288 | if (WITH_WPIMATH) |
| 289 | add_subdirectory(wpimath) |
| 290 | endif() |
| 291 | |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 292 | if (WITH_GUI) |
Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 293 | add_subdirectory(fieldImages) |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 294 | add_subdirectory(imgui) |
| 295 | add_subdirectory(wpigui) |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 296 | add_subdirectory(glass) |
| 297 | add_subdirectory(outlineviewer) |
Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 298 | if (LIBSSH_FOUND) |
| 299 | add_subdirectory(roborioteamnumbersetter) |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 300 | add_subdirectory(datalogtool) |
Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 301 | endif() |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 302 | endif() |
| 303 | |
| 304 | if (WITH_WPILIB OR WITH_SIMULATION_MODULES) |
| 305 | set(HAL_DEP_REPLACE ${HAL_DEP_REPLACE_IMPL}) |
| 306 | add_subdirectory(hal) |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 307 | endif() |
| 308 | |
| 309 | if (WITH_CSCORE) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 310 | set(CSCORE_DEP_REPLACE ${CSCORE_DEP_REPLACE_IMPL}) |
| 311 | set(CAMERASERVER_DEP_REPLACE ${CAMERASERVER_DEP_REPLACE_IMPL}) |
| 312 | add_subdirectory(cscore) |
| 313 | add_subdirectory(cameraserver) |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 314 | endif() |
| 315 | |
| 316 | if (WITH_WPILIB) |
| 317 | set(WPILIBC_DEP_REPLACE ${WPILIBC_DEP_REPLACE_IMPL}) |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame^] | 318 | add_subdirectory(apriltag) |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 319 | add_subdirectory(wpilibj) |
| 320 | add_subdirectory(wpilibc) |
| 321 | add_subdirectory(wpilibNewCommands) |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 322 | if (WITH_EXAMPLES) |
| 323 | add_subdirectory(wpilibcExamples) |
| 324 | endif() |
| 325 | add_subdirectory(myRobot) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 326 | endif() |
| 327 | |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 328 | if (WITH_SIMULATION_MODULES AND NOT WITH_EXTERNAL_HAL) |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 329 | add_subdirectory(simulation) |
| 330 | endif() |
| 331 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 332 | configure_file(wpilib-config.cmake.in ${WPILIB_BINARY_DIR}/wpilib-config.cmake ) |
| 333 | install(FILES ${WPILIB_BINARY_DIR}/wpilib-config.cmake DESTINATION ${wpilib_config_dir}) |