1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 12:00:06 +00:00

CMake code review (#318)

This commit is contained in:
Chuck Walbourn 2023-02-09 21:58:13 -08:00 committed by GitHub
parent 4c277982ed
commit 5b06df54e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,9 +56,9 @@ elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$")
set(DIRECTX_ARCH arm64)
endif()
if(VCPKG_TARGET_IS_XBOX)
set(BUILD_DX11 OFF)
set(BUILD_DX12 ON)
if(DEFINED XBOX_CONSOLE_TARGET)
set(BUILD_DX11 OFF)
set(BUILD_DX12 ON)
endif()
include(GNUInstallDirs)
@ -171,15 +171,23 @@ if(NOT MINGW)
target_precompile_headers(${PROJECT_NAME} PRIVATE DirectXTex/DirectXTexP.h)
endif()
if(MINGW OR (NOT WIN32) OR VCPKG_TOOLCHAIN)
if(MINGW OR (NOT WIN32))
find_package(directxmath CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC Microsoft::DirectXMath)
find_package(directx-headers CONFIG REQUIRED)
else()
find_package(directxmath CONFIG QUIET)
find_package(directx-headers CONFIG QUIET)
endif()
if(NOT VCPKG_TARGET_IS_XBOX)
find_package(directx-headers CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC Microsoft::DirectX-Headers)
target_compile_definitions(${PROJECT_NAME} PRIVATE USING_DIRECTX_HEADERS)
endif()
if(directxmath_FOUND)
message(STATUS "Using DirectXMath package")
target_link_libraries(${PROJECT_NAME} PUBLIC Microsoft::DirectXMath)
endif()
if(directx-headers_FOUND)
message(STATUS "Using DirectX-Headers package")
target_link_libraries(${PROJECT_NAME} PUBLIC Microsoft::DirectX-Headers)
target_compile_definitions(${PROJECT_NAME} PRIVATE USING_DIRECTX_HEADERS)
endif()
#--- Package
@ -284,7 +292,7 @@ if(BUILD_SAMPLE AND BUILD_DX11 AND WIN32 AND (NOT WINDOWS_STORE))
endif()
endif()
if(MINGW OR (NOT WIN32) OR VCPKG_TOOLCHAIN)
if(directxmath_FOUND)
foreach(t IN LISTS TOOL_EXES)
target_link_libraries(${t} Microsoft::DirectXMath)
endforeach()