mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-06-01 09:27:54 +00:00

Allows build options specific to Vulkan-Utility-Libraries to be easily grouped via cmake-gui. This approach is also nicer for users who consume the library via add_subdirectory or FetchContent since it more obvious what settings are being ovverriden. Remove UTILITY_LIBRARIES_CPP_STANDARD since we don't have a reason to support multiple CPP standards. Set testing to OFF by default to make consuming the library easier for users and package managers.
52 lines
1.6 KiB
CMake
52 lines
1.6 KiB
CMake
# Copyright (c) 2023 Valve Corporation
|
|
# Copyright (c) 2023 LunarG, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
cmake_minimum_required(VERSION 3.17.2)
|
|
|
|
project(VUL LANGUAGES CXX)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Remove when min is 3.26, see CMP0143
|
|
|
|
option(VUL_TESTS "Build utility libraries tests")
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
|
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN "YES")
|
|
|
|
# NOTE: The idiom for open source projects is to not enable warnings as errors.
|
|
# This reduces problems for users who simply want to build the repository.
|
|
option(VUL_WERROR "Treat compiler warnings as errors")
|
|
if (VUL_WERROR)
|
|
add_compile_options("$<IF:$<CXX_COMPILER_ID:MSVC>,/WX,-Werror>")
|
|
if (MSVC)
|
|
add_link_options(/WX)
|
|
endif()
|
|
endif()
|
|
|
|
find_package(PythonInterp 3.7.2 REQUIRED)
|
|
|
|
add_subdirectory(scripts)
|
|
|
|
find_package(VulkanHeaders REQUIRED CONFIG QUIET)
|
|
|
|
if (VUL_TESTS)
|
|
enable_testing()
|
|
endif()
|
|
|
|
add_subdirectory(layer_utils)
|