Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame] | 1 | project(wpilibOldCommands) |
| 2 | |
| 3 | include(SubDirList) |
| 4 | include(CompileWarnings) |
| 5 | include(AddTest) |
| 6 | |
| 7 | if (WITH_JAVA) |
| 8 | find_package(Java REQUIRED) |
| 9 | include(UseJava) |
| 10 | set(CMAKE_JAVA_COMPILE_FLAGS "-encoding" "UTF8" "-Xlint:unchecked") |
| 11 | |
| 12 | file(GLOB_RECURSE JAVA_SOURCES src/main/java/*.java) |
| 13 | add_jar(wpilibOldCommands_jar ${JAVA_SOURCES} INCLUDE_JARS hal_jar ntcore_jar cscore_jar cameraserver_jar wpimath_jar wpiutil_jar wpilibj_jar OUTPUT_NAME wpilibOldCommands) |
| 14 | |
| 15 | get_property(WPIlIBOLDCOMMANDS_JAR_FILE TARGET wpilibOldCommands_jar PROPERTY JAR_FILE) |
| 16 | install(FILES ${WPIlIBOLDCOMMANDS_JAR_FILE} DESTINATION "${java_lib_dest}") |
| 17 | |
| 18 | set_property(TARGET wpilibOldCommands_jar PROPERTY FOLDER "java") |
| 19 | |
| 20 | if (WITH_FLAT_INSTALL) |
| 21 | set (wpilibOldCommands_config_dir ${wpilib_dest}) |
| 22 | else() |
| 23 | set (wpilibOldCommands_config_dir share/wpilibOldCommands) |
| 24 | endif() |
| 25 | |
| 26 | install(FILES wpilibOldCommands-config.cmake DESTINATION ${wpilibOldCommands_config_dir}) |
| 27 | endif() |
| 28 | |
| 29 | file(GLOB_RECURSE wpilibOldCommands_native_src src/main/native/cpp/*.cpp) |
| 30 | add_library(wpilibOldCommands ${wpilibOldCommands_native_src}) |
| 31 | set_target_properties(wpilibOldCommands PROPERTIES DEBUG_POSTFIX "d") |
| 32 | set_property(TARGET wpilibOldCommands PROPERTY FOLDER "libraries") |
| 33 | |
| 34 | target_compile_features(wpilibOldCommands PUBLIC cxx_std_17) |
| 35 | wpilib_target_warnings(wpilibOldCommands) |
| 36 | target_link_libraries(wpilibOldCommands wpilibc) |
| 37 | |
| 38 | target_include_directories(wpilibOldCommands PUBLIC |
| 39 | $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include> |
| 40 | $<INSTALL_INTERFACE:${include_dest}/wpilibOldCommands>) |
| 41 | |
| 42 | install(TARGETS wpilibOldCommands EXPORT wpilibOldCommands DESTINATION "${main_lib_dest}") |
| 43 | install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/wpilibOldCommands") |
| 44 | |
| 45 | if (MSVC OR FLAT_INSTALL_WPILIB) |
| 46 | set(wpilibOldCommands_config_dir ${wpilib_dest}) |
| 47 | else() |
| 48 | set(wpilibOldCommands_config_dir share/wpilibOldCommands) |
| 49 | endif() |
| 50 | |
| 51 | configure_file(wpilibOldCommands-config.cmake.in ${WPILIB_BINARY_DIR}/wpilibOldCommands-config.cmake) |
| 52 | install(FILES ${WPILIB_BINARY_DIR}/wpilibOldCommands-config.cmake DESTINATION ${wpilibOldCommands_config_dir}) |
| 53 | install(EXPORT wpilibOldCommands DESTINATION ${wpilibOldCommands_config_dir}) |
| 54 | |
| 55 | if (WITH_TESTS) |
| 56 | wpilib_add_test(wpilibOldCommands src/test/native/cpp) |
| 57 | target_include_directories(wpilibOldCommands_test PRIVATE src/test/native/include) |
| 58 | target_link_libraries(wpilibOldCommands_test wpilibOldCommands gmock_main) |
| 59 | endif() |