Mike Weiblen | 6cb0f5b | 2018-06-26 14:24:09 -0600 | [diff] [blame] | 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 | |
Mike Weiblen | 6b47ce4 | 2018-07-04 15:23:41 -0600 | [diff] [blame] | 18 | # CMake project initialization --------------------------------------------------------------------------------------------------- |
| 19 | # This section contains pre-project() initialization, and ends with the project() command. |
| 20 | |
Karl Schultz | afd12b7 | 2018-05-30 16:43:14 -0600 | [diff] [blame] | 21 | cmake_minimum_required(VERSION 2.8.11) |
| 22 | |
Mike Weiblen | 6b47ce4 | 2018-07-04 15:23:41 -0600 | [diff] [blame] | 23 | # NONE = this project has no language toolchain requirement. |
Karl Schultz | afd12b7 | 2018-05-30 16:43:14 -0600 | [diff] [blame] | 24 | project(Vulkan-Headers NONE) |
| 25 | |
Mike Weiblen | 6b47ce4 | 2018-07-04 15:23:41 -0600 | [diff] [blame] | 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 | |
Karl Schultz | afd12b7 | 2018-05-30 16:43:14 -0600 | [diff] [blame] | 30 | include(GNUInstallDirs) |
Mike Weiblen | 6b47ce4 | 2018-07-04 15:23:41 -0600 | [diff] [blame] | 31 | |
| 32 | if(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 Schultz | afd12b7 | 2018-05-30 16:43:14 -0600 | [diff] [blame] | 34 | set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE) |
| 35 | endif() |
| 36 | |
Mike Weiblen | 6b47ce4 | 2018-07-04 15:23:41 -0600 | [diff] [blame] | 37 | # -------------------------------------------------------------------------------------------------------------------------------- |
| 38 | |
Nuno Subtil | 2ed3359 | 2019-02-07 19:32:29 -0800 | [diff] [blame] | 39 | # define exported targets for nested project builds to consume |
| 40 | add_library(Vulkan-Headers INTERFACE) |
| 41 | target_include_directories(Vulkan-Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") |
| 42 | add_library(Vulkan::Headers ALIAS Vulkan-Headers) |
| 43 | |
| 44 | add_library(Vulkan-Registry INTERFACE) |
| 45 | target_include_directories(Vulkan-Registry INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/registry") |
| 46 | add_library(Vulkan::Registry ALIAS Vulkan-Registry) |
| 47 | |
Nuno Subtil | 1c8d71f | 2018-11-20 19:05:58 -0800 | [diff] [blame] | 48 | install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
| 49 | install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/registry" DESTINATION ${CMAKE_INSTALL_DATADIR}/vulkan) |
Karl Schultz | afd12b7 | 2018-05-30 16:43:14 -0600 | [diff] [blame] | 50 | |
| 51 | # uninstall target |
Karl Schultz | 70413b6 | 2018-06-12 15:06:34 -0600 | [diff] [blame] | 52 | if(NOT TARGET uninstall) |
Mike Weiblen | 6b47ce4 | 2018-07-04 15:23:41 -0600 | [diff] [blame] | 53 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" |
| 54 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" |
Mike Weiblen | 0642c1b | 2018-06-26 15:04:33 -0600 | [diff] [blame] | 55 | IMMEDIATE |
| 56 | @ONLY) |
| 57 | add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) |
Mike Weiblen | 6cb0f5b | 2018-06-26 14:24:09 -0600 | [diff] [blame] | 58 | endif() |