This commit is contained in:
2026-06-14 19:09:18 +01:00
parent 14bd1a9271
commit 13fa90a0e9
3958 changed files with 999286 additions and 4 deletions
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2020 Andreas Atteneder
SPDX-License-Identifier: Apache-2.0
-->
<installer-gui-script minSpecVersion="1.0">
<title>KTX-Software</title>
<welcome file="@CPACK_RESOURCE_FILE_WELCOME_NOPATH@"/>
<readme file="@CPACK_RESOURCE_FILE_README_NOPATH@"/>
<license file="@CPACK_RESOURCE_FILE_LICENSE_NOPATH@"/>
<domains enable_localSystem="true"/>
<options allow-external-scripts="no" customize="allow" rootVolumeOnly="true"/>
@CPACK_PACKAGEMAKER_CHOICES@
<conclusion file="summary.html" mime-type="text/html"/>
</installer-gui-script>
+100
View File
@@ -0,0 +1,100 @@
##############################################################################
# @file FindBASH.cmake
# @brief Find BASH interpreter.
#
# Sets the CMake variables @c BASH_FOUND, @c BASH_EXECUTABLE,
# @c BASH_VERSION_STRING, @c BASH_VERSION_MAJOR, @c BASH_VERSION_MINOR, and
# @c BASH_VERSION_PATCH.
#
# @ingroup CMakeFindModules
##############################################################################
#=============================================================================
# Copyright 2011-2012 University of Pennsylvania
# Copyright 2013-2016 Andreas Schuh <andreas.schuh.84@gmail.com>
# Copyright 2013-2020 Andreas Atteneder <andreas.atteneder@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
#
# Distributed under the OSI-approved BSD License (the "License");
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# ----------------------------------------------------------------------------
# find BASH executable
# First, look if GIT bash is installed
find_program (
BASH_EXECUTABLE
bash
PATHS
# Additional paths for Windows
"C:\\Program Files\\Git\\bin"
NO_SYSTEM_ENVIRONMENT_PATH
)
if(NOT BASH_EXECUTABLE)
# Fallback search in default locations
find_program (
BASH_EXECUTABLE
bash
)
endif()
mark_as_advanced (BASH_EXECUTABLE)
# ----------------------------------------------------------------------------
# Get version of found BASH executable.
if (BASH_EXECUTABLE)
# Set LANG to en because match looks for English "version".
set(ENV{LANG} "en_US.UTF-8")
execute_process (COMMAND "${BASH_EXECUTABLE}" --version OUTPUT_VARIABLE _BASH_STDOUT ERROR_VARIABLE _BASH_STDERR)
if (_BASH_STDOUT MATCHES "version ([0-9]+)\\.([0-9]+)\\.([0-9]+)")
set (BASH_VERSION_MAJOR "${CMAKE_MATCH_1}")
set (BASH_VERSION_MINOR "${CMAKE_MATCH_2}")
set (BASH_VERSION_PATCH "${CMAKE_MATCH_3}")
set (BASH_VERSION_STRING "${BASH_VERSION_MAJOR}.${BASH_VERSION_MINOR}.${BASH_VERSION_PATCH}")
else ()
message (WARNING "Failed to determine version of Bash interpreter (${BASH_EXECUTABLE})! Error:\n${_BASH_STDERR}")
endif ()
unset (_BASH_STDOUT)
unset (_BASH_STDERR)
endif ()
# ----------------------------------------------------------------------------
# Handle the QUIET and REQUIRED arguments and set *_FOUND to TRUE
# if all listed variables are found or TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (
Bash
REQUIRED_VARS
BASH_EXECUTABLE
)
+210
View File
@@ -0,0 +1,210 @@
# A version of cmake's FindSDL module modified to find SDL2.
# Copyright 2000-2020 Kitware, Inc. and Contributors
# SPDX-License-Identifier: BSD-3-Clause
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Modifled for SDL2 by Mark Callow. (khronos at callow.im)
#[=======================================================================[.rst:
FindSDL2
--------
Locate SDL2 library
This module defines
::
SDL2_LIBRARY, the name of the library to link against
SDL2_FOUND, if false, do not try to link to SDL
SDL2_INCLUDE_DIR, where to find SDL.h
SDL2_VERSION_STRING, human-readable string containing the version of SDL
This module responds to the flag:
::
SDL2_BUILDING_LIBRARY
If this is defined, then no SDL2_main will be linked in because
only applications need main().
Otherwise, it is assumed you are building an application and this
module will attempt to locate and set the proper link flags
as part of the returned SDL2_LIBRARY variable.
Don't forget to include SDLmain.h and SDLmain.m your project for the
OS X framework based version. (Other versions link to -lSDLmain which
this module will try to find on your behalf.) Also for OS X, this
module will automatically add the -framework Cocoa on your behalf.
Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your
configuration and no SDL2_LIBRARY, it means CMake did not find your SDL
library (SDL.dll, libsdl.so, SDL.framework, etc). Set
SDL2_LIBRARY_TEMP to point to your SDL library, and configure again.
Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this
value as appropriate. These values are used to generate the final
SDL2_LIBRARY variable, but when these values are unset, SDL2_LIBRARY
does not get created.
$SDL2DIR is an environment variable that would correspond to the
./configure --prefix=$SDL2DIR used in building SDL. l.e.galup 9-20-02
Modified by Eric Wing. Added code to assist with automated building
by using environmental variables and providing a more
controlled/consistent search behavior. Added new modifications to
recognize OS X frameworks and additional Unix paths (FreeBSD, etc).
Also corrected the header search path to follow "proper" SDL
guidelines. Added a search for SDLmain which is needed by some
platforms. Added a search for threads which is needed by some
platforms. Added needed compile switches for MinGW.
On OSX, this will prefer the Framework version (if found) over others.
People will have to manually change the cache values of SDL2_LIBRARY to
override this selection or set the CMake environment
CMAKE_INCLUDE_PATH to modify the search paths.
Note that the header path has changed from SDL/SDL.h to just SDL.h
This needed to change because "proper" SDL convention is #include
"SDL.h", not <SDL/SDL.h>. This is done for portability reasons
because not all systems place things in SDL/ (see FreeBSD).
#]=======================================================================]
if(NOT SDL2_DIR)
set(SDL2_DIR "" CACHE PATH "SDL2 directory")
endif()
find_path(SDL2_INCLUDE_DIR SDL.h
HINTS
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES SDL2
# path suffixes to search inside ENV{SDL2DIR}
include/SDL2 include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VC_LIB_PATH_SUFFIX lib/x64)
else()
set(VC_LIB_PATH_SUFFIX lib/x86)
endif()
find_library(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
)
# Hide this cache variable from the user, it's an internal implementation
# detail. The documented library variable for the user is SDL2_LIBRARY
# which is derived from SDL2_LIBRARY_TEMP further below.
set_property(CACHE SDL2_LIBRARY_TEMP PROPERTY TYPE INTERNAL)
if(NOT SDL2_BUILDING_LIBRARY)
if(NOT SDL2_INCLUDE_DIR MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDLmain for compatibility even though they don't
# necessarily need it.
find_library(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
ENV SDL2DIR
${SDL2_DIR}
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
PATHS
/sw
/opt/local
/opt/csw
/opt
)
endif()
endif()
# SDL may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
if(NOT APPLE)
find_package(Threads)
endif()
# MinGW needs an additional link flag, -mwindows
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -mwindows
if(MINGW)
set(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "link flags for MinGW")
endif()
if(SDL2_LIBRARY_TEMP)
# For SDLmain
if(SDL2MAIN_LIBRARY AND NOT SDL2_BUILDING_LIBRARY)
list(FIND SDL2_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL2_MAIN_INDEX)
if(_SDL2_MAIN_INDEX EQUAL -1)
set(SDL2_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL2_LIBRARY_TEMP})
endif()
unset(_SDL2_MAIN_INDEX)
endif()
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
if(APPLE)
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
endif()
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
if(NOT APPLE)
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
endif()
# For MinGW library
if(MINGW)
set(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
endif()
# Set the final string here so the GUI reflects the final state.
set(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
endif()
if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL2_version.h")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}")
set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH})
unset(SDL2_VERSION_MAJOR_LINE)
unset(SDL2_VERSION_MINOR_LINE)
unset(SDL2_VERSION_PATCH_LINE)
unset(SDL2_VERSION_MAJOR)
unset(SDL2_VERSION_MINOR)
unset(SDL2_VERSION_PATCH)
endif()
set(SDL2_LIBRARIES ${SDL2_LIBRARY} ${SDL2MAIN_LIBRARY})
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
VERSION_VAR SDL2_VERSION_STRING)
# vim:ai:ts=4:sts=4:sw=2:expandtab:textwidth=70
+983
View File
@@ -0,0 +1,983 @@
# Updates for iOS Copyright (c) 2024, Holochip Inc.
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindVulkan
----------
.. versionadded:: 3.7
Find Vulkan, which is a low-overhead, cross-platform 3D graphics
and computing API.
Optional COMPONENTS
^^^^^^^^^^^^^^^^^^^
.. versionadded:: 3.24
This module respects several optional COMPONENTS.
There are corresponding imported targets for each of these.
``glslc``
The SPIR-V compiler.
``glslangValidator``
The ``glslangValidator`` tool.
``glslang``
The SPIR-V generator library.
``shaderc_combined``
The static library for Vulkan shader compilation.
``SPIRV-Tools``
Tools to process SPIR-V modules.
``MoltenVK``
On macOS, an additional component ``MoltenVK`` is available.
``dxc``
.. versionadded:: 3.25
The DirectX Shader Compiler.
The ``glslc`` and ``glslangValidator`` components are provided even
if not explicitly requested (for backward compatibility).
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` targets if Vulkan has been found:
``Vulkan::Vulkan``
The main Vulkan library.
``Vulkan::glslc``
.. versionadded:: 3.19
The GLSLC SPIR-V compiler, if it has been found.
``Vulkan::Headers``
.. versionadded:: 3.21
Provides just Vulkan headers include paths, if found. No library is
included in this target. This can be useful for applications that
load Vulkan library dynamically.
``Vulkan::glslangValidator``
.. versionadded:: 3.21
The glslangValidator tool, if found. It is used to compile GLSL and
HLSL shaders into SPIR-V.
``Vulkan::glslang``
.. versionadded:: 3.24
Defined if SDK has the Khronos-reference front-end shader parser and SPIR-V
generator library (glslang).
``Vulkan::shaderc_combined``
.. versionadded:: 3.24
Defined if SDK has the Google static library for Vulkan shader compilation
(shaderc_combined).
``Vulkan::SPIRV-Tools``
.. versionadded:: 3.24
Defined if SDK has the Khronos library to process SPIR-V modules
(SPIRV-Tools).
``Vulkan::MoltenVK``
.. versionadded:: 3.24
Defined if SDK has the Khronos library which implement a subset of Vulkan API
over Apple Metal graphics framework. (MoltenVK).
``Vulkan::volk``
.. versionadded:: 3.25
Defined if SDK has the Vulkan meta-loader (volk).
``Vulkan::dxc_lib``
.. versionadded:: 3.25
Defined if SDK has the DirectX shader compiler library.
``Vulkan::dxc_exe``
.. versionadded:: 3.25
Defined if SDK has the DirectX shader compiler CLI tool.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``Vulkan_FOUND``
set to true if Vulkan was found
``Vulkan_INCLUDE_DIRS``
include directories for Vulkan
``Vulkan_LIBRARIES``
link against this library to use Vulkan
``Vulkan_VERSION``
.. versionadded:: 3.23
value from ``vulkan/vulkan_core.h``
``Vulkan_glslc_FOUND``
.. versionadded:: 3.24
True, if the SDK has the glslc executable.
``Vulkan_glslangValidator_FOUND``
.. versionadded:: 3.24
True, if the SDK has the glslangValidator executable.
``Vulkan_glslang_FOUND``
.. versionadded:: 3.24
True, if the SDK has the glslang library.
``Vulkan_shaderc_combined_FOUND``
.. versionadded:: 3.24
True, if the SDK has the shaderc_combined library.
``Vulkan_SPIRV-Tools_FOUND``
.. versionadded:: 3.24
True, if the SDK has the SPIRV-Tools library.
``Vulkan_MoltenVK_FOUND``
.. versionadded:: 3.24
True, if the SDK has the MoltenVK library.
``Vulkan_volk_FOUND``
.. versionadded:: 3.25
True, if the SDK has the volk library.
``Vulkan_dxc_lib_FOUND``
.. versionadded:: 3.25
True, if the SDK has the DirectX shader compiler library.
``Vulkan_dxc_exe_FOUND``
.. versionadded:: 3.25
True, if the SDK has the DirectX shader compiler CLI tool.
The module will also defines these cache variables:
``Vulkan_INCLUDE_DIR``
the Vulkan include directory
``Vulkan_LIBRARY``
the path to the Vulkan library
``Vulkan_GLSLC_EXECUTABLE``
the path to the GLSL SPIR-V compiler
``Vulkan_GLSLANG_VALIDATOR_EXECUTABLE``
the path to the glslangValidator tool
``Vulkan_glslang_LIBRARY``
.. versionadded:: 3.24
Path to the glslang library.
``Vulkan_shaderc_combined_LIBRARY``
.. versionadded:: 3.24
Path to the shaderc_combined library.
``Vulkan_SPIRV-Tools_LIBRARY``
.. versionadded:: 3.24
Path to the SPIRV-Tools library.
``Vulkan_MoltenVK_LIBRARY``
.. versionadded:: 3.24
Path to the MoltenVK library.
``Vulkan_volk_LIBRARY``
.. versionadded:: 3.25
Path to the volk library.
``Vulkan_dxc_LIBRARY``
.. versionadded:: 3.25
Path to the DirectX shader compiler library.
``Vulkan_dxc_EXECUTABLE``
.. versionadded:: 3.25
Path to the DirectX shader compiler CLI tool.
Hints
^^^^^
.. versionadded:: 3.18
The ``VULKAN_SDK`` environment variable optionally specifies the
location of the Vulkan SDK root directory for the given
architecture. It is typically set by sourcing the toplevel
``setup-env.sh`` script of the Vulkan SDK directory into the shell
environment.
#]=======================================================================]
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
# Provide compatibility with a common invalid component request that
# was silently ignored prior to CMake 3.24.
if("FATAL_ERROR" IN_LIST Vulkan_FIND_COMPONENTS)
message(AUTHOR_WARNING
"Ignoring unknown component 'FATAL_ERROR'.\n"
"The find_package() command documents no such argument."
)
list(REMOVE_ITEM Vulkan_FIND_COMPONENTS "FATAL_ERROR")
endif()
# FindVulkan only works correctly for iOS with CMAKE_FIND_FRAMEWORK set to
# FIRST or ALWAYS. If LAST or NEVER it will find the macOS dylibs instead
# of the iOS frameworks because the macOS lib directory has to be added to
# the search path so libraries for various tools can be found.
#
# For macOS there is a MoltenVK.xcframework which contains a static library.
# To find the MoltenVK.dylib, which is needed when building bundles we need
# to LAST or NEVER. LAST appears to be default value.
#
# If frameworks are ever included in the SDK for macOS, the search mechanism
# will need revisiting.
if(APPLE)
if(IOS)
if (NOT ${CMAKE_FIND_FRAMEWORK} STREQUAL "FIRST" AND NOT ${CMAKE_FIND_FRAMEWORK} STREQUAL "ALWAYS")
message(NOTICE "Temporarily setting CMAKE_FIND_FRAMEWORK to FIRST to find Vulkan iOS frameworks.")
set(_Vulkan_saved_cmake_find_framework ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK FIRST)
endif()
else()
if (NOT ${CMAKE_FIND_FRAMEWORK} STREQUAL "LAST" AND NOT ${CMAKE_FIND_FRAMEWORK} STREQUAL "NEVER")
message(NOTICE "Temporarily setting CMAKE_FIND_FRAMEWORK to LAST to find Vulkan macOS dylibs.")
endif()
endif()
endif()
if(APPLE)
# Make robust against different ways VULKAN_SDK may be set.
get_filename_component(_Vulkan_SDK_dirname "$ENV{VULKAN_SDK}" NAME)
if(${_Vulkan_SDK_dirname} STREQUAL "macOS" OR ${_Vulkan_SDK_dirname} STREQUAL "iOS")
get_filename_component(Vulkan_SDK_Base "$ENV{VULKAN_SDK}/.." REALPATH)
else()
get_filename_component(Vulkan_SDK_Base "$ENV{VULKAN_SDK}" REALPATH)
endif()
set(_Vulkan_SDK ${Vulkan_SDK_Base}/macOS)
if(IOS)
list(APPEND CMAKE_FRAMEWORK_PATH "${Vulkan_SDK_Base}/iOS/lib")
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
endif()
else()
set(_Vulkan_SDK "$ENV{VULKAN_SDK}")
endif()
# For backward compatibility as `FindVulkan` in previous CMake versions allow to retrieve `glslc`
# and `glslangValidator` without requesting the corresponding component.
if(NOT glslc IN_LIST Vulkan_FIND_COMPONENTS)
list(APPEND Vulkan_FIND_COMPONENTS glslc)
endif()
if(NOT glslangValidator IN_LIST Vulkan_FIND_COMPONENTS)
list(APPEND Vulkan_FIND_COMPONENTS glslangValidator)
endif()
if(WIN32)
set(_Vulkan_library_name vulkan-1)
set(_Vulkan_hint_include_search_paths
${_Vulkan_SDK}/include
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_Vulkan_hint_executable_search_paths
${_Vulkan_SDK}/bin
)
set(_Vulkan_hint_library_search_paths
${_Vulkan_SDK}/lib
${_Vulkan_SDK}/bin
)
else()
set(_Vulkan_hint_executable_search_paths
${_Vulkan_SDK}/bin32
${_Vulkan_SDK}/bin
)
set(_Vulkan_hint_library_search_paths
${_Vulkan_SDK}/lib32
${_Vulkan_SDK}/bin32
${_Vulkan_SDK}/lib
${_Vulkan_SDK}/bin
)
endif()
else()
set(_Vulkan_library_name vulkan)
set(_Vulkan_hint_include_search_paths
${_Vulkan_SDK}/include
)
set(_Vulkan_hint_executable_search_paths
${_Vulkan_SDK}/bin
)
set(_Vulkan_hint_library_search_paths
${_Vulkan_SDK}/lib
)
endif()
if(APPLE AND IOS)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
list(APPEND _Vulkan_hint_library_search_paths
${Vulkan_SDK_Base}/iOS/lib
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
list(APPEND _Vulkan_hint_library_search_paths
${Vulkan_SDK_Base}/tvOS/lib
)
endif()
endif()
find_path(Vulkan_INCLUDE_DIR
NAMES vulkan/vulkan.h
HINTS
${_Vulkan_hint_include_search_paths}
)
mark_as_advanced(Vulkan_INCLUDE_DIR)
find_library(Vulkan_LIBRARY
NAMES ${_Vulkan_library_name}
HINTS
${_Vulkan_hint_library_search_paths}
)
message(STATUS "Vulkan_LIBRARY ${Vulkan_LIBRARY} search paths ${_Vulkan_hint_library_search_paths}")
mark_as_advanced(Vulkan_LIBRARY)
find_library(Vulkan_Layer_API_DUMP
NAMES VkLayer_api_dump
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_Layer_API_DUMP)
find_library(Vulkan_Layer_SHADER_OBJECT
NAMES VkLayer_khronos_shader_object
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(VkLayer_khronos_shader_object)
find_library(Vulkan_Layer_SYNC2
NAMES VkLayer_khronos_synchronization2
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_Layer_SYNC2)
find_library(Vulkan_Layer_VALIDATION
NAMES VkLayer_khronos_validation
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_Layer_VALIDATION)
if(glslc IN_LIST Vulkan_FIND_COMPONENTS)
find_program(Vulkan_GLSLC_EXECUTABLE
NAMES glslc
HINTS
${_Vulkan_hint_executable_search_paths}
)
mark_as_advanced(Vulkan_GLSLC_EXECUTABLE)
endif()
if(glslangValidator IN_LIST Vulkan_FIND_COMPONENTS)
find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE
NAMES glslangValidator
HINTS
${_Vulkan_hint_executable_search_paths}
)
mark_as_advanced(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
endif()
if(glslang IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_glslang-spirv_LIBRARY
NAMES SPIRV
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-spirv_LIBRARY)
find_library(Vulkan_glslang-spirv_DEBUG_LIBRARY
NAMES SPIRVd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-spirv_DEBUG_LIBRARY)
find_library(Vulkan_glslang-oglcompiler_LIBRARY
NAMES OGLCompiler
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-oglcompiler_LIBRARY)
find_library(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY
NAMES OGLCompilerd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY)
find_library(Vulkan_glslang-osdependent_LIBRARY
NAMES OSDependent
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-osdependent_LIBRARY)
find_library(Vulkan_glslang-osdependent_DEBUG_LIBRARY
NAMES OSDependentd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-osdependent_DEBUG_LIBRARY)
find_library(Vulkan_glslang-machineindependent_LIBRARY
NAMES MachineIndependent
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-machineindependent_LIBRARY)
find_library(Vulkan_glslang-machineindependent_DEBUG_LIBRARY
NAMES MachineIndependentd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-machineindependent_DEBUG_LIBRARY)
find_library(Vulkan_glslang-genericcodegen_LIBRARY
NAMES GenericCodeGen
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-genericcodegen_LIBRARY)
find_library(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY
NAMES GenericCodeGend
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY)
find_library(Vulkan_glslang_LIBRARY
NAMES glslang
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang_LIBRARY)
find_library(Vulkan_glslang_DEBUG_LIBRARY
NAMES glslangd
HINTS
${_Vulkan_hint_library_search_paths}
)
mark_as_advanced(Vulkan_glslang_DEBUG_LIBRARY)
endif()
if(shaderc_combined IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_shaderc_combined_LIBRARY
NAMES shaderc_combined
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_shaderc_combined_LIBRARY)
find_library(Vulkan_shaderc_combined_DEBUG_LIBRARY
NAMES shaderc_combinedd
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_shaderc_combined_DEBUG_LIBRARY)
endif()
if(SPIRV-Tools IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_SPIRV-Tools_LIBRARY
NAMES SPIRV-Tools
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_SPIRV-Tools_LIBRARY)
find_library(Vulkan_SPIRV-Tools_DEBUG_LIBRARY
NAMES SPIRV-Toolsd
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_SPIRV-Tools_DEBUG_LIBRARY)
endif()
if(MoltenVK IN_LIST Vulkan_FIND_COMPONENTS)
# CMake has a bug in 3.28 that doesn't handle xcframeworks. Do it by hand for now.
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
if(CMAKE_VERSION VERSION_LESS 3.29)
set( _Vulkan_hint_library_search_paths ${Vulkan_SDK_Base}/ios/lib/MoltenVK.xcframework/ios-arm64)
else ()
set( _Vulkan_hint_library_search_paths ${Vulkan_SDK_Base}/ios/lib/)
endif ()
endif ()
find_library(Vulkan_MoltenVK_LIBRARY
NAMES MoltenVK
NO_DEFAULT_PATH
HINTS
${_Vulkan_hint_library_search_paths}
)
message(STATUS "MoltenVK_LIBRARY ${Vulkan_MoltenVK_LIBRARY} search paths ${_Vulkan_hint_library_search_paths}")
mark_as_advanced(Vulkan_MoltenVK_LIBRARY)
find_path(Vulkan_MoltenVK_INCLUDE_DIR
NAMES MoltenVK/mvk_vulkan.h
HINTS
${_Vulkan_hint_include_search_paths}
)
mark_as_advanced(Vulkan_MoltenVK_INCLUDE_DIR)
endif()
if(volk IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_volk_LIBRARY
NAMES volk
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_Volk_LIBRARY)
endif()
if (dxc IN_LIST Vulkan_FIND_COMPONENTS)
find_library(Vulkan_dxc_LIBRARY
NAMES dxcompiler
HINTS
${_Vulkan_hint_library_search_paths})
mark_as_advanced(Vulkan_dxc_LIBRARY)
find_program(Vulkan_dxc_EXECUTABLE
NAMES dxc
HINTS
${_Vulkan_hint_executable_search_paths})
mark_as_advanced(Vulkan_dxc_EXECUTABLE)
endif()
if(DEFINED _Vulkan_saved_cmake_find_framework)
set(CMAKE_FIND_FRAMEWORK ${_Vulkan_saved_cmake_find_framework})
unset(_Vulkan_saved_cmake_find_framework)
endif()
if(Vulkan_GLSLC_EXECUTABLE)
set(Vulkan_glslc_FOUND TRUE)
else()
set(Vulkan_glslc_FOUND FALSE)
endif()
if(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
set(Vulkan_glslangValidator_FOUND TRUE)
else()
set(Vulkan_glslangValidator_FOUND FALSE)
endif()
if (Vulkan_dxc_EXECUTABLE)
set(Vulkan_dxc_exe_FOUND TRUE)
else()
set(Vulkan_dxc_exe_FOUND FALSE)
endif()
function(_Vulkan_set_library_component_found component)
cmake_parse_arguments(PARSE_ARGV 1 _ARG
"NO_WARNING"
""
"DEPENDENT_COMPONENTS")
set(all_dependent_component_found TRUE)
foreach(dependent_component IN LISTS _ARG_DEPENDENT_COMPONENTS)
if(NOT Vulkan_${dependent_component}_FOUND)
set(all_dependent_component_found FALSE)
break()
endif()
endforeach()
if(all_dependent_component_found AND (Vulkan_${component}_LIBRARY OR Vulkan_${component}_DEBUG_LIBRARY))
set(Vulkan_${component}_FOUND TRUE PARENT_SCOPE)
# For Windows Vulkan SDK, third party tools binaries are provided with different MSVC ABI:
# - Release binaries uses a runtime library
# - Debug binaries uses a debug runtime library
# This lead to incompatibilities in linking for some configuration types due to CMake-default or project-configured selected MSVC ABI.
if(WIN32 AND NOT _ARG_NO_WARNING)
if(NOT Vulkan_${component}_LIBRARY)
message(WARNING
"Library ${component} for Release configuration is missing, imported target Vulkan::${component} may not be able to link when targeting this build configuration due to incompatible MSVC ABI.")
endif()
if(NOT Vulkan_${component}_DEBUG_LIBRARY)
message(WARNING
"Library ${component} for Debug configuration is missing, imported target Vulkan::${component} may not be able to link when targeting this build configuration due to incompatible MSVC ABI. Consider re-installing the Vulkan SDK and request debug libraries to fix this warning.")
endif()
endif()
else()
set(Vulkan_${component}_FOUND FALSE PARENT_SCOPE)
endif()
endfunction()
_Vulkan_set_library_component_found(glslang-spirv NO_WARNING)
_Vulkan_set_library_component_found(glslang-oglcompiler NO_WARNING)
_Vulkan_set_library_component_found(glslang-osdependent NO_WARNING)
_Vulkan_set_library_component_found(glslang-machineindependent NO_WARNING)
_Vulkan_set_library_component_found(glslang-genericcodegen NO_WARNING)
_Vulkan_set_library_component_found(glslang
DEPENDENT_COMPONENTS
glslang-spirv
glslang-oglcompiler
glslang-osdependent
glslang-machineindependent
glslang-genericcodegen)
_Vulkan_set_library_component_found(shaderc_combined)
_Vulkan_set_library_component_found(SPIRV-Tools)
_Vulkan_set_library_component_found(volk)
_Vulkan_set_library_component_found(dxc)
if(Vulkan_MoltenVK_INCLUDE_DIR AND Vulkan_MoltenVK_LIBRARY)
set(Vulkan_MoltenVK_FOUND TRUE)
else()
set(Vulkan_MoltenVK_FOUND FALSE)
endif()
set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
# detect version e.g 1.2.189
set(Vulkan_VERSION "")
if(Vulkan_INCLUDE_DIR)
set(VULKAN_CORE_H ${Vulkan_INCLUDE_DIR}/vulkan/vulkan_core.h)
if(EXISTS ${VULKAN_CORE_H})
file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine REGEX "^#define VK_HEADER_VERSION ")
string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion "${VulkanHeaderVersionLine}")
file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ")
string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion2 "${VulkanHeaderVersionLine2}")
list(LENGTH VulkanHeaderVersion2 _len)
# versions >= 1.2.175 have an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2'
if(_len EQUAL 3)
list(REMOVE_AT VulkanHeaderVersion2 0)
endif()
list(APPEND VulkanHeaderVersion2 ${VulkanHeaderVersion})
list(JOIN VulkanHeaderVersion2 "." Vulkan_VERSION)
endif()
endif()
if(Vulkan_MoltenVK_FOUND)
set(Vulkan_MoltenVK_VERSION "")
if(Vulkan_MoltenVK_INCLUDE_DIR)
set(VK_MVK_MOLTENVK_H ${Vulkan_MoltenVK_INCLUDE_DIR}/MoltenVK/vk_mvk_moltenvk.h)
if(EXISTS ${VK_MVK_MOLTENVK_H})
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_MAJOR REGEX "^#define MVK_VERSION_MAJOR ")
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_MAJOR "${_Vulkan_MoltenVK_VERSION_MAJOR}")
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_MINOR REGEX "^#define MVK_VERSION_MINOR ")
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_MINOR "${_Vulkan_MoltenVK_VERSION_MINOR}")
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_PATCH REGEX "^#define MVK_VERSION_PATCH ")
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_PATCH "${_Vulkan_MoltenVK_VERSION_PATCH}")
set(Vulkan_MoltenVK_VERSION "${_Vulkan_MoltenVK_VERSION_MAJOR}.${_Vulkan_MoltenVK_VERSION_MINOR}.${_Vulkan_MoltenVK_VERSION_PATCH}")
unset(_Vulkan_MoltenVK_VERSION_MAJOR)
unset(_Vulkan_MoltenVK_VERSION_MINOR)
unset(_Vulkan_MoltenVK_VERSION_PATCH)
endif()
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vulkan
REQUIRED_VARS
Vulkan_LIBRARY
Vulkan_INCLUDE_DIR
VERSION_VAR
Vulkan_VERSION
HANDLE_COMPONENTS
)
if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan)
add_library(Vulkan::Vulkan UNKNOWN IMPORTED)
get_filename_component(_Vulkan_lib_extension ${Vulkan_LIBRARIES} LAST_EXT)
if(_Vulkan_lib_extension STREQUAL ".framework" AND CMAKE_VERSION VERSION_LESS 3.28)
set_target_properties(Vulkan::Vulkan PROPERTIES
# Prior to 3.28 must reference library just inside the framework.
IMPORTED_LOCATION "${Vulkan_LIBRARIES}/vulkan")
else()
set_target_properties(Vulkan::Vulkan PROPERTIES
IMPORTED_LOCATION "${Vulkan_LIBRARIES}")
endif()
set_target_properties(Vulkan::Vulkan PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
unset(_Vulkan_lib_extension)
endif()
if(Vulkan_FOUND AND NOT TARGET Vulkan::Headers)
add_library(Vulkan::Headers INTERFACE IMPORTED)
set_target_properties(Vulkan::Headers PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
endif()
if(Vulkan_FOUND AND Vulkan_GLSLC_EXECUTABLE AND NOT TARGET Vulkan::glslc)
add_executable(Vulkan::glslc IMPORTED)
set_property(TARGET Vulkan::glslc PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLC_EXECUTABLE}")
endif()
if(Vulkan_FOUND AND Vulkan_GLSLANG_VALIDATOR_EXECUTABLE AND NOT TARGET Vulkan::glslangValidator)
add_executable(Vulkan::glslangValidator IMPORTED)
set_property(TARGET Vulkan::glslangValidator PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE}")
endif()
if(Vulkan_FOUND)
if((Vulkan_glslang-spirv_LIBRARY OR Vulkan_glslang-spirv_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-spirv)
add_library(Vulkan::glslang-spirv STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-spirv
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-spirv_LIBRARY)
set_property(TARGET Vulkan::glslang-spirv APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-spirv
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-spirv_LIBRARY}")
endif()
if(Vulkan_glslang-spirv_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-spirv APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-spirv
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-spirv_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang-oglcompiler_LIBRARY OR Vulkan_glslang-oglcompiler_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-oglcompiler)
add_library(Vulkan::glslang-oglcompiler STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-oglcompiler
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-oglcompiler_LIBRARY)
set_property(TARGET Vulkan::glslang-oglcompiler APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-oglcompiler
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-oglcompiler_LIBRARY}")
endif()
if(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-oglcompiler APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-oglcompiler
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-oglcompiler_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang-osdependent_LIBRARY OR Vulkan_glslang-osdependent_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-osdependent)
add_library(Vulkan::glslang-osdependent STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-osdependent
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-osdependent_LIBRARY)
set_property(TARGET Vulkan::glslang-osdependent APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-osdependent
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-osdependent_LIBRARY}")
endif()
if(Vulkan_glslang-osdependent_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-osdependent APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-osdependent
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-osdependent_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang-machineindependent_LIBRARY OR Vulkan_glslang-machineindependent_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-machineindependent)
add_library(Vulkan::glslang-machineindependent STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-machineindependent
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-machineindependent_LIBRARY)
set_property(TARGET Vulkan::glslang-machineindependent APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-machineindependent
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-machineindependent_LIBRARY}")
endif()
if(Vulkan_glslang-machineindependent_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-machineindependent APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-machineindependent
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-machineindependent_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang-genericcodegen_LIBRARY OR Vulkan_glslang-genericcodegen_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-genericcodegen)
add_library(Vulkan::glslang-genericcodegen STATIC IMPORTED)
set_property(TARGET Vulkan::glslang-genericcodegen
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang-genericcodegen_LIBRARY)
set_property(TARGET Vulkan::glslang-genericcodegen APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang-genericcodegen
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-genericcodegen_LIBRARY}")
endif()
if(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang-genericcodegen APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang-genericcodegen
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-genericcodegen_DEBUG_LIBRARY}")
endif()
endif()
if((Vulkan_glslang_LIBRARY OR Vulkan_glslang_DEBUG_LIBRARY)
AND TARGET Vulkan::glslang-spirv
AND TARGET Vulkan::glslang-oglcompiler
AND TARGET Vulkan::glslang-osdependent
AND TARGET Vulkan::glslang-machineindependent
AND TARGET Vulkan::glslang-genericcodegen
AND NOT TARGET Vulkan::glslang)
add_library(Vulkan::glslang STATIC IMPORTED)
set_property(TARGET Vulkan::glslang
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_glslang_LIBRARY)
set_property(TARGET Vulkan::glslang APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::glslang
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang_LIBRARY}")
endif()
if(Vulkan_glslang_DEBUG_LIBRARY)
set_property(TARGET Vulkan::glslang APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::glslang
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang_DEBUG_LIBRARY}")
endif()
target_link_libraries(Vulkan::glslang
INTERFACE
Vulkan::glslang-spirv
Vulkan::glslang-oglcompiler
Vulkan::glslang-osdependent
Vulkan::glslang-machineindependent
Vulkan::glslang-genericcodegen
)
endif()
if((Vulkan_shaderc_combined_LIBRARY OR Vulkan_shaderc_combined_DEBUG_LIBRARY) AND NOT TARGET Vulkan::shaderc_combined)
add_library(Vulkan::shaderc_combined STATIC IMPORTED)
set_property(TARGET Vulkan::shaderc_combined
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_shaderc_combined_LIBRARY)
set_property(TARGET Vulkan::shaderc_combined APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::shaderc_combined
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_shaderc_combined_LIBRARY}")
endif()
if(Vulkan_shaderc_combined_DEBUG_LIBRARY)
set_property(TARGET Vulkan::shaderc_combined APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::shaderc_combined
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_shaderc_combined_DEBUG_LIBRARY}")
endif()
if(UNIX)
find_package(Threads REQUIRED)
target_link_libraries(Vulkan::shaderc_combined
INTERFACE
Threads::Threads)
endif()
endif()
if((Vulkan_SPIRV-Tools_LIBRARY OR Vulkan_SPIRV-Tools_DEBUG_LIBRARY) AND NOT TARGET Vulkan::SPIRV-Tools)
add_library(Vulkan::SPIRV-Tools STATIC IMPORTED)
set_property(TARGET Vulkan::SPIRV-Tools
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
if(Vulkan_SPIRV-Tools_LIBRARY)
set_property(TARGET Vulkan::SPIRV-Tools APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::SPIRV-Tools
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_SPIRV-Tools_LIBRARY}")
endif()
if(Vulkan_SPIRV-Tools_DEBUG_LIBRARY)
set_property(TARGET Vulkan::SPIRV-Tools APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Debug)
set_property(TARGET Vulkan::SPIRV-Tools
PROPERTY
IMPORTED_LOCATION_DEBUG "${Vulkan_SPIRV-Tools_DEBUG_LIBRARY}")
endif()
endif()
if(Vulkan_volk_LIBRARY AND NOT TARGET Vulkan::volk)
add_library(Vulkan::volk STATIC IMPORTED)
set_property(TARGET Vulkan::volk
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
set_property(TARGET Vulkan::volk APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::volk APPEND
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_volk_LIBRARY}")
if (NOT WIN32)
set_property(TARGET Vulkan::volk APPEND
PROPERTY
IMPORTED_LINK_INTERFACE_LIBRARIES dl)
endif()
endif()
if (Vulkan_dxc_LIBRARY AND NOT TARGET Vulkan::dxc_lib)
add_library(Vulkan::dxc_lib STATIC IMPORTED)
set_property(TARGET Vulkan::dxc_lib
PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
set_property(TARGET Vulkan::dxc_lib APPEND
PROPERTY
IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Vulkan::dxc_lib APPEND
PROPERTY
IMPORTED_LOCATION_RELEASE "${Vulkan_dxc_LIBRARY}")
endif()
if(Vulkan_dxc_EXECUTABLE AND NOT TARGET Vulkan::dxc_exe)
add_executable(Vulkan::dxc_exe IMPORTED)
set_property(TARGET Vulkan::dxc_exe PROPERTY IMPORTED_LOCATION "${Vulkan_dxc_EXECUTABLE}")
endif()
endif()
if(Vulkan_MoltenVK_FOUND)
if(Vulkan_MoltenVK_LIBRARY AND NOT TARGET Vulkan::MoltenVK)
add_library(Vulkan::MoltenVK SHARED IMPORTED)
set_target_properties(Vulkan::MoltenVK
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_MoltenVK_INCLUDE_DIR}"
IMPORTED_LOCATION "${Vulkan_MoltenVK_LIBRARY}"
)
endif()
endif()
unset(_Vulkan_library_name)
unset(_Vulkan_SDK)
unset(_Vulkan_SDK_dirname)
unset(_Vulkan_hint_include_search_paths)
unset(_Vulkan_hint_executable_search_paths)
unset(_Vulkan_hint_library_search_paths)
cmake_policy(POP)
+89
View File
@@ -0,0 +1,89 @@
# Copyright 2020 Andreas Atteneder
# SPDX-License-Identifier: Apache-2.0
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ASSIMP_ARCHITECTURE "64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ASSIMP_ARCHITECTURE "32")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(WIN32)
set(ASSIMP_ROOT_DIR CACHE PATH "ASSIMP root directory")
# Find path of each library
find_path(ASSIMP_INCLUDE_DIR
NAMES
assimp/anim.h
HINTS
${ASSIMP_ROOT_DIR}/include
)
if(MSVC12)
set(ASSIMP_MSVC_VERSION "vc120")
elseif(MSVC14)
set(ASSIMP_MSVC_VERSION "vc140")
endif(MSVC12)
if(MSVC12 OR MSVC14)
find_path(ASSIMP_LIBRARY_DIR
NAMES
assimp-${ASSIMP_MSVC_VERSION}-mt.lib
HINTS
${ASSIMP_ROOT_DIR}/lib${ASSIMP_ARCHITECTURE}
)
find_library(ASSIMP_LIBRARY_RELEASE assimp-${ASSIMP_MSVC_VERSION}-mt.lib PATHS ${ASSIMP_LIBRARY_DIR})
find_library(ASSIMP_LIBRARY_DEBUG assimp-${ASSIMP_MSVC_VERSION}-mtd.lib PATHS ${ASSIMP_LIBRARY_DIR})
set(ASSIMP_LIBRARY
optimized ${ASSIMP_LIBRARY_RELEASE}
debug ${ASSIMP_LIBRARY_DEBUG}
)
set(ASSIMP_LIBRARIES "ASSIMP_LIBRARY_RELEASE" "ASSIMP_LIBRARY_DEBUG")
FUNCTION(ASSIMP_COPY_BINARIES TargetDirectory)
ADD_CUSTOM_TARGET(AssimpCopyBinaries
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${TargetDirectory}/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${TargetDirectory}/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll
COMMENT "Copying Assimp binaries to '${TargetDirectory}'"
VERBATIM)
ENDFUNCTION(ASSIMP_COPY_BINARIES)
endif()
else(WIN32)
find_path(
assimp_INCLUDE_DIRS
NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h
PATHS /usr/local/include
PATHS /usr/include/
)
find_library(
assimp_LIBRARIES
NAMES assimp
PATHS /usr/local/lib/
PATHS /usr/lib64/
PATHS /usr/lib/
)
if (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
SET(assimp_FOUND TRUE)
ENDIF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
if (assimp_FOUND)
if (NOT assimp_FIND_QUIETLY)
message(STATUS "Found asset importer library: ${assimp_LIBRARIES}")
endif (NOT assimp_FIND_QUIETLY)
else (assimp_FOUND)
if (assimp_FIND_REQUIRED)
message(FATAL_ERROR "Could not find asset importer library")
endif (assimp_FIND_REQUIRED)
endif (assimp_FOUND)
endif(WIN32)
+135
View File
@@ -0,0 +1,135 @@
#[============================================================================
# Copyright 2022, Khronos Group, Inc.
# SPDX-License-Identifier: Apache-2.0
#============================================================================]
# Functions to convert unix-style paths into paths useable by cmake on windows.
#[=======================================================================[.rst:
Findsigntool
-------
Finds the signtool executable used for codesigning on Windows.
Note that signtool does not offer a way to make it print its version
so version selection and reporting is not possible.
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``signtool_FOUND``
True if the system has the signtool executable.
``signtool_EXECUTABLE``
The signtool command executable.
#]=======================================================================]
if (WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES "CYGWIN.*")
find_program(CYGPATH
NAMES cygpath
HINTS [HKEY_LOCAL_MACHINE\\Software\\Cygwin\\setup;rootdir]/bin
PATHS C:/cygwin64/bin
C:/cygwin/bin
)
endif ()
function(convert_cygwin_path _pathvar)
if (WIN32 AND CYGPATH)
execute_process(
COMMAND "${CYGPATH}" -m "${${_pathvar}}"
OUTPUT_VARIABLE ${_pathvar}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(${_pathvar} "${${_pathvar}}" PARENT_SCOPE)
endif ()
endfunction()
function(convert_windows_path _pathvar)
if (CYGPATH)
execute_process(
COMMAND "${CYGPATH}" "${${_pathvar}}"
OUTPUT_VARIABLE ${_pathvar}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(${_pathvar} "${${_pathvar}}" PARENT_SCOPE)
endif ()
endfunction()
# Make a list of Windows Kit versions with newer versions first.
#
# _root string KitsRoot for the Windows version whose kits to find.
# _versions variable name Variable in which to return the list of versions.
#
function(find_kits _winver _kit_versions)
set(${_kit_versions})
set(_kit_root "KitsRoot${_winver}")
set(regkey "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots")
set(regval ${_kit_root})
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
# Note: must be a cache operation in order to read from the registry.
get_filename_component(_kits_path "[${regkey};${regval}]"
ABSOLUTE CACHE
)
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "CYGWIN.*")
# On Cygwin, CMake's built-in registry query won't work.
# Use Cygwin utility "regtool" instead.
execute_process(COMMAND regtool get "\\${regkey}\\${regval}"
OUTPUT_VARIABLE _kits_path}
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (_kits_path)
convert_windows_path(_kits_path)
endif ()
endif()
if (_kits_path)
file(GLOB ${_kit_versions} "${_kits_path}/bin/${_winver}.*")
# Reverse list, so newer versions (higher-numbered) appear first.
list(REVERSE ${_kit_versions})
endif ()
unset(_kits_path CACHE)
set(${_kit_versions} ${${_kit_versions}} PARENT_SCOPE)
endfunction()
if (WIN32 AND NOT signtool_EXECUTABLE)
if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64")
set(arch "x64")
else()
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
# Look for latest signtool
foreach(winver 11 10)
find_kits(${winver} kit_versions)
if (kit_versions)
find_program(signtool_EXECUTABLE
NAMES signtool
PATHS ${kit_versions}
PATH_SUFFIXES ${arch}
bin/${arch}
bin
NO_DEFAULT_PATH
)
if (signtool_EXECUTABLE)
break()
endif()
endif()
endforeach()
if (signtool_EXECUTABLE)
mark_as_advanced (signtool_EXECUTABLE)
endif ()
# handle the QUIETLY and REQUIRED arguments and set *_FOUND to TRUE
# if all listed variables are found or TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (
signtool
REQUIRED_VARS
signtool_EXECUTABLE
FAIL_MESSAGE
"Could NOT find signtool. Will be unable to sign Windows binaries."
)
endif()
+33
View File
@@ -0,0 +1,33 @@
# Copyright 2020 Andreas Atteneder
# SPDX-License-Identifier: Apache-2.0
# - Find zstd
# Find the zstd compression library and includes
#
# zstd_INCLUDE_DIRS - where to find zstd.h, etc.
# zstd_LIBRARIES - List of libraries when using zstd.
# zstd_FOUND - True if zstd found.
find_path(zstd_INCLUDE_DIRS
NAMES zstd.h
HINTS ${zstd_ROOT_DIR}/include)
find_library(zstd_LIBRARIES
NAMES zstd
HINTS ${zstd_ROOT_DIR}/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(zstd DEFAULT_MSG zstd_LIBRARIES zstd_INCLUDE_DIRS)
mark_as_advanced(
zstd_LIBRARIES
zstd_INCLUDE_DIRS)
if(zstd_FOUND AND NOT (TARGET zstd::zstd))
add_library (zstd::zstd UNKNOWN IMPORTED)
set_target_properties(zstd::zstd
PROPERTIES
IMPORTED_LOCATION ${zstd_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${zstd_INCLUDE_DIRS})
endif()
@@ -0,0 +1,175 @@
# Copyright 2009-2010 Iowa State University
# SPDX-License-Identifier: BSL-1.0
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
if(NOT IS_DIRECTORY "${GIT_DIR}")
file(READ ${GIT_DIR} worktree)
string(REGEX REPLACE "gitdir: (.*)worktrees(.*)\n$" "\\1" GIT_DIR ${worktree})
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND
"${GIT_EXECUTABLE}"
diff-index --quiet HEAD --
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var} "CLEAN" PARENT_SCOPE)
else()
set(${_var} "DIRTY" PARENT_SCOPE)
endif()
endfunction()
@@ -0,0 +1,44 @@
# Copyright 2009-2010 Iowa State University
# SPDX-License-Identifier: BSL-1.0
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()
@@ -0,0 +1,79 @@
#[============================================================================
# Copyright 2022, Khronos Group, Inc.
# SPDX-License-Identifier: Apache-2.0
#============================================================================]
#[=======================================================================[.rst:
KtxDependentVariable
--------------------
Macro to provide a cache variable dependent on other options.
This macro presents the variable to the user only if a set of other
conditions are true.
.. command:: dependent_variable
.. code-block:: cmake
KTX_DEPENDENT_VARIABLE(<var> type "<help_text>" <value> <depends> <force>)
Makes ``<var>`` available to the user if the
:ref:`semicolon-separated list <CMake Language Lists>` of conditions in
``<depends>`` are all true. Otherwise, a local variable named ``<var>``
is set to ``<force>``.
When ``<var>`` is available, the given ``<help_text>`` and initial
``<value>`` are used. Otherwise, any value set by the user is preserved for
when ``<depends>`` is satisfied in the future.
Note that the ``<var>`` variable only has a value which satisfies the
``<depends>`` condition within the scope of the caller because it is a local
variable.
Example invocation:
.. code-block:: cmake
KTX_DEPENDENT_VARIABLE(USE_FOO STRING "Use Foo" "Default" "USE_BAR;NOT USE_ZOT" "")
If ``USE_BAR`` is true and ``USE_ZOT`` is false, this provides an var called
``USE_FOO`` that defaults to Default. Otherwise, it sets ``USE_FOO`` to OFF and
hides the var from the user. If the status of ``USE_BAR`` or ``USE_ZOT``
ever changes, any value for the ``USE_FOO`` var is saved so that when the
var is re-enabled it retains its old value.
An important difference to CMakeDependentOption is that this does an early
out on false when processing the list of dependencies. This is so expressions
of dependencies based on a potentially unset variable do not fail when it
is unset.
#]=======================================================================]
macro(KTX_DEPENDENT_VARIABLE var type doc default depends force)
if(${var}_ISSET MATCHES "^${var}_ISSET$")
set(${var}_AVAILABLE 1)
foreach(d ${depends})
cmake_language(EVAL CODE "
if (${d})
else()
set(${var}_AVAILABLE 0)
endif()"
)
if(NOT ${${var}_AVAILABLE})
break()
endif()
endforeach()
if(${var}_AVAILABLE)
set(${var} "${${var}}" CACHE ${type} "${doc}" FORCE)
else()
if(${var} MATCHES "^${var}$")
else()
set(${var} "${${var}}" CACHE INTERNAL "${doc}")
endif()
set(${var} ${force})
endif()
else()
set(${var} "${${var}_ISSET}")
endif()
endmacro()
@@ -0,0 +1,37 @@
[Settings]
NumFields=4
[Field 1]
Type=label
Text=By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does not add its directory to the system PATH.
Left=0
Right=-1
Top=0
Bottom=20
[Field 2]
Type=radiobutton
Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH
Left=0
Right=-1
Top=30
Bottom=40
State=1
[Field 3]
Type=radiobutton
Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users
Left=0
Right=-1
Top=40
Bottom=50
State=0
[Field 4]
Type=radiobutton
Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user
Left=0
Right=-1
Top=50
Bottom=60
State=0
+987
View File
@@ -0,0 +1,987 @@
; Copyright 2020 Andreas Atteneder
; SPDX-License-Identifier: Apache-2.0
; CPack install script designed for a nmake build
;--------------------------------
; You must define these values
!define VERSION "@CPACK_PACKAGE_VERSION@"
!define PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
!define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
;--------------------------------
;Variables
Var MUI_TEMP
;Var STARTMENU_FOLDER
Var SV_ALLUSERS
;Var START_MENU
Var DO_NOT_ADD_TO_PATH
Var ADD_TO_PATH_ALL_USERS
Var ADD_TO_PATH_CURRENT_USER
Var INSTALL_DESKTOP
Var IS_DEFAULT_INSTALLDIR
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;Default installation folder
InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
;--------------------------------
;Signing
!finalize '@CPACK_NSIS_FINALIZE_CMD@'
!uninstfinalize '@CPACK_NSIS_FINALIZE_CMD@'
;--------------------------------
;General
;Name and file
Name "@CPACK_NSIS_PACKAGE_NAME@"
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
;Set compression
SetCompressor @CPACK_NSIS_COMPRESSOR@
;Require administrator access
RequestExecutionLevel admin
@CPACK_NSIS_DEFINES@
!include Sections.nsh
;--- Component support macros: ---
; The code for the add/remove functionality is from:
; http://nsis.sourceforge.net/Add/Remove_Functionality
; It has been modified slightly and extended to provide
; inter-component dependencies.
Var AR_SecFlags
Var AR_RegFlags
@CPACK_NSIS_SECTION_SELECTED_VARS@
; Loads the "selected" flag for the section named SecName into the
; variable VarName.
!macro LoadSectionSelectedIntoVar SecName VarName
SectionGetFlags ${${SecName}} $${VarName}
IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
!macroend
; Loads the value of a variable... can we get around this?
!macro LoadVar VarName
IntOp $R0 0 + $${VarName}
!macroend
; Sets the value of a variable
!macro StoreVar VarName IntValue
IntOp $${VarName} 0 + ${IntValue}
!macroend
!macro InitSection SecName
; This macro reads component installed flag from the registry and
;changes checked state of the section on the components page.
;Input: section index constant name specified in Section command.
ClearErrors
;Reading component status from registry
ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
IfErrors "default_${SecName}"
;Status will stay default if registry value not found
;(component was never installed)
IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
; Note whether this component was installed before
!insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
IntOp $R0 $AR_RegFlags & $AR_RegFlags
;Writing modified flags
SectionSetFlags ${${SecName}} $AR_SecFlags
"default_${SecName}:"
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
!macroend
!macro FinishSection SecName
; This macro reads section flag set by user and removes the section
;if it is not selected.
;Then it writes component installed flag to registry
;Input: section index constant name specified in Section command.
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
;Checking lowest bit:
IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
IntCmp $AR_SecFlags 1 "leave_${SecName}"
;Section is not selected:
;Calling Section uninstall macro and writing zero installed flag
!insertmacro "Remove_${${SecName}}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
"Installed" 0
Goto "exit_${SecName}"
"leave_${SecName}:"
;Section is selected:
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
"Installed" 1
"exit_${SecName}:"
!macroend
!macro RemoveSection_CPack SecName
; This macro is used to call section's Remove_... macro
;from the uninstaller.
;Input: section index constant name specified in Section command.
!insertmacro "Remove_${${SecName}}"
!macroend
; Determine whether the selection of SecName changed
!macro MaybeSelectionChanged SecName
!insertmacro LoadVar ${SecName}_selected
SectionGetFlags ${${SecName}} $R1
IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
; See if the status has changed:
IntCmp $R0 $R1 "${SecName}_unchanged"
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
!insertmacro "Deselect_required_by_${SecName}"
goto "${SecName}_unchanged"
"${SecName}_was_selected:"
!insertmacro "Select_${SecName}_depends"
"${SecName}_unchanged:"
!macroend
;--- End of Add/Remove macros ---
;--------------------------------
;Interface Settings
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
;----------------------------------------
; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
;----------------------------------------
!verbose 3
!include "WinMessages.NSH"
!verbose 4
;====================================================
; get_NT_environment
; Returns: the selected environment
; Output : head of the stack
;====================================================
!macro select_NT_profile UN
Function ${UN}select_NT_profile
StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
DetailPrint "Selected environment for all users"
Push "all"
Return
environment_single:
DetailPrint "Selected environment for current user only."
Push "current"
Return
FunctionEnd
!macroend
!insertmacro select_NT_profile ""
!insertmacro select_NT_profile "un."
;----------------------------------------------------
!define NT_current_env 'HKCU "Environment"'
!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
!ifndef WriteEnvStr_RegKey
!ifdef ALL_USERS
!define WriteEnvStr_RegKey \
'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
!else
!define WriteEnvStr_RegKey 'HKCU "Environment"'
!endif
!endif
; AddToPath - Adds the given dir to the search path.
; Input - head of the stack
; Note - Win9x systems requires reboot
Function AddToPath
Exch $0
Push $1
Push $2
Push $3
# don't add if the path doesn't exist
IfFileExists "$0\*.*" "" AddToPath_done
ReadEnvStr $1 PATH
; if the path is too long for a NSIS variable NSIS will return a 0
; length string. If we find that, then warn and skip any path
; modification as it will trash the existing path.
StrLen $2 $1
IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
CheckPathLength_ShowPathWarning:
Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
Goto AddToPath_done
CheckPathLength_Done:
Push "$1;"
Push "$0;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
Push "$1;"
Push "$0\;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
GetFullPathName /SHORT $3 $0
Push "$1;"
Push "$3;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
Push "$1;"
Push "$3\;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
Call IsNT
Pop $1
StrCmp $1 1 AddToPath_NT
; Not on NT
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" a
FileSeek $1 -1 END
FileReadByte $1 $2
IntCmp $2 26 0 +2 +2 # DOS EOF
FileSeek $1 -1 END # write over EOF
FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
FileClose $1
SetRebootFlag true
Goto AddToPath_done
AddToPath_NT:
StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
ReadRegStr $1 ${NT_current_env} "PATH"
Goto DoTrim
ReadAllKey:
ReadRegStr $1 ${NT_all_env} "PATH"
DoTrim:
StrCmp $1 "" AddToPath_NTdoIt
Push $1
Call Trim
Pop $1
StrCpy $0 "$1;$0"
AddToPath_NTdoIt:
StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
WriteRegExpandStr ${NT_current_env} "PATH" $0
Goto DoSend
WriteAllKey:
WriteRegExpandStr ${NT_all_env} "PATH" $0
DoSend:
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
AddToPath_done:
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
; RemoveFromPath - Remove a given dir from the path
; Input: head of the stack
Function un.RemoveFromPath
Exch $0
Push $1
Push $2
Push $3
Push $4
Push $5
Push $6
IntFmt $6 "%c" 26 # DOS EOF
Call un.IsNT
Pop $1
StrCmp $1 1 unRemoveFromPath_NT
; Not on NT
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" r
GetTempFileName $4
FileOpen $2 $4 w
GetFullPathName /SHORT $0 $0
StrCpy $0 "SET PATH=%PATH%;$0"
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoop:
FileRead $1 $3
StrCpy $5 $3 1 -1 # read last char
StrCmp $5 $6 0 +2 # if DOS EOF
StrCpy $3 $3 -1 # remove DOS EOF so we can compare
StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
StrCmp $3 "" unRemoveFromPath_dosLoopEnd
FileWrite $2 $3
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoopRemoveLine:
SetRebootFlag true
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoopEnd:
FileClose $2
FileClose $1
StrCpy $1 $WINDIR 2
Delete "$1\autoexec.bat"
CopyFiles /SILENT $4 "$1\autoexec.bat"
Delete $4
Goto unRemoveFromPath_done
unRemoveFromPath_NT:
StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
ReadRegStr $1 ${NT_current_env} "PATH"
Goto unDoTrim
unReadAllKey:
ReadRegStr $1 ${NT_all_env} "PATH"
unDoTrim:
StrCpy $5 $1 1 -1 # copy last char
StrCmp $5 ";" +2 # if last char != ;
StrCpy $1 "$1;" # append ;
Push $1
Push "$0;"
Call un.StrStr ; Find `$0;` in $1
Pop $2 ; pos of our dir
StrCmp $2 "" unRemoveFromPath_done
; else, it is in path
# $0 - path to add
# $1 - path var
StrLen $3 "$0;"
StrLen $4 $2
StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
StrCpy $3 $5$6
StrCpy $5 $3 1 -1 # copy last char
StrCmp $5 ";" 0 +2 # if last char == ;
StrCpy $3 $3 -1 # remove last char
StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
WriteRegExpandStr ${NT_current_env} "PATH" $3
Goto unDoSend
unWriteAllKey:
WriteRegExpandStr ${NT_all_env} "PATH" $3
unDoSend:
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
unRemoveFromPath_done:
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Uninstall sutff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
###########################################
# Utility Functions #
###########################################
;====================================================
; IsNT - Returns 1 if the current system is NT, 0
; otherwise.
; Output: head of the stack
;====================================================
; IsNT
; no input
; output, top of the stack = 1 if NT or 0 if not
;
; Usage:
; Call IsNT
; Pop $R0
; ($R0 at this point is 1 or 0)
!macro IsNT un
Function ${un}IsNT
Push $0
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 IsNT_yes
; we are not NT.
Pop $0
Push 0
Return
IsNT_yes:
; NT!!!
Pop $0
Push 1
FunctionEnd
!macroend
!insertmacro IsNT ""
!insertmacro IsNT "un."
; StrStr
; input, top of stack = string to search for
; top of stack-1 = string to search in
; output, top of stack (replaces with the portion of the string remaining)
; modifies no other variables.
;
; Usage:
; Push "this is a long ass string"
; Push "ass"
; Call StrStr
; Pop $R0
; ($R0 at this point is "ass string")
!macro StrStr un
Function ${un}StrStr
Exch $R1 ; st=haystack,old$R1, $R1=needle
Exch ; st=old$R1,haystack
Exch $R2 ; st=old$R1,old$R2, $R2=haystack
Push $R3
Push $R4
Push $R5
StrLen $R3 $R1
StrCpy $R4 0
; $R1=needle
; $R2=haystack
; $R3=len(needle)
; $R4=cnt
; $R5=tmp
loop:
StrCpy $R5 $R2 $R3 $R4
StrCmp $R5 $R1 done
StrCmp $R5 "" done
IntOp $R4 $R4 + 1
Goto loop
done:
StrCpy $R1 $R2 "" $R4
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Exch $R1
FunctionEnd
!macroend
!insertmacro StrStr ""
!insertmacro StrStr "un."
Function Trim ; Added by Pelaca
Exch $R1
Push $R2
Loop:
StrCpy $R2 "$R1" 1 -1
StrCmp "$R2" " " RTrim
StrCmp "$R2" "$\n" RTrim
StrCmp "$R2" "$\r" RTrim
StrCmp "$R2" ";" RTrim
GoTo Done
RTrim:
StrCpy $R1 "$R1" -1
Goto Loop
Done:
Pop $R2
Exch $R1
FunctionEnd
Function ConditionalAddToRegisty
Pop $0
Pop $1
StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
"$1" "$0"
;MessageBox MB_OK "Set Registry: '$1' to '$0'"
DetailPrint "Set install registry entry: '$1' to '$0'"
ConditionalAddToRegisty_EmptyString:
FunctionEnd
;--------------------------------
!ifdef CPACK_USES_DOWNLOAD
Function DownloadFile
IfFileExists $INSTDIR\* +2
CreateDirectory $INSTDIR
Pop $0
; Skip if already downloaded
IfFileExists $INSTDIR\$0 0 +2
Return
StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
try_again:
NSISdl::download "$1/$0" "$INSTDIR\$0"
Pop $1
StrCmp $1 "success" success
StrCmp $1 "Cancelled" cancel
MessageBox MB_OK "Download failed: $1"
cancel:
Return
success:
FunctionEnd
!endif
;--------------------------------
; Define some macro setting for the gui
@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
@CPACK_NSIS_INSTALLER_ICON_CODE@
@CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE@
@CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE@
@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
;--------------------------------
;Pages
@CPACK_NSIS_INSTALLER_WELCOME_TITLE_CODE@
@CPACK_NSIS_INSTALLER_WELCOME_TITLE_3LINES_CODE@
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
Page custom InstallOptionsPage
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
;!define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
;!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
;!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
;!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
@CPACK_NSIS_PAGE_COMPONENTS@
!insertmacro MUI_PAGE_INSTFILES
@CPACK_NSIS_INSTALLER_FINISH_TITLE_CODE@
@CPACK_NSIS_INSTALLER_FINISH_TITLE_3LINES_CODE@
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Basque"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Bosnian"
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Bulgarian"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Hebrew"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Icelandic"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Irish"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Kurdish"
!insertmacro MUI_LANGUAGE "Latvian"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Luxembourgish"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Welsh"
;--------------------------------
;Reserve Files
;These files should be inserted before other files in the data block
;Keep these lines before any File command
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
ReserveFile "NSIS.InstallOptions.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; for UserInfo::GetName and UserInfo::GetAccountType
ReserveFile /plugin 'UserInfo.dll'
;--------------------------------
; Installation types
@CPACK_NSIS_INSTALLATION_TYPES@
;--------------------------------
; Component sections
@CPACK_NSIS_COMPONENT_SECTIONS@
;--------------------------------
;Installer Sections
Section "-Core installation"
;Use the entire tree produced by the INSTALL target. Keep the
;list of directories here in sync with the RMDir commands below.
SetOutPath "$INSTDIR"
@CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
@CPACK_NSIS_FULL_INSTALL@
;Store installation folder
WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
Push "DisplayName"
Push "@CPACK_NSIS_DISPLAY_NAME@"
Call ConditionalAddToRegisty
Push "DisplayVersion"
Push "@CPACK_PACKAGE_VERSION@"
Call ConditionalAddToRegisty
Push "Publisher"
Push "@CPACK_PACKAGE_VENDOR@"
Call ConditionalAddToRegisty
Push "UninstallString"
Push "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
Call ConditionalAddToRegisty
Push "NoRepair"
Push "1"
Call ConditionalAddToRegisty
!ifdef CPACK_NSIS_ADD_REMOVE
;Create add/remove functionality
Push "ModifyPath"
Push "$INSTDIR\AddRemove.exe"
Call ConditionalAddToRegisty
!else
Push "NoModify"
Push "1"
Call ConditionalAddToRegisty
!endif
; Optional registration
Push "DisplayIcon"
Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
Call ConditionalAddToRegisty
Push "HelpLink"
Push "@CPACK_NSIS_HELP_LINK@"
Call ConditionalAddToRegisty
Push "URLInfoAbout"
Push "@CPACK_NSIS_URL_INFO_ABOUT@"
Call ConditionalAddToRegisty
Push "Contact"
Push "@CPACK_NSIS_CONTACT@"
Call ConditionalAddToRegisty
;!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
;!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
;CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
;@CPACK_NSIS_CREATE_ICONS@
;@CPACK_NSIS_CREATE_ICONS_EXTRA@
;CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
;Read a value from an InstallOptions INI file
!insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
; Write special uninstall registry entries
;Push "StartMenu"
;Push "$STARTMENU_FOLDER"
;Call ConditionalAddToRegisty
;Push "DoNotAddToPath"
;Push "$DO_NOT_ADD_TO_PATH"
;Call ConditionalAddToRegisty
;Push "AddToPathAllUsers"
;Push "$ADD_TO_PATH_ALL_USERS"
;Call ConditionalAddToRegisty
;Push "AddToPathCurrentUser"
;Push "$ADD_TO_PATH_CURRENT_USER"
;Call ConditionalAddToRegisty
;Push "InstallToDesktop"
;Push "$INSTALL_DESKTOP"
;Call ConditionalAddToRegisty
!insertmacro MUI_STARTMENU_WRITE_END
@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
SectionEnd
Section "-Add to path"
Push $INSTDIR\bin
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
Call AddToPath
doNotAddToPath:
SectionEnd
;--------------------------------
; Create custom pages
Function InstallOptionsPage
!insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
FunctionEnd
;--------------------------------
; determine admin versus local install
Function un.onInit
ClearErrors
UserInfo::GetName
IfErrors noLM
Pop $0
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" 0 +3
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Admin group'
Goto done
StrCmp $1 "Power" 0 +3
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Power Users group'
Goto done
noLM:
;Get installation folder from registry if available
done:
FunctionEnd
;--- Add/Remove callback functions: ---
!macro SectionList MacroName
;This macro used to perform operation on multiple sections.
;List all of your components in following manner here.
@CPACK_NSIS_COMPONENT_SECTION_LIST@
!macroend
Section -FinishComponents
;Removes unselected components and writes component status to registry
!insertmacro SectionList "FinishSection"
!ifdef CPACK_NSIS_ADD_REMOVE
; Get the name of the installer executable
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
StrCpy $R3 $R0
; Strip off the last 13 characters, to see if we have AddRemove.exe
StrLen $R1 $R0
IntOp $R1 $R0 - 13
StrCpy $R2 $R0 13 $R1
StrCmp $R2 "AddRemove.exe" addremove_installed
; We're not running AddRemove.exe, so install it
CopyFiles $R3 $INSTDIR\AddRemove.exe
addremove_installed:
!endif
SectionEnd
;--- End of Add/Remove callback functions ---
;--------------------------------
; Component dependencies
Function .onSelChange
!insertmacro SectionList MaybeSelectionChanged
FunctionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ReadRegStr $START_MENU SHCTX \
; "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu"
;MessageBox MB_OK "Start menu is in: $START_MENU"
ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser"
;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
;ReadRegStr $INSTALL_DESKTOP SHCTX \
; "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
;Remove files we installed.
;Keep the list of directories here in sync with the File commands above.
@CPACK_NSIS_DELETE_FILES@
@CPACK_NSIS_DELETE_DIRECTORIES@
!ifdef CPACK_NSIS_ADD_REMOVE
;Remove the add/remove program
Delete "$INSTDIR\AddRemove.exe"
!endif
;Remove the uninstaller itself.
Delete "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
;Remove the installation directory if it is empty.
RMDir "$INSTDIR"
; Remove the registry entries.
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
; Removes all optional components
!insertmacro SectionList "RemoveSection_CPack"
;!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
@CPACK_NSIS_DELETE_ICONS@
@CPACK_NSIS_DELETE_ICONS_EXTRA@
;Delete empty start menu parent directories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
; startMenuDeleteLoop:
; ClearErrors
; RMDir $MUI_TEMP
; GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
;
; IfErrors startMenuDeleteLoopDone
;
; StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
; startMenuDeleteLoopDone:
; If the user changed the shortcut, then untinstall may not work. This should
; try to fix it.
;StrCpy $MUI_TEMP "$START_MENU"
;Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
@CPACK_NSIS_DELETE_ICONS_EXTRA@
;Delete empty start menu parent directories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
; secondStartMenuDeleteLoop:
; ClearErrors
; RMDir $MUI_TEMP
; GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
;
; IfErrors secondStartMenuDeleteLoopDone
;
; StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
; secondStartMenuDeleteLoopDone:
DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
Push $INSTDIR\bin
StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
Call un.RemoveFromPath
doNotRemoveFromPath:
SectionEnd
;--------------------------------
; determine admin versus local install
; Is install for "AllUsers" or "JustMe"?
; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
; This function is used for the very first "custom page" of the installer.
; This custom page does not show up visibly, but it executes prior to the
; first visible page and sets up $INSTDIR properly...
; Choose different default installation folder based on SV_ALLUSERS...
; "Program Files" for AllUsers, "My Documents" for JustMe...
Function .onInit
StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString"
StrCmp $0 "" inst
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \
"@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \
/SD IDYES IDYES uninst IDNO inst
Abort
;Run the uninstaller
uninst:
ClearErrors
StrLen $2 "\Uninstall.exe"
StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path
ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file
IfErrors uninst_failed inst
uninst_failed:
MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
Abort
inst:
; Reads components status for registry
!insertmacro SectionList "InitSection"
; check to see if /D has been used to change
; the install directory by comparing it to the
; install directory that is expected to be the
; default
StrCpy $IS_DEFAULT_INSTALLDIR 0
StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
StrCpy $IS_DEFAULT_INSTALLDIR 1
StrCpy $SV_ALLUSERS "JustMe"
; if default install dir then change the default
; if it is installed for JustMe
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
ClearErrors
UserInfo::GetName
IfErrors noLM
Pop $0
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" 0 +4
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Admin group'
StrCpy $SV_ALLUSERS "AllUsers"
Goto done
StrCmp $1 "Power" 0 +4
SetShellVarContext all
;MessageBox MB_OK 'User "$0" is in the Power Users group'
StrCpy $SV_ALLUSERS "AllUsers"
Goto done
noLM:
StrCpy $SV_ALLUSERS "AllUsers"
;Get installation folder from registry if available
done:
StrCmp $SV_ALLUSERS "AllUsers" 0 +3
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
noOptionsPage:
FunctionEnd