2020-11-26 14:47:35 -05:00
|
|
|
project(wpilibcExamples)
|
|
|
|
|
|
|
|
|
|
include(AddTest)
|
|
|
|
|
include(SubDirList)
|
|
|
|
|
|
2023-08-30 21:17:09 -07:00
|
|
|
subdir_list(TEMPLATES ${CMAKE_SOURCE_DIR}/wpilibcExamples/src/main/cpp/templates)
|
|
|
|
|
subdir_list(EXAMPLES ${CMAKE_SOURCE_DIR}/wpilibcExamples/src/main/cpp/examples)
|
2020-11-26 14:47:35 -05:00
|
|
|
|
|
|
|
|
foreach(example ${EXAMPLES})
|
|
|
|
|
file(GLOB_RECURSE sources src/main/cpp/examples/${example}/cpp/*.cpp
|
|
|
|
|
src/main/cpp/examples/${example}/c/*.c)
|
|
|
|
|
add_executable(${example} ${sources})
|
2023-01-01 08:14:19 -08:00
|
|
|
wpilib_target_warnings(${example})
|
2020-11-26 14:47:35 -05:00
|
|
|
target_include_directories(${example} PUBLIC src/main/cpp/examples/${example}/include)
|
2023-09-18 22:42:10 -04:00
|
|
|
target_link_libraries(${example} apriltag wpilibc wpilibNewCommands romiVendordep xrpVendordep)
|
2020-11-26 14:47:35 -05:00
|
|
|
|
|
|
|
|
if (WITH_TESTS AND EXISTS ${CMAKE_SOURCE_DIR}/wpilibcExamples/src/test/cpp/examples/${example})
|
|
|
|
|
wpilib_add_test(${example} src/test/cpp/examples/${example}/cpp)
|
|
|
|
|
target_sources(${example}_test PRIVATE ${sources})
|
2022-12-02 10:37:49 -08:00
|
|
|
target_include_directories(${example}_test PRIVATE
|
|
|
|
|
src/main/cpp/examples/${example}/include
|
|
|
|
|
src/test/cpp/examples/${example}/include)
|
2020-11-26 14:47:35 -05:00
|
|
|
target_compile_definitions(${example}_test PUBLIC RUNNING_FRC_TESTS)
|
2023-09-18 22:42:10 -04:00
|
|
|
target_link_libraries(${example}_test apriltag wpilibc wpilibNewCommands romiVendordep xrpVendordep gmock_main)
|
2020-11-26 14:47:35 -05:00
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
foreach(template ${TEMPLATES})
|
|
|
|
|
file(GLOB_RECURSE sources src/main/cpp/templates/${template}/cpp/*.cpp
|
|
|
|
|
src/main/cpp/templates/${template}/c/*.c)
|
|
|
|
|
add_executable(${template} ${sources})
|
2023-01-01 08:14:19 -08:00
|
|
|
wpilib_target_warnings(${template})
|
2020-11-26 14:47:35 -05:00
|
|
|
target_include_directories(${template} PUBLIC src/main/cpp/templates/${template}/include)
|
2023-09-18 22:42:10 -04:00
|
|
|
target_link_libraries(${template} wpilibc wpilibNewCommands romiVendordep xrpVendordep)
|
2020-11-26 14:47:35 -05:00
|
|
|
endforeach()
|