From 8a4c89377cfd8d3184a5e29c500903b598c38a6d Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 22 Nov 2022 11:21:24 -0800 Subject: [PATCH] CMake update for version 3.20 (#154) --- CMakeLists.txt | 24 ++++++++- CMakePresets.json | 134 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 156 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d24628e..ea23fab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -cmake_minimum_required (VERSION 3.14) +cmake_minimum_required (VERSION 3.20) set(DIRECTXMATH_VERSION 3.1.8) @@ -67,3 +67,25 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}-config-version.cmake DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}) + +#--- Test suite +if (DEFINED VCPKG_TARGET_ARCHITECTURE) + set(DXMATH_ARCHITECTURE ${VCPKG_TARGET_ARCHITECTURE}) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") + set(DXMATH_ARCHITECTURE x86) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") + set(DXMATH_ARCHITECTURE x64) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") + set(DXMATH_ARCHITECTURE arm) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$") + set(DXMATH_ARCHITECTURE arm64) +elseif(NOT DXMATH_ARCHITECTURE) + set(DXMATH_ARCHITECTURE "x64") +endif() + +#--- Test suite +include(CTest) +if(BUILD_TESTING AND WIN32 AND (NOT WINDOWS_STORE) AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/CMakeLists.txt")) + enable_testing() + add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests) +endif() diff --git a/CMakePresets.json b/CMakePresets.json index 43515ab..90b680e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -17,6 +17,34 @@ "value": "x64", "strategy": "external" }, + "cacheVariables": { "DXMATH_ARCHITECTURE": "x64" }, + "hidden": true + }, + { + "name": "x86", + "architecture": { + "value": "x86", + "strategy": "external" + }, + "cacheVariables": { "DXMATH_ARCHITECTURE": "x86" }, + "hidden": true + }, + { + "name": "ARM", + "architecture": { + "value": "arm", + "strategy": "external" + }, + "cacheVariables": { "DXMATH_ARCHITECTURE": "arm" }, + "hidden": true + }, + { + "name": "ARM64", + "architecture": { + "value": "arm64", + "strategy": "external" + }, + "cacheVariables": { "DXMATH_ARCHITECTURE": "arm64" }, "hidden": true }, @@ -25,6 +53,37 @@ "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }, "hidden": true }, + { + "name": "Release", + "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" }, + "hidden": true + }, + + { + "name": "OneCore", + "cacheVariables": { "BUILD_FOR_ONECORE": true }, + "hidden": true + }, + { + "name": "AVX", + "cacheVariables": { "BUILD_AVX_TEST": true }, + "hidden": true + }, + { + "name": "AVX2", + "cacheVariables": { "BUILD_AVX2_TEST": true }, + "hidden": true + }, + { + "name": "F16C", + "cacheVariables": { "BUILD_F16C_TEST": true }, + "hidden": true + }, + { + "name": "NI", + "cacheVariables": { "BUILD_NO_INTRINSICS": true }, + "hidden": true + }, { "name": "MSVC", @@ -37,7 +96,80 @@ "strategy": "external" } }, + { + "name": "Clang", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clang-cl.exe" + }, + "toolset": { + "value": "host=x64", + "strategy": "external" + } + }, + { + "name": "GNUC", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++.exe" + }, + "toolset": { + "value": "host=x64", + "strategy": "external" + } + }, + { + "name": "Intel", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "icl.exe" + }, + "toolset": { + "value": "host=x64", + "strategy": "external" + } + }, + { + "name": "IntelLLVM", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "icx.exe" + }, + "toolset": { + "value": "host=x64", + "strategy": "external" + } + }, - { "name": "x64-Debug" , "description": "MSVC for x64 (Debug) for Windows 8", "inherits": [ "base", "x64", "Debug", "MSVC" ] } + { "name": "x64-Debug" , "description": "MSVC for x64 (Debug) - SSE/SSE2", "inherits": [ "base", "x64", "Debug", "MSVC" ] }, + { "name": "x64-Release" , "description": "MSVC for x64 (Release) - SSE/SSE2", "inherits": [ "base", "x64", "Release", "MSVC" ] }, + { "name": "x86-Debug" , "description": "MSVC for x86 (Debug) - SSE/SSE2", "inherits": [ "base", "x86", "Debug", "MSVC" ] }, + { "name": "x86-Release" , "description": "MSVC for x86 (Release) - SSE/SSE2", "inherits": [ "base", "x86", "Release", "MSVC" ] }, + { "name": "arm-Debug" , "description": "MSVC for ARM (Debug) - ARM-NEON", "inherits": [ "base", "ARM", "Debug", "MSVC" ] }, + { "name": "arm-Release" , "description": "MSVC for ARM (Release) - ARM-NEON", "inherits": [ "base", "ARM", "Release", "MSVC" ] }, + { "name": "arm64-Debug" , "description": "MSVC for ARM64 (Debug) - ARM-NEON", "inherits": [ "base", "ARM64", "Debug", "MSVC" ] }, + { "name": "arm64-Release", "description": "MSVC for ARM64 (Release) - ARM-NEON", "inherits": [ "base", "ARM64", "Release", "MSVC" ] }, + + { "name": "x64-Debug-Clang" , "description": "Clang/LLVM for x64 (Debug) - SSE/SSE2", "inherits": [ "base", "x64", "Debug", "Clang" ] }, + { "name": "x64-Release-Clang" , "description": "Clang/LLVM for x64 (Release) - SSE/SSE2", "inherits": [ "base", "x64", "Release", "Clang" ] }, + { "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug) - SSE/SSE2", "inherits": [ "base", "x86", "Debug", "Clang" ], "environment": { "CXXFLAGS": "-m32" } }, + { "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release) - SSE/SSE2", "inherits": [ "base", "x86", "Release", "Clang" ], "environment": { "CXXFLAGS": "-m32" } }, + { "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug) - ARM-NEON", "inherits": [ "base", "ARM64", "Debug", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, + { "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release) - ARM-NEON", "inherits": [ "base", "ARM64", "Release", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } } + ], + "testPresets": [ + { "name": "x64-Debug" , "configurePreset": "x64-Debug" }, + { "name": "x64-Release" , "configurePreset": "x64-Release" }, + { "name": "x86-Debug" , "configurePreset": "x86-Debug" }, + { "name": "x86-Release" , "configurePreset": "x86-Release" }, + { "name": "arm64-Debug" , "configurePreset": "arm64-Debug" }, + { "name": "arm64-Release", "configurePreset": "arm64-Release" }, + + { "name": "x64-Debug-Clang" , "configurePreset": "x64-Debug-Clang" }, + { "name": "x64-Release-Clang" , "configurePreset": "x64-Release-Clang" }, + { "name": "x86-Debug-Clang" , "configurePreset": "x86-Debug-Clang" }, + { "name": "x86-Release-Clang" , "configurePreset": "x86-Release-Clang" }, + { "name": "arm64-Debug-Clang" , "configurePreset": "arm64-Debug-Clang" }, + { "name": "arm64-Release-Clang", "configurePreset": "arm64-Release-Clang" } ] } \ No newline at end of file