diff --git a/.gitattributes b/.gitattributes index 3333ec9c..93887667 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ # Declare txt file must remain as provided (unchanged carriage return) *.txt binary +CMakeLists.txt -binary text diff merge diff --git a/.github/workflows/build-and-test-pixi.yml b/.github/workflows/build-and-test-pixi.yml index 590d8ba7..06fafdc3 100644 --- a/.github/workflows/build-and-test-pixi.yml +++ b/.github/workflows/build-and-test-pixi.yml @@ -36,3 +36,6 @@ jobs: - name: Test run: pixi run test + + - name: Test installed CMake package + run: pixi run test-consumer diff --git a/CMakeLists.txt b/CMakeLists.txt index f5bb9fd6..95529f44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ project(vrs DESCRIPTION "Meta VRS File Format Project" LANGUAGES CXX ) +include(GNUInstallDirs) message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") message(STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}") diff --git a/cmake/FindOcean.cmake b/cmake/FindOcean.cmake index 948a4daa..fa0348c6 100644 --- a/cmake/FindOcean.cmake +++ b/cmake/FindOcean.cmake @@ -20,6 +20,21 @@ if(Ocean_FOUND) return() endif() +# Reuse the Ocean targets installed alongside VRS when this module is loaded +# from vrslibConfig.cmake. This avoids fetching and rebuilding Ocean in every +# downstream project. +set(_Ocean_INSTALLED_TARGETS "${CMAKE_CURRENT_LIST_DIR}/../../Ocean/FindOceanTargets.cmake") +if(EXISTS "${_Ocean_INSTALLED_TARGETS}") + include("${_Ocean_INSTALLED_TARGETS}") + if(TARGET Ocean::Ocean) + set(Ocean_LIBRARIES Ocean::Ocean) + set(Ocean_FOUND TRUE) + unset(_Ocean_INSTALLED_TARGETS) + return() + endif() +endif() +unset(_Ocean_INSTALLED_TARGETS) + # -------------------------- # 0) Standard install dirs include(GNUInstallDirs) @@ -82,6 +97,7 @@ target_link_libraries(ocean INTERFACE ocean_math ) add_library(Ocean::Ocean ALIAS ocean) +set_target_properties(ocean PROPERTIES EXPORT_NAME Ocean) # -------------------------- # 4) Installation diff --git a/cmake/FindRapidjsonLib.cmake b/cmake/FindRapidjsonLib.cmake index 4924d013..2a7084ce 100644 --- a/cmake/FindRapidjsonLib.cmake +++ b/cmake/FindRapidjsonLib.cmake @@ -12,8 +12,47 @@ # See the License for the specific language governing permissions and # limitations under the License. -# The package version of rapidjson provided by apt on Linux or brew on Mac date from August 2016, -# despite being the last official version (v1.1.0), and don't include important fixes. +if(TARGET rapidjson::rapidjson) + return() +endif() + +# Package managers can opt into a maintained RapidJSON package. Keep VRS' +# pinned source fallback as the default because the official v1.1.0 release is +# too old for VRS. +if(VRS_USE_SYSTEM_RAPIDJSON OR VRS_CONFIG_USE_SYSTEM_RAPIDJSON) + unset(_RAPIDJSON_TARGET) + find_package(RapidJSON CONFIG QUIET) + + if(TARGET RapidJSON::rapidjson) + set(_RAPIDJSON_TARGET RapidJSON::rapidjson) + elseif(TARGET RapidJSON) + set(_RAPIDJSON_TARGET RapidJSON) + elseif(TARGET rapidjson) + set(_RAPIDJSON_TARGET rapidjson) + else() + find_path(RAPIDJSON_INCLUDE_DIR NAMES rapidjson/rapidjson.h) + if(NOT RAPIDJSON_INCLUDE_DIR) + message(FATAL_ERROR "VRS_USE_SYSTEM_RAPIDJSON is enabled, but RapidJSON was not found") + endif() + endif() + + add_library(rapidjson::rapidjson INTERFACE IMPORTED) + if(_RAPIDJSON_TARGET) + set_target_properties(rapidjson::rapidjson PROPERTIES + INTERFACE_LINK_LIBRARIES "${_RAPIDJSON_TARGET}" + ) + else() + set_target_properties(rapidjson::rapidjson PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${RAPIDJSON_INCLUDE_DIR}" + ) + endif() + + unset(_RAPIDJSON_TARGET) + return() +endif() + +# The package version of rapidjson provided by apt on Linux or brew on Mac dates from August 2016, +# despite being the last official version (v1.1.0), and does not include important fixes. # So we get the code from GitHub at a known working state. # Try to find rapidjson in fbsource third-party (for fbsource builds) @@ -36,6 +75,9 @@ if (RAPIDJSON_INCLUDE_DIR) set(RAPIDJSON_FOUND TRUE) else() # Fall back to downloading from GitHub (OSS behavior) + if ("${EXTERNAL_DEPENDENCIES_DIR}" STREQUAL "") + set(EXTERNAL_DEPENDENCIES_DIR "${CMAKE_BINARY_DIR}/external") + endif() set(RAPIDJSON_DIR "${EXTERNAL_DEPENDENCIES_DIR}/rapidjson") set(RAPIDJSON_INCLUDE_DIR "${RAPIDJSON_DIR}/include") set(RAPIDJSON_INCLUDE_FILE "${RAPIDJSON_INCLUDE_DIR}/rapidjson/rapidjson.h") diff --git a/cmake/LibrariesSetup.cmake b/cmake/LibrariesSetup.cmake index a38b0184..f906cd3b 100644 --- a/cmake/LibrariesSetup.cmake +++ b/cmake/LibrariesSetup.cmake @@ -33,8 +33,10 @@ find_package(TurboJpeg REQUIRED) find_package(Opus) find_package(Ocean) -# Optional dependencies for XPRS decoding: only on Unix-like platforms (Linux & macOS) -if (BUILD_WITH_XPRS AND (TARGET_LINUX OR TARGET_MACOS)) +# Optional dependencies for XPRS decoding: only on Unix-like platforms (Linux & macOS). +# VRS_CONFIG_WITH_XPRS records whether an installed VRS package contains XPRS. +if ((BUILD_WITH_XPRS OR VRS_CONFIG_WITH_XPRS) AND + (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")) find_package(FFmpeg) endif() diff --git a/cmake/Options.cmake b/cmake/Options.cmake index b3ae03fe..28a8d52f 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -18,3 +18,9 @@ endif() set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release") set(UNIT_TESTS ON CACHE BOOL "Disable unit tests.") + +option( + VRS_USE_SYSTEM_RAPIDJSON + "Use an installed RapidJSON package instead of downloading VRS' pinned revision." + OFF +) diff --git a/pixi.lock b/pixi.lock index d46c59e9..d72a58fd 100644 --- a/pixi.lock +++ b/pixi.lock @@ -134,6 +134,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/pugixml-1.14-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.12.2-hab00c5b_0_cpython.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/python_abi-3.12-4_cp312.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/rapidjson-1.1.0.post20240409-h59595ed_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8228510_1.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/rhash-1.4.4-hd590300_0.conda - conda: https://conda.anaconda.org/conda-forge/linux-64/snappy-1.2.1-h8bd8927_1.conda @@ -279,6 +280,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-64/pugixml-1.14-he965462_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/python-3.12.2-h9f0c242_0_cpython.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/python_abi-3.12-4_cp312.conda + - conda: https://conda.anaconda.org/conda-forge/osx-64/rapidjson-1.1.0.post20240409-h73e2aa4_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/readline-8.2-h9e318b2_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/rhash-1.4.4-h0dc2134_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-64/sigtool-0.1.3-h88f4db0_0.tar.bz2 @@ -412,6 +414,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pugixml-1.14-h13dd4ca_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.12.2-hdf0ec26_0_cpython.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python_abi-3.12-4_cp312.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/rapidjson-1.1.0.post20240409-hebf3989_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.2-h92ec313_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/rhash-1.4.4-hb547adb_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/sigtool-0.1.3-h44b9a77_0.tar.bz2 @@ -489,6 +492,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/pthreads-win32-2.9.1-hfa6e2cd_3.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/win-64/python-3.12.2-h2628c8c_0_cpython.conda - conda: https://conda.anaconda.org/conda-forge/win-64/python_abi-3.12-4_cp312.conda + - conda: https://conda.anaconda.org/conda-forge/win-64/rapidjson-1.1.0.post20240409-h63175ca_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/svt-av1-2.1.0-he0c23c2_0.conda - conda: https://conda.anaconda.org/conda-forge/win-64/tbb-2021.11.0-h91493d7_1.conda - conda: https://conda.anaconda.org/conda-forge/win-64/tk-8.6.13-h5226925_1.conda @@ -5129,6 +5133,45 @@ packages: license_family: BSD size: 6785 timestamp: 1695147430513 +- conda: https://conda.anaconda.org/conda-forge/linux-64/rapidjson-1.1.0.post20240409-h59595ed_0.conda + sha256: 6d38a24b1bf7a386d0f0b8771a9a8f66f2d1b2a16209a6a5c27fcb5edb63422f + md5: f09de945165cad04c9055967e69a97e6 + depends: + - libgcc-ng >=12 + - libstdcxx-ng >=12 + license: MIT + license_family: MIT + size: 144702 + timestamp: 1714495765985 +- conda: https://conda.anaconda.org/conda-forge/osx-64/rapidjson-1.1.0.post20240409-h73e2aa4_0.conda + sha256: d3d8e9af9a81ed6ac58ff89c38cc6cec94533371f6944a92a96e3700b2665575 + md5: ba43337614ba4d27c5758dd93cfb065c + depends: + - libcxx >=16 + license: MIT + license_family: MIT + size: 144612 + timestamp: 1714495981287 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/rapidjson-1.1.0.post20240409-hebf3989_0.conda + sha256: 587385bb3717e39a5c201f5567f34634bd32d95b9a4723a5019c7fa6b45a27f7 + md5: 52a06664ab20c3fc919765b23a740ee7 + depends: + - libcxx >=16 + license: MIT + license_family: MIT + size: 144984 + timestamp: 1714496136369 +- conda: https://conda.anaconda.org/conda-forge/win-64/rapidjson-1.1.0.post20240409-h63175ca_0.conda + sha256: a371176f6893208b18ed044275e3a2bab1a75de215abb7f58cd6753f444498f2 + md5: 3c850635034b0e5e99b3ed171c02ebdd + depends: + - ucrt >=10.0.20348.0 + - vc >=14.2,<15 + - vc14_runtime >=14.29.30139 + license: MIT + license_family: MIT + size: 144681 + timestamp: 1714496008040 - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8228510_1.conda sha256: 5435cf39d039387fbdc977b0a762357ea909a7694d9528ab40f005e9208744d7 md5: 47d31b792659ce70f470b5c82fdfb7a4 diff --git a/pixi.toml b/pixi.toml index 2395b845..a6d37c0b 100644 --- a/pixi.toml +++ b/pixi.toml @@ -27,17 +27,23 @@ version = "1.1.0" # Note: extra CLI argument after `pixi run TASK` are passed to the task cmd. clean = { cmd = "rm -rf build" } print-env = { cmd = "echo $PATH" } -prepare = "cmake -G 'Ninja' -B build -S . -DBUILD_WITH_XPRS:BOOL=ON -DFFmpeg_ROOT=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release" +prepare = "cmake -G 'Ninja' -B build -S . -DBUILD_WITH_XPRS:BOOL=ON -DVRS_USE_SYSTEM_RAPIDJSON:BOOL=ON -DFFmpeg_ROOT=$CONDA_PREFIX -DCMAKE_INSTALL_PREFIX=$PIXI_PROJECT_ROOT/build/install -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release" build = { cmd = "cmake --build build --config Release --target all", depends-on = ["prepare"] } test = { cmd = "ctest -j --rerun-failed --output-on-failure ", cwd = "build", depends-on = ["build"]} +install = { cmd = "cmake --install build --config Release", depends-on = ["build"] } +prepare-consumer = { cmd = "cmake -S sample_project -B build/sample_project -Dvrslib_DIR=$PIXI_PROJECT_ROOT/build/install/lib/cmake/vrslib", depends-on = ["install"] } +test-consumer = { cmd = "cmake --build build/sample_project --config Release", depends-on = ["prepare-consumer"] } vrs = { cmd = "build/tools/vrs/vrs", depends-on = ["build"]} [target.win-64.tasks] # Deal with windows specifics (prepare and build) cmake-generator = "cmake --help" -prepare = "cmake -B build -S . -DCMAKE_BUILD_TYPE=Release" +prepare = "cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DVRS_USE_SYSTEM_RAPIDJSON:BOOL=ON -DCMAKE_INSTALL_PREFIX=$PIXI_PROJECT_ROOT/build/install" build = { cmd = "cmake --build build --config Release -- /m", depends-on = [ "prepare", ] } +prepare-consumer = { cmd = "cmake -S sample_project -B build/sample_project -Dvrslib_DIR=$PIXI_PROJECT_ROOT/build/install/lib/cmake/vrslib", depends-on = [ + "install", +] } vrs = { cmd = "build/tools/vrs/Release/vrs", depends-on = ["build"]} [build-dependencies] @@ -58,3 +64,11 @@ zlib = "1.2.*" eigen = "3.4.*" libopus = "1.4*" # optional dependency ffmpeg = { version = "*", build = "*lgpl*" } +# Keep this build compatible with the cxx-compiler 1.6 toolchain pinned above. +rapidjson = { version = "==1.1.0.post20240409", build = "*_0" } + +[target.osx-64.dependencies] +libcxx = { version = "==16.0.6", build = "*_0" } + +[target.osx-arm64.dependencies] +libcxx = { version = "==16.0.6", build = "*_0" } diff --git a/tools/vrs/CMakeLists.txt b/tools/vrs/CMakeLists.txt index 57aec0f7..8f7f0778 100644 --- a/tools/vrs/CMakeLists.txt +++ b/tools/vrs/CMakeLists.txt @@ -36,7 +36,7 @@ target_link_libraries(vrs install(TARGETS vrs EXPORT VRSLibTargets - RUNTIME DESTINATION bin + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) if (UNIT_TESTS) diff --git a/tools/vrsplayer/CMakeLists.txt b/tools/vrsplayer/CMakeLists.txt index 4e1e02d9..c8e6136f 100644 --- a/tools/vrsplayer/CMakeLists.txt +++ b/tools/vrsplayer/CMakeLists.txt @@ -48,7 +48,7 @@ if (QT_FOUND) endif() install(TARGETS vrsplayer EXPORT VRSLibTargets - RUNTIME DESTINATION bin + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) set(CMAKE_AUTOMOC OFF) diff --git a/vrs/CMakeLists.txt b/vrs/CMakeLists.txt index 34ed2029..1c3bba01 100644 --- a/vrs/CMakeLists.txt +++ b/vrs/CMakeLists.txt @@ -22,7 +22,7 @@ add_library(vrslib ${VRS_SRCS}) target_include_directories(vrslib PUBLIC $ - $ + $ ) target_link_libraries(vrslib PUBLIC @@ -41,23 +41,23 @@ target_link_libraries(vrslib target_link_libraries (vrslib PUBLIC $<$:rt>) install(TARGETS vrslib EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(EXPORT VRSLibTargets NAMESPACE vrs:: FILE vrslibTargets.cmake - DESTINATION lib/cmake/vrslib + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/vrslib ) include(CMakePackageConfigHelpers) configure_package_config_file(vrslibConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/vrslibConfig.cmake - INSTALL_DESTINATION ${LIB_INSTALL_DIR}/vrslib/cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/vrslib ) write_basic_package_version_file( @@ -68,21 +68,21 @@ write_basic_package_version_file( install( DIRECTORY . - DESTINATION include/vrs + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vrs COMPONENT headers - FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" + FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" PATTERN "*.inc" ) install( DIRECTORY ../cmake - DESTINATION lib/cmake/vrslib + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/vrslib FILES_MATCHING PATTERN "*.cmake" ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vrslibConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/vrslibConfigVersion.cmake" - DESTINATION lib/cmake/vrslib + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/vrslib ) if (UNIT_TESTS) diff --git a/vrs/helpers/CMakeLists.txt b/vrs/helpers/CMakeLists.txt index b3d7d37e..f5e8a886 100644 --- a/vrs/helpers/CMakeLists.txt +++ b/vrs/helpers/CMakeLists.txt @@ -16,7 +16,7 @@ add_library(vrs_helpers_strings INTERFACE) target_include_directories(vrs_helpers_strings INTERFACE $ - $ + $ ) file(GLOB VRS_HELPERS_SRCS *.cpp *.h *.hpp) @@ -33,14 +33,14 @@ target_link_libraries(vrs_helpers target_include_directories(vrs_helpers PUBLIC $ - $ + $ ) install(TARGETS vrs_helpers vrs_helpers_strings EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) if (UNIT_TESTS) diff --git a/vrs/os/CMakeLists.txt b/vrs/os/CMakeLists.txt index 5d3803a7..d28bb4bd 100644 --- a/vrs/os/CMakeLists.txt +++ b/vrs/os/CMakeLists.txt @@ -23,7 +23,7 @@ add_library(vrs_os ${VRS_OS_SRCS}) target_include_directories(vrs_os PUBLIC $ - $ + $ ) target_link_libraries(vrs_os @@ -38,16 +38,16 @@ add_library(vrs_platform INTERFACE) target_include_directories(vrs_platform INTERFACE $ - $ + $ ) # When building with cmake, always enable OSS build mode target_compile_definitions(vrs_platform INTERFACE OSS_BUILD_MODE) install(TARGETS vrs_os vrs_platform EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) if (UNIT_TESTS) diff --git a/vrs/oss/logging/CMakeLists.txt b/vrs/oss/logging/CMakeLists.txt index 5e312476..6f316cb6 100644 --- a/vrs/oss/logging/CMakeLists.txt +++ b/vrs/oss/logging/CMakeLists.txt @@ -21,7 +21,7 @@ add_library(vrs_logging ${VRS_LOGGING_SRCS}) target_include_directories(vrs_logging INTERFACE $ - $ + $ ) target_link_libraries(vrs_logging @@ -31,8 +31,8 @@ target_link_libraries(vrs_logging ) install(TARGETS vrs_logging EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/vrs/oss/portability/CMakeLists.txt b/vrs/oss/portability/CMakeLists.txt index f1bc8239..78887a68 100644 --- a/vrs/oss/portability/CMakeLists.txt +++ b/vrs/oss/portability/CMakeLists.txt @@ -22,8 +22,8 @@ target_include_directories(vrs_oss_portability ) install(TARGETS vrs_oss_portability EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/vrs/oss/thread_safety_analysis/CMakeLists.txt b/vrs/oss/thread_safety_analysis/CMakeLists.txt index 94cca7b3..59230910 100644 --- a/vrs/oss/thread_safety_analysis/CMakeLists.txt +++ b/vrs/oss/thread_safety_analysis/CMakeLists.txt @@ -26,8 +26,8 @@ target_include_directories(vrs_oss_thread_safety_analysis ) install(TARGETS vrs_oss_thread_safety_analysis EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/vrs/utils/CMakeLists.txt b/vrs/utils/CMakeLists.txt index 8c561045..97cef976 100644 --- a/vrs/utils/CMakeLists.txt +++ b/vrs/utils/CMakeLists.txt @@ -51,14 +51,14 @@ endif() target_include_directories(vrs_utils INTERFACE $ - $ + $ ) install(TARGETS vrs_utils EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) if (UNIT_TESTS) diff --git a/vrs/utils/cli/CMakeLists.txt b/vrs/utils/cli/CMakeLists.txt index d423727b..260e1734 100644 --- a/vrs/utils/cli/CMakeLists.txt +++ b/vrs/utils/cli/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(vrs_utils_cli ${VRS_UTILS_CLI_SRCS}) target_include_directories(vrs_utils_cli PUBLIC $ - $ + $ ) target_link_libraries(vrs_utils_cli PUBLIC @@ -28,8 +28,8 @@ target_link_libraries(vrs_utils_cli vrs_logging ) install(TARGETS vrs_utils_cli EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/vrs/utils/converters/CMakeLists.txt b/vrs/utils/converters/CMakeLists.txt index f391645f..3c2e93b0 100644 --- a/vrs/utils/converters/CMakeLists.txt +++ b/vrs/utils/converters/CMakeLists.txt @@ -25,10 +25,10 @@ target_include_directories(vrs_utils_converters $ ) install(TARGETS vrs_utils_converters EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) if (UNIT_TESTS) diff --git a/vrs/utils/xprs/CMakeLists.txt b/vrs/utils/xprs/CMakeLists.txt index bca9d5f7..24726520 100644 --- a/vrs/utils/xprs/CMakeLists.txt +++ b/vrs/utils/xprs/CMakeLists.txt @@ -30,8 +30,8 @@ target_include_directories(vrs_utils_xprs ) install(TARGETS vrs_utils_xprs EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/vrs/utils/xxhash/CMakeLists.txt b/vrs/utils/xxhash/CMakeLists.txt index 18ece948..ebe2f997 100644 --- a/vrs/utils/xxhash/CMakeLists.txt +++ b/vrs/utils/xxhash/CMakeLists.txt @@ -26,10 +26,10 @@ target_link_libraries(vrs_utils_xxhash xxHash::xxHash ) install(TARGETS vrs_utils_xxhash EXPORT VRSLibTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) if (UNIT_TESTS) diff --git a/vrs/vrslibConfig.cmake.in b/vrs/vrslibConfig.cmake.in index 4253080c..ff960fe3 100644 --- a/vrs/vrslibConfig.cmake.in +++ b/vrs/vrslibConfig.cmake.in @@ -14,8 +14,16 @@ @PACKAGE_INIT@ set(PACKAGE_VERSION "1.0") -include("${CMAKE_CURRENT_LIST_DIR}/vrslibTargets.cmake") # Library setup -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") +set(_VRS_SAVED_CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}") +list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") +set(VRS_CONFIG_USE_SYSTEM_RAPIDJSON "@VRS_USE_SYSTEM_RAPIDJSON@") +set(VRS_CONFIG_WITH_XPRS "@BUILD_WITH_XPRS@") include(${CMAKE_CURRENT_LIST_DIR}/cmake/LibrariesSetup.cmake) +set(CMAKE_MODULE_PATH "${_VRS_SAVED_CMAKE_MODULE_PATH}") +unset(_VRS_SAVED_CMAKE_MODULE_PATH) +unset(VRS_CONFIG_USE_SYSTEM_RAPIDJSON) +unset(VRS_CONFIG_WITH_XPRS) + +include("${CMAKE_CURRENT_LIST_DIR}/vrslibTargets.cmake")