• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ~~~
2# Copyright (c) 2018 Valve Corporation
3# Copyright (c) 2018 LunarG, Inc.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# ~~~
17
18# CMake project initialization ---------------------------------------------------------------------------------------------------
19# This section contains pre-project() initialization, and ends with the project() command.
20
21cmake_minimum_required(VERSION 3.10.2)
22
23# NONE = this project has no language toolchain requirement.
24project(Vulkan-Headers NONE)
25
26# User-interface declarations ----------------------------------------------------------------------------------------------------
27# This section contains variables that affect development GUIs (e.g. CMake GUI and IDEs), such as option(), folders, and variables
28# with the CACHE property.
29
30include(GNUInstallDirs)
31
32if(WIN32 AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
33    # Windows: if install locations not set by user, set install prefix to "<build_dir>\install".
34    set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE)
35endif()
36
37# --------------------------------------------------------------------------------------------------------------------------------
38
39# define exported targets for nested project builds to consume
40add_library(Vulkan-Headers INTERFACE)
41target_include_directories(Vulkan-Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
42add_library(Vulkan::Headers ALIAS Vulkan-Headers)
43
44add_library(Vulkan-Registry INTERFACE)
45target_include_directories(Vulkan-Registry INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/registry")
46add_library(Vulkan::Registry ALIAS Vulkan-Registry)
47
48install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
49install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/registry" DESTINATION ${CMAKE_INSTALL_DATADIR}/vulkan)
50
51# uninstall target
52if(NOT TARGET uninstall)
53    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
54                   "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
55                   IMMEDIATE
56                   @ONLY)
57    add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
58endif()
59