diff options
Diffstat (limited to '0001-build-Remove-wpilib-prefix-from-CMake-flat-install.patch')
-rw-r--r-- | 0001-build-Remove-wpilib-prefix-from-CMake-flat-install.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/0001-build-Remove-wpilib-prefix-from-CMake-flat-install.patch b/0001-build-Remove-wpilib-prefix-from-CMake-flat-install.patch new file mode 100644 index 000000000000..b787cc65d289 --- /dev/null +++ b/0001-build-Remove-wpilib-prefix-from-CMake-flat-install.patch @@ -0,0 +1,67 @@ +From 4414bdbd81a96c07de7a1791f3d30c36be064da9 Mon Sep 17 00:00:00 2001 +From: Tyler Veness <calcmogul@gmail.com> +Date: Thu, 20 Oct 2022 19:49:38 -0700 +Subject: [PATCH] [build] Remove wpilib prefix from CMake flat install + +For system installs, `DESTDIR=/usr cmake --install buildfolder` installs +libraries to `/usr/lib` with the correct rpath. Example structure: +``` +/usr/include/wpimath/frc/controller/LinearQuadraticRegulator.h +/usr/lib/libwpimath.so +``` + +Users need to provide `-I/usr/include/wpimath` in their projects. This +is an artifact of the install() commands being in the subdirectory CMake +files. + +For other locations, `DESTDIR=/opt/wpilib cmake --install buildfolder` +installs libraries to `/opt/wpilib/lib`. Example structure: +``` +/opt/wpilib/include/wpimath/frc/controller/LinearQuadraticRegulator.h +/opt/wpilib/lib/libwpimath.so +``` +--- + CMakeLists.txt | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c65eaf376..53d901f4c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -36,16 +36,16 @@ SET(CMAKE_SKIP_BUILD_RPATH FALSE) + # (but later on when installing) + SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +-SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/wpilib/lib") ++SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # the RPATH to be used when installing, but only if it's not a system directory +-LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/wpilib/lib" isSystemDir) ++LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + IF("${isSystemDir}" STREQUAL "-1") +- SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/wpilib/lib") ++ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + ENDIF("${isSystemDir}" STREQUAL "-1") + + # Options for building certain parts of the repo. Everything is built by default. +@@ -153,11 +153,11 @@ FATAL: Cannot build wpilib without wpimath. + ") + endif() + +-set( wpilib_dest wpilib) +-set( include_dest wpilib/include ) +-set( main_lib_dest wpilib/lib ) +-set( java_lib_dest wpilib/java ) +-set( jni_lib_dest wpilib/jni ) ++set( wpilib_dest "") ++set( include_dest include ) ++set( main_lib_dest lib ) ++set( java_lib_dest java ) ++set( jni_lib_dest jni ) + + if (WITH_FLAT_INSTALL) + set (wpilib_config_dir ${wpilib_dest}) |