blob: 79df35974bb024217950bceb88bfea53b642a395 [file] [log] [blame]
Brian Silverman8fce7482020-01-05 13:18:21 -08001# Disable in-source builds to prevent source tree corruption.
Austin Schuh812d0d12021-11-04 20:16:48 -07002if(" ${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL " ${CMAKE_CURRENT_BINARY_DIR}")
Maxwell Henderson80bec322024-01-09 15:48:44 -08003 message(
4 FATAL_ERROR
5 "
Brian Silverman8fce7482020-01-05 13:18:21 -08006FATAL: In-source builds are not allowed.
7 You should create a separate directory for build files.
Maxwell Henderson80bec322024-01-09 15:48:44 -08008"
9 )
Brian Silverman8fce7482020-01-05 13:18:21 -080010endif()
11
Maxwell Henderson80bec322024-01-09 15:48:44 -080012if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
Austin Schuh75263e32022-02-22 18:05:32 -080013 set(CMAKE_SYSTEM_VERSION 10.0.18362.0 CACHE STRING INTERNAL FORCE)
14 set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION 10.0.18362.0 CACHE STRING INTERNAL FORCE)
15endif()
Brian Silverman8fce7482020-01-05 13:18:21 -080016
James Kuszmaulb13e13f2023-11-22 20:44:04 -080017cmake_minimum_required(VERSION 3.11)
Brian Silverman8fce7482020-01-05 13:18:21 -080018project(allwpilib)
Austin Schuh812d0d12021-11-04 20:16:48 -070019set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
20
James Kuszmaulb13e13f2023-11-22 20:44:04 -080021# Make timestamps of extracted files from FetchContent the time of extraction
Maxwell Henderson80bec322024-01-09 15:48:44 -080022if(POLICY CMP0135)
James Kuszmaulb13e13f2023-11-22 20:44:04 -080023 cmake_policy(SET CMP0135 NEW)
24endif()
25
Austin Schuh75263e32022-02-22 18:05:32 -080026message(STATUS "Platform version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
27
Austin Schuh812d0d12021-11-04 20:16:48 -070028set(WPILIB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
Brian Silverman8fce7482020-01-05 13:18:21 -080029
Maxwell Henderson80bec322024-01-09 15:48:44 -080030include(CPack)
Brian Silverman8fce7482020-01-05 13:18:21 -080031
32set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
33set_property(GLOBAL PROPERTY USE_FOLDERS ON)
34
Austin Schuh812d0d12021-11-04 20:16:48 -070035set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib)
36set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib)
37set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/bin)
38set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${WPILIB_BINARY_DIR}/jar)
Brian Silverman8fce7482020-01-05 13:18:21 -080039
40# use, i.e. don't skip the full RPATH for the build tree
Maxwell Henderson80bec322024-01-09 15:48:44 -080041set(CMAKE_SKIP_BUILD_RPATH FALSE)
Brian Silverman8fce7482020-01-05 13:18:21 -080042
43# when building, don't use the install RPATH already
44# (but later on when installing)
Maxwell Henderson80bec322024-01-09 15:48:44 -080045set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
Brian Silverman8fce7482020-01-05 13:18:21 -080046
Maxwell Henderson80bec322024-01-09 15:48:44 -080047set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
Brian Silverman8fce7482020-01-05 13:18:21 -080048
49# add the automatically determined parts of the RPATH
50# which point to directories outside the build tree to the install RPATH
Maxwell Henderson80bec322024-01-09 15:48:44 -080051set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
Brian Silverman8fce7482020-01-05 13:18:21 -080052
53# the RPATH to be used when installing, but only if it's not a system directory
Maxwell Henderson80bec322024-01-09 15:48:44 -080054list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
55if("${isSystemDir}" STREQUAL "-1")
56 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
57endif()
Brian Silverman8fce7482020-01-05 13:18:21 -080058
Austin Schuh1e69f942020-11-14 15:06:14 -080059# Options for building certain parts of the repo. Everything is built by default.
60option(BUILD_SHARED_LIBS "Build with shared libs (needed for JNI)" ON)
James Kuszmaulb13e13f2023-11-22 20:44:04 -080061option(WITH_JAVA "Include Java and JNI in the build" ON)
Maxwell Henderson80bec322024-01-09 15:48:44 -080062option(WITH_JAVA_SOURCE "Build Java source jars" ${WITH_JAVA})
Austin Schuh1e69f942020-11-14 15:06:14 -080063option(WITH_CSCORE "Build cscore (needs OpenCV)" ON)
James Kuszmaulcf324122023-01-14 14:07:17 -080064option(WITH_NTCORE "Build ntcore" ON)
Austin Schuh812d0d12021-11-04 20:16:48 -070065option(WITH_WPIMATH "Build wpimath" ON)
Maxwell Henderson80bec322024-01-09 15:48:44 -080066option(WITH_WPIUNITS "Build wpiunits" ON)
Austin Schuh812d0d12021-11-04 20:16:48 -070067option(WITH_WPILIB "Build hal, wpilibc/j, and myRobot (needs OpenCV)" ON)
Austin Schuh812d0d12021-11-04 20:16:48 -070068option(WITH_EXAMPLES "Build examples" OFF)
Austin Schuh1e69f942020-11-14 15:06:14 -080069option(WITH_TESTS "Build unit tests (requires internet connection)" ON)
70option(WITH_GUI "Build GUI items" ON)
71option(WITH_SIMULATION_MODULES "Build simulation modules" ON)
72
73# Options for external HAL.
74option(WITH_EXTERNAL_HAL "Use a separately built HAL" OFF)
Brian Silverman8fce7482020-01-05 13:18:21 -080075set(EXTERNAL_HAL_FILE "" CACHE FILEPATH "Location to look for an external HAL CMake File")
Austin Schuh1e69f942020-11-14 15:06:14 -080076
James Kuszmaulcf324122023-01-14 14:07:17 -080077# Options for using a package manager (e.g., vcpkg) for certain dependencies.
78option(USE_SYSTEM_FMTLIB "Use system fmtlib" OFF)
79option(USE_SYSTEM_LIBUV "Use system libuv" OFF)
80option(USE_SYSTEM_EIGEN "Use system eigen" OFF)
Brian Silverman8fce7482020-01-05 13:18:21 -080081
Austin Schuh1e69f942020-11-14 15:06:14 -080082# Options for location of OpenCV Java.
83set(OPENCV_JAVA_INSTALL_DIR "" CACHE PATH "Location to search for the OpenCV jar file")
84
Maxwell Henderson80bec322024-01-09 15:48:44 -080085# Options for compilation flags.
86option(NO_WERROR "Disable -Werror flag during compilation" OFF)
87
Austin Schuh1e69f942020-11-14 15:06:14 -080088# Set default build type to release with debug info (i.e. release mode optimizations
89# are performed, but debug info still exists).
Maxwell Henderson80bec322024-01-09 15:48:44 -080090if(NOT CMAKE_BUILD_TYPE)
91 set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
Austin Schuh1e69f942020-11-14 15:06:14 -080092endif()
93
Maxwell Henderson80bec322024-01-09 15:48:44 -080094if(WITH_JAVA AND NOT BUILD_SHARED_LIBS)
95 message(
96 FATAL_ERROR
97 "
Brian Silverman8fce7482020-01-05 13:18:21 -080098FATAL: Cannot build static libs with Java enabled.
99 Static libs requires both BUILD_SHARED_LIBS=OFF and
Austin Schuh1e69f942020-11-14 15:06:14 -0800100 WITH_JAVA=OFF
Maxwell Henderson80bec322024-01-09 15:48:44 -0800101"
102 )
Austin Schuh1e69f942020-11-14 15:06:14 -0800103endif()
104
Maxwell Henderson80bec322024-01-09 15:48:44 -0800105if(WITH_SIMULATION_MODULES AND NOT BUILD_SHARED_LIBS)
106 message(
107 FATAL_ERROR
108 "
Austin Schuh1e69f942020-11-14 15:06:14 -0800109FATAL: Cannot build static libs with simulation modules enabled.
110 Static libs requires both BUILD_SHARED_LIBS=OFF and
111 WITH_SIMULATION_MODULES=OFF
Maxwell Henderson80bec322024-01-09 15:48:44 -0800112"
113 )
Austin Schuh1e69f942020-11-14 15:06:14 -0800114endif()
115
Maxwell Henderson80bec322024-01-09 15:48:44 -0800116if(NOT WITH_JAVA OR NOT WITH_CSCORE)
Austin Schuh1e69f942020-11-14 15:06:14 -0800117 if(NOT "${OPENCV_JAVA_INSTALL_DIR}" STREQUAL "")
Maxwell Henderson80bec322024-01-09 15:48:44 -0800118 message(
119 WARNING
120 "
Austin Schuh1e69f942020-11-14 15:06:14 -0800121WARNING: OpenCV Java dir set but java is not enabled!
122It will be ignored.
Maxwell Henderson80bec322024-01-09 15:48:44 -0800123"
124 )
Austin Schuh1e69f942020-11-14 15:06:14 -0800125 endif()
126endif()
127
Maxwell Henderson80bec322024-01-09 15:48:44 -0800128if(NOT WITH_WPILIB AND WITH_SIMULATION_MODULES)
129 message(
130 FATAL_ERROR
131 "
Austin Schuh1e69f942020-11-14 15:06:14 -0800132FATAL: Cannot build simulation modules with wpilib disabled.
133 Enable wpilib by setting WITH_WPILIB=ON
Maxwell Henderson80bec322024-01-09 15:48:44 -0800134"
135 )
Brian Silverman8fce7482020-01-05 13:18:21 -0800136endif()
137
Maxwell Henderson80bec322024-01-09 15:48:44 -0800138if(NOT WITH_NTCORE AND WITH_CSCORE)
139 message(
140 FATAL_ERROR
141 "
James Kuszmaulcf324122023-01-14 14:07:17 -0800142FATAL: Cannot build cameraserver without ntcore.
143 Enable ntcore by setting WITH_NTCORE=ON
Maxwell Henderson80bec322024-01-09 15:48:44 -0800144"
145 )
James Kuszmaulcf324122023-01-14 14:07:17 -0800146endif()
147
Maxwell Henderson80bec322024-01-09 15:48:44 -0800148if(NOT WITH_NTCORE AND WITH_GUI)
149 message(
150 FATAL_ERROR
151 "
James Kuszmaulcf324122023-01-14 14:07:17 -0800152FATAL: Cannot build GUI modules without ntcore.
153 Enable ntcore by setting WITH_NTCORE=ON
Maxwell Henderson80bec322024-01-09 15:48:44 -0800154"
155 )
James Kuszmaulcf324122023-01-14 14:07:17 -0800156endif()
157
Maxwell Henderson80bec322024-01-09 15:48:44 -0800158if(NOT WITH_NTCORE AND WITH_SIMULATION_MODULES)
159 message(
160 FATAL_ERROR
161 "
James Kuszmaulcf324122023-01-14 14:07:17 -0800162FATAL: Cannot build simulation modules without ntcore.
163 Enable ntcore by setting WITH_NTCORE=ON
Maxwell Henderson80bec322024-01-09 15:48:44 -0800164"
165 )
James Kuszmaulcf324122023-01-14 14:07:17 -0800166endif()
167
Maxwell Henderson80bec322024-01-09 15:48:44 -0800168if(NOT WITH_NTCORE AND WITH_WPILIB)
169 message(
170 FATAL_ERROR
171 "
James Kuszmaulcf324122023-01-14 14:07:17 -0800172FATAL: Cannot build wpilib without ntcore.
173 Enable ntcore by setting WITH_NTCORE=ON
Maxwell Henderson80bec322024-01-09 15:48:44 -0800174"
175 )
James Kuszmaulcf324122023-01-14 14:07:17 -0800176endif()
177
Maxwell Henderson80bec322024-01-09 15:48:44 -0800178if(NOT WITH_WPIMATH AND WITH_WPILIB)
179 message(
180 FATAL_ERROR
181 "
Austin Schuh812d0d12021-11-04 20:16:48 -0700182FATAL: Cannot build wpilib without wpimath.
183 Enable wpimath by setting WITH_WPIMATH=ON
Maxwell Henderson80bec322024-01-09 15:48:44 -0800184"
185 )
Austin Schuh812d0d12021-11-04 20:16:48 -0700186endif()
187
Maxwell Henderson80bec322024-01-09 15:48:44 -0800188if(NOT WITH_WPIUNITS AND WITH_WPIMATH AND WITH_JAVA)
189 message(
190 FATAL_ERROR
191 "
192FATAL: Cannot build Java wpimath without wpiunits.
193 Enable wpiunits by setting WITH_WPIUNITS=ON or disable the Java build by setting WITH_JAVA=OFF
194"
195 )
Brian Silverman8fce7482020-01-05 13:18:21 -0800196endif()
197
Maxwell Henderson80bec322024-01-09 15:48:44 -0800198set(include_dest include)
199set(java_lib_dest java)
200set(jni_lib_dest jni)
201
202if(USE_SYSTEM_LIBUV)
203 set(LIBUV_SYSTEM_REPLACE
204 "
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800205find_dependency(libuv CONFIG)
Maxwell Henderson80bec322024-01-09 15:48:44 -0800206"
207 )
Brian Silverman8fce7482020-01-05 13:18:21 -0800208endif()
209
Maxwell Henderson80bec322024-01-09 15:48:44 -0800210if(USE_SYSTEM_EIGEN)
211 set(EIGEN_SYSTEM_REPLACE "find_package(Eigen3 CONFIG)")
Brian Silverman8fce7482020-01-05 13:18:21 -0800212endif()
213
Austin Schuh75263e32022-02-22 18:05:32 -0800214find_package(LIBSSH 0.7.1)
215
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800216find_package(Protobuf REQUIRED)
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800217
Maxwell Henderson80bec322024-01-09 15:48:44 -0800218set(APRILTAG_DEP_REPLACE "find_dependency(apriltag)")
Brian Silverman8fce7482020-01-05 13:18:21 -0800219set(CAMERASERVER_DEP_REPLACE_IMPL "find_dependency(cameraserver)")
Maxwell Henderson80bec322024-01-09 15:48:44 -0800220set(CSCORE_DEP_REPLACE_IMPL "find_dependency(cscore)")
Brian Silverman8fce7482020-01-05 13:18:21 -0800221set(HAL_DEP_REPLACE_IMPL "find_dependency(hal)")
Maxwell Henderson80bec322024-01-09 15:48:44 -0800222set(NTCORE_DEP_REPLACE "find_dependency(ntcore)")
Brian Silverman8fce7482020-01-05 13:18:21 -0800223set(WPILIBC_DEP_REPLACE_IMPL "find_dependency(wpilibc)")
Maxwell Henderson80bec322024-01-09 15:48:44 -0800224set(WPILIBJ_DEP_REPLACE "find_dependency(wpilibj)")
Austin Schuh812d0d12021-11-04 20:16:48 -0700225set(WPILIBNEWCOMMANDS_DEP_REPLACE "find_dependency(wpilibNewCommands)")
Maxwell Henderson80bec322024-01-09 15:48:44 -0800226set(WPIMATH_DEP_REPLACE "find_dependency(wpimath)")
227set(WPINET_DEP_REPLACE "find_dependency(wpinet)")
228set(WPIUNITS_DEP_REPLACE "find_dependency(wpiunits)")
229set(WPIUTIL_DEP_REPLACE "find_dependency(wpiutil)")
Brian Silverman8fce7482020-01-05 13:18:21 -0800230
231set(FILENAME_DEP_REPLACE "get_filename_component(SELF_DIR \"$\{CMAKE_CURRENT_LIST_FILE\}\" PATH)")
232set(SELF_DIR "$\{SELF_DIR\}")
233
Austin Schuh812d0d12021-11-04 20:16:48 -0700234get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
235
236if(isMultiConfig)
237 if(NOT "Asan" IN_LIST CMAKE_CONFIGURATION_TYPES)
238 list(APPEND CMAKE_CONFIGURATION_TYPES Asan)
239 endif()
240 if(NOT "Tsan" IN_LIST CMAKE_CONFIGURATION_TYPES)
241 list(APPEND CMAKE_CONFIGURATION_TYPES Tsan)
242 endif()
243 if(NOT "Ubsan" IN_LIST CMAKE_CONFIGURATION_TYPES)
244 list(APPEND CMAKE_CONFIGURATION_TYPES Ubsan)
245 endif()
246else()
Maxwell Henderson80bec322024-01-09 15:48:44 -0800247 set(allowedBuildTypes
248 Asan
249 Tsan
250 Ubsan
251 Debug
252 Release
253 RelWithDebInfo
254 MinSizeRel
255 )
Austin Schuh812d0d12021-11-04 20:16:48 -0700256 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowedBuildTypes}")
257
258 if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE IN_LIST allowedBuildTypes)
259 message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}")
260 endif()
261endif()
262
263set(CMAKE_C_FLAGS_ASAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800264 "${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer"
265 CACHE STRING
266 "Flags used by the C compiler for Asan build type or configuration."
267 FORCE
268)
Austin Schuh812d0d12021-11-04 20:16:48 -0700269
270set(CMAKE_CXX_FLAGS_ASAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800271 "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer"
272 CACHE STRING
273 "Flags used by the C++ compiler for Asan build type or configuration."
274 FORCE
275)
Austin Schuh812d0d12021-11-04 20:16:48 -0700276
277set(CMAKE_EXE_LINKER_FLAGS_ASAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800278 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address"
279 CACHE STRING
280 "Linker flags to be used to create executables for Asan build type."
281 FORCE
282)
Austin Schuh812d0d12021-11-04 20:16:48 -0700283
284set(CMAKE_SHARED_LINKER_FLAGS_ASAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800285 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address"
286 CACHE STRING
287 "Linker lags to be used to create shared libraries for Asan build type."
288 FORCE
289)
Austin Schuh812d0d12021-11-04 20:16:48 -0700290
291set(CMAKE_C_FLAGS_TSAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800292 "${CMAKE_C_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer"
293 CACHE STRING
294 "Flags used by the C compiler for Tsan build type or configuration."
295 FORCE
296)
Austin Schuh812d0d12021-11-04 20:16:48 -0700297
298set(CMAKE_CXX_FLAGS_TSAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800299 "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer"
300 CACHE STRING
301 "Flags used by the C++ compiler for Tsan build type or configuration."
302 FORCE
303)
Austin Schuh812d0d12021-11-04 20:16:48 -0700304
305set(CMAKE_EXE_LINKER_FLAGS_TSAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800306 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread"
307 CACHE STRING
308 "Linker flags to be used to create executables for Tsan build type."
309 FORCE
310)
Austin Schuh812d0d12021-11-04 20:16:48 -0700311
312set(CMAKE_SHARED_LINKER_FLAGS_TSAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800313 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread"
314 CACHE STRING
315 "Linker lags to be used to create shared libraries for Tsan build type."
316 FORCE
317)
Austin Schuh812d0d12021-11-04 20:16:48 -0700318
319set(CMAKE_C_FLAGS_UBSAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800320 "${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer"
321 CACHE STRING
322 "Flags used by the C compiler for Ubsan build type or configuration."
323 FORCE
324)
Austin Schuh812d0d12021-11-04 20:16:48 -0700325
326set(CMAKE_CXX_FLAGS_UBSAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800327 "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer"
328 CACHE STRING
329 "Flags used by the C++ compiler for Ubsan build type or configuration."
330 FORCE
331)
Austin Schuh812d0d12021-11-04 20:16:48 -0700332
333set(CMAKE_EXE_LINKER_FLAGS_UBSAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800334 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all"
335 CACHE STRING
336 "Linker flags to be used to create executables for Ubsan build type."
337 FORCE
338)
Austin Schuh812d0d12021-11-04 20:16:48 -0700339
340set(CMAKE_SHARED_LINKER_FLAGS_UBSAN
Maxwell Henderson80bec322024-01-09 15:48:44 -0800341 "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined"
342 CACHE STRING
343 "Linker lags to be used to create shared libraries for Ubsan build type."
344 FORCE
345)
Austin Schuh812d0d12021-11-04 20:16:48 -0700346
Maxwell Henderson80bec322024-01-09 15:48:44 -0800347if(WITH_TESTS)
Brian Silverman8fce7482020-01-05 13:18:21 -0800348 enable_testing()
349 add_subdirectory(googletest)
350 include(GoogleTest)
351endif()
352
353add_subdirectory(wpiutil)
James Kuszmaulcf324122023-01-14 14:07:17 -0800354
Maxwell Henderson80bec322024-01-09 15:48:44 -0800355if(WITH_NTCORE)
James Kuszmaulcf324122023-01-14 14:07:17 -0800356 add_subdirectory(wpinet)
357 add_subdirectory(ntcore)
358endif()
Brian Silverman8fce7482020-01-05 13:18:21 -0800359
Maxwell Henderson80bec322024-01-09 15:48:44 -0800360if(WITH_WPIMATH)
361 if(WITH_JAVA)
362 add_subdirectory(wpiunits)
363 endif()
Austin Schuh812d0d12021-11-04 20:16:48 -0700364 add_subdirectory(wpimath)
365endif()
366
Maxwell Henderson80bec322024-01-09 15:48:44 -0800367if(WITH_WPIUNITS AND NOT WITH_WPIMATH)
368 # In case of building wpiunits standalone
369 add_subdirectory(wpiunits)
370endif()
371
372if(WITH_GUI)
Austin Schuh75263e32022-02-22 18:05:32 -0800373 add_subdirectory(fieldImages)
Austin Schuh1e69f942020-11-14 15:06:14 -0800374 add_subdirectory(imgui)
375 add_subdirectory(wpigui)
Austin Schuh812d0d12021-11-04 20:16:48 -0700376 add_subdirectory(glass)
377 add_subdirectory(outlineviewer)
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800378 add_subdirectory(sysid)
Maxwell Henderson80bec322024-01-09 15:48:44 -0800379 if(LIBSSH_FOUND)
Austin Schuh75263e32022-02-22 18:05:32 -0800380 add_subdirectory(roborioteamnumbersetter)
James Kuszmaulcf324122023-01-14 14:07:17 -0800381 add_subdirectory(datalogtool)
Austin Schuh75263e32022-02-22 18:05:32 -0800382 endif()
Austin Schuh812d0d12021-11-04 20:16:48 -0700383endif()
384
Maxwell Henderson80bec322024-01-09 15:48:44 -0800385if(WITH_WPILIB OR WITH_SIMULATION_MODULES)
Austin Schuh812d0d12021-11-04 20:16:48 -0700386 set(HAL_DEP_REPLACE ${HAL_DEP_REPLACE_IMPL})
387 add_subdirectory(hal)
Austin Schuh1e69f942020-11-14 15:06:14 -0800388endif()
389
Maxwell Henderson80bec322024-01-09 15:48:44 -0800390if(WITH_CSCORE)
Brian Silverman8fce7482020-01-05 13:18:21 -0800391 set(CSCORE_DEP_REPLACE ${CSCORE_DEP_REPLACE_IMPL})
392 set(CAMERASERVER_DEP_REPLACE ${CAMERASERVER_DEP_REPLACE_IMPL})
393 add_subdirectory(cscore)
394 add_subdirectory(cameraserver)
Austin Schuh812d0d12021-11-04 20:16:48 -0700395endif()
396
Maxwell Henderson80bec322024-01-09 15:48:44 -0800397if(WITH_WPILIB)
Austin Schuh812d0d12021-11-04 20:16:48 -0700398 set(WPILIBC_DEP_REPLACE ${WPILIBC_DEP_REPLACE_IMPL})
James Kuszmaulcf324122023-01-14 14:07:17 -0800399 add_subdirectory(apriltag)
Austin Schuh812d0d12021-11-04 20:16:48 -0700400 add_subdirectory(wpilibj)
401 add_subdirectory(wpilibc)
402 add_subdirectory(wpilibNewCommands)
James Kuszmaulb13e13f2023-11-22 20:44:04 -0800403 add_subdirectory(romiVendordep)
404 add_subdirectory(xrpVendordep)
Maxwell Henderson80bec322024-01-09 15:48:44 -0800405 if(WITH_EXAMPLES)
Austin Schuh812d0d12021-11-04 20:16:48 -0700406 add_subdirectory(wpilibcExamples)
407 endif()
408 add_subdirectory(myRobot)
Brian Silverman8fce7482020-01-05 13:18:21 -0800409endif()
410
Maxwell Henderson80bec322024-01-09 15:48:44 -0800411if(WITH_SIMULATION_MODULES AND NOT WITH_EXTERNAL_HAL)
Brian Silverman8fce7482020-01-05 13:18:21 -0800412 add_subdirectory(simulation)
413endif()
414
Maxwell Henderson80bec322024-01-09 15:48:44 -0800415configure_file(wpilib-config.cmake.in ${WPILIB_BINARY_DIR}/wpilib-config.cmake)
416install(FILES ${WPILIB_BINARY_DIR}/wpilib-config.cmake DESTINATION share/wpilib)