blob: 26408912aae7dc3de56666f0e09b59a2dcc67e4c [file] [log] [blame]
Mike Weiblen6cb0f5b2018-06-26 14:24:09 -06001# ~~~
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
Mike Weiblen6b47ce42018-07-04 15:23:41 -060018# CMake project initialization ---------------------------------------------------------------------------------------------------
19# This section contains pre-project() initialization, and ends with the project() command.
20
Karl Schultzafd12b72018-05-30 16:43:14 -060021cmake_minimum_required(VERSION 2.8.11)
22
Mike Weiblen6b47ce42018-07-04 15:23:41 -060023# NONE = this project has no language toolchain requirement.
Karl Schultzafd12b72018-05-30 16:43:14 -060024project(Vulkan-Headers NONE)
25
Mike Weiblen6b47ce42018-07-04 15:23:41 -060026# 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
Karl Schultzafd12b72018-05-30 16:43:14 -060030include(GNUInstallDirs)
Mike Weiblen6b47ce42018-07-04 15:23:41 -060031
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".
Karl Schultzafd12b72018-05-30 16:43:14 -060034 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE)
35endif()
36
Mike Weiblen6b47ce42018-07-04 15:23:41 -060037# --------------------------------------------------------------------------------------------------------------------------------
38
Nuno Subtil2ed33592019-02-07 19:32:29 -080039# 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
Nuno Subtil1c8d71f2018-11-20 19:05:58 -080048install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
49install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/registry" DESTINATION ${CMAKE_INSTALL_DATADIR}/vulkan)
Karl Schultzafd12b72018-05-30 16:43:14 -060050
51# uninstall target
Karl Schultz70413b62018-06-12 15:06:34 -060052if(NOT TARGET uninstall)
Mike Weiblen6b47ce42018-07-04 15:23:41 -060053 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
54 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
Mike Weiblen0642c1b2018-06-26 15:04:33 -060055 IMMEDIATE
56 @ONLY)
57 add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
Mike Weiblen6cb0f5b2018-06-26 14:24:09 -060058endif()