Skip to content

Commit

Permalink
[build] Remove CMake flat install option (wpilibsuite#5944)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 authored Nov 21, 2023
1 parent bb05e20 commit 25b7dca
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 174 deletions.
25 changes: 1 addition & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ option(USE_SYSTEM_FMTLIB "Use system fmtlib" OFF)
option(USE_SYSTEM_LIBUV "Use system libuv" OFF)
option(USE_SYSTEM_EIGEN "Use system eigen" OFF)

# Options for installation.
option(WITH_FLAT_INSTALL "Use a flat install directory" OFF)

# Options for location of OpenCV Java.
set(OPENCV_JAVA_INSTALL_DIR "" CACHE PATH "Location to search for the OpenCV jar file")

Expand Down Expand Up @@ -162,17 +159,10 @@ FATAL: Cannot build Java wpimath without wpiunits.
")
endif()

set( wpilib_dest "")
set( include_dest include )
set( java_lib_dest java )
set( jni_lib_dest jni )

if (WITH_FLAT_INSTALL)
set (wpilib_config_dir ${wpilib_dest})
else()
set (wpilib_config_dir share/wpilib)
endif()

if (USE_SYSTEM_LIBUV)
set (LIBUV_SYSTEM_REPLACE "
find_dependency(libuv CONFIG)
Expand All @@ -191,18 +181,6 @@ find_program(Quickbuf_EXECUTABLE
DOC "The Quickbuf protoc plugin"
)

if (WITH_FLAT_INSTALL)
set(WPIUTIL_DEP_REPLACE "include($\{SELF_DIR\}/wpiutil-config.cmake)")
set(WPINET_DEP_REPLACE "include($\{SELF_DIR\}/wpinet-config.cmake)")
set(NTCORE_DEP_REPLACE "include($\{SELF_DIR\}/ntcore-config.cmake)")
set(CSCORE_DEP_REPLACE_IMPL "include(\${SELF_DIR}/cscore-config.cmake)")
set(CAMERASERVER_DEP_REPLACE_IMPL "include(\${SELF_DIR}/cameraserver-config.cmake)")
set(HAL_DEP_REPLACE_IMPL "include(\${SELF_DIR}/hal-config.cmake)")
set(WPIMATH_DEP_REPLACE "include($\{SELF_DIR\}/wpimath-config.cmake)")
set(WPIUNITS_DEP_REPLACE "include($\{SELF_DIR\}/wpiunits-config.cmake)")
set(WPILIBC_DEP_REPLACE_IMPL "include(\${SELF_DIR}/wpilibc-config.cmake)")
set(WPILIBNEWCOMMANDS_DEP_REPLACE "include(\${SELF_DIR}/wpilibNewcommands-config.cmake)")
else()
set(WPIUTIL_DEP_REPLACE "find_dependency(wpiutil)")
set(WPINET_DEP_REPLACE "find_dependency(wpinet)")
set(NTCORE_DEP_REPLACE "find_dependency(ntcore)")
Expand All @@ -213,7 +191,6 @@ set(WPIMATH_DEP_REPLACE "find_dependency(wpimath)")
set(WPIUNITS_DEP_REPLACE "find_dependency(wpiunits)")
set(WPILIBC_DEP_REPLACE_IMPL "find_dependency(wpilibc)")
set(WPILIBNEWCOMMANDS_DEP_REPLACE "find_dependency(wpilibNewCommands)")
endif()

set(FILENAME_DEP_REPLACE "get_filename_component(SELF_DIR \"$\{CMAKE_CURRENT_LIST_FILE\}\" PATH)")
set(SELF_DIR "$\{SELF_DIR\}")
Expand Down Expand Up @@ -356,4 +333,4 @@ if (WITH_SIMULATION_MODULES AND NOT WITH_EXTERNAL_HAL)
endif()

configure_file(wpilib-config.cmake.in ${WPILIB_BINARY_DIR}/wpilib-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/wpilib-config.cmake DESTINATION ${wpilib_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/wpilib-config.cmake DESTINATION share/wpilib)
9 changes: 2 additions & 7 deletions apriltag/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,10 @@ target_include_directories(apriltag PUBLIC
install(TARGETS apriltag EXPORT apriltag)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/apriltag")

if (WITH_FLAT_INSTALL)
set (apriltag_config_dir ${wpilib_dest})
else()
set (apriltag_config_dir share/apriltag)
endif()

configure_file(apriltag-config.cmake.in ${WPILIB_BINARY_DIR}/apriltag-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/apriltag-config.cmake DESTINATION ${apriltag_config_dir})
install(EXPORT apriltag DESTINATION ${apriltag_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/apriltag-config.cmake DESTINATION share/apriltag)
install(EXPORT apriltag DESTINATION share/apriltag)

if (WITH_TESTS)
wpilib_add_test(apriltag src/test/native/cpp)
Expand Down
10 changes: 2 additions & 8 deletions cameraserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,9 @@ set_property(TARGET cameraserver PROPERTY FOLDER "libraries")
install(TARGETS cameraserver EXPORT cameraserver)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/cameraserver")

if (WITH_FLAT_INSTALL)
set (cameraserver_config_dir ${wpilib_dest})
else()
set (cameraserver_config_dir share/cameraserver)
endif()

configure_file(cameraserver-config.cmake.in ${WPILIB_BINARY_DIR}/cameraserver-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/cameraserver-config.cmake DESTINATION ${cameraserver_config_dir})
install(EXPORT cameraserver DESTINATION ${cameraserver_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/cameraserver-config.cmake DESTINATION share/cameraserver)
install(EXPORT cameraserver DESTINATION share/cameraserver)

file(GLOB multiCameraServer_src multiCameraServer/src/main/native/cpp/*.cpp)
add_executable(multiCameraServer ${multiCameraServer_src})
Expand Down
10 changes: 2 additions & 8 deletions cscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,9 @@ set_property(TARGET cscore PROPERTY FOLDER "libraries")
install(TARGETS cscore EXPORT cscore)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/cscore")

if (WITH_FLAT_INSTALL)
set (cscore_config_dir ${wpilib_dest})
else()
set (cscore_config_dir share/cscore)
endif()

configure_file(cscore-config.cmake.in ${WPILIB_BINARY_DIR}/cscore-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/cscore-config.cmake DESTINATION ${cscore_config_dir})
install(EXPORT cscore DESTINATION ${cscore_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/cscore-config.cmake DESTINATION share/cscore)
install(EXPORT cscore DESTINATION share/cscore)

subdir_list(cscore_examples "${CMAKE_CURRENT_SOURCE_DIR}/examples")
foreach(example ${cscore_examples})
Expand Down
10 changes: 0 additions & 10 deletions glass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,3 @@ if (WIN32)
elseif(APPLE)
set_target_properties(glass PROPERTIES MACOSX_BUNDLE YES OUTPUT_NAME "Glass")
endif()

#if (MSVC OR FLAT_INSTALL_WPILIB)
# set (wpigui_config_dir ${wpilib_dest})
#else()
# set (wpigui_config_dir share/wpigui)
#endif()

#configure_file(wpigui-config.cmake.in ${CMAKE_BINARY_DIR}/wpigui-config.cmake )
#install(FILES ${CMAKE_BINARY_DIR}/wpigui-config.cmake DESTINATION ${wpigui_config_dir})
#install(EXPORT wpigui DESTINATION ${wpigui_config_dir})
10 changes: 2 additions & 8 deletions hal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,9 @@ install(TARGETS hal EXPORT hal)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/hal")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen/ DESTINATION "${include_dest}/hal")

if (WITH_FLAT_INSTALL)
set (hal_config_dir ${wpilib_dest})
else()
set (hal_config_dir share/hal)
endif()

configure_file(hal-config.cmake.in ${WPILIB_BINARY_DIR}/hal-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/hal-config.cmake DESTINATION ${hal_config_dir})
install(EXPORT hal DESTINATION ${hal_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/hal-config.cmake DESTINATION share/hal)
install(EXPORT hal DESTINATION share/hal)

# Java bindings
if (WITH_JAVA)
Expand Down
10 changes: 2 additions & 8 deletions ntcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,9 @@ install(TARGETS ntcore EXPORT ntcore)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/ntcore")
install(DIRECTORY ${WPILIB_BINARY_DIR}/ntcore/generated/main/native/include/ DESTINATION "${include_dest}/ntcore")

if (WITH_FLAT_INSTALL)
set (ntcore_config_dir ${wpilib_dest})
else()
set (ntcore_config_dir share/ntcore)
endif()

configure_file(ntcore-config.cmake.in ${WPILIB_BINARY_DIR}/ntcore-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/ntcore-config.cmake DESTINATION ${ntcore_config_dir})
install(EXPORT ntcore DESTINATION ${ntcore_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/ntcore-config.cmake DESTINATION share/ntcore)
install(EXPORT ntcore DESTINATION share/ntcore)

# Java bindings
if (WITH_JAVA)
Expand Down
18 changes: 3 additions & 15 deletions romiVendordep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ if (WITH_JAVA)
install(FILES ${ROMIVENDORDEP_JAR_FILE} DESTINATION "${java_lib_dest}")

set_property(TARGET romiVendordep_jar PROPERTY FOLDER "java")

if (WITH_FLAT_INSTALL)
set (romiVendordep_config_dir ${wpilib_dest})
else()
set (romiVendordep_config_dir share/romiVendordep)
endif()
endif()

if (WITH_JAVA_SOURCE)
Expand Down Expand Up @@ -54,15 +48,9 @@ target_include_directories(romiVendordep PUBLIC
install(TARGETS romiVendordep EXPORT romiVendordep DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/romiVendordep")

if (FLAT_INSTALL_WPILIB)
set(romiVendordep_config_dir ${wpilib_dest})
else()
set(romiVendordep_config_dir share/romiVendordep)
endif()

configure_file(romiVendordep-config.cmake.in ${WPILIB_BINARY_DIR}/romiVendordep-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/romiVendordep-config.cmake DESTINATION ${romiVendordep_config_dir})
install(EXPORT romiVendordep DESTINATION ${romiVendordep_config_dir})
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)
Expand Down
10 changes: 0 additions & 10 deletions wpigui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,3 @@ target_link_libraries(wpiguidev wpigui)

install(TARGETS wpigui EXPORT wpigui)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/wpigui")

#if (WITH_FLAT_INSTALL)
# set (wpigui_config_dir ${wpilib_dest})
#else()
# set (wpigui_config_dir share/wpigui)
#endif()

#configure_file(wpigui-config.cmake.in ${WPILIB_BINARY_DIR}/wpigui-config.cmake )
#install(FILES ${WPILIB_BINARY_DIR}/wpigui-config.cmake DESTINATION ${wpigui_config_dir})
#install(EXPORT wpigui DESTINATION ${wpigui_config_dir})
18 changes: 3 additions & 15 deletions wpilibNewCommands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ if (WITH_JAVA)
install(FILES ${WPILIBNEWCOMMANDS_JAR_FILE} DESTINATION "${java_lib_dest}")

set_property(TARGET wpilibNewCommands_jar PROPERTY FOLDER "java")

if (WITH_FLAT_INSTALL)
set (wpilibNewCommands_config_dir ${wpilib_dest})
else()
set (wpilibNewCommands_config_dir share/wpilibNewCommands)
endif()
endif()

if (WITH_JAVA_SOURCE)
Expand Down Expand Up @@ -56,15 +50,9 @@ target_include_directories(wpilibNewCommands PUBLIC
install(TARGETS wpilibNewCommands EXPORT wpilibNewCommands)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/wpilibNewCommands")

if (FLAT_INSTALL_WPILIB)
set(wpilibNewCommands_config_dir ${wpilib_dest})
else()
set(wpilibNewCommands_config_dir share/wpilibNewCommands)
endif()

configure_file(wpilibNewCommands-config.cmake.in ${WPILIB_BINARY_DIR}/wpilibNewCommands-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/wpilibNewCommands-config.cmake DESTINATION ${wpilibNewCommands_config_dir})
install(EXPORT wpilibNewCommands DESTINATION ${wpilibNewCommands_config_dir})
configure_file(wpilibNewCommands-config.cmake.in ${WPILIB_BINARY_DIR}/wpilibNewCommands-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/wpilibNewCommands-config.cmake DESTINATION share/wpilibNewCommands)
install(EXPORT wpilibNewCommands DESTINATION share/wpilibNewCommands)

if (WITH_TESTS)
wpilib_add_test(wpilibNewCommands src/test/native/cpp)
Expand Down
10 changes: 2 additions & 8 deletions wpilibc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,9 @@ set_property(TARGET wpilibc PROPERTY FOLDER "libraries")
install(TARGETS wpilibc EXPORT wpilibc)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/wpilibc")

if (WITH_FLAT_INSTALL)
set (wpilibc_config_dir ${wpilib_dest})
else()
set (wpilibc_config_dir share/wpilibc)
endif()

configure_file(wpilibc-config.cmake.in ${WPILIB_BINARY_DIR}/wpilibc-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/wpilibc-config.cmake DESTINATION ${wpilibc_config_dir})
install(EXPORT wpilibc DESTINATION ${wpilibc_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/wpilibc-config.cmake DESTINATION share/wpilibc)
install(EXPORT wpilibc DESTINATION share/wpilibc)

if (WITH_TESTS)
wpilib_add_test(wpilibc src/test/native/cpp)
Expand Down
8 changes: 1 addition & 7 deletions wpilibj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ if (WITH_JAVA)

set_property(TARGET wpilibj_jar PROPERTY FOLDER "java")

if (WITH_FLAT_INSTALL)
set (wpilibj_config_dir ${wpilib_dest})
else()
set (wpilibj_config_dir share/wpilibj)
endif()

install(FILES wpilibj-config.cmake DESTINATION ${wpilibj_config_dir})
install(FILES wpilibj-config.cmake DESTINATION share/wpilibj)
endif()

if (WITH_JAVA_SOURCE)
Expand Down
10 changes: 2 additions & 8 deletions wpimath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,9 @@ target_include_directories(wpimath PUBLIC

install(TARGETS wpimath EXPORT wpimath)

if (WITH_FLAT_INSTALL)
set (wpimath_config_dir ${wpilib_dest})
else()
set (wpimath_config_dir share/wpimath)
endif()

configure_file(wpimath-config.cmake.in ${WPILIB_BINARY_DIR}/wpimath-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/wpimath-config.cmake DESTINATION ${wpimath_config_dir})
install(EXPORT wpimath DESTINATION ${wpimath_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/wpimath-config.cmake DESTINATION share/wpimath)
install(EXPORT wpimath DESTINATION share/wpimath)

if (WITH_TESTS)
wpilib_add_test(wpimath src/test/native/cpp)
Expand Down
10 changes: 2 additions & 8 deletions wpinet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,9 @@ target_include_directories(wpinet PUBLIC

install(TARGETS wpinet EXPORT wpinet)

if (WITH_FLAT_INSTALL)
set (wpinet_config_dir ${wpilib_dest})
else()
set (wpinet_config_dir share/wpinet)
endif()

configure_file(wpinet-config.cmake.in ${WPILIB_BINARY_DIR}/wpinet-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/wpinet-config.cmake DESTINATION ${wpinet_config_dir})
install(EXPORT wpinet DESTINATION ${wpinet_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/wpinet-config.cmake DESTINATION share/wpinet)
install(EXPORT wpinet DESTINATION share/wpinet)

subdir_list(wpinet_examples "${CMAKE_CURRENT_SOURCE_DIR}/examples")
foreach(example ${wpinet_examples})
Expand Down
8 changes: 1 addition & 7 deletions wpiunits/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,5 @@ if (WITH_JAVA)

set_property(TARGET wpiunits_jar PROPERTY FOLDER "java")

if (WITH_FLAT_INSTALL)
set (wpiunits_config_dir ${wpiunits_dest})
else()
set (wpiunits_config_dir share/wpiunits)
endif()

install(FILES wpiunits-config.cmake DESTINATION ${wpiunits_config_dir})
install(FILES wpiunits-config.cmake DESTINATION share/wpiunits)
endif()
10 changes: 2 additions & 8 deletions wpiutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,9 @@ target_include_directories(wpiutil PUBLIC

install(TARGETS wpiutil EXPORT wpiutil)

if (WITH_FLAT_INSTALL)
set (wpiutil_config_dir ${wpilib_dest})
else()
set (wpiutil_config_dir share/wpiutil)
endif()

configure_file(wpiutil-config.cmake.in ${WPILIB_BINARY_DIR}/wpiutil-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/wpiutil-config.cmake DESTINATION ${wpiutil_config_dir})
install(EXPORT wpiutil DESTINATION ${wpiutil_config_dir})
install(FILES ${WPILIB_BINARY_DIR}/wpiutil-config.cmake DESTINATION share/wpiutil)
install(EXPORT wpiutil DESTINATION share/wpiutil)

subdir_list(wpiutil_examples "${CMAKE_CURRENT_SOURCE_DIR}/examples")
foreach(example ${wpiutil_examples})
Expand Down
18 changes: 3 additions & 15 deletions xrpVendordep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ if (WITH_JAVA)
install(FILES ${xrpVendordep_JAR_FILE} DESTINATION "${java_lib_dest}")

set_property(TARGET xrpVendordep_jar PROPERTY FOLDER "java")

if (WITH_FLAT_INSTALL)
set (xrpVendordep_config_dir ${wpilib_dest})
else()
set (xrpVendordep_config_dir share/xrpVendordep)
endif()
endif()

if (WITH_JAVA_SOURCE)
Expand Down Expand Up @@ -54,15 +48,9 @@ target_include_directories(xrpVendordep PUBLIC
install(TARGETS xrpVendordep EXPORT xrpVendordep DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/xrpVendordep")

if (FLAT_INSTALL_WPILIB)
set(xrpVendordep_config_dir ${wpilib_dest})
else()
set(xrpVendordep_config_dir share/xrpVendordep)
endif()

configure_file(xrpVendordep-config.cmake.in ${WPILIB_BINARY_DIR}/xrpVendordep-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/xrpVendordep-config.cmake DESTINATION ${xrpVendordep_config_dir})
install(EXPORT xrpVendordep DESTINATION ${xrpVendordep_config_dir})
configure_file(xrpVendordep-config.cmake.in ${WPILIB_BINARY_DIR}/xrpVendordep-config.cmake)
install(FILES ${WPILIB_BINARY_DIR}/xrpVendordep-config.cmake DESTINATION share/xrpVendordep)
install(EXPORT xrpVendordep DESTINATION share/xrpVendordep)

if (WITH_TESTS)
wpilib_add_test(xrpVendordep src/test/native/cpp)
Expand Down

0 comments on commit 25b7dca

Please sign in to comment.