2018-05-02 21:15:30 -07:00
|
|
|
project(wpilibc)
|
|
|
|
|
|
2019-06-23 12:44:28 -07:00
|
|
|
include(CompileWarnings)
|
|
|
|
|
include(AddTest)
|
|
|
|
|
|
2018-05-02 21:15:30 -07:00
|
|
|
configure_file(src/generate/WPILibVersion.cpp.in WPILibVersion.cpp)
|
|
|
|
|
|
2024-06-08 12:59:07 -04:00
|
|
|
file(
|
|
|
|
|
GLOB_RECURSE wpilibc_native_src
|
|
|
|
|
src/main/native/cpp/*.cpp
|
|
|
|
|
src/main/native/cppcs/*.cpp
|
|
|
|
|
src/generated/main/native/cpp/*.cpp
|
|
|
|
|
)
|
2018-05-02 21:15:30 -07:00
|
|
|
|
|
|
|
|
add_library(wpilibc ${wpilibc_native_src} ${CMAKE_CURRENT_BINARY_DIR}/WPILibVersion.cpp)
|
2018-10-27 00:19:38 -07:00
|
|
|
set_target_properties(wpilibc PROPERTIES DEBUG_POSTFIX "d")
|
2018-05-02 21:15:30 -07:00
|
|
|
|
2023-11-30 19:52:21 -05:00
|
|
|
target_include_directories(
|
|
|
|
|
wpilibc
|
|
|
|
|
PUBLIC
|
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
|
2024-06-08 12:59:07 -04:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/generated/main/native/include>
|
2023-11-30 19:52:21 -05:00
|
|
|
$<INSTALL_INTERFACE:${include_dest}/wpilibc>
|
|
|
|
|
)
|
2019-06-23 12:44:28 -07:00
|
|
|
wpilib_target_warnings(wpilibc)
|
2021-09-27 21:37:04 -07:00
|
|
|
|
2023-11-30 19:52:21 -05:00
|
|
|
if(WITH_CSCORE)
|
2021-09-27 21:37:04 -07:00
|
|
|
target_link_libraries(wpilibc PUBLIC cameraserver cscore ${OpenCV_LIBS})
|
|
|
|
|
else()
|
|
|
|
|
target_compile_definitions(wpilibc PRIVATE DYNAMIC_CAMERA_SERVER)
|
|
|
|
|
# Add just the camera server include directory
|
2023-11-30 19:52:21 -05:00
|
|
|
target_include_directories(
|
|
|
|
|
wpilibc
|
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../cameraserver/src/main/native/include
|
|
|
|
|
)
|
2021-09-27 21:37:04 -07:00
|
|
|
endif()
|
|
|
|
|
|
2025-02-19 23:08:17 -06:00
|
|
|
target_link_libraries(wpilibc PUBLIC hal ntcore wpimath datalog)
|
2021-09-27 21:37:04 -07:00
|
|
|
|
2018-05-02 21:15:30 -07:00
|
|
|
set_property(TARGET wpilibc PROPERTY FOLDER "libraries")
|
|
|
|
|
|
2023-09-18 01:17:32 +02:00
|
|
|
install(TARGETS wpilibc EXPORT wpilibc)
|
2024-04-10 22:04:22 -07:00
|
|
|
export(TARGETS wpilibc FILE wpilibc.cmake NAMESPACE wpilibc::)
|
2018-05-02 21:15:30 -07:00
|
|
|
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/wpilibc")
|
2024-07-11 18:01:05 -04:00
|
|
|
install(DIRECTORY src/generated/main/native/include/ DESTINATION "${include_dest}/wpilibc")
|
2018-05-02 21:15:30 -07:00
|
|
|
|
2023-11-30 19:52:21 -05:00
|
|
|
configure_file(wpilibc-config.cmake.in ${WPILIB_BINARY_DIR}/wpilibc-config.cmake)
|
2023-11-21 14:48:32 -05:00
|
|
|
install(FILES ${WPILIB_BINARY_DIR}/wpilibc-config.cmake DESTINATION share/wpilibc)
|
|
|
|
|
install(EXPORT wpilibc DESTINATION share/wpilibc)
|
2019-06-23 12:44:28 -07:00
|
|
|
|
2023-11-30 19:52:21 -05:00
|
|
|
if(WITH_TESTS)
|
2019-06-23 12:44:28 -07:00
|
|
|
wpilib_add_test(wpilibc src/test/native/cpp)
|
2026-06-11 16:06:45 -07:00
|
|
|
file(GLOB_RECURSE wpilibc_generated_test_src src/generated/test/native/cpp/*.cpp)
|
|
|
|
|
target_sources(wpilibc_test PRIVATE ${wpilibc_generated_test_src})
|
2019-06-23 12:44:28 -07:00
|
|
|
target_include_directories(wpilibc_test PRIVATE src/test/native/include)
|
2024-07-19 00:10:26 -04:00
|
|
|
target_link_libraries(wpilibc_test wpilibc googletest)
|
2023-11-30 19:52:21 -05:00
|
|
|
if(NOT WITH_CSCORE)
|
2021-09-27 21:37:04 -07:00
|
|
|
target_compile_definitions(wpilibc_test PRIVATE DYNAMIC_CAMERA_SERVER)
|
|
|
|
|
# Add just the camera server include directory
|
2023-11-30 19:52:21 -05:00
|
|
|
target_include_directories(
|
|
|
|
|
wpilibc_test
|
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../cameraserver/src/main/native/include
|
|
|
|
|
)
|
2021-09-27 21:37:04 -07:00
|
|
|
endif()
|
2019-06-23 12:44:28 -07:00
|
|
|
endif()
|