CMake code review (#102)

This commit is contained in:
Chuck Walbourn 2023-02-09 18:54:37 -08:00 committed by GitHub
parent c8dee6538c
commit 32d41a98fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,15 +131,23 @@ if(NOT MINGW)
target_precompile_headers(${PROJECT_NAME} PRIVATE UVAtlas/pch.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()
if(ENABLE_USE_EIGEN)
@ -187,7 +195,7 @@ install(FILES
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set(TOOL_EXES uvatlastool)
message(STATUS "Using VCPKG for DirectXMesh and DirectXTex (required for uvatlastool).")
message(STATUS "Using DirectXMesh and DirectXTex (required for uvatlastool).")
find_package(directxmesh CONFIG REQUIRED COMPONENTS library utils)
find_package(directxtex CONFIG REQUIRED)
@ -206,7 +214,7 @@ if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
Microsoft::DirectXMesh::Utilities)
source_group(uvatlastool REGULAR_EXPRESSION UVAtlasTool/*.*)
if(MINGW OR VCPKG_TOOLCHAIN)
if(directxmath_FOUND)
target_link_libraries(uvatlastool Microsoft::DirectXMath)
endif()
endif()
@ -329,7 +337,7 @@ if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE WINAPI_FAMILY=WINAPI_FAMILY_APP)
endif()
if(WINDOWS_STORE OR (${DIRECTX_ARCH} MATCHES "^arm64") OR VCPKG_TARGET_IS_XBOX)
if(WINDOWS_STORE OR (${DIRECTX_ARCH} MATCHES "^arm64") OR (DEFINED XBOX_CONSOLE_TARGET))
set(WINVER 0x0A00)
elseif(${DIRECTX_ARCH} MATCHES "^arm")
set(WINVER 0x0602)