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 | |
Mike Weiblen | 5ce5b15 | 2019-07-16 15:10:44 -0600 | [diff] [blame] | 21 | cmake_minimum_required(VERSION 3.10.2) |
Karl Schultz | afd12b7 | 2018-05-30 16:43:14 -0600 | [diff] [blame] | 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) |
Mike Weiblen | 62becc5 | 2020-04-23 10:59:45 -0600 | [diff] [blame] | 41 | target_include_directories(Vulkan-Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") |
Nuno Subtil | 2ed3359 | 2019-02-07 19:32:29 -0800 | [diff] [blame] | 42 | add_library(Vulkan::Headers ALIAS Vulkan-Headers) |
| 43 | |
| 44 | add_library(Vulkan-Registry INTERFACE) |
Mike Weiblen | 62becc5 | 2020-04-23 10:59:45 -0600 | [diff] [blame] | 45 | target_include_directories(Vulkan-Registry INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/registry") |
Nuno Subtil | 2ed3359 | 2019-02-07 19:32:29 -0800 | [diff] [blame] | 46 | add_library(Vulkan::Registry ALIAS Vulkan-Registry) |
| 47 | |
Mike Weiblen | 62becc5 | 2020-04-23 10:59:45 -0600 | [diff] [blame] | 48 | install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vulkan" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
Mike Schuchardt | f5ac258 | 2021-04-13 15:59:45 -0700 | [diff] [blame] | 49 | install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/vk_video" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
Mike Weiblen | 62becc5 | 2020-04-23 10:59:45 -0600 | [diff] [blame] | 50 | install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/registry" DESTINATION ${CMAKE_INSTALL_DATADIR}/vulkan) |
Karl Schultz | afd12b7 | 2018-05-30 16:43:14 -0600 | [diff] [blame] | 51 | |
Mike Weiblen | 62becc5 | 2020-04-23 10:59:45 -0600 | [diff] [blame] | 52 | # uninstall target |
| 53 | if(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 Weiblen | 6cb0f5b | 2018-06-26 14:24:09 -0600 | [diff] [blame] | 59 | endif() |