blob: 472dec6e66352c48a614a16d52b50a915cd651a9 [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
Mike Weiblen5ce5b152019-07-16 15:10:44 -060021cmake_minimum_required(VERSION 3.10.2)
Karl Schultzafd12b72018-05-30 16:43:14 -060022
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)
Mike Weiblen62becc52020-04-23 10:59:45 -060041target_include_directories(Vulkan-Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
Nuno Subtil2ed33592019-02-07 19:32:29 -080042add_library(Vulkan::Headers ALIAS Vulkan-Headers)
43
44add_library(Vulkan-Registry INTERFACE)
Mike Weiblen62becc52020-04-23 10:59:45 -060045target_include_directories(Vulkan-Registry INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/registry")
Nuno Subtil2ed33592019-02-07 19:32:29 -080046add_library(Vulkan::Registry ALIAS Vulkan-Registry)
47
Mike Weiblen62becc52020-04-23 10:59:45 -060048install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
Mike Schuchardtf5ac2582021-04-13 15:59:45 -070049install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vk_video" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
Mike Weiblen62becc52020-04-23 10:59:45 -060050install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/registry" DESTINATION ${CMAKE_INSTALL_DATADIR}/vulkan)
Karl Schultzafd12b72018-05-30 16:43:14 -060051
Mike Weiblen62becc52020-04-23 10:59:45 -060052# uninstall target
53if(NOT TARGET uninstall)
54 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
55 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
56 IMMEDIATE
57 @ONLY)
58 add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
Mike Weiblen6cb0f5b2018-06-26 14:24:09 -060059endif()