-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
74 lines (60 loc) · 2.61 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# This file is part of KDGpu Examples.
#
# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
#
# SPDX-License-Identifier: MIT
#
# Contact KDAB at <[email protected]> for commercial licensing options.
#
cmake_minimum_required(VERSION 3.16)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
cmake_policy(SET CMP0090 NEW) # Stop export(PACKAGE) from modifying the
# system-wide cmake package system
cmake_policy(SET CMP0117 NEW) # Do not add /GR to CMAKE_CXX_FLAGS
project(KDGpuExamples VERSION 0.0.1)
set(BUILD_SHARED_LIBS ON)
add_definitions(-DGLTF_RENDERER_ASSET_PATH="${CMAKE_CURRENT_BINARY_DIR}/assets")
add_definitions(
-DGLTF_RENDERER_MODEL_PATH="${CMAKE_CURRENT_BINARY_DIR}/_deps/sample-models-src/models/"
)
# Add a DEBUG define on DEBUG builds
add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>")
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE)
OR (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT WIN32))
# Linker warnings should be treated as errors
set(CMAKE_SHARED_LINKER_FLAGS
"-Wl,--fatal-warnings ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS
"-Wl,--fatal-warnings ${CMAKE_MODULE_LINKER_FLAGS}")
# Do not allow undefined symbols, even in non-symbolic shared libraries
set(CMAKE_SHARED_LINKER_FLAGS
"-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS
"-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU")
add_compile_options(-Wimplicit-fallthrough)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Silences a warning on raspberry pi gcc. See:
# https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m
add_compile_options(-Wno-psabi)
endif()
include(CompileShader)
include(CheckAtomic)
include(ECMEnableSanitizers)
include(FeatureSummary)
include(CMakeDependentOption)
include(GNUInstallDirs)
# Note: Set before including dependencies.cmake, so 3rd party libs end up in the
# correct dir
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies.cmake)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(src)
add_subdirectory(assets)
feature_summary(WHAT PACKAGES_FOUND ENABLED_FEATURES PACKAGES_NOT_FOUND
DISABLED_FEATURES INCLUDE_QUIET_PACKAGES)