From 133f26c80a5e79f66769d33e2d01252d12016e69 Mon Sep 17 00:00:00 2001 From: kidrigger Date: Sat, 1 Feb 2025 23:30:50 +0100 Subject: [PATCH] Fix installation and VCPKG patch. --- CMakeLists.txt | 49 ++++++++++++++++++++++++------ EASTLConfig.cmake.in | 9 ++++++ scripts/CMake/CommonCppFlags.cmake | 3 ++ 3 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 EASTLConfig.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index a5870f8..fd64807 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,9 @@ cmake_minimum_required(VERSION 3.11) include(FetchContent) project(EASTL CXX) +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) + #------------------------------------------------------------------------------------------- # Options #------------------------------------------------------------------------------------------- @@ -12,7 +15,6 @@ option(EASTL_BUILD_BENCHMARK "Enable generation of build files for benchmark" OF option(EASTL_BUILD_TESTS "Enable generation of build files for tests" OFF) option(EASTL_STD_ITERATOR_CATEGORY_ENABLED "Enable compatibility with std:: iterator categories" OFF) - option(EASTL_DISABLE_APRIL_2024_DEPRECATIONS "Enable use of API marked for removal in April 2024." OFF) option(EASTL_DISABLE_SEPT_2024_DEPRECATIONS "Enable use of API marked for removal in September 2024." OFF) option(EASTL_DISABLE_APRIL_2025_DEPRECATIONS "Enable use of API marked for removal in April 2025." OFF) @@ -65,21 +67,50 @@ endif() #------------------------------------------------------------------------------------------- # Include dirs #------------------------------------------------------------------------------------------- -target_include_directories(EASTL PUBLIC include) +target_include_directories(EASTL PUBLIC + $ + $ + ) #------------------------------------------------------------------------------------------- # Dependencies #------------------------------------------------------------------------------------------- -FetchContent_Declare( - EABase - GIT_REPOSITORY https://github.com/electronicarts/EABase.git - GIT_TAG 123363eb82e132c0181ac53e43226d8ee76dea12 - GIT_SUBMODULES "" # This should be temporary until we update the cyclic submodule dependencies in EABase. +find_package(EABase CONFIG REQUIRED) +target_link_libraries(EASTL PUBLIC EABase) + +# create and install an export set for eabase target as EABase::EABase +set(EASTL_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/EASTL") + +configure_package_config_file( + EASTLConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/EASTLConfig.cmake + INSTALL_DESTINATION ${EASTL_CMAKE_CONFIG_DESTINATION} +) + +# create and install an export set for Terra target as Terra +install( + TARGETS EASTL EXPORT EASTLTargets + DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + + +install(EXPORT EASTLTargets DESTINATION ${EASTL_CMAKE_CONFIG_DESTINATION}) + +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/EASTLConfigVersion.cmake" + VERSION 3.16.05 + COMPATIBILITY SameMajorVersion ) -FetchContent_MakeAvailable(EABase) +install(TARGETS EASTL LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") +install(DIRECTORY "include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") -target_link_libraries(EASTL EABase) +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/EASTLConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/EASTLConfigVersion.cmake" + DESTINATION ${EASTL_CMAKE_CONFIG_DESTINATION} +) #------------------------------------------------------------------------------------------- # Deprecations diff --git a/EASTLConfig.cmake.in b/EASTLConfig.cmake.in new file mode 100644 index 0000000..92fb2b1 --- /dev/null +++ b/EASTLConfig.cmake.in @@ -0,0 +1,9 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) +find_dependency(EABase CONFIG REQUIRED) + +# Provide path for scripts +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + +include(${CMAKE_CURRENT_LIST_DIR}/EASTLTargets.cmake) \ No newline at end of file diff --git a/scripts/CMake/CommonCppFlags.cmake b/scripts/CMake/CommonCppFlags.cmake index 08b6af5..281665e 100644 --- a/scripts/CMake/CommonCppFlags.cmake +++ b/scripts/CMake/CommonCppFlags.cmake @@ -74,6 +74,9 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") endif() elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest /W4 /permissive-") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.31.30911.95") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:static_assert-") + endif() endif() -- 2.47.0