Skip to content

Commit

Permalink
CMake minor cleanup (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Apr 28, 2023
1 parent bef3384 commit 2de3d7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ cmake_minimum_required (VERSION 3.20)

set(DIRECTXMESH_VERSION 1.6.3)

if(DEFINED XBOX_CONSOLE_TARGET)
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
endif()

project(DirectXMesh
VERSION ${DIRECTXMESH_VERSION}
DESCRIPTION "DirectXMesh geometry Library"
Expand Down Expand Up @@ -130,7 +134,11 @@ if(DEFINED XBOX_CONSOLE_TARGET)
message(FATAL_ERROR "Microsoft GDK with Xbox Extensions environment needs to be set for Xbox One.")
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC _GAMING_XBOX _GAMING_XBOX_XBOXONE)
else()
message(FATAL_ERROR "Unknown XBOX_CONSOLE_TARGET")
endif()
elseif(WINDOWS_STORE)
target_compile_definitions(${PROJECT_NAME} PUBLIC WINAPI_FAMILY=WINAPI_FAMILY_APP)
endif()

#--- Utilities
Expand Down Expand Up @@ -269,6 +277,9 @@ endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(WarningsLib -Wall -Wpedantic -Wextra)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
list(APPEND WarningsLib "-Wno-unsafe-buffer-usage")
endif()
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsLib})

set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-double-promotion" "-Wno-exit-time-destructors" "-Wno-missing-prototypes")
Expand Down Expand Up @@ -338,10 +349,6 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
endif()

if(WIN32)
if(WINDOWS_STORE)
target_compile_definitions(${PROJECT_NAME} PRIVATE WINAPI_FAMILY=WINAPI_FAMILY_APP)
endif()

if(BUILD_DX12 OR (${DIRECTX_ARCH} MATCHES "^arm64"))
message(STATUS "Building with DirectX 12 Runtime support")
set(WINVER 0x0A00)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ The DirectXMesh library is the work of Chuck Walbourn, with contributions from D
Thanks to Matt Hurliman for his contribution of the meshlet generation functions.

Thanks to Adrian Stone (Game Angst) for the public domain implementation of Tom Forsyth's linear-speed vertex cache optimization, and thanks to Tom Forsyth for his contribution.

Thanks to Andrew Farrier and Scott Matloff for their on-going help with code reviews.

0 comments on commit 2de3d7b

Please sign in to comment.