Files
allwpilib/romiVendordep/CMakeLists.txt
Gold856 bf75c03218 [build] Clean up CMake files (#6802)
Explicitly list required components when using FindJava and FindJNI
Consolidate find_package calls for Java, JNI, and OpenCV into the root CMakeLists.txt file
Remove references to main_lib_dest
Install missing generated headers
Flatten some if statements
Use LinkMacOSGUI macro instead of hand rolling it
Stop installing OpenCV libraries and an extra ntcorejni library; OpenCV JAR will still be installed to make it easy to use
Only print platform version on Windows
Prevent GUI modules from being built when wpimath is off, which would otherwise cause a build failure
Simplify build configuration checks
Clean up fieldImages JAR creation
Place built JARs in the same subdir as installed JARs
Remove unnecessary JAR includes
Remove extra directories in target_include_directories
Improve CMake docs
2024-07-11 16:01:05 -06:00

82 lines
2.7 KiB
CMake

project(romiVendordep)
include(SubDirList)
include(CompileWarnings)
include(AddTest)
if(WITH_JAVA)
include(UseJava)
file(GLOB_RECURSE JAVA_SOURCES src/main/java/*.java)
add_jar(
romiVendordep_jar
${JAVA_SOURCES}
INCLUDE_JARS
hal_jar
ntcore_jar
cscore_jar
cameraserver_jar
wpimath_jar
wpiunits_jar
wpiutil_jar
wpilibj_jar
OUTPUT_NAME romiVendordep
OUTPUT_DIR ${WPILIB_BINARY_DIR}/${java_lib_dest}
)
set_property(TARGET romiVendordep_jar PROPERTY FOLDER "java")
install_jar(romiVendordep_jar DESTINATION ${java_lib_dest})
install_jar_exports(
TARGETS romiVendordep_jar
FILE romiVendordep_jar.cmake
DESTINATION share/romiVendordep
)
endif()
if(WITH_JAVA_SOURCE)
include(UseJava)
file(GLOB_RECURSE ROMIVENDORDEP_SOURCES src/main/java/*.java)
add_jar(
romiVendordep_src_jar
RESOURCES
NAMESPACE "edu/wpi/first/wpilibj/romi" ${ROMIVENDORDEP_SOURCES}
OUTPUT_NAME romiVendordep-sources
OUTPUT_DIR ${WPILIB_BINARY_DIR}/${java_lib_dest}
)
get_property(ROMIVENDORDEP_SRC_JAR_FILE TARGET romiVendordep_src_jar PROPERTY JAR_FILE)
install(FILES ${ROMIVENDORDEP_JAR_FILE} DESTINATION "${java_lib_dest}")
set_property(TARGET romiVendordep_src_jar PROPERTY FOLDER "java")
endif()
file(GLOB_RECURSE romiVendordep_native_src src/main/native/cpp/*.cpp)
add_library(romiVendordep ${romiVendordep_native_src})
set_target_properties(romiVendordep PROPERTIES DEBUG_POSTFIX "d")
set_property(TARGET romiVendordep PROPERTY FOLDER "libraries")
target_compile_features(romiVendordep PUBLIC cxx_std_20)
wpilib_target_warnings(romiVendordep)
target_link_libraries(romiVendordep wpilibc)
target_include_directories(
romiVendordep
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/romiVendordep>
)
install(TARGETS romiVendordep EXPORT romivendordep)
export(TARGETS romiVendordep FILE romivendordep.cmake NAMESPACE romivendordep::)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/romiVendordep")
configure_file(romivendordep-config.cmake.in ${WPILIB_BINARY_DIR}/romivendordep-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/romivendordep-config.cmake DESTINATION share/romiVendordep)
install(EXPORT romivendordep DESTINATION share/romiVendordep)
if(WITH_TESTS)
wpilib_add_test(romiVendordep src/test/native/cpp)
target_include_directories(romiVendordep_test PRIVATE src/test/native/include)
target_link_libraries(romiVendordep_test romiVendordep gmock_main)
endif()