diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
| commit | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (patch) | |
| tree | fbfdfe6bcb0a8a114be2480dac53d88c977e4869 /CMake | |
| parent | 4320ce238aae1fe87fc9f379cdd816e9317885fa (diff) | |
New upstream version 2.7.0~rc8+repackupstream/2.7.0_rc8+repack
Diffstat (limited to 'CMake')
| -rwxr-xr-x | CMake/Modules/FindFFTW3.cmake | 206 | ||||
| -rwxr-xr-x | CMake/Modules/FindGitSubversion.cmake | 150 | ||||
| -rwxr-xr-x | CMake/Modules/FindHamlib.cmake | 128 | ||||
| -rwxr-xr-x | CMake/Modules/FindPortaudio.cmake | 100 | ||||
| -rwxr-xr-x | CMake/Modules/FindUsb.cmake | 98 | ||||
| -rwxr-xr-x | CMake/Modules/GetGitRevisionDescription.cmake | 336 | ||||
| -rwxr-xr-x | CMake/Modules/GetGitRevisionDescription.cmake.in | 82 | ||||
| -rwxr-xr-x | CMake/Modules/LibFindMacros.cmake | 538 | ||||
| -rwxr-xr-x | CMake/Modules/NSIS.template.in | 2112 | ||||
| -rwxr-xr-x | CMake/Modules/QtAxMacros.cmake | 70 | ||||
| -rwxr-xr-x | CMake/Modules/VersionInfo.h.in | 188 | ||||
| -rwxr-xr-x | CMake/Modules/VersionResource.rc.in | 146 | ||||
| -rwxr-xr-x | CMake/Modules/generate_version_info.cmake | 334 | ||||
| -rwxr-xr-x | CMake/Modules/set_build_type.cmake | 84 | ||||
| -rwxr-xr-x | CMake/cmake_uninstall.cmake.in | 44 | ||||
| -rwxr-xr-x | CMake/getsvn.cmake | 170 |
16 files changed, 2393 insertions, 2393 deletions
diff --git a/CMake/Modules/FindFFTW3.cmake b/CMake/Modules/FindFFTW3.cmake index 489257b2..999c2ffe 100755 --- a/CMake/Modules/FindFFTW3.cmake +++ b/CMake/Modules/FindFFTW3.cmake @@ -1,103 +1,103 @@ -# - Try to find FFTW3.
-# Usage: find_package(FFTW3 [COMPONENTS [single double long-double threads]])
-#
-# Variables used by this module:
-# FFTW3_ROOT_DIR - FFTW3 root directory
-# Variables defined by this module:
-# FFTW3_FOUND - system has FFTW3
-# FFTW3_INCLUDE_DIR - the FFTW3 include directory (cached)
-# FFTW3_INCLUDE_DIRS - the FFTW3 include directories
-# (identical to FFTW3_INCLUDE_DIR)
-# FFTW3[FL]?_LIBRARY - the FFTW3 library - double, single(F),
-# long-double(L) precision (cached)
-# FFTW3[FL]?_THREADS_LIBRARY - the threaded FFTW3 library - double, single(F),
-# long-double(L) precision (cached)
-# FFTW3_LIBRARIES - list of all FFTW3 libraries found
-
-# Copyright (C) 2009-2010
-# ASTRON (Netherlands Institute for Radio Astronomy)
-# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
-#
-# This file is part of the LOFAR software suite.
-# The LOFAR software suite is free software: you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as published
-# by the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# The LOFAR software suite is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
-#
-# $Id: FindFFTW3.cmake 15918 2010-06-25 11:12:42Z loose $
-
-# Compatibily with old style MinGW packages with no .dll.a files
-# needed since CMake v3.17 because of fix for #20019
-if (MINGW)
- set (CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
-endif ()
-
-# Use double precision by default.
-if (FFTW3_FIND_COMPONENTS MATCHES "^$")
- set (_components double)
-else ()
- set (_components ${FFTW3_FIND_COMPONENTS})
-endif ()
-
-# Loop over each component.
-set (_libraries)
-foreach (_comp ${_components})
- if (_comp STREQUAL "single")
- list (APPEND _libraries fftw3f)
- elseif (_comp STREQUAL "double")
- list (APPEND _libraries fftw3)
- elseif (_comp STREQUAL "long-double")
- list (APPEND _libraries fftw3l)
- elseif (_comp STREQUAL "threads")
- set (_use_threads ON)
- else (_comp STREQUAL "single")
- message (FATAL_ERROR "FindFFTW3: unknown component `${_comp}' specified. "
- "Valid components are `single', `double', `long-double', and `threads'.")
- endif (_comp STREQUAL "single")
-endforeach (_comp ${_components})
-
-# If using threads, we need to link against threaded libraries as well - except on Windows.
-if (NOT WIN32 AND _use_threads)
- set (_thread_libs)
- foreach (_lib ${_libraries})
- list (APPEND _thread_libs ${_lib}_threads)
- endforeach (_lib ${_libraries})
- set (_libraries ${_thread_libs} ${_libraries})
-endif (NOT WIN32 AND _use_threads)
-
-# Keep a list of variable names that we need to pass on to
-# find_package_handle_standard_args().
-set (_check_list)
-
-# Search for all requested libraries.
-foreach (_lib ${_libraries})
- string (TOUPPER ${_lib} _LIB)
- find_library (${_LIB}_LIBRARY NAMES ${_lib} ${_lib}-3
- HINTS ${FFTW3_ROOT_DIR} PATH_SUFFIXES lib)
- mark_as_advanced (${_LIB}_LIBRARY)
- list (APPEND FFTW3_LIBRARIES ${${_LIB}_LIBRARY})
- list (APPEND _check_list ${_LIB}_LIBRARY)
-endforeach (_lib ${_libraries})
-
-# Search for the header file.
-find_path (FFTW3_INCLUDE_DIR fftw3.h
- HINTS ${FFTW3_ROOT_DIR} PATH_SUFFIXES include)
-mark_as_advanced (FFTW3_INCLUDE_DIR)
-list(APPEND _check_list FFTW3_INCLUDE_DIR)
-
-# Handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
-# all listed variables are TRUE
-include (FindPackageHandleStandardArgs)
-find_package_handle_standard_args (FFTW3 DEFAULT_MSG ${_check_list})
-
-if (FFTW3_FOUND)
- set (FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR})
-endif (FFTW3_FOUND)
+# - Try to find FFTW3. +# Usage: find_package(FFTW3 [COMPONENTS [single double long-double threads]]) +# +# Variables used by this module: +# FFTW3_ROOT_DIR - FFTW3 root directory +# Variables defined by this module: +# FFTW3_FOUND - system has FFTW3 +# FFTW3_INCLUDE_DIR - the FFTW3 include directory (cached) +# FFTW3_INCLUDE_DIRS - the FFTW3 include directories +# (identical to FFTW3_INCLUDE_DIR) +# FFTW3[FL]?_LIBRARY - the FFTW3 library - double, single(F), +# long-double(L) precision (cached) +# FFTW3[FL]?_THREADS_LIBRARY - the threaded FFTW3 library - double, single(F), +# long-double(L) precision (cached) +# FFTW3_LIBRARIES - list of all FFTW3 libraries found + +# Copyright (C) 2009-2010 +# ASTRON (Netherlands Institute for Radio Astronomy) +# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +# +# This file is part of the LOFAR software suite. +# The LOFAR software suite is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# The LOFAR software suite is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. +# +# $Id: FindFFTW3.cmake 15918 2010-06-25 11:12:42Z loose $ + +# Compatibily with old style MinGW packages with no .dll.a files +# needed since CMake v3.17 because of fix for #20019 +if (MINGW) + set (CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib") +endif () + +# Use double precision by default. +if (FFTW3_FIND_COMPONENTS MATCHES "^$") + set (_components double) +else () + set (_components ${FFTW3_FIND_COMPONENTS}) +endif () + +# Loop over each component. +set (_libraries) +foreach (_comp ${_components}) + if (_comp STREQUAL "single") + list (APPEND _libraries fftw3f) + elseif (_comp STREQUAL "double") + list (APPEND _libraries fftw3) + elseif (_comp STREQUAL "long-double") + list (APPEND _libraries fftw3l) + elseif (_comp STREQUAL "threads") + set (_use_threads ON) + else (_comp STREQUAL "single") + message (FATAL_ERROR "FindFFTW3: unknown component `${_comp}' specified. " + "Valid components are `single', `double', `long-double', and `threads'.") + endif (_comp STREQUAL "single") +endforeach (_comp ${_components}) + +# If using threads, we need to link against threaded libraries as well - except on Windows. +if (NOT WIN32 AND _use_threads) + set (_thread_libs) + foreach (_lib ${_libraries}) + list (APPEND _thread_libs ${_lib}_threads) + endforeach (_lib ${_libraries}) + set (_libraries ${_thread_libs} ${_libraries}) +endif (NOT WIN32 AND _use_threads) + +# Keep a list of variable names that we need to pass on to +# find_package_handle_standard_args(). +set (_check_list) + +# Search for all requested libraries. +foreach (_lib ${_libraries}) + string (TOUPPER ${_lib} _LIB) + find_library (${_LIB}_LIBRARY NAMES ${_lib} ${_lib}-3 + HINTS ${FFTW3_ROOT_DIR} PATH_SUFFIXES lib) + mark_as_advanced (${_LIB}_LIBRARY) + list (APPEND FFTW3_LIBRARIES ${${_LIB}_LIBRARY}) + list (APPEND _check_list ${_LIB}_LIBRARY) +endforeach (_lib ${_libraries}) + +# Search for the header file. +find_path (FFTW3_INCLUDE_DIR fftw3.h + HINTS ${FFTW3_ROOT_DIR} PATH_SUFFIXES include) +mark_as_advanced (FFTW3_INCLUDE_DIR) +list(APPEND _check_list FFTW3_INCLUDE_DIR) + +# Handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if +# all listed variables are TRUE +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (FFTW3 DEFAULT_MSG ${_check_list}) + +if (FFTW3_FOUND) + set (FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) +endif (FFTW3_FOUND) diff --git a/CMake/Modules/FindGitSubversion.cmake b/CMake/Modules/FindGitSubversion.cmake index a47a4981..3ee6b053 100755 --- a/CMake/Modules/FindGitSubversion.cmake +++ b/CMake/Modules/FindGitSubversion.cmake @@ -1,75 +1,75 @@ -# - Extract information from a git-svn working copy
-# The module defines the following variables:
-#
-# If the command line client executable is found two macros are defined:
-# GitSubversion_WC_INFO(<dir> <var-prefix>)
-# GitSubversion_WC_INFO extracts information of a subversion working copy at
-# a given location. This macro defines the following variables:
-# <var-prefix>_WC_URL - url of the repository (at <dir>)
-# <var-prefix>_WC_ROOT - root url of the repository
-# <var-prefix>_WC_REVISION - current revision
-# <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
-# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
-# <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
-# <var-prefix>_WC_INFO - output of command `svn info <dir>'
-# Example usage:
-# find_package(Subversion)
-# if(SUBVERSION_FOUND)
-# GitSubversion_WC_INFO(${PROJECT_SOURCE_DIR} Project)
-# message("Current revision is ${Project_WC_REVISION}")
-# endif()
-
-find_package (Git)
-
-if(GIT_FOUND)
- # the git-svn commands should be executed with the C locale, otherwise
- # the message (which are parsed) may be translated, Alex
- set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
- set(ENV{LC_ALL} C)
-
- # execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} --version
- # OUTPUT_VARIABLE Subversion_VERSION_SVN
- # OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- # restore the previous LC_ALL
- set(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
-
- # string(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*"
- # "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}")
-
- macro(GitSubversion_WC_INFO dir prefix)
- # the subversion commands should be executed with the C locale, otherwise
- # the message (which are parsed) may be translated, Alex
- set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}")
- set(ENV{LC_ALL} C)
-
- execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${dir}/.git svn info
- OUTPUT_VARIABLE ${prefix}_WC_INFO
- ERROR_VARIABLE Git_git_svn_info_error
- RESULT_VARIABLE Git_git_svn_info_result
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- if(NOT ${Git_git_svn_info_result} EQUAL 0)
- message(SEND_ERROR "Command \"${GIT_EXECUTABLE} --git-dir=${dir}/.git svn info\" failed with output:\n${Git_git_svn_info_error}")
- else()
-
- string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*"
- "\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}")
- string(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*"
- "\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}")
- string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*"
- "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}")
- string(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*"
- "\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}")
- string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
- "\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}")
- string(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*"
- "\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}")
- endif()
-
- # restore the previous LC_ALL
- set(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL})
-
- endmacro()
-
-endif()
+# - Extract information from a git-svn working copy +# The module defines the following variables: +# +# If the command line client executable is found two macros are defined: +# GitSubversion_WC_INFO(<dir> <var-prefix>) +# GitSubversion_WC_INFO extracts information of a subversion working copy at +# a given location. This macro defines the following variables: +# <var-prefix>_WC_URL - url of the repository (at <dir>) +# <var-prefix>_WC_ROOT - root url of the repository +# <var-prefix>_WC_REVISION - current revision +# <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit +# <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit +# <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit +# <var-prefix>_WC_INFO - output of command `svn info <dir>' +# Example usage: +# find_package(Subversion) +# if(SUBVERSION_FOUND) +# GitSubversion_WC_INFO(${PROJECT_SOURCE_DIR} Project) +# message("Current revision is ${Project_WC_REVISION}") +# endif() + +find_package (Git) + +if(GIT_FOUND) + # the git-svn commands should be executed with the C locale, otherwise + # the message (which are parsed) may be translated, Alex + set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") + set(ENV{LC_ALL} C) + + # execute_process(COMMAND ${Subversion_SVN_EXECUTABLE} --version + # OUTPUT_VARIABLE Subversion_VERSION_SVN + # OUTPUT_STRIP_TRAILING_WHITESPACE) + + # restore the previous LC_ALL + set(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL}) + + # string(REGEX REPLACE "^(.*\n)?svn, version ([.0-9]+).*" + # "\\2" Subversion_VERSION_SVN "${Subversion_VERSION_SVN}") + + macro(GitSubversion_WC_INFO dir prefix) + # the subversion commands should be executed with the C locale, otherwise + # the message (which are parsed) may be translated, Alex + set(_Subversion_SAVED_LC_ALL "$ENV{LC_ALL}") + set(ENV{LC_ALL} C) + + execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${dir}/.git svn info + OUTPUT_VARIABLE ${prefix}_WC_INFO + ERROR_VARIABLE Git_git_svn_info_error + RESULT_VARIABLE Git_git_svn_info_result + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(NOT ${Git_git_svn_info_result} EQUAL 0) + message(SEND_ERROR "Command \"${GIT_EXECUTABLE} --git-dir=${dir}/.git svn info\" failed with output:\n${Git_git_svn_info_error}") + else() + + string(REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" + "\\2" ${prefix}_WC_URL "${${prefix}_WC_INFO}") + string(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" + "\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}") + string(REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" + "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") + string(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" + "\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}") + string(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" + "\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}") + string(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" + "\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}") + endif() + + # restore the previous LC_ALL + set(ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL}) + + endmacro() + +endif() diff --git a/CMake/Modules/FindHamlib.cmake b/CMake/Modules/FindHamlib.cmake index 592f03ad..581b8949 100755 --- a/CMake/Modules/FindHamlib.cmake +++ b/CMake/Modules/FindHamlib.cmake @@ -1,64 +1,64 @@ -#
-# Find the hamlib library
-#
-# This will define the following variables::
-#
-# Hamlib_FOUND - True if the system has the usb library
-# Hamlib_VERSION - The verion of the usb library which was found
-#
-# and the following imported targets::
-#
-# Hamlib::Hamlib - The hamlib library
-#
-
-include (LibFindMacros)
-
-libfind_pkg_detect (Hamlib hamlib
- FIND_PATH hamlib/rig.h PATH_SUFFIXES hamlib
- FIND_LIBRARY hamlib
- )
-
-libfind_package (Hamlib Usb)
-
-libfind_process (Hamlib)
-
-if (NOT Hamlib_PKGCONF_FOUND)
- if (WIN32)
- set (Hamlib_LIBRARIES ${Hamlib_LIBRARIES};${Usb_LIBRARY};ws2_32)
- else ()
- set (Hamlib_LIBRARIES ${Hamlib_LIBRARIES};m;dl)
- endif ()
-elseif (UNIX AND NOT APPLE)
- set (Hamlib_LIBRARIES ${Hamlib_PKGCONF_STATIC_LDFLAGS})
-endif ()
-
-# fix up extra link libraries for macOS as target_link_libraries gets
-# it wrong for frameworks
-unset (_next_is_framework)
-unset (_Hamlib_EXTRA_LIBS)
-foreach (_lib IN LISTS Hamlib_LIBRARIES Hamlib_PKGCONF_LDFLAGS)
- if (_next_is_framework)
- list (APPEND _Hamlib_EXTRA_LIBS "-framework ${_lib}")
- unset (_next_is_framework)
- elseif (${_lib} STREQUAL "-framework")
- set (_next_is_framework TRUE)
- else ()
- list (APPEND _Hamlib_EXTRA_LIBS ${_lib})
- endif ()
-endforeach ()
-
-if (Hamlib_FOUND AND NOT TARGET Hamlib::Hamlib)
- add_library (Hamlib::Hamlib UNKNOWN IMPORTED)
- set_target_properties (Hamlib::Hamlib PROPERTIES
- IMPORTED_LOCATION "${Hamlib_LIBRARY}"
- INTERFACE_COMPILE_OPTIONS "${Hamlib_PKGCONF_STATIC_OTHER}"
- INTERFACE_INCLUDE_DIRECTORIES "${Hamlib_INCLUDE_DIR}"
- INTERFACE_LINK_LIBRARIES "${_Hamlib_EXTRA_LIBS}"
- )
-endif ()
-
-mark_as_advanced (
- Hamlib_INCLUDE_DIR
- Hamlib_LIBRARY
- Hamlib_LIBRARIES
- )
+# +# Find the hamlib library +# +# This will define the following variables:: +# +# Hamlib_FOUND - True if the system has the usb library +# Hamlib_VERSION - The verion of the usb library which was found +# +# and the following imported targets:: +# +# Hamlib::Hamlib - The hamlib library +# + +include (LibFindMacros) + +libfind_pkg_detect (Hamlib hamlib + FIND_PATH hamlib/rig.h PATH_SUFFIXES hamlib + FIND_LIBRARY hamlib + ) + +libfind_package (Hamlib Usb) + +libfind_process (Hamlib) + +if (NOT Hamlib_PKGCONF_FOUND) + if (WIN32) + set (Hamlib_LIBRARIES ${Hamlib_LIBRARIES};${Usb_LIBRARY};ws2_32) + else () + set (Hamlib_LIBRARIES ${Hamlib_LIBRARIES};m;dl) + endif () +elseif (UNIX AND NOT APPLE) + set (Hamlib_LIBRARIES ${Hamlib_PKGCONF_STATIC_LDFLAGS}) +endif () + +# fix up extra link libraries for macOS as target_link_libraries gets +# it wrong for frameworks +unset (_next_is_framework) +unset (_Hamlib_EXTRA_LIBS) +foreach (_lib IN LISTS Hamlib_LIBRARIES Hamlib_PKGCONF_LDFLAGS) + if (_next_is_framework) + list (APPEND _Hamlib_EXTRA_LIBS "-framework ${_lib}") + unset (_next_is_framework) + elseif (${_lib} STREQUAL "-framework") + set (_next_is_framework TRUE) + else () + list (APPEND _Hamlib_EXTRA_LIBS ${_lib}) + endif () +endforeach () + +if (Hamlib_FOUND AND NOT TARGET Hamlib::Hamlib) + add_library (Hamlib::Hamlib UNKNOWN IMPORTED) + set_target_properties (Hamlib::Hamlib PROPERTIES + IMPORTED_LOCATION "${Hamlib_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Hamlib_PKGCONF_STATIC_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Hamlib_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_Hamlib_EXTRA_LIBS}" + ) +endif () + +mark_as_advanced ( + Hamlib_INCLUDE_DIR + Hamlib_LIBRARY + Hamlib_LIBRARIES + ) diff --git a/CMake/Modules/FindPortaudio.cmake b/CMake/Modules/FindPortaudio.cmake index 22efd782..4a38cc44 100755 --- a/CMake/Modules/FindPortaudio.cmake +++ b/CMake/Modules/FindPortaudio.cmake @@ -1,50 +1,50 @@ -# - Try to find portaudio
-#
-# Once done, this will define:
-#
-# Portaudio_FOUND - system has portaudio
-# Portaudio_VERSION - The version of the portaudio library which was found
-#
-# and the following imported targets::
-#
-# Portaudio::Portaudio - The portaudio library
-#
-
-include (LibFindMacros)
-
-libfind_pkg_detect (Portaudio portaudio-2.0
- FIND_PATH portaudio.h
- FIND_LIBRARY portaudio
- )
-
-libfind_process (Portaudio)
-
-# fix up extra link libraries for macOS as target_link_libraries gets
-# it wrong for frameworks
-unset (_next_is_framework)
-unset (_Portaudio_EXTRA_LIBS)
-foreach (_lib IN LISTS Portaudio_PKGCONF_LDFLAGS)
- if (_next_is_framework)
- list (APPEND _Portaudio_EXTRA_LIBS "-framework ${_lib}")
- unset (_next_is_framework)
- elseif (${_lib} STREQUAL "-framework")
- set (_next_is_framework TRUE)
- else ()
- list (APPEND _Portaudio_EXTRA_LIBS ${_lib})
- endif ()
-endforeach ()
-
-if (Portaudio_FOUND AND NOT TARGET Portaudio::Portaudio)
- add_library (Portaudio::Portaudio UNKNOWN IMPORTED)
- set_target_properties (Portaudio::Portaudio PROPERTIES
- IMPORTED_LOCATION "${Portaudio_LIBRARY}"
- INTERFACE_COMPILE_OPTIONS "${Portaudio_PKGCONF_CFLAGS_OTHER}"
- INTERFACE_INCLUDE_DIRECTORIES "${Portaudio_INCLUDE_DIRS}"
- INTERFACE_LINK_LIBRARIES "${_Portaudio_EXTRA_LIBS}"
- )
-endif ()
-
-mark_as_advanced (
- Portaudio_INCLUDE_DIR
- Portaudio_LIBRARY
- )
+# - Try to find portaudio +# +# Once done, this will define: +# +# Portaudio_FOUND - system has portaudio +# Portaudio_VERSION - The version of the portaudio library which was found +# +# and the following imported targets:: +# +# Portaudio::Portaudio - The portaudio library +# + +include (LibFindMacros) + +libfind_pkg_detect (Portaudio portaudio-2.0 + FIND_PATH portaudio.h + FIND_LIBRARY portaudio + ) + +libfind_process (Portaudio) + +# fix up extra link libraries for macOS as target_link_libraries gets +# it wrong for frameworks +unset (_next_is_framework) +unset (_Portaudio_EXTRA_LIBS) +foreach (_lib IN LISTS Portaudio_PKGCONF_LDFLAGS) + if (_next_is_framework) + list (APPEND _Portaudio_EXTRA_LIBS "-framework ${_lib}") + unset (_next_is_framework) + elseif (${_lib} STREQUAL "-framework") + set (_next_is_framework TRUE) + else () + list (APPEND _Portaudio_EXTRA_LIBS ${_lib}) + endif () +endforeach () + +if (Portaudio_FOUND AND NOT TARGET Portaudio::Portaudio) + add_library (Portaudio::Portaudio UNKNOWN IMPORTED) + set_target_properties (Portaudio::Portaudio PROPERTIES + IMPORTED_LOCATION "${Portaudio_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Portaudio_PKGCONF_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Portaudio_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${_Portaudio_EXTRA_LIBS}" + ) +endif () + +mark_as_advanced ( + Portaudio_INCLUDE_DIR + Portaudio_LIBRARY + ) diff --git a/CMake/Modules/FindUsb.cmake b/CMake/Modules/FindUsb.cmake index d979321c..9e76f244 100755 --- a/CMake/Modules/FindUsb.cmake +++ b/CMake/Modules/FindUsb.cmake @@ -1,49 +1,49 @@ -# Findlibusb
-# ==========
-#
-# Find the usb library
-#
-# This will define the following variables::
-#
-# Usb_FOUND - True if the system has the usb library
-# Usb_VERSION - The verion of the usb library which was found
-#
-# and the following imported targets::
-#
-# Usb::Usb - The libusb library
-#
-
-include (LibFindMacros)
-
-if (WIN32)
- # Use path suffixes on MS Windows as we probably shouldn't
- # trust the PATH envvar. PATH will still be searched to find the
- # library as last resort.
- if (CMAKE_SIZEOF_VOID_P MATCHES "8")
- set (_library_options PATH_SUFFIXES MinGW64/dll MinGW64/static)
- else ()
- set (_library_options PATH_SUFFIXES MinGW32/dll MinGW32/static)
- endif ()
-endif ()
-libfind_pkg_detect (Usb usb-1.0
- FIND_PATH libusb.h PATH_SUFFIXES libusb-1.0
- FIND_LIBRARY usb-1.0 ${_library_options}
- )
-
-libfind_process (Usb)
-
-if (Usb_FOUND AND NOT TARGET Usb::Usb)
- add_library (Usb::Usb UNKNOWN IMPORTED)
- set_target_properties (Usb::Usb PROPERTIES
- IMPORTED_LOCATION "${Usb_LIBRARY}"
- INTERFACE_COMPILE_OPTIONS "${Usb_PKGCONF_CFLAGS_OTHER}"
- INTERFACE_INCLUDE_DIRECTORIES "${Usb_INCLUDE_DIRS}"
- INTERFACE_LINK_LIBRARIES "${Usb_LIBRARIES}"
- )
-endif ()
-
-mark_as_advanced (
- Usb_INCLUDE_DIR
- Usb_LIBRARY
- Usb_LIBRARIES
- )
+# Findlibusb +# ========== +# +# Find the usb library +# +# This will define the following variables:: +# +# Usb_FOUND - True if the system has the usb library +# Usb_VERSION - The verion of the usb library which was found +# +# and the following imported targets:: +# +# Usb::Usb - The libusb library +# + +include (LibFindMacros) + +if (WIN32) + # Use path suffixes on MS Windows as we probably shouldn't + # trust the PATH envvar. PATH will still be searched to find the + # library as last resort. + if (CMAKE_SIZEOF_VOID_P MATCHES "8") + set (_library_options PATH_SUFFIXES MinGW64/dll MinGW64/static) + else () + set (_library_options PATH_SUFFIXES MinGW32/dll MinGW32/static) + endif () +endif () +libfind_pkg_detect (Usb usb-1.0 + FIND_PATH libusb.h PATH_SUFFIXES libusb-1.0 + FIND_LIBRARY usb-1.0 ${_library_options} + ) + +libfind_process (Usb) + +if (Usb_FOUND AND NOT TARGET Usb::Usb) + add_library (Usb::Usb UNKNOWN IMPORTED) + set_target_properties (Usb::Usb PROPERTIES + IMPORTED_LOCATION "${Usb_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Usb_PKGCONF_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Usb_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${Usb_LIBRARIES}" + ) +endif () + +mark_as_advanced ( + Usb_INCLUDE_DIR + Usb_LIBRARY + Usb_LIBRARIES + ) diff --git a/CMake/Modules/GetGitRevisionDescription.cmake b/CMake/Modules/GetGitRevisionDescription.cmake index 42fa3ed9..7d75ff0b 100755 --- a/CMake/Modules/GetGitRevisionDescription.cmake +++ b/CMake/Modules/GetGitRevisionDescription.cmake @@ -1,168 +1,168 @@ -# - 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(<source_dir> <refspecvar> <hashvar> [<additional arguments to git describe> ...])
-#
-# Returns the refspec and sha hash of the current head revision
-#
-# git_describe(<source-dir> <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(<source-dir> <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(<source-dir> <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 _source_dir _refspecvar _hashvar)
- set(GIT_PARENT_DIR "${_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()
- 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 _source_dir _var)
- if(NOT GIT_FOUND)
- find_package(Git QUIET)
- endif()
- get_git_head_revision(${_source_dir} 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
- "${_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 _source_dir _var)
- git_describe(${_source_dir} out --exact-match ${ARGN})
- set(${_var} "${out}" PARENT_SCOPE)
-endfunction()
-
-function(git_local_changes _source_dir _var)
- if(NOT GIT_FOUND)
- find_package(Git QUIET)
- endif()
- get_git_head_revision(${_source_dir} 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
- "${_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()
+# - 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(<source_dir> <refspecvar> <hashvar> [<additional arguments to git describe> ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe(<source-dir> <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(<source-dir> <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(<source-dir> <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 _source_dir _refspecvar _hashvar) + set(GIT_PARENT_DIR "${_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() + 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 _source_dir _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(${_source_dir} 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 + "${_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 _source_dir _var) + git_describe(${_source_dir} out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_local_changes _source_dir _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(${_source_dir} 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 + "${_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() diff --git a/CMake/Modules/GetGitRevisionDescription.cmake.in b/CMake/Modules/GetGitRevisionDescription.cmake.in index 8f8d5043..6d8b708e 100755 --- a/CMake/Modules/GetGitRevisionDescription.cmake.in +++ b/CMake/Modules/GetGitRevisionDescription.cmake.in @@ -1,41 +1,41 @@ -#
-# 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()
+# +# 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() diff --git a/CMake/Modules/LibFindMacros.cmake b/CMake/Modules/LibFindMacros.cmake index 31f2e24b..e293efff 100755 --- a/CMake/Modules/LibFindMacros.cmake +++ b/CMake/Modules/LibFindMacros.cmake @@ -1,269 +1,269 @@ -# Version 2.3
-# Public Domain, originally written by Lasse Kärkkäinen <tronic>
-# Maintained at https://github.com/Tronic/cmake-modules
-# Please send your improvements as pull requests on Github.
-
-# Find another package and make it a dependency of the current package.
-# This also automatically forwards the "REQUIRED" argument.
-# Usage: libfind_package(<prefix> <another package> [extra args to find_package])
-macro (libfind_package PREFIX PKG)
- set(${PREFIX}_args ${PKG} ${ARGN})
- if (${PREFIX}_FIND_REQUIRED)
- set(${PREFIX}_args ${${PREFIX}_args} REQUIRED)
- endif()
- find_package(${${PREFIX}_args})
- set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG})
- unset(${PREFIX}_args)
-endmacro()
-
-# A simple wrapper to make pkg-config searches a bit easier.
-# Works the same as CMake's internal pkg_check_modules but is always quiet.
-macro (libfind_pkg_check_modules)
- find_package(PkgConfig QUIET)
- if (PKG_CONFIG_FOUND)
- pkg_check_modules(${ARGN} QUIET)
- endif()
-endmacro()
-
-# Avoid useless copy&pasta by doing what most simple libraries do anyway:
-# pkg-config, find headers, find library.
-# Usage: libfind_pkg_detect(<prefix> <pkg-config args> FIND_PATH <name> [other args] FIND_LIBRARY <name> [other args])
-# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2)
-function (libfind_pkg_detect PREFIX)
- # Parse arguments
- set(argname pkgargs)
- foreach (i ${ARGN})
- if ("${i}" STREQUAL "FIND_PATH")
- set(argname pathargs)
- elseif ("${i}" STREQUAL "FIND_LIBRARY")
- set(argname libraryargs)
- else()
- set(${argname} ${${argname}} ${i})
- endif()
- endforeach()
- if (NOT pkgargs)
- message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.")
- endif()
- # Find library
- libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs})
- if (pathargs)
- find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS})
- endif()
- if (libraryargs)
- find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
- endif()
- # Read pkg-config version
- if (${PREFIX}_PKGCONF_VERSION)
- set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE)
- endif()
-endfunction()
-
-# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
-# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR)
-# Fourth argument "QUIET" may be used for silently testing different define names.
-# This function does nothing if the version variable is already defined.
-function (libfind_version_header PREFIX VERSION_H DEFINE_NAME)
- # Skip processing if we already have a version or if the include dir was not found
- if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR)
- return()
- endif()
- set(quiet ${${PREFIX}_FIND_QUIETLY})
- # Process optional arguments
- foreach(arg ${ARGN})
- if (arg STREQUAL "QUIET")
- set(quiet TRUE)
- else()
- message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.")
- endif()
- endforeach()
- # Read the header and parse for version number
- set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
- if (NOT EXISTS ${filename})
- if (NOT quiet)
- message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
- endif()
- return()
- endif()
- file(READ "${filename}" header)
- string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}")
- # No regex match?
- if (match STREQUAL header)
- if (NOT quiet)
- message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"<version>\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
- endif()
- return()
- endif()
- # Export the version string
- set(${PREFIX}_VERSION "${match}" PARENT_SCOPE)
-endfunction()
-
-# Do the final processing once the paths have been detected.
-# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
-# all the variables, each of which contain one include directory.
-# Ditto for ${PREFIX}_PROCESS_LIBS and library files.
-# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
-# Also handles errors in case library detection was required, etc.
-function (libfind_process PREFIX)
- # Skip processing if already processed during this configuration run
- if (${PREFIX}_FOUND)
- return()
- endif()
-
- set(found TRUE) # Start with the assumption that the package was found
-
- # Did we find any files? Did we miss includes? These are for formatting better error messages.
- set(some_files FALSE)
- set(missing_headers FALSE)
-
- # Shorthands for some variables that we need often
- set(quiet ${${PREFIX}_FIND_QUIETLY})
- set(required ${${PREFIX}_FIND_REQUIRED})
- set(exactver ${${PREFIX}_FIND_VERSION_EXACT})
- set(findver "${${PREFIX}_FIND_VERSION}")
- set(version "${${PREFIX}_VERSION}")
-
- # Lists of config option names (all, includes, libs)
- unset(configopts)
- set(includeopts ${${PREFIX}_PROCESS_INCLUDES})
- set(libraryopts ${${PREFIX}_PROCESS_LIBS})
-
- # Process deps to add to
- foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
- if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
- # The package seems to export option lists that we can use, woohoo!
- list(APPEND includeopts ${${i}_INCLUDE_OPTS})
- list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
- else()
- # If plural forms don't exist or they equal singular forms
- if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
- (${i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
- # Singular forms can be used
- if (DEFINED ${i}_INCLUDE_DIR)
- list(APPEND includeopts ${i}_INCLUDE_DIR)
- endif()
- if (DEFINED ${i}_LIBRARY)
- list(APPEND libraryopts ${i}_LIBRARY)
- endif()
- else()
- # Oh no, we don't know the option names
- message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!")
- endif()
- endif()
- endforeach()
-
- if (includeopts)
- list(REMOVE_DUPLICATES includeopts)
- endif()
-
- if (libraryopts)
- list(REMOVE_DUPLICATES libraryopts)
- endif()
-
- string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}")
- if (NOT tmp STREQUAL "${includeopts} ${libraryopts}")
- message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).")
- endif()
-
- # Include/library names separated by spaces (notice: not CMake lists)
- unset(includes)
- unset(libs)
-
- # Process all includes and set found false if any are missing
- foreach (i ${includeopts})
- list(APPEND configopts ${i})
- if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
- list(APPEND includes "${${i}}")
- else()
- set(found FALSE)
- set(missing_headers TRUE)
- endif()
- endforeach()
-
- # Process all libraries and set found false if any are missing
- foreach (i ${libraryopts})
- list(APPEND configopts ${i})
- if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
- list(APPEND libs "${${i}}")
- else()
- set (found FALSE)
- endif()
- endforeach()
-
- # Version checks
- if (found AND findver)
- if (NOT version)
- message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.")
- elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver))
- set(found FALSE)
- set(version_unsuitable TRUE)
- endif()
- endif()
-
- # If all-OK, hide all config options, export variables, print status and exit
- if (found)
- foreach (i ${configopts})
- mark_as_advanced(${i})
- endforeach()
- if (NOT quiet)
- message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
- if (LIBFIND_DEBUG)
- message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}")
- message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}")
- message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}")
- message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
- message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
- endif()
- endif()
- set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
- set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
- set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
- set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
- set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
- return()
- endif()
-
- # Format messages for debug info and the type of error
- set(vars "Relevant CMake configuration variables:\n")
- foreach (i ${configopts})
- mark_as_advanced(CLEAR ${i})
- set(val ${${i}})
- if ("${val}" STREQUAL "${i}-NOTFOUND")
- set (val "<not found>")
- elseif (val AND NOT EXISTS ${val})
- set (val "${val} (does not exist)")
- else()
- set(some_files TRUE)
- endif()
- set(vars "${vars} ${i}=${val}\n")
- endforeach()
- set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n")
- if (version_unsuitable)
- set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but")
- if (exactver)
- set(msg "${msg} only version ${findver} is acceptable.")
- else()
- set(msg "${msg} version ${findver} is the minimum requirement.")
- endif()
- else()
- if (missing_headers)
- set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?")
- elseif (some_files)
- set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?")
- if(findver)
- set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).")
- endif()
- else()
- set(msg "We were unable to find package ${PREFIX}.")
- endif()
- endif()
-
- # Fatal error out if REQUIRED
- if (required)
- set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.")
- message(FATAL_ERROR "${msg}\n${vars}")
- endif()
- # Otherwise just print a nasty warning
- if (NOT quiet)
- message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}")
- endif()
-endfunction()
+# Version 2.3 +# Public Domain, originally written by Lasse Kärkkäinen <tronic> +# Maintained at https://github.com/Tronic/cmake-modules +# Please send your improvements as pull requests on Github. + +# Find another package and make it a dependency of the current package. +# This also automatically forwards the "REQUIRED" argument. +# Usage: libfind_package(<prefix> <another package> [extra args to find_package]) +macro (libfind_package PREFIX PKG) + set(${PREFIX}_args ${PKG} ${ARGN}) + if (${PREFIX}_FIND_REQUIRED) + set(${PREFIX}_args ${${PREFIX}_args} REQUIRED) + endif() + find_package(${${PREFIX}_args}) + set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG}) + unset(${PREFIX}_args) +endmacro() + +# A simple wrapper to make pkg-config searches a bit easier. +# Works the same as CMake's internal pkg_check_modules but is always quiet. +macro (libfind_pkg_check_modules) + find_package(PkgConfig QUIET) + if (PKG_CONFIG_FOUND) + pkg_check_modules(${ARGN} QUIET) + endif() +endmacro() + +# Avoid useless copy&pasta by doing what most simple libraries do anyway: +# pkg-config, find headers, find library. +# Usage: libfind_pkg_detect(<prefix> <pkg-config args> FIND_PATH <name> [other args] FIND_LIBRARY <name> [other args]) +# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2) +function (libfind_pkg_detect PREFIX) + # Parse arguments + set(argname pkgargs) + foreach (i ${ARGN}) + if ("${i}" STREQUAL "FIND_PATH") + set(argname pathargs) + elseif ("${i}" STREQUAL "FIND_LIBRARY") + set(argname libraryargs) + else() + set(${argname} ${${argname}} ${i}) + endif() + endforeach() + if (NOT pkgargs) + message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.") + endif() + # Find library + libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs}) + if (pathargs) + find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS}) + endif() + if (libraryargs) + find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}) + endif() + # Read pkg-config version + if (${PREFIX}_PKGCONF_VERSION) + set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE) + endif() +endfunction() + +# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION. +# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR) +# Fourth argument "QUIET" may be used for silently testing different define names. +# This function does nothing if the version variable is already defined. +function (libfind_version_header PREFIX VERSION_H DEFINE_NAME) + # Skip processing if we already have a version or if the include dir was not found + if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR) + return() + endif() + set(quiet ${${PREFIX}_FIND_QUIETLY}) + # Process optional arguments + foreach(arg ${ARGN}) + if (arg STREQUAL "QUIET") + set(quiet TRUE) + else() + message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.") + endif() + endforeach() + # Read the header and parse for version number + set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") + if (NOT EXISTS ${filename}) + if (NOT quiet) + message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") + endif() + return() + endif() + file(READ "${filename}" header) + string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}") + # No regex match? + if (match STREQUAL header) + if (NOT quiet) + message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"<version>\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}") + endif() + return() + endif() + # Export the version string + set(${PREFIX}_VERSION "${match}" PARENT_SCOPE) +endfunction() + +# Do the final processing once the paths have been detected. +# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain +# all the variables, each of which contain one include directory. +# Ditto for ${PREFIX}_PROCESS_LIBS and library files. +# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. +# Also handles errors in case library detection was required, etc. +function (libfind_process PREFIX) + # Skip processing if already processed during this configuration run + if (${PREFIX}_FOUND) + return() + endif() + + set(found TRUE) # Start with the assumption that the package was found + + # Did we find any files? Did we miss includes? These are for formatting better error messages. + set(some_files FALSE) + set(missing_headers FALSE) + + # Shorthands for some variables that we need often + set(quiet ${${PREFIX}_FIND_QUIETLY}) + set(required ${${PREFIX}_FIND_REQUIRED}) + set(exactver ${${PREFIX}_FIND_VERSION_EXACT}) + set(findver "${${PREFIX}_FIND_VERSION}") + set(version "${${PREFIX}_VERSION}") + + # Lists of config option names (all, includes, libs) + unset(configopts) + set(includeopts ${${PREFIX}_PROCESS_INCLUDES}) + set(libraryopts ${${PREFIX}_PROCESS_LIBS}) + + # Process deps to add to + foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES}) + if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS) + # The package seems to export option lists that we can use, woohoo! + list(APPEND includeopts ${${i}_INCLUDE_OPTS}) + list(APPEND libraryopts ${${i}_LIBRARY_OPTS}) + else() + # If plural forms don't exist or they equal singular forms + if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR + (${i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES)) + # Singular forms can be used + if (DEFINED ${i}_INCLUDE_DIR) + list(APPEND includeopts ${i}_INCLUDE_DIR) + endif() + if (DEFINED ${i}_LIBRARY) + list(APPEND libraryopts ${i}_LIBRARY) + endif() + else() + # Oh no, we don't know the option names + message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!") + endif() + endif() + endforeach() + + if (includeopts) + list(REMOVE_DUPLICATES includeopts) + endif() + + if (libraryopts) + list(REMOVE_DUPLICATES libraryopts) + endif() + + string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}") + if (NOT tmp STREQUAL "${includeopts} ${libraryopts}") + message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).") + endif() + + # Include/library names separated by spaces (notice: not CMake lists) + unset(includes) + unset(libs) + + # Process all includes and set found false if any are missing + foreach (i ${includeopts}) + list(APPEND configopts ${i}) + if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") + list(APPEND includes "${${i}}") + else() + set(found FALSE) + set(missing_headers TRUE) + endif() + endforeach() + + # Process all libraries and set found false if any are missing + foreach (i ${libraryopts}) + list(APPEND configopts ${i}) + if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND") + list(APPEND libs "${${i}}") + else() + set (found FALSE) + endif() + endforeach() + + # Version checks + if (found AND findver) + if (NOT version) + message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.") + elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver)) + set(found FALSE) + set(version_unsuitable TRUE) + endif() + endif() + + # If all-OK, hide all config options, export variables, print status and exit + if (found) + foreach (i ${configopts}) + mark_as_advanced(${i}) + endforeach() + if (NOT quiet) + message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") + if (LIBFIND_DEBUG) + message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}") + message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}") + message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}") + message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}") + message(STATUS " ${PREFIX}_LIBRARIES=${libs}") + endif() + endif() + set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE) + set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE) + set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE) + set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE) + set (${PREFIX}_FOUND TRUE PARENT_SCOPE) + return() + endif() + + # Format messages for debug info and the type of error + set(vars "Relevant CMake configuration variables:\n") + foreach (i ${configopts}) + mark_as_advanced(CLEAR ${i}) + set(val ${${i}}) + if ("${val}" STREQUAL "${i}-NOTFOUND") + set (val "<not found>") + elseif (val AND NOT EXISTS ${val}) + set (val "${val} (does not exist)") + else() + set(some_files TRUE) + endif() + set(vars "${vars} ${i}=${val}\n") + endforeach() + set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n") + if (version_unsuitable) + set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but") + if (exactver) + set(msg "${msg} only version ${findver} is acceptable.") + else() + set(msg "${msg} version ${findver} is the minimum requirement.") + endif() + else() + if (missing_headers) + set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?") + elseif (some_files) + set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?") + if(findver) + set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).") + endif() + else() + set(msg "We were unable to find package ${PREFIX}.") + endif() + endif() + + # Fatal error out if REQUIRED + if (required) + set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.") + message(FATAL_ERROR "${msg}\n${vars}") + endif() + # Otherwise just print a nasty warning + if (NOT quiet) + message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}") + endif() +endfunction() diff --git a/CMake/Modules/NSIS.template.in b/CMake/Modules/NSIS.template.in index d3809878..9e171e28 100755 --- a/CMake/Modules/NSIS.template.in +++ b/CMake/Modules/NSIS.template.in @@ -1,1056 +1,1056 @@ -; 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 RB_DO_NOT_ADD_TO_PATH
- Var DO_NOT_ADD_TO_PATH
- Var RB_ADD_TO_PATH_ALL_USERS
- Var ADD_TO_PATH_ALL_USERS
- Var RB_ADD_TO_PATH_CURRENT_USER
- Var ADD_TO_PATH_CURRENT_USER
- Var CB_INSTALL_DESKTOP
- Var INSTALL_DESKTOP
- Var IS_DEFAULT_INSTALLDIR
-
-;--------------------------------
-;Include Modern UI
-
- !include "MUI2.nsh"
- !include "nsDialogs.nsh"
-
-;--------------------------------
-;Include Logic Lib and add a DirExists command
-
- !include "LogicLib.nsh"
-;FileExists is already part of LogicLib, but returns true for directories as well as files
- !macro _FileExists2 _a _b _t _f
- !insertmacro _LOGICLIB_TEMP
- StrCpy $_LOGICLIB_TEMP '0'
- StrCmp `${_b}` `` +4 0 ;if path is not blank, continue to next check
- IfFileExists `${_b}` `0` +3 ;if path exists, continue to next check (IfFileExists returns true if this is a directory)
- IfFileExists `${_b}\*.*` +2 0 ;if path is not a directory, continue to confirm exists
- StrCpy $_LOGICLIB_TEMP '1' ;file exists
- ;now we have a definitive value - the file exists or it does not
- StrCmp $_LOGICLIB_TEMP '1' `${_t}` `${_f}`
- !macroend
- !undef FileExists
- !define FileExists `'' FileExists2`
- !macro _DirExists _a _b _t _f
- !insertmacro _LOGICLIB_TEMP
- StrCpy $_LOGICLIB_TEMP '0'
- StrCmp `${_b}` `` +3 0 ;if path is not blank, continue to next check
- IfFileExists `${_b}\*.*` 0 +2 ;if directory exists, continue to confirm exists
- StrCpy $_LOGICLIB_TEMP '1'
- StrCmp $_LOGICLIB_TEMP '1' `${_t}` `${_f}`
- !macroend
- !define DirExists `'' DirExists`
-
- ;Default installation folder
- InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
-
-;--------------------------------
-;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@
-@CPACK_NSIS_EXTRA_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
- !define MUI_FINISHPAGE_NOAUTOCLOSE
-
-;--------------------------------
-; path functions
-
-!verbose 3
-!include "WinMessages.NSH"
-!verbose 4
-
-;----------------------------------------
-; 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
- ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED}
- DetailPrint "Selected environment for all users"
- Push "all"
- ${Else}
- DetailPrint "Selected environment for current user only."
- Push "current"
- ${EndIf}
-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:
- ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED}
- ReadRegStr $1 ${NT_all_env} "PATH"
- ${Else}
- ReadRegStr $1 ${NT_current_env} "PATH"
- ${EndIf}
- StrCmp $1 "" AddToPath_NTdoIt
- Push $1
- Call Trim
- Pop $1
- StrCpy $0 "$1;$0"
- AddToPath_NTdoIt:
- ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED}
- WriteRegExpandStr ${NT_all_env} "PATH" $0
- ${Else}
- WriteRegExpandStr ${NT_current_env} "PATH" $0
- ${EndIf}
- 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:
- ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED}
- ReadRegStr $1 ${NT_all_env} "PATH"
- ${Else}
- ReadRegStr $1 ${NT_current_env} "PATH"
- ${EndIf}
- 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
-
- ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED}
- WriteRegExpandStr ${NT_all_env} "PATH" $3
- ${Else}
- WriteRegExpandStr ${NT_current_env} "PATH" $3
- ${EndIf}
- 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
-
-;--------------------------------
-; Installation types
-@CPACK_NSIS_INSTALLATION_TYPES@
-
-;--------------------------------
-; Component sections
-@CPACK_NSIS_COMPONENT_SECTIONS@
-
-;--------------------------------
-; Define some macro setting for the gui
-@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
-@CPACK_NSIS_INSTALLER_ICON_CODE@
-@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
-@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
-
-;--------------------------------
-;Pages
- !insertmacro MUI_PAGE_WELCOME
-
- !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
- Page custom InstallOptionsPage InstallOptionsPageLeave
- !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@
-
- @CPACK_NSIS_EXTRA_PAGES@
-
- !insertmacro MUI_PAGE_INSTFILES
- !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)
-
-;--------------------------------
-;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\Uninstall.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\Uninstall.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_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\Uninstall.exe"
-
- ; Write special uninstall registry entries
- Push "StartMenu"
- Push "$STARTMENU_FOLDER"
- Call ConditionalAddToRegisty
- WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
- "DoNotAddToPath" $DO_NOT_ADD_TO_PATH
- WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
- "AddToPathAllUsers" $ADD_TO_PATH_ALL_USERS
- WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
- "AddToPathCurrentUser" $ADD_TO_PATH_CURRENT_USER
- WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
- "InstallToDesktop" $INSTALL_DESKTOP
-
- !insertmacro MUI_STARTMENU_WRITE_END
-
-@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
-
-SectionEnd
-
-Section "-Add to path"
- Push $INSTDIR\bin
- ${If} "@CPACK_NSIS_MODIFY_PATH@" == "ON"
- ${If} $DO_NOT_ADD_TO_PATH = ${BST_UNCHECKED}
- Call AddToPath
- ${EndIf}
- ${EndIf}
-SectionEnd
-
-;--------------------------------
-; Create custom pages
-Function InstallOptionsPage
- Push $R0
- Push $0
-
- !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
-
- nsDialogs::Create 1018
- Pop $R0
- ${If} $R0 == error
- Abort
- ${EndIf}
-
- ${NSD_CreateLabel} 0u 0u 100% 20u 'By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does not add its directory to the system PATH.'
- Pop $0
-
- ${NSD_CreateRadioButton} 0u 30u 100% 10u 'Do not add @CPACK_PACKAGE_NAME@ to the system PATH'
- Pop $RB_DO_NOT_ADD_TO_PATH
- ${NSD_SetState} $RB_DO_NOT_ADD_TO_PATH $DO_NOT_ADD_TO_PATH
-
- ${NSD_CreateRadioButton} 0u 40u 100% 10u 'Add @CPACK_PACKAGE_NAME@ to the system PATH for all users'
- Pop $RB_ADD_TO_PATH_ALL_USERS
- ${NSD_SetState} $RB_ADD_TO_PATH_ALL_USERS $ADD_TO_PATH_ALL_USERS
-
- ${NSD_CreateRadioButton} 0u 50u 100% 10u 'Add @CPACK_PACKAGE_NAME@ to the system PATH for the current user'
- Pop $RB_ADD_TO_PATH_CURRENT_USER
- ${NSD_SetState} $RB_ADD_TO_PATH_CURRENT_USER $ADD_TO_PATH_CURRENT_USER
-
- ${NSD_CreateCheckBox} 0u 80u 100% 10u 'Create @CPACK_PACKAGE_NAME@ Desktop Icon'
- Pop $CB_INSTALL_DESKTOP
- ${NSD_SetState} $CB_INSTALL_DESKTOP $INSTALL_DESKTOP
-
- @CPACK_NSIS_EXTRA_INSTALL_OPTIONS@
-
- nsDialogs::Show
-
- Pop $0
- Pop $R0
-FunctionEnd
-
-Function InstallOptionsPageLeave
- ${NSD_GetState} $RB_DO_NOT_ADD_TO_PATH $DO_NOT_ADD_TO_PATH
- ${NSD_GetState} $RB_ADD_TO_PATH_ALL_USERS $ADD_TO_PATH_ALL_USERS
- ${NSD_GetState} $RB_ADD_TO_PATH_CURRENT_USER $ADD_TO_PATH_CURRENT_USER
-
- ${NSD_GetState} $CB_INSTALL_DESKTOP $INSTALL_DESKTOP
-
- @CPACK_NSIS_EXTRA_INSTALL_OPTIONS_READ@
-FunctionEnd
-
-;--------------------------------
-; determine admin versus local install
-Function un.onInit
- Push $0
- Push $1
-
- 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:
-
- Pop $1
- Pop $0
-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"
- ReadRegDWORD $DO_NOT_ADD_TO_PATH SHCTX \
- "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
- ReadRegDWORD $ADD_TO_PATH_ALL_USERS SHCTX \
- "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
- ReadRegDWORD $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"
- ReadRegDWORD $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\Uninstall.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 diretories
- 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 diretories
- 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
- ${Unless} $DO_NOT_ADD_TO_PATH = ${BST_CHECKED}
- Call un.RemoveFromPath
- ${EndUnless}
-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
- Push $0
- Push $1
- Push $2
- Push $3
-
- 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?" \
- 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 _?=$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@"
-
- IntOp $DO_NOT_ADD_TO_PATH 0 + ${BST_CHECKED} ; set to checked
- IntOp $ADD_TO_PATH_ALL_USERS 0 + ${BST_UNCHECKED} ; set to unchecked
- IntOp $ADD_TO_PATH_CURRENT_USER 0 + ${BST_UNCHECKED} ; ditto
- IntOp $INSTALL_DESKTOP 0 + ${BST_UNCHECKED} ; set to unchecked
-
- @CPACK_NSIS_EXTRA_INIT_COMMANDS@
-
- Pop $3
- Pop $2
- Pop $1
- Pop $0
-FunctionEnd
+; 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 RB_DO_NOT_ADD_TO_PATH + Var DO_NOT_ADD_TO_PATH + Var RB_ADD_TO_PATH_ALL_USERS + Var ADD_TO_PATH_ALL_USERS + Var RB_ADD_TO_PATH_CURRENT_USER + Var ADD_TO_PATH_CURRENT_USER + Var CB_INSTALL_DESKTOP + Var INSTALL_DESKTOP + Var IS_DEFAULT_INSTALLDIR + +;-------------------------------- +;Include Modern UI + + !include "MUI2.nsh" + !include "nsDialogs.nsh" + +;-------------------------------- +;Include Logic Lib and add a DirExists command + + !include "LogicLib.nsh" +;FileExists is already part of LogicLib, but returns true for directories as well as files + !macro _FileExists2 _a _b _t _f + !insertmacro _LOGICLIB_TEMP + StrCpy $_LOGICLIB_TEMP '0' + StrCmp `${_b}` `` +4 0 ;if path is not blank, continue to next check + IfFileExists `${_b}` `0` +3 ;if path exists, continue to next check (IfFileExists returns true if this is a directory) + IfFileExists `${_b}\*.*` +2 0 ;if path is not a directory, continue to confirm exists + StrCpy $_LOGICLIB_TEMP '1' ;file exists + ;now we have a definitive value - the file exists or it does not + StrCmp $_LOGICLIB_TEMP '1' `${_t}` `${_f}` + !macroend + !undef FileExists + !define FileExists `'' FileExists2` + !macro _DirExists _a _b _t _f + !insertmacro _LOGICLIB_TEMP + StrCpy $_LOGICLIB_TEMP '0' + StrCmp `${_b}` `` +3 0 ;if path is not blank, continue to next check + IfFileExists `${_b}\*.*` 0 +2 ;if directory exists, continue to confirm exists + StrCpy $_LOGICLIB_TEMP '1' + StrCmp $_LOGICLIB_TEMP '1' `${_t}` `${_f}` + !macroend + !define DirExists `'' DirExists` + + ;Default installation folder + InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + +;-------------------------------- +;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@ +@CPACK_NSIS_EXTRA_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 + !define MUI_FINISHPAGE_NOAUTOCLOSE + +;-------------------------------- +; path functions + +!verbose 3 +!include "WinMessages.NSH" +!verbose 4 + +;---------------------------------------- +; 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 + ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED} + DetailPrint "Selected environment for all users" + Push "all" + ${Else} + DetailPrint "Selected environment for current user only." + Push "current" + ${EndIf} +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: + ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED} + ReadRegStr $1 ${NT_all_env} "PATH" + ${Else} + ReadRegStr $1 ${NT_current_env} "PATH" + ${EndIf} + StrCmp $1 "" AddToPath_NTdoIt + Push $1 + Call Trim + Pop $1 + StrCpy $0 "$1;$0" + AddToPath_NTdoIt: + ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED} + WriteRegExpandStr ${NT_all_env} "PATH" $0 + ${Else} + WriteRegExpandStr ${NT_current_env} "PATH" $0 + ${EndIf} + 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: + ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED} + ReadRegStr $1 ${NT_all_env} "PATH" + ${Else} + ReadRegStr $1 ${NT_current_env} "PATH" + ${EndIf} + 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 + + ${If} $ADD_TO_PATH_ALL_USERS = ${BST_CHECKED} + WriteRegExpandStr ${NT_all_env} "PATH" $3 + ${Else} + WriteRegExpandStr ${NT_current_env} "PATH" $3 + ${EndIf} + 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 + +;-------------------------------- +; Installation types +@CPACK_NSIS_INSTALLATION_TYPES@ + +;-------------------------------- +; Component sections +@CPACK_NSIS_COMPONENT_SECTIONS@ + +;-------------------------------- +; Define some macro setting for the gui +@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ +@CPACK_NSIS_INSTALLER_ICON_CODE@ +@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ +@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ + +;-------------------------------- +;Pages + !insertmacro MUI_PAGE_WELCOME + + !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@" + Page custom InstallOptionsPage InstallOptionsPageLeave + !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@ + + @CPACK_NSIS_EXTRA_PAGES@ + + !insertmacro MUI_PAGE_INSTFILES + !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) + +;-------------------------------- +;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\Uninstall.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\Uninstall.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_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\Uninstall.exe" + + ; Write special uninstall registry entries + Push "StartMenu" + Push "$STARTMENU_FOLDER" + Call ConditionalAddToRegisty + WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ + "DoNotAddToPath" $DO_NOT_ADD_TO_PATH + WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ + "AddToPathAllUsers" $ADD_TO_PATH_ALL_USERS + WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ + "AddToPathCurrentUser" $ADD_TO_PATH_CURRENT_USER + WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ + "InstallToDesktop" $INSTALL_DESKTOP + + !insertmacro MUI_STARTMENU_WRITE_END + +@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ + +SectionEnd + +Section "-Add to path" + Push $INSTDIR\bin + ${If} "@CPACK_NSIS_MODIFY_PATH@" == "ON" + ${If} $DO_NOT_ADD_TO_PATH = ${BST_UNCHECKED} + Call AddToPath + ${EndIf} + ${EndIf} +SectionEnd + +;-------------------------------- +; Create custom pages +Function InstallOptionsPage + Push $R0 + Push $0 + + !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@" + + nsDialogs::Create 1018 + Pop $R0 + ${If} $R0 == error + Abort + ${EndIf} + + ${NSD_CreateLabel} 0u 0u 100% 20u 'By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does not add its directory to the system PATH.' + Pop $0 + + ${NSD_CreateRadioButton} 0u 30u 100% 10u 'Do not add @CPACK_PACKAGE_NAME@ to the system PATH' + Pop $RB_DO_NOT_ADD_TO_PATH + ${NSD_SetState} $RB_DO_NOT_ADD_TO_PATH $DO_NOT_ADD_TO_PATH + + ${NSD_CreateRadioButton} 0u 40u 100% 10u 'Add @CPACK_PACKAGE_NAME@ to the system PATH for all users' + Pop $RB_ADD_TO_PATH_ALL_USERS + ${NSD_SetState} $RB_ADD_TO_PATH_ALL_USERS $ADD_TO_PATH_ALL_USERS + + ${NSD_CreateRadioButton} 0u 50u 100% 10u 'Add @CPACK_PACKAGE_NAME@ to the system PATH for the current user' + Pop $RB_ADD_TO_PATH_CURRENT_USER + ${NSD_SetState} $RB_ADD_TO_PATH_CURRENT_USER $ADD_TO_PATH_CURRENT_USER + + ${NSD_CreateCheckBox} 0u 80u 100% 10u 'Create @CPACK_PACKAGE_NAME@ Desktop Icon' + Pop $CB_INSTALL_DESKTOP + ${NSD_SetState} $CB_INSTALL_DESKTOP $INSTALL_DESKTOP + + @CPACK_NSIS_EXTRA_INSTALL_OPTIONS@ + + nsDialogs::Show + + Pop $0 + Pop $R0 +FunctionEnd + +Function InstallOptionsPageLeave + ${NSD_GetState} $RB_DO_NOT_ADD_TO_PATH $DO_NOT_ADD_TO_PATH + ${NSD_GetState} $RB_ADD_TO_PATH_ALL_USERS $ADD_TO_PATH_ALL_USERS + ${NSD_GetState} $RB_ADD_TO_PATH_CURRENT_USER $ADD_TO_PATH_CURRENT_USER + + ${NSD_GetState} $CB_INSTALL_DESKTOP $INSTALL_DESKTOP + + @CPACK_NSIS_EXTRA_INSTALL_OPTIONS_READ@ +FunctionEnd + +;-------------------------------- +; determine admin versus local install +Function un.onInit + Push $0 + Push $1 + + 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: + + Pop $1 + Pop $0 +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" + ReadRegDWORD $DO_NOT_ADD_TO_PATH SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath" + ReadRegDWORD $ADD_TO_PATH_ALL_USERS SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers" + ReadRegDWORD $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" + ReadRegDWORD $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\Uninstall.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 diretories + 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 diretories + 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 + ${Unless} $DO_NOT_ADD_TO_PATH = ${BST_CHECKED} + Call un.RemoveFromPath + ${EndUnless} +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 + Push $0 + Push $1 + Push $2 + Push $3 + + 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?" \ + 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 _?=$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@" + + IntOp $DO_NOT_ADD_TO_PATH 0 + ${BST_CHECKED} ; set to checked + IntOp $ADD_TO_PATH_ALL_USERS 0 + ${BST_UNCHECKED} ; set to unchecked + IntOp $ADD_TO_PATH_CURRENT_USER 0 + ${BST_UNCHECKED} ; ditto + IntOp $INSTALL_DESKTOP 0 + ${BST_UNCHECKED} ; set to unchecked + + @CPACK_NSIS_EXTRA_INIT_COMMANDS@ + + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd diff --git a/CMake/Modules/QtAxMacros.cmake b/CMake/Modules/QtAxMacros.cmake index eabde093..ee9f88a1 100755 --- a/CMake/Modules/QtAxMacros.cmake +++ b/CMake/Modules/QtAxMacros.cmake @@ -1,36 +1,36 @@ -#
-# Macros for processing ActiveX and COM controls with ActiveQt
-#
-
-if (WIN32)
- include (CMakeParseArguments)
-
- find_program (DUMPCPP_Executable dumpcpp.exe)
-
- # wrap_ax_server (outfiles inputfile ...)
-
- function (WRAP_AX_SERVER outfiles)
- set (options)
- set (oneValueArgs)
- set (multiValueArgs OPTIONS)
-
- cmake_parse_arguments (_WRAP_AX_SERVER "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- set (ax_server_files ${_WRAP_AX_SERVER_UNPARSED_ARGUMENTS})
- set (ax_server_options ${_WRAP_AX_SERVER_OPTIONS})
-
- foreach (it ${ax_server_files})
- get_filename_component (outfile ${it} NAME_WE)
- get_filename_component (infile ${it} ABSOLUTE)
- set (outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile})
- add_custom_command (
- OUTPUT ${outfile}.h ${outfile}.cpp
- COMMAND ${DUMPCPP_Executable}
- ARGS ${ax_server_options} -o "${outfile}" "${infile}"
- MAIN_DEPENDENCY ${infile} VERBATIM)
- list (APPEND ${outfiles} ${outfile}.cpp)
- endforeach()
- set(${outfiles} ${${outfiles}} PARENT_SCOPE)
- endfunction ()
-
+# +# Macros for processing ActiveX and COM controls with ActiveQt +# + +if (WIN32) + include (CMakeParseArguments) + + find_program (DUMPCPP_Executable dumpcpp.exe) + + # wrap_ax_server (outfiles inputfile ...) + + function (WRAP_AX_SERVER outfiles) + set (options) + set (oneValueArgs) + set (multiValueArgs OPTIONS) + + cmake_parse_arguments (_WRAP_AX_SERVER "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set (ax_server_files ${_WRAP_AX_SERVER_UNPARSED_ARGUMENTS}) + set (ax_server_options ${_WRAP_AX_SERVER_OPTIONS}) + + foreach (it ${ax_server_files}) + get_filename_component (outfile ${it} NAME_WE) + get_filename_component (infile ${it} ABSOLUTE) + set (outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile}) + add_custom_command ( + OUTPUT ${outfile}.h ${outfile}.cpp + COMMAND ${DUMPCPP_Executable} + ARGS ${ax_server_options} -o "${outfile}" "${infile}" + MAIN_DEPENDENCY ${infile} VERBATIM) + list (APPEND ${outfiles} ${outfile}.cpp) + endforeach() + set(${outfiles} ${${outfiles}} PARENT_SCOPE) + endfunction () + endif (WIN32)
\ No newline at end of file diff --git a/CMake/Modules/VersionInfo.h.in b/CMake/Modules/VersionInfo.h.in index 386d470a..1fb09c76 100755 --- a/CMake/Modules/VersionInfo.h.in +++ b/CMake/Modules/VersionInfo.h.in @@ -1,94 +1,94 @@ -#pragma once
-
-#ifndef VERSION_INFO_@PRODUCT_NAME@_H__
-#define VERSION_INFO_@PRODUCT_NAME@_H__
-
-#include "scs_version.h"
-
-#ifndef PRODUCT_VERSION_MAJOR
-#define PRODUCT_VERSION_MAJOR @PRODUCT_VERSION_MAJOR@
-#endif
-
-#ifndef PRODUCT_VERSION_MINOR
-#define PRODUCT_VERSION_MINOR @PRODUCT_VERSION_MINOR@
-#endif
-
-#ifndef PRODUCT_VERSION_PATCH
-#define PRODUCT_VERSION_PATCH @PRODUCT_VERSION_PATCH@
-#endif
-
-#ifndef PRODUCT_VERSION_TWEAK
-#define PRODUCT_VERSION_TWEAK @PRODUCT_VERSION_TWEAK@
-#endif
-
-#ifndef PRODUCT_VERSION_REVISION
-#define PRODUCT_VERSION_REVISION @PRODUCT_VERSION_REVISION@
-#endif
-
-#ifndef FILE_VERSION_MAJOR
-#define FILE_VERSION_MAJOR @PRODUCT_VERSION_MAJOR@
-#endif
-
-#ifndef FILE_VERSION_MINOR
-#define FILE_VERSION_MINOR @PRODUCT_VERSION_MINOR@
-#endif
-
-#ifndef FILE_VERSION_PATCH
-#define FILE_VERSION_PATCH @PRODUCT_VERSION_PATCH@
-#endif
-
-#ifndef FILE_VERSION_TWEAK
-#define FILE_VERSION_TWEAK @PRODUCT_VERSION_TWEAK@
-#endif
-
-#ifndef TO_STRING__
-#define TO_STRING_IMPL__(x) #x
-#define TO_STRING__(x) TO_STRING_IMPL__(x)
-#endif
-
-#define PRODUCT_VERSION_MAJOR_MINOR_STR TO_STRING__ (PRODUCT_VERSION_MAJOR) "." TO_STRING__(PRODUCT_VERSION_MINOR)
-#define PRODUCT_VERSION_MAJOR_MINOR_PATCH_STR PRODUCT_VERSION_MAJOR_MINOR_STR "." TO_STRING__ (PRODUCT_VERSION_PATCH)
-#define PRODUCT_VERSION_FULL_STR PRODUCT_VERSION_MAJOR_MINOR_PATCH_STR TO_STRING__ (PRODUCT_VERSION_REVISION)
-#define PRODUCT_VERSION_RESOURCE PRODUCT_VERSION_MAJOR,PRODUCT_VERSION_MINOR,PRODUCT_VERSION_PATCH,PRODUCT_VERSION_TWEAK
-#define PRODUCT_VERSION_RESOURCE_STR PRODUCT_VERSION_FULL_STR " " SCS_VERSION_STR "\0"
-
-#define FILE_VERSION_MAJOR_MINOR_STR TO_STRING__ (FILE_VERSION_MAJOR) "." TO_STRING__ (FILE_VERSION_MINOR)
-#define FILE_VERSION_MAJOR_MINOR_PATCH_STR FILE_VERSION_MAJOR_MINOR_STR "." TO_STRING__ (FILE_VERSION_PATCH)
-#define FILE_VERSION_FULL_STR FILE_VERSION_MAJOR_MINOR_PATCH_STR TO_STRING__ (PRODUCT_VERSION_REVISION)
-#define FILE_VERSION_RESOURCE FILE_VERSION_MAJOR,FILE_VERSION_MINOR,FILE_VERSION_PATCH,FILE_VERSION_TWEAK
-#define FILE_VERSION_RESOURCE_STR FILE_VERSION_FULL_STR "\0"
-
-#ifndef PRODUCT_ICON
-#define PRODUCT_ICON "@PRODUCT_ICON@"
-#endif
-
-#ifndef PRODUCT_COMMENTS
-#define PRODUCT_COMMENTS "@PRODUCT_COMMENTS@\0"
-#endif
-
-#ifndef PRODUCT_VENDOR_NAME
-#define PRODUCT_VENDOR_NAME "@PRODUCT_VENDOR_NAME@\0"
-#endif
-
-#ifndef PRODUCT_LEGAL_COPYRIGHT
-#define PRODUCT_LEGAL_COPYRIGHT "@PRODUCT_LEGAL_COPYRIGHT@\0"
-#endif
-
-#ifndef PRODUCT_FILE_DESCRIPTION
-#define PRODUCT_FILE_DESCRIPTION "@PRODUCT_FILE_DESCRIPTION@\0"
-#endif
-
-#ifndef PRODUCT_INTERNAL_NAME
-#define PRODUCT_INTERNAL_NAME "@PRODUCT_NAME@\0"
-#endif
-
-#ifndef PRODUCT_ORIGINAL_FILENAME
-#define PRODUCT_ORIGINAL_FILENAME "@PRODUCT_ORIGINAL_FILENAME@\0"
-#endif
-
-#ifndef PRODUCT_BUNDLE
-#define PRODUCT_BUNDLE "@PRODUCT_BUNDLE@\0"
-#endif
-
-#endif
-
+#pragma once + +#ifndef VERSION_INFO_@PRODUCT_NAME@_H__ +#define VERSION_INFO_@PRODUCT_NAME@_H__ + +#include "scs_version.h" + +#ifndef PRODUCT_VERSION_MAJOR +#define PRODUCT_VERSION_MAJOR @PRODUCT_VERSION_MAJOR@ +#endif + +#ifndef PRODUCT_VERSION_MINOR +#define PRODUCT_VERSION_MINOR @PRODUCT_VERSION_MINOR@ +#endif + +#ifndef PRODUCT_VERSION_PATCH +#define PRODUCT_VERSION_PATCH @PRODUCT_VERSION_PATCH@ +#endif + +#ifndef PRODUCT_VERSION_TWEAK +#define PRODUCT_VERSION_TWEAK @PRODUCT_VERSION_TWEAK@ +#endif + +#ifndef PRODUCT_VERSION_REVISION +#define PRODUCT_VERSION_REVISION @PRODUCT_VERSION_REVISION@ +#endif + +#ifndef FILE_VERSION_MAJOR +#define FILE_VERSION_MAJOR @PRODUCT_VERSION_MAJOR@ +#endif + +#ifndef FILE_VERSION_MINOR +#define FILE_VERSION_MINOR @PRODUCT_VERSION_MINOR@ +#endif + +#ifndef FILE_VERSION_PATCH +#define FILE_VERSION_PATCH @PRODUCT_VERSION_PATCH@ +#endif + +#ifndef FILE_VERSION_TWEAK +#define FILE_VERSION_TWEAK @PRODUCT_VERSION_TWEAK@ +#endif + +#ifndef TO_STRING__ +#define TO_STRING_IMPL__(x) #x +#define TO_STRING__(x) TO_STRING_IMPL__(x) +#endif + +#define PRODUCT_VERSION_MAJOR_MINOR_STR TO_STRING__ (PRODUCT_VERSION_MAJOR) "." TO_STRING__(PRODUCT_VERSION_MINOR) +#define PRODUCT_VERSION_MAJOR_MINOR_PATCH_STR PRODUCT_VERSION_MAJOR_MINOR_STR "." TO_STRING__ (PRODUCT_VERSION_PATCH) +#define PRODUCT_VERSION_FULL_STR PRODUCT_VERSION_MAJOR_MINOR_PATCH_STR TO_STRING__ (PRODUCT_VERSION_REVISION) +#define PRODUCT_VERSION_RESOURCE PRODUCT_VERSION_MAJOR,PRODUCT_VERSION_MINOR,PRODUCT_VERSION_PATCH,PRODUCT_VERSION_TWEAK +#define PRODUCT_VERSION_RESOURCE_STR PRODUCT_VERSION_FULL_STR " " SCS_VERSION_STR "\0" + +#define FILE_VERSION_MAJOR_MINOR_STR TO_STRING__ (FILE_VERSION_MAJOR) "." TO_STRING__ (FILE_VERSION_MINOR) +#define FILE_VERSION_MAJOR_MINOR_PATCH_STR FILE_VERSION_MAJOR_MINOR_STR "." TO_STRING__ (FILE_VERSION_PATCH) +#define FILE_VERSION_FULL_STR FILE_VERSION_MAJOR_MINOR_PATCH_STR TO_STRING__ (PRODUCT_VERSION_REVISION) +#define FILE_VERSION_RESOURCE FILE_VERSION_MAJOR,FILE_VERSION_MINOR,FILE_VERSION_PATCH,FILE_VERSION_TWEAK +#define FILE_VERSION_RESOURCE_STR FILE_VERSION_FULL_STR "\0" + +#ifndef PRODUCT_ICON +#define PRODUCT_ICON "@PRODUCT_ICON@" +#endif + +#ifndef PRODUCT_COMMENTS +#define PRODUCT_COMMENTS "@PRODUCT_COMMENTS@\0" +#endif + +#ifndef PRODUCT_VENDOR_NAME +#define PRODUCT_VENDOR_NAME "@PRODUCT_VENDOR_NAME@\0" +#endif + +#ifndef PRODUCT_LEGAL_COPYRIGHT +#define PRODUCT_LEGAL_COPYRIGHT "@PRODUCT_LEGAL_COPYRIGHT@\0" +#endif + +#ifndef PRODUCT_FILE_DESCRIPTION +#define PRODUCT_FILE_DESCRIPTION "@PRODUCT_FILE_DESCRIPTION@\0" +#endif + +#ifndef PRODUCT_INTERNAL_NAME +#define PRODUCT_INTERNAL_NAME "@PRODUCT_NAME@\0" +#endif + +#ifndef PRODUCT_ORIGINAL_FILENAME +#define PRODUCT_ORIGINAL_FILENAME "@PRODUCT_ORIGINAL_FILENAME@\0" +#endif + +#ifndef PRODUCT_BUNDLE +#define PRODUCT_BUNDLE "@PRODUCT_BUNDLE@\0" +#endif + +#endif + diff --git a/CMake/Modules/VersionResource.rc.in b/CMake/Modules/VersionResource.rc.in index e1274a24..ded4b0cd 100755 --- a/CMake/Modules/VersionResource.rc.in +++ b/CMake/Modules/VersionResource.rc.in @@ -1,73 +1,73 @@ -#include "VersionInfo_@PRODUCT_NAME@.h"
-
-#ifdef RC_INVOKED
-
-#if defined (__MINGW64__) || defined (__MINGW32__)
- /* MinGW-w64 or MinGW */
- #if defined (__has_include) && __has_include (<windres.h>)
- #include <windres.h>
- #else
- #include <afxres.h>
- #include <winresrc.h>
- #endif
-#else
- /* MSVC, Windows SDK */
- #include <winres.h>
-#endif
-
-#ifndef _NDEBUG
-#define PRODUCT_DEBUGFLAG 0x0L
-#else
-#define PRODUCT_DEBUGFLAG VS_FF_DEBUG
-#endif
-
-#ifdef SCS_VERSION_IS_DIRTY
-#define PRODUCT_SPECIALFLAG VS_FF_SPECIALBUILD
-#else
-#define PRODUCT_SPECIALFLAG 0x0L
-#endif
-
-#if PRODUCT_PRERELEASE
-#define PRODUCT_PRERELEASEFLAG VS_FF_PRERELEASE
-#else
-#define PRODUCT_PRERELEASEFLAG 0x0L
-#endif
-
-IDI_ICON1 ICON DISCARDABLE PRODUCT_ICON
-
-LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
-
-VS_VERSION_INFO VERSIONINFO
-FILEVERSION FILE_VERSION_RESOURCE
-PRODUCTVERSION PRODUCT_VERSION_RESOURCE
-FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
-FILEFLAGS (PRODUCT_DEBUGFLAG | PRODUCT_SPECIALFLAG | PRODUCT_PRERELEASEFLAG)
-FILEOS VOS_NT_WINDOWS32
-FILETYPE VFT_APP
-FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", PRODUCT_COMMENTS
- VALUE "CompanyName", PRODUCT_VENDOR_NAME
- VALUE "FileDescription", PRODUCT_FILE_DESCRIPTION
- VALUE "FileVersion", FILE_VERSION_RESOURCE_STR
- VALUE "LegalCopyright", PRODUCT_LEGAL_COPYRIGHT
- VALUE "ProductName", PRODUCT_BUNDLE
- VALUE "ProductVersion", PRODUCT_VERSION_RESOURCE_STR
- VALUE "InternalName", PRODUCT_INTERNAL_NAME
- VALUE "OriginalFileName", PRODUCT_ORIGINAL_FILENAME
-#if SCS_VERSION_IS_DIRTY
- VALUE "SpecialBuild", SCS_VERSION_STR "\0"
-#endif
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0409, 0x04b /* en-US Unicode */
- END
-END
-
-#endif
+#include "VersionInfo_@PRODUCT_NAME@.h" + +#ifdef RC_INVOKED + +#if defined (__MINGW64__) || defined (__MINGW32__) + /* MinGW-w64 or MinGW */ + #if defined (__has_include) && __has_include (<windres.h>) + #include <windres.h> + #else + #include <afxres.h> + #include <winresrc.h> + #endif +#else + /* MSVC, Windows SDK */ + #include <winres.h> +#endif + +#ifndef _NDEBUG +#define PRODUCT_DEBUGFLAG 0x0L +#else +#define PRODUCT_DEBUGFLAG VS_FF_DEBUG +#endif + +#ifdef SCS_VERSION_IS_DIRTY +#define PRODUCT_SPECIALFLAG VS_FF_SPECIALBUILD +#else +#define PRODUCT_SPECIALFLAG 0x0L +#endif + +#if PRODUCT_PRERELEASE +#define PRODUCT_PRERELEASEFLAG VS_FF_PRERELEASE +#else +#define PRODUCT_PRERELEASEFLAG 0x0L +#endif + +IDI_ICON1 ICON DISCARDABLE PRODUCT_ICON + +LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL + +VS_VERSION_INFO VERSIONINFO +FILEVERSION FILE_VERSION_RESOURCE +PRODUCTVERSION PRODUCT_VERSION_RESOURCE +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS (PRODUCT_DEBUGFLAG | PRODUCT_SPECIALFLAG | PRODUCT_PRERELEASEFLAG) +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_APP +FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", PRODUCT_COMMENTS + VALUE "CompanyName", PRODUCT_VENDOR_NAME + VALUE "FileDescription", PRODUCT_FILE_DESCRIPTION + VALUE "FileVersion", FILE_VERSION_RESOURCE_STR + VALUE "LegalCopyright", PRODUCT_LEGAL_COPYRIGHT + VALUE "ProductName", PRODUCT_BUNDLE + VALUE "ProductVersion", PRODUCT_VERSION_RESOURCE_STR + VALUE "InternalName", PRODUCT_INTERNAL_NAME + VALUE "OriginalFileName", PRODUCT_ORIGINAL_FILENAME +#if SCS_VERSION_IS_DIRTY + VALUE "SpecialBuild", SCS_VERSION_STR "\0" +#endif + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04b /* en-US Unicode */ + END +END + +#endif diff --git a/CMake/Modules/generate_version_info.cmake b/CMake/Modules/generate_version_info.cmake index 85dd27c0..885921f5 100755 --- a/CMake/Modules/generate_version_info.cmake +++ b/CMake/Modules/generate_version_info.cmake @@ -1,167 +1,167 @@ -include (CMakeParseArguments)
-
-set (_THIS_MODULE_BASE_DIR "${CMAKE_CURRENT_LIST_DIR}")
-
-# generate_product_version() function
-#
-# This function uses VersionInfo.in template file and VersionResource.rc file
-# to generate WIN32 resource with version information and general resource strings.
-#
-# Usage:
-# generate_product_version(
-# SomeOutputResourceVariable
-# NAME MyVersinedTarget
-# ICON ${PATH_TO_ICON}
-# VERSION_MAJOR 2
-# VERSION_MINOR 3
-# VERSION_PATCH 1
-# VERSION_REVISION sha1
-# )
-#
-# You can use generated resource for your executable targets:
-# add_executable(target-name ${target-files} ${SomeOutputResourceVariable})
-# add_library (target-name SHARED ${target-files} ${SomeOutputResourceVariable})
-#
-# You can specify resource strings in arguments:
-# NAME - name of executable (no defaults, ex: Microsoft Word)
-# BUNDLE - bundle (${PROJECT_NAME} or ${NAME} is default, ex: Microsoft Office)
-# ICON - path to application icon, default: ${CMAKE_SOURCE_DIR}/icons/windows-icons/${NAME}.ico
-# VERSION_MAJOR - default: 1
-# VERSION_MINOR - deafult: 0
-# VERSION_PATCH - deafult: 0
-# VERSION_REVISION - deafult: 0
-# VENDOR_NAME - your vendor name, default: ${PROJECT_VENDOR}
-# LEGAL_COPYRIGHT - default: ${PROJECT_COPYRIGHT}
-# COMMENTS - default: ${PROJECT_DESCRIPTION}
-# ORIGINAL_FILENAME - default: ${NAME}
-# INTERNAL_NAME - default: ${NAME}
-# FILE_DESCRIPTION - default: ${COMMENTS}
-function(generate_version_info outfiles)
- set (options)
- set (oneValueArgs
- NAME
- BUNDLE
- ICON
- VERSION_MAJOR
- VERSION_MINOR
- VERSION_PATCH
- VERSION_REVISION
- VENDOR_NAME
- LEGAL_COPYRIGHT
- COMMENTS
- ORIGINAL_FILENAME
- INTERNAL_NAME
- FILE_DESCRIPTION)
- set (multiValueArgs)
- cmake_parse_arguments(PRODUCT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- if (NOT PRODUCT_BUNDLE)
- if (PROJECT_NAME)
- set (PRODUCT_BUNDLE "${PROJECT_NAME}")
- else ()
- set (PRODUCT_BUNDLE "${PRODUCT_NAME}")
- endif ()
- endif()
-
- if (NOT PRODUCT_ICON)
- set (PRODUCT_ICON "${CMAKE_SOURCE_DIR}/icons/windows-icons/${PRODUCT_NAME}.ico")
- endif ()
-
- if (NOT PRODUCT_VERSION_MAJOR)
- if (PROJECT_VERSION_MAJOR)
- set (PRODUCT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
- else ()
- set (PRODUCT_VERSION_MAJOR 1)
- endif ()
- else ()
- if (NOT ${PRODUCT_VERSION_MAJOR} MATCHES "^[0-9]+$")
- message (FATAL_ERROR "Numeric major version number required")
- endif ()
- endif ()
-
- if (NOT PRODUCT_VERSION_MINOR)
- if (PROJECT_VERSION_MINOR)
- set (PRODUCT_VERSION_MINOR ${PROJECT_VERSION_MINOR})
- else ()
- set (PRODUCT_VERSION_MINOR 0)
- endif ()
- else ()
- if (NOT ${PRODUCT_VERSION_MINOR} MATCHES "^[0-9]+$")
- message (FATAL_ERROR "Numeric minor version number required")
- endif ()
- endif()
-
- if (NOT PRODUCT_VERSION_PATCH)
- if (PROJECT_VERSION_PATCH)
- set (PRODUCT_VERSION_PATCH ${PROJECT_VERSION_PATCH})
- else ()
- set (PRODUCT_VERSION_PATCH 0)
- endif ()
- else ()
- if (NOT ${PRODUCT_VERSION_PATCH} MATCHES "^[0-9]+$")
- message (FATAL_ERROR "Numeric patch version number required")
- endif ()
- endif()
-
- if (NOT PRODUCT_VERSION_TWEAK)
- if (PROJECT_VERSION_TWEAK)
- set (PRODUCT_VERSION_TWEAK ${PROJECT_VERSION_TWEAK})
- else ()
- set (PRODUCT_VERSION_TWEAK 0)
- endif ()
- else()
- if (NOT ${PRODUCT_VERSION_TWEAK} MATCHES "^[0-9]+$")
- message (FATAL_ERROR "Numeric tweak version number required")
- endif()
- endif()
-
- if (NOT PROJECT_VERSION_REVISION AND BUILD_TYPE_REVISION)
- set (PRODUCT_VERSION_REVISION ${BUILD_TYPE_REVISION})
- endif ()
-
- if (NOT PRODUCT_VENDOR_NAME AND PROJECT_VENDOR)
- set (PRODUCT_VENDOR_NAME ${PROJECT_VENDOR})
- endif ()
-
- if (NOT PRODUCT_LEGAL_COPYRIGHT)
- if (PROJECT_COPYRIGHT)
- set (PRODUCT_LEGAL_COPYRIGHT ${PROJECT_COPYRIGHT})
- else ()
- string(TIMESTAMP PRODUCT_CURRENT_YEAR "%Y")
- set(PRODUCT_LEGAL_COPYRIGHT "${PRODUCT_VENDOR_NAME} (C) Copyright ${PRODUCT_CURRENT_YEAR}")
- endif ()
- endif()
-
- if (NOT PRODUCT_COMMENTS)
- if (PROJECT_DESCRIPTION)
- set(PRODUCT_COMMENTS ${PROJECT_DESCRIPTION})
- else ()
- set(PRODUCT_COMMENTS "${PRODUCT_NAME} v${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_PATCH}")
- endif ()
- endif()
-
- if (NOT PRODUCT_ORIGINAL_FILENAME)
- set(PRODUCT_ORIGINAL_FILENAME "${PRODUCT_NAME}")
- endif()
-
- if (NOT PRODUCT_INTERNAL_NAME)
- set(PRODUCT_INTERNAL_NAME "${PRODUCT_NAME}")
- endif()
-
- if (NOT PRODUCT_FILE_DESCRIPTION)
- set(PRODUCT_FILE_DESCRIPTION "${PRODUCT_COMMENTS}")
- endif()
-
- set (_VersionInfoFile VersionInfo_${PRODUCT_NAME}.h)
- set (_VersionResourceFile VersionResource_${PRODUCT_NAME}.rc)
- configure_file(
- ${_THIS_MODULE_BASE_DIR}/VersionInfo.h.in
- ${_VersionInfoFile}
- @ONLY)
- configure_file(
- ${_THIS_MODULE_BASE_DIR}/VersionResource.rc.in
- ${_VersionResourceFile}
- @ONLY)
- list(APPEND ${outfiles} ${CMAKE_CURRENT_BINARY_DIR}/${_VersionInfoFile} ${CMAKE_CURRENT_BINARY_DIR}/${_VersionResourceFile})
- set (${outfiles} ${${outfiles}} PARENT_SCOPE)
-endfunction()
+include (CMakeParseArguments) + +set (_THIS_MODULE_BASE_DIR "${CMAKE_CURRENT_LIST_DIR}") + +# generate_product_version() function +# +# This function uses VersionInfo.in template file and VersionResource.rc file +# to generate WIN32 resource with version information and general resource strings. +# +# Usage: +# generate_product_version( +# SomeOutputResourceVariable +# NAME MyVersinedTarget +# ICON ${PATH_TO_ICON} +# VERSION_MAJOR 2 +# VERSION_MINOR 3 +# VERSION_PATCH 1 +# VERSION_REVISION sha1 +# ) +# +# You can use generated resource for your executable targets: +# add_executable(target-name ${target-files} ${SomeOutputResourceVariable}) +# add_library (target-name SHARED ${target-files} ${SomeOutputResourceVariable}) +# +# You can specify resource strings in arguments: +# NAME - name of executable (no defaults, ex: Microsoft Word) +# BUNDLE - bundle (${PROJECT_NAME} or ${NAME} is default, ex: Microsoft Office) +# ICON - path to application icon, default: ${CMAKE_SOURCE_DIR}/icons/windows-icons/${NAME}.ico +# VERSION_MAJOR - default: 1 +# VERSION_MINOR - deafult: 0 +# VERSION_PATCH - deafult: 0 +# VERSION_REVISION - deafult: 0 +# VENDOR_NAME - your vendor name, default: ${PROJECT_VENDOR} +# LEGAL_COPYRIGHT - default: ${PROJECT_COPYRIGHT} +# COMMENTS - default: ${PROJECT_DESCRIPTION} +# ORIGINAL_FILENAME - default: ${NAME} +# INTERNAL_NAME - default: ${NAME} +# FILE_DESCRIPTION - default: ${COMMENTS} +function(generate_version_info outfiles) + set (options) + set (oneValueArgs + NAME + BUNDLE + ICON + VERSION_MAJOR + VERSION_MINOR + VERSION_PATCH + VERSION_REVISION + VENDOR_NAME + LEGAL_COPYRIGHT + COMMENTS + ORIGINAL_FILENAME + INTERNAL_NAME + FILE_DESCRIPTION) + set (multiValueArgs) + cmake_parse_arguments(PRODUCT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if (NOT PRODUCT_BUNDLE) + if (PROJECT_NAME) + set (PRODUCT_BUNDLE "${PROJECT_NAME}") + else () + set (PRODUCT_BUNDLE "${PRODUCT_NAME}") + endif () + endif() + + if (NOT PRODUCT_ICON) + set (PRODUCT_ICON "${CMAKE_SOURCE_DIR}/icons/windows-icons/${PRODUCT_NAME}.ico") + endif () + + if (NOT PRODUCT_VERSION_MAJOR) + if (PROJECT_VERSION_MAJOR) + set (PRODUCT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) + else () + set (PRODUCT_VERSION_MAJOR 1) + endif () + else () + if (NOT ${PRODUCT_VERSION_MAJOR} MATCHES "^[0-9]+$") + message (FATAL_ERROR "Numeric major version number required") + endif () + endif () + + if (NOT PRODUCT_VERSION_MINOR) + if (PROJECT_VERSION_MINOR) + set (PRODUCT_VERSION_MINOR ${PROJECT_VERSION_MINOR}) + else () + set (PRODUCT_VERSION_MINOR 0) + endif () + else () + if (NOT ${PRODUCT_VERSION_MINOR} MATCHES "^[0-9]+$") + message (FATAL_ERROR "Numeric minor version number required") + endif () + endif() + + if (NOT PRODUCT_VERSION_PATCH) + if (PROJECT_VERSION_PATCH) + set (PRODUCT_VERSION_PATCH ${PROJECT_VERSION_PATCH}) + else () + set (PRODUCT_VERSION_PATCH 0) + endif () + else () + if (NOT ${PRODUCT_VERSION_PATCH} MATCHES "^[0-9]+$") + message (FATAL_ERROR "Numeric patch version number required") + endif () + endif() + + if (NOT PRODUCT_VERSION_TWEAK) + if (PROJECT_VERSION_TWEAK) + set (PRODUCT_VERSION_TWEAK ${PROJECT_VERSION_TWEAK}) + else () + set (PRODUCT_VERSION_TWEAK 0) + endif () + else() + if (NOT ${PRODUCT_VERSION_TWEAK} MATCHES "^[0-9]+$") + message (FATAL_ERROR "Numeric tweak version number required") + endif() + endif() + + if (NOT PROJECT_VERSION_REVISION AND BUILD_TYPE_REVISION) + set (PRODUCT_VERSION_REVISION ${BUILD_TYPE_REVISION}) + endif () + + if (NOT PRODUCT_VENDOR_NAME AND PROJECT_VENDOR) + set (PRODUCT_VENDOR_NAME ${PROJECT_VENDOR}) + endif () + + if (NOT PRODUCT_LEGAL_COPYRIGHT) + if (PROJECT_COPYRIGHT) + set (PRODUCT_LEGAL_COPYRIGHT ${PROJECT_COPYRIGHT}) + else () + string(TIMESTAMP PRODUCT_CURRENT_YEAR "%Y") + set(PRODUCT_LEGAL_COPYRIGHT "${PRODUCT_VENDOR_NAME} (C) Copyright ${PRODUCT_CURRENT_YEAR}") + endif () + endif() + + if (NOT PRODUCT_COMMENTS) + if (PROJECT_DESCRIPTION) + set(PRODUCT_COMMENTS ${PROJECT_DESCRIPTION}) + else () + set(PRODUCT_COMMENTS "${PRODUCT_NAME} v${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_PATCH}") + endif () + endif() + + if (NOT PRODUCT_ORIGINAL_FILENAME) + set(PRODUCT_ORIGINAL_FILENAME "${PRODUCT_NAME}") + endif() + + if (NOT PRODUCT_INTERNAL_NAME) + set(PRODUCT_INTERNAL_NAME "${PRODUCT_NAME}") + endif() + + if (NOT PRODUCT_FILE_DESCRIPTION) + set(PRODUCT_FILE_DESCRIPTION "${PRODUCT_COMMENTS}") + endif() + + set (_VersionInfoFile VersionInfo_${PRODUCT_NAME}.h) + set (_VersionResourceFile VersionResource_${PRODUCT_NAME}.rc) + configure_file( + ${_THIS_MODULE_BASE_DIR}/VersionInfo.h.in + ${_VersionInfoFile} + @ONLY) + configure_file( + ${_THIS_MODULE_BASE_DIR}/VersionResource.rc.in + ${_VersionResourceFile} + @ONLY) + list(APPEND ${outfiles} ${CMAKE_CURRENT_BINARY_DIR}/${_VersionInfoFile} ${CMAKE_CURRENT_BINARY_DIR}/${_VersionResourceFile}) + set (${outfiles} ${${outfiles}} PARENT_SCOPE) +endfunction() diff --git a/CMake/Modules/set_build_type.cmake b/CMake/Modules/set_build_type.cmake index 03d5ce87..1f1f1273 100755 --- a/CMake/Modules/set_build_type.cmake +++ b/CMake/Modules/set_build_type.cmake @@ -1,42 +1,42 @@ -include (CMakeParseArguments)
-
-# set_build_type() function
-#
-# Configure the output artefacts and their names for development,
-# Release Candidate (RC), or General Availability (GA) build type.
-#
-# Usage:
-# set_build_type ()
-# set_build_type (RC n)
-# set_build_type (GA)
-#
-# With no arguments or with RC 0 a development is specified. The
-# variable BUILD_TYPE_REVISION is set to "-devel".
-#
-# With RC n with n>0 specifies a Release Candidate build. The
-# variable BUIlD_TYPE_REVISION is set to "-rcn".
-#
-# With GA a General Availability release is specified and the
-# variable BUIlD_TYPE_REVISION is unset.
-#
-macro (set_build_type)
- set (options GA)
- set (oneValueArgs RC)
- set (multiValueArgs)
- cmake_parse_arguments (BUILD_TYPE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- if (BUILD_TYPE_UNPARSED_ARGUMENTS)
- message (FATAL_ERROR "Unrecognized macro arguments: \"${BUILD_TYPE_UNPARSED_ARGUMENTS}\"")
- endif ()
- if (BUILD_TYPE_GA AND BUILD_TYPE_RC)
- message (FATAL_ERROR "Only specify one build type from RC or GA.")
- endif ()
- if (NOT BUILD_TYPE_GA)
- if (BUILD_TYPE_RC)
- set (BUILD_TYPE_REVISION "-rc${BUILD_TYPE_RC}")
- else ()
- set (BUILD_TYPE_REVISION "-devel")
- endif ()
- endif ()
- message (STATUS "Building ${PROJECT_NAME} v${PROJECT_VERSION}${BUILD_TYPE_REVISION}")
-endmacro ()
+include (CMakeParseArguments) + +# set_build_type() function +# +# Configure the output artefacts and their names for development, +# Release Candidate (RC), or General Availability (GA) build type. +# +# Usage: +# set_build_type () +# set_build_type (RC n) +# set_build_type (GA) +# +# With no arguments or with RC 0 a development is specified. The +# variable BUILD_TYPE_REVISION is set to "-devel". +# +# With RC n with n>0 specifies a Release Candidate build. The +# variable BUIlD_TYPE_REVISION is set to "-rcn". +# +# With GA a General Availability release is specified and the +# variable BUIlD_TYPE_REVISION is unset. +# +macro (set_build_type) + set (options GA) + set (oneValueArgs RC) + set (multiValueArgs) + cmake_parse_arguments (BUILD_TYPE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if (BUILD_TYPE_UNPARSED_ARGUMENTS) + message (FATAL_ERROR "Unrecognized macro arguments: \"${BUILD_TYPE_UNPARSED_ARGUMENTS}\"") + endif () + if (BUILD_TYPE_GA AND BUILD_TYPE_RC) + message (FATAL_ERROR "Only specify one build type from RC or GA.") + endif () + if (NOT BUILD_TYPE_GA) + if (BUILD_TYPE_RC) + set (BUILD_TYPE_REVISION "-rc${BUILD_TYPE_RC}") + else () + set (BUILD_TYPE_REVISION "-devel") + endif () + endif () + message (STATUS "Building ${PROJECT_NAME} v${PROJECT_VERSION}${BUILD_TYPE_REVISION}") +endmacro () diff --git a/CMake/cmake_uninstall.cmake.in b/CMake/cmake_uninstall.cmake.in index a8663972..23b3064a 100755 --- a/CMake/cmake_uninstall.cmake.in +++ b/CMake/cmake_uninstall.cmake.in @@ -1,22 +1,22 @@ -if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
- message (FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
-endif ()
-
-file (READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
-string (REGEX REPLACE "\n" ";" files "${files}")
-foreach (file ${files})
- message (STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
- if (EXISTS "$ENV{DESTDIR}${file}")
- exec_program (
- "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
- OUTPUT_VARIABLE rm_out
- RETURN_VALUE rm_retval
- )
- if ("${rm_retval}" STREQUAL 0)
- else ()
- message (FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
- endif ()
- else ()
- message (STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
- endif ()
-endforeach ()
+if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message (FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +endif () + +file (READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string (REGEX REPLACE "\n" ";" files "${files}") +foreach (file ${files}) + message (STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if (EXISTS "$ENV{DESTDIR}${file}") + exec_program ( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if ("${rm_retval}" STREQUAL 0) + else () + message (FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif () + else () + message (STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif () +endforeach () diff --git a/CMake/getsvn.cmake b/CMake/getsvn.cmake index 144d2ae1..92b5b415 100755 --- a/CMake/getsvn.cmake +++ b/CMake/getsvn.cmake @@ -1,85 +1,85 @@ -message (STATUS "Checking for revision information")
-set (__scs_header_file ${BINARY_DIR}/scs_version.h.txt)
-file (WRITE ${__scs_header_file} "/* SCS version information */\n\n")
-if (EXISTS "${SOURCE_DIR}/.svn")
- message (STATUS "Checking for Subversion revision information")
- find_package (Subversion QUIET REQUIRED)
- # the FindSubversion.cmake module is part of the standard distribution
- include (FindSubversion)
- # extract working copy information for SOURCE_DIR into MY_XXX variables
- Subversion_WC_INFO (${SOURCE_DIR} MY)
- message ("${MY_WC_INFO}")
- # determine if the working copy has outstanding changes
- execute_process (COMMAND ${Subversion_SVN_EXECUTABLE} status ${SOURCE_DIR}
- OUTPUT_FILE "${BINARY_DIR}/svn_status.txt"
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- file (STRINGS "${BINARY_DIR}/svn_status.txt" __svn_changes
- REGEX "^[^?].*$"
- )
- set (SCS_VERSION "r${MY_WC_LAST_CHANGED_REV}")
- if (__svn_changes)
- message (STATUS "Source tree based on revision ${SCS_VERSION} appears to have local changes")
- file (APPEND ${__scs_header_file} "#define SCS_VERSION_IS_DIRTY 1\n")
- set (SCS_VERSION_STR "${SCS_VERSION}-dirty")
- foreach (__svn_change ${__svn_changes})
- message (STATUS "${__svn_change}")
- endforeach (__svn_change ${__svn_changes})
- else ()
- set (SCS_VERSION_STR "${SCS_VERSION}")
- endif ()
- message (STATUS "${SOURCE_DIR} contains a .svn and is revision ${SCS_VERSION}")
-elseif (EXISTS "${SOURCE_DIR}/.git")
- if (EXISTS "${SOURCE_DIR}/.git/svn/.metadata") # try git-svn
- message (STATUS "Checking for Subversion revision information using git-svn")
- include (${SOURCE_DIR}/CMake/Modules/FindGitSubversion.cmake)
- # extract working copy information for SOURCE_DIR into MY_XXX variables
- GitSubversion_WC_INFO (${SOURCE_DIR} MY)
- message ("${MY_WC_INFO}")
- set (SCS_VERSION "r${MY_WC_LAST_CHANGED_REV}")
- # try and determine if the working copy has outstanding changes
- execute_process (COMMAND ${GIT_EXECUTABLE} --git-dir=${SOURCE_DIR}/.git --work-tree=${SOURCE_DIR} svn dcommit --dry-run
- RESULT_VARIABLE __git_svn_status
- OUTPUT_FILE "${BINARY_DIR}/svn_status.txt"
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- file (STRINGS "${BINARY_DIR}/svn_status.txt" __svn_changes
- REGEX "^diff-tree"
- )
- if ((NOT ${__git_svn_status} EQUAL 0) OR __svn_changes)
- message (STATUS "Source tree based on revision ${MY_WC_LAST_CHANGED_REV} appears to have local changes")
- file (APPEND ${__scs_header_file} "#define SCS_VERSION_IS_DIRTY 1\n")
- set (SCS_VERSION_STR "${SCS_VERSION}-dirty")
- else ()
- set (SCS_VERSION_STR "${SCS_VERSION}")
- endif ()
- else ()
- #
- # try git
- #
- message (STATUS "Checking for gitrevision information")
- include (${SOURCE_DIR}/CMake/Modules/GetGitRevisionDescription.cmake)
- get_git_head_revision (${SOURCE_DIR} GIT_REFSPEC GIT_SHA1)
- git_local_changes (${SOURCE_DIR} GIT_SANITARY)
- string (SUBSTRING "${GIT_SHA1}" 0 6 SCS_VERSION)
- if ("${GIT_SANITARY}" STREQUAL "DIRTY")
- message (STATUS "Source tree based on revision ${GIT_REFSPEC} ${SCS_VERSION} appears to have local changes")
- file (APPEND ${__scs_header_file} "#define SCS_VERSION_IS_DIRTY 1\n")
- set (SCS_VERSION_STR "${SCS_VERSION}-dirty")
- execute_process (COMMAND ${GIT_EXECUTABLE} --git-dir=${SOURCE_DIR}/.git --work-tree=${SOURCE_DIR} status
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- else ()
- set (SCS_VERSION_STR "${SCS_VERSION}")
- endif ()
- message (STATUS "refspec: ${GIT_REFSPEC} - SHA1: ${SCS_VERSION}")
- endif ()
-else()
- message (STATUS "No SCS found")
-endif ()
-file (APPEND ${__scs_header_file} "#define SCS_VERSION ${SCS_VERSION}\n")
-file (APPEND ${__scs_header_file} "#define SCS_VERSION_STR \"${SCS_VERSION_STR}\"\n")
-
-# copy the file to the final header only if the version changes
-# reduces needless rebuilds
-execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${__scs_header_file} "${OUTPUT_DIR}/scs_version.h")
-file (REMOVE ${__scs_header_file})
+message (STATUS "Checking for revision information") +set (__scs_header_file ${BINARY_DIR}/scs_version.h.txt) +file (WRITE ${__scs_header_file} "/* SCS version information */\n\n") +if (EXISTS "${SOURCE_DIR}/.svn") + message (STATUS "Checking for Subversion revision information") + find_package (Subversion QUIET REQUIRED) + # the FindSubversion.cmake module is part of the standard distribution + include (FindSubversion) + # extract working copy information for SOURCE_DIR into MY_XXX variables + Subversion_WC_INFO (${SOURCE_DIR} MY) + message ("${MY_WC_INFO}") + # determine if the working copy has outstanding changes + execute_process (COMMAND ${Subversion_SVN_EXECUTABLE} status ${SOURCE_DIR} + OUTPUT_FILE "${BINARY_DIR}/svn_status.txt" + OUTPUT_STRIP_TRAILING_WHITESPACE) + file (STRINGS "${BINARY_DIR}/svn_status.txt" __svn_changes + REGEX "^[^?].*$" + ) + set (SCS_VERSION "r${MY_WC_LAST_CHANGED_REV}") + if (__svn_changes) + message (STATUS "Source tree based on revision ${SCS_VERSION} appears to have local changes") + file (APPEND ${__scs_header_file} "#define SCS_VERSION_IS_DIRTY 1\n") + set (SCS_VERSION_STR "${SCS_VERSION}-dirty") + foreach (__svn_change ${__svn_changes}) + message (STATUS "${__svn_change}") + endforeach (__svn_change ${__svn_changes}) + else () + set (SCS_VERSION_STR "${SCS_VERSION}") + endif () + message (STATUS "${SOURCE_DIR} contains a .svn and is revision ${SCS_VERSION}") +elseif (EXISTS "${SOURCE_DIR}/.git") + if (EXISTS "${SOURCE_DIR}/.git/svn/.metadata") # try git-svn + message (STATUS "Checking for Subversion revision information using git-svn") + include (${SOURCE_DIR}/CMake/Modules/FindGitSubversion.cmake) + # extract working copy information for SOURCE_DIR into MY_XXX variables + GitSubversion_WC_INFO (${SOURCE_DIR} MY) + message ("${MY_WC_INFO}") + set (SCS_VERSION "r${MY_WC_LAST_CHANGED_REV}") + # try and determine if the working copy has outstanding changes + execute_process (COMMAND ${GIT_EXECUTABLE} --git-dir=${SOURCE_DIR}/.git --work-tree=${SOURCE_DIR} svn dcommit --dry-run + RESULT_VARIABLE __git_svn_status + OUTPUT_FILE "${BINARY_DIR}/svn_status.txt" + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + file (STRINGS "${BINARY_DIR}/svn_status.txt" __svn_changes + REGEX "^diff-tree" + ) + if ((NOT ${__git_svn_status} EQUAL 0) OR __svn_changes) + message (STATUS "Source tree based on revision ${MY_WC_LAST_CHANGED_REV} appears to have local changes") + file (APPEND ${__scs_header_file} "#define SCS_VERSION_IS_DIRTY 1\n") + set (SCS_VERSION_STR "${SCS_VERSION}-dirty") + else () + set (SCS_VERSION_STR "${SCS_VERSION}") + endif () + else () + # + # try git + # + message (STATUS "Checking for gitrevision information") + include (${SOURCE_DIR}/CMake/Modules/GetGitRevisionDescription.cmake) + get_git_head_revision (${SOURCE_DIR} GIT_REFSPEC GIT_SHA1) + git_local_changes (${SOURCE_DIR} GIT_SANITARY) + string (SUBSTRING "${GIT_SHA1}" 0 6 SCS_VERSION) + if ("${GIT_SANITARY}" STREQUAL "DIRTY") + message (STATUS "Source tree based on revision ${GIT_REFSPEC} ${SCS_VERSION} appears to have local changes") + file (APPEND ${__scs_header_file} "#define SCS_VERSION_IS_DIRTY 1\n") + set (SCS_VERSION_STR "${SCS_VERSION}-dirty") + execute_process (COMMAND ${GIT_EXECUTABLE} --git-dir=${SOURCE_DIR}/.git --work-tree=${SOURCE_DIR} status + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + else () + set (SCS_VERSION_STR "${SCS_VERSION}") + endif () + message (STATUS "refspec: ${GIT_REFSPEC} - SHA1: ${SCS_VERSION}") + endif () +else() + message (STATUS "No SCS found") +endif () +file (APPEND ${__scs_header_file} "#define SCS_VERSION ${SCS_VERSION}\n") +file (APPEND ${__scs_header_file} "#define SCS_VERSION_STR \"${SCS_VERSION_STR}\"\n") + +# copy the file to the final header only if the version changes +# reduces needless rebuilds +execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${__scs_header_file} "${OUTPUT_DIR}/scs_version.h") +file (REMOVE ${__scs_header_file}) |
