diff options
author | CRTS <crts [at] gmx [dot] net> | 2021-01-24 19:34:40 +0100 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2021-04-18 00:04:03 -0500 |
commit | a569ecc1f95142fae653b2c75079d87a9c1f32b3 (patch) | |
tree | 14858a60c74981df276749edd313ea1f4e05b941 /games/vegastrike | |
parent | ad1208115f0dc3c27bfaec00de1f3db7dd7550b2 (diff) | |
download | slackbuilds-a569ecc1f95142fae653b2c75079d87a9c1f32b3.tar.gz |
games/vegastrike: Adjustments for -current.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'games/vegastrike')
-rw-r--r-- | games/vegastrike/cmake/FindGTK2.cmake | 946 | ||||
-rw-r--r-- | games/vegastrike/cmake/FindPackageHandleStandardArgs.cmake | 466 | ||||
-rw-r--r-- | games/vegastrike/cmake/FindPackageMessage.cmake | 48 | ||||
-rw-r--r-- | games/vegastrike/cmake/SelectLibraryConfigurations.cmake | 80 | ||||
-rw-r--r-- | games/vegastrike/patches/patch-0.5.1.r1_2 | 216 | ||||
-rw-r--r-- | games/vegastrike/vegastrike.SlackBuild | 4 |
6 files changed, 1724 insertions, 36 deletions
diff --git a/games/vegastrike/cmake/FindGTK2.cmake b/games/vegastrike/cmake/FindGTK2.cmake new file mode 100644 index 0000000000..62f1614f8c --- /dev/null +++ b/games/vegastrike/cmake/FindGTK2.cmake @@ -0,0 +1,946 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindGTK2 +-------- + +Find the GTK2 widget libraries and several of its other optional components +like ``gtkmm``, ``glade``, and ``glademm``. + +Specify one or more of the following components as you call this find +module. See example below. + +* ``gtk`` +* ``gtkmm`` +* ``glade`` +* ``glademm`` + +Result Variables +^^^^^^^^^^^^^^^^ + +The following variables will be defined for your use + +``GTK2_FOUND`` + Were all of your specified components found? +``GTK2_INCLUDE_DIRS`` + All include directories +``GTK2_LIBRARIES`` + All libraries +``GTK2_TARGETS`` + All imported targets +``GTK2_DEFINITIONS`` + Additional compiler flags +``GTK2_VERSION`` + The version of GTK2 found (x.y.z) +``GTK2_MAJOR_VERSION`` + The major version of GTK2 +``GTK2_MINOR_VERSION`` + The minor version of GTK2 +``GTK2_PATCH_VERSION`` + The patch version of GTK2 + +Input Variables +^^^^^^^^^^^^^^^ + +Optional variables you can define prior to calling this module: + +``GTK2_DEBUG`` + Enables verbose debugging of the module +``GTK2_ADDITIONAL_SUFFIXES`` + Allows defining additional directories to search for include files + +Example Usage +^^^^^^^^^^^^^ + +Call :command:`find_package` once. Here are some examples to pick from: + +Require GTK 2.6 or later: + +.. code-block:: cmake + + find_package(GTK2 2.6 REQUIRED gtk) + +Require GTK 2.10 or later and Glade: + +.. code-block:: cmake + + find_package(GTK2 2.10 REQUIRED gtk glade) + +Search for GTK/GTKMM 2.8 or later: + +.. code-block:: cmake + + find_package(GTK2 2.8 COMPONENTS gtk gtkmm) + +Use the results: + +.. code-block:: cmake + + if(GTK2_FOUND) + include_directories(${GTK2_INCLUDE_DIRS}) + add_executable(mygui mygui.cc) + target_link_libraries(mygui ${GTK2_LIBRARIES}) + endif() +#]=======================================================================] + +# Version 1.6 (CMake 3.0) +# * Create targets for each library +# * Do not link libfreetype +# Version 1.5 (CMake 2.8.12) +# * 14236: Detect gthread library +# Detect pangocairo on windows +# Detect pangocairo with gtk module instead of with gtkmm +# * 14259: Use vc100 libraries with VS 11 +# * 14260: Export a GTK2_DEFINITIONS variable to set /vd2 when appropriate +# (i.e. MSVC) +# * Use the optimized/debug syntax for _LIBRARY and _LIBRARIES variables when +# appropriate. A new set of _RELEASE variables was also added. +# * Remove GTK2_SKIP_MARK_AS_ADVANCED option, as now the variables are +# marked as advanced by SelectLibraryConfigurations +# * Detect gmodule, pangoft2 and pangoxft libraries +# Version 1.4 (10/4/2012) (CMake 2.8.10) +# * 12596: Missing paths for FindGTK2 on NetBSD +# * 12049: Fixed detection of GTK include files in the lib folder on +# multiarch systems. +# Version 1.3 (11/9/2010) (CMake 2.8.4) +# * 11429: Add support for detecting GTK2 built with Visual Studio 10. +# Thanks to Vincent Levesque for the patch. +# Version 1.2 (8/30/2010) (CMake 2.8.3) +# * Merge patch for detecting gdk-pixbuf library (split off +# from core GTK in 2.21). Thanks to Vincent Untz for the patch +# and Ricardo Cruz for the heads up. +# Version 1.1 (8/19/2010) (CMake 2.8.3) +# * Add support for detecting GTK2 under macports (thanks to Gary Kramlich) +# Version 1.0 (8/12/2010) (CMake 2.8.3) +# * Add support for detecting new pangommconfig.h header file +# (Thanks to Sune Vuorela & the Debian Project for the patch) +# * Add support for detecting fontconfig.h header +# * Call find_package(Freetype) since it's required +# * Add support for allowing users to add additional library directories +# via the GTK2_ADDITIONAL_SUFFIXES variable (kind of a future-kludge in +# case the GTK developers change versions on any of the directories in the +# future). +# Version 0.8 (1/4/2010) +# * Get module working under MacOSX fink by adding /sw/include, /sw/lib +# to PATHS and the gobject library +# Version 0.7 (3/22/09) +# * Checked into CMake CVS +# * Added versioning support +# * Module now defaults to searching for GTK if COMPONENTS not specified. +# * Added HKCU prior to HKLM registry key and GTKMM specific environment +# variable as per mailing list discussion. +# * Added lib64 to include search path and a few other search paths where GTK +# may be installed on Unix systems. +# * Switched to lowercase CMake commands +# * Prefaced internal variables with _GTK2 to prevent collision +# * Changed internal macros to functions +# * Enhanced documentation +# Version 0.6 (1/8/08) +# Added GTK2_SKIP_MARK_AS_ADVANCED option +# Version 0.5 (12/19/08) +# Second release to cmake mailing list + +#============================================================= +# _GTK2_GET_VERSION +# Internal function to parse the version number in gtkversion.h +# _OUT_major = Major version number +# _OUT_minor = Minor version number +# _OUT_micro = Micro version number +# _gtkversion_hdr = Header file to parse +#============================================================= + +include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + +function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr) + file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+") + if(_contents) + string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}") + string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}") + string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}") + + if(NOT ${_OUT_major} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for GTK2_MAJOR_VERSION!") + endif() + if(NOT ${_OUT_minor} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for GTK2_MINOR_VERSION!") + endif() + if(NOT ${_OUT_micro} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for GTK2_MICRO_VERSION!") + endif() + + set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE) + set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE) + set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist") + endif() +endfunction() + + +#============================================================= +# _GTK2_SIGCXX_GET_VERSION +# Internal function to parse the version number in +# sigc++config.h +# _OUT_major = Major version number +# _OUT_minor = Minor version number +# _OUT_micro = Micro version number +# _sigcxxversion_hdr = Header file to parse +#============================================================= + +function(_GTK2_SIGCXX_GET_VERSION _OUT_major _OUT_minor _OUT_micro _sigcxxversion_hdr) + file(STRINGS ${_sigcxxversion_hdr} _contents REGEX "#define SIGCXX_M[A-Z]+_VERSION[ \t]+") + if(_contents) + string(REGEX REPLACE ".*#define SIGCXX_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_major} "${_contents}") + string(REGEX REPLACE ".*#define SIGCXX_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_minor} "${_contents}") + string(REGEX REPLACE ".*#define SIGCXX_MICRO_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_micro} "${_contents}") + + if(NOT ${_OUT_major} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MAJOR_VERSION!") + endif() + if(NOT ${_OUT_minor} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MINOR_VERSION!") + endif() + if(NOT ${_OUT_micro} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for SIGCXX_MICRO_VERSION!") + endif() + + set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE) + set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE) + set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE) + else() + # The header does not have the version macros; assume it is ``0.0.0``. + set(${_OUT_major} 0) + set(${_OUT_minor} 0) + set(${_OUT_micro} 0) + endif() +endfunction() + + +#============================================================= +# _GTK2_FIND_INCLUDE_DIR +# Internal function to find the GTK include directories +# _var = variable to set (_INCLUDE_DIR is appended) +# _hdr = header file to look for +#============================================================= +function(_GTK2_FIND_INCLUDE_DIR _var _hdr) + + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_FIND_INCLUDE_DIR( ${_var} ${_hdr} )") + endif() + + set(_gtk_packages + # If these ever change, things will break. + ${GTK2_ADDITIONAL_SUFFIXES} + glibmm-2.4 + glib-2.0 + atk-1.0 + atkmm-1.6 + cairo + cairomm-1.0 + gdk-pixbuf-2.0 + gdkmm-2.4 + giomm-2.4 + gtk-2.0 + gtkmm-2.4 + libglade-2.0 + libglademm-2.4 + harfbuzz + pango-1.0 + pangomm-1.4 + sigc++-2.0 + ) + + # + # NOTE: The following suffixes cause searching for header files in both of + # these directories: + # /usr/include/<pkg> + # /usr/lib/<pkg>/include + # + + set(_suffixes) + foreach(_d ${_gtk_packages}) + list(APPEND _suffixes ${_d}) + list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-2.0/include + endforeach() + + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "include suffixes = ${_suffixes}") + endif() + + if(CMAKE_LIBRARY_ARCHITECTURE) + set(_gtk2_arch_dir /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) + if(GTK2_DEBUG) + message(STATUS "Adding ${_gtk2_arch_dir} to search path for multiarch support") + endif() + endif() + find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr} + PATHS + ${_gtk2_arch_dir} + /usr/local/libx32 + /usr/local/lib64 + /usr/local/lib + /usr/libx32 + /usr/lib64 + /usr/lib + /opt/gnome/include + /opt/gnome/lib + /opt/openwin/include + /usr/openwin/lib + /sw/lib + /opt/local/lib + /usr/pkg/lib + /usr/pkg/include/glib + $ENV{GTKMM_BASEPATH}/include + $ENV{GTKMM_BASEPATH}/lib + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib + PATH_SUFFIXES + ${_suffixes} + ) + mark_as_advanced(GTK2_${_var}_INCLUDE_DIR) + + if(GTK2_${_var}_INCLUDE_DIR) + set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${GTK2_${_var}_INCLUDE_DIR} PARENT_SCOPE) + endif() + +endfunction() + +#============================================================= +# _GTK2_FIND_LIBRARY +# Internal function to find libraries packaged with GTK2 +# _var = library variable to create (_LIBRARY is appended) +#============================================================= +function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) + + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_FIND_LIBRARY( ${_var} ${_lib} ${_expand_vc} ${_append_version} )") + endif() + + # Not GTK versions per se but the versions encoded into Windows + # import libraries (GtkMM 2.14.1 has a gtkmm-vc80-2_4.lib for example) + # Also the MSVC libraries use _ for . (this is handled below) + set(_versions 2.20 2.18 2.16 2.14 2.12 + 2.10 2.8 2.6 2.4 2.2 2.0 + 1.20 1.18 1.16 1.14 1.12 + 1.10 1.8 1.6 1.4 1.2 1.0) + + set(_library) + set(_library_d) + + set(_library ${_lib}) + + if(_expand_vc AND MSVC) + # Add vc80/vc90/vc100 midfixes + if(MSVC_TOOLSET_VERSION LESS 110) + set(_library ${_library}-vc${MSVC_TOOLSET_VERSION}) + else() + # Up to gtkmm-win 2.22.0-2 there are no vc110 libraries but vc100 can be used + set(_library ${_library}-vc100) + endif() + set(_library_d ${_library}-d) + endif() + + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "After midfix addition = ${_library} and ${_library_d}") + endif() + + set(_lib_list) + set(_libd_list) + if(_append_version) + foreach(_ver ${_versions}) + list(APPEND _lib_list "${_library}-${_ver}") + list(APPEND _libd_list "${_library_d}-${_ver}") + endforeach() + else() + set(_lib_list ${_library}) + set(_libd_list ${_library_d}) + endif() + + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "library list = ${_lib_list} and library debug list = ${_libd_list}") + endif() + + # For some silly reason the MSVC libraries use _ instead of . + # in the version fields + if(_expand_vc AND MSVC) + set(_no_dots_lib_list) + set(_no_dots_libd_list) + foreach(_l ${_lib_list}) + string(REPLACE "." "_" _no_dots_library ${_l}) + list(APPEND _no_dots_lib_list ${_no_dots_library}) + endforeach() + # And for debug + set(_no_dots_libsd_list) + foreach(_l ${_libd_list}) + string(REPLACE "." "_" _no_dots_libraryd ${_l}) + list(APPEND _no_dots_libd_list ${_no_dots_libraryd}) + endforeach() + + # Copy list back to original names + set(_lib_list ${_no_dots_lib_list}) + set(_libd_list ${_no_dots_libd_list}) + endif() + + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "While searching for GTK2_${_var}_LIBRARY, our proposed library list is ${_lib_list}") + endif() + + find_library(GTK2_${_var}_LIBRARY_RELEASE + NAMES ${_lib_list} + PATHS + /opt/gnome/lib + /usr/openwin/lib + $ENV{GTKMM_BASEPATH}/lib + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib + ) + + if(_expand_vc AND MSVC) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "While searching for GTK2_${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}") + endif() + + find_library(GTK2_${_var}_LIBRARY_DEBUG + NAMES ${_libd_list} + PATHS + $ENV{GTKMM_BASEPATH}/lib + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib + ) + endif() + + select_library_configurations(GTK2_${_var}) + + set(GTK2_${_var}_LIBRARY ${GTK2_${_var}_LIBRARY} PARENT_SCOPE) + set(GTK2_${_var}_FOUND ${GTK2_${_var}_FOUND} PARENT_SCOPE) + + if(GTK2_${_var}_FOUND) + set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${GTK2_${_var}_LIBRARY}) + set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE) + endif() + + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "GTK2_${_var}_LIBRARY_RELEASE = \"${GTK2_${_var}_LIBRARY_RELEASE}\"") + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "GTK2_${_var}_LIBRARY_DEBUG = \"${GTK2_${_var}_LIBRARY_DEBUG}\"") + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "GTK2_${_var}_LIBRARY = \"${GTK2_${_var}_LIBRARY}\"") + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "GTK2_${_var}_FOUND = \"${GTK2_${_var}_FOUND}\"") + endif() + +endfunction() + + +function(_GTK2_ADD_TARGET_DEPENDS_INTERNAL _var _property) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET_DEPENDS_INTERNAL( ${_var} ${_property} )") + endif() + + string(TOLOWER "${_var}" _basename) + + if (TARGET GTK2::${_basename}) + foreach(_depend ${ARGN}) + set(_valid_depends) + if (TARGET GTK2::${_depend}) + list(APPEND _valid_depends GTK2::${_depend}) + endif() + if (_valid_depends) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY ${_property} "${_valid_depends}") + endif() + set(_valid_depends) + endforeach() + endif() +endfunction() + +function(_GTK2_ADD_TARGET_DEPENDS _var) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET_DEPENDS( ${_var} )") + endif() + + string(TOLOWER "${_var}" _basename) + + if(TARGET GTK2::${_basename}) + get_target_property(_configs GTK2::${_basename} IMPORTED_CONFIGURATIONS) + _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN}) + foreach(_config ${_configs}) + _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN}) + endforeach() + endif() +endfunction() + +function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET_INCLUDE_DIRS( ${_var} )") + endif() + + string(TOLOWER "${_var}" _basename) + + if(TARGET GTK2::${_basename}) + foreach(_include ${ARGN}) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") + endforeach() + endif() +endfunction() + +#============================================================= +# _GTK2_ADD_TARGET +# Internal function to create targets for GTK2 +# _var = target to create +#============================================================= +function(_GTK2_ADD_TARGET _var) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET( ${_var} )") + endif() + + string(TOLOWER "${_var}" _basename) + + cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN}) + + if(GTK2_${_var}_FOUND) + if(NOT TARGET GTK2::${_basename}) + # Do not create the target if dependencies are missing + foreach(_dep ${_${_var}_GTK2_DEPENDS}) + if(NOT TARGET GTK2::${_dep}) + return() + endif() + endforeach() + + add_library(GTK2::${_basename} UNKNOWN IMPORTED) + + if(GTK2_${_var}_LIBRARY_RELEASE) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) + endif() + + if(GTK2_${_var}_LIBRARY_DEBUG) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" ) + endif() + + if(GTK2_${_var}_INCLUDE_DIR) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") + endif() + + if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}") + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") + endif() + + if(GTK2_DEFINITIONS) + set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") + endif() + + if(_${_var}_GTK2_DEPENDS) + _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS}) + endif() + + if(_${_var}_OPTIONAL_INCLUDES) + foreach(_D ${_${_var}_OPTIONAL_INCLUDES}) + if(_D) + _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D}) + endif() + endforeach() + endif() + endif() + + set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename}) + set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE) + + if(GTK2_USE_IMPORTED_TARGETS) + set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) + endif() + + endif() +endfunction() + + + +#============================================================= + +# +# main() +# + +set(GTK2_FOUND) +set(GTK2_INCLUDE_DIRS) +set(GTK2_LIBRARIES) +set(GTK2_TARGETS) +set(GTK2_DEFINITIONS) + +if(NOT GTK2_FIND_COMPONENTS) + # Assume they only want GTK + set(GTK2_FIND_COMPONENTS gtk) +endif() + +# +# If specified, enforce version number +# +if(GTK2_FIND_VERSION) + set(GTK2_FAILED_VERSION_CHECK true) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "Searching for version ${GTK2_FIND_VERSION}") + endif() + _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h) + if(GTK2_GTK_INCLUDE_DIR) + _GTK2_GET_VERSION(GTK2_MAJOR_VERSION + GTK2_MINOR_VERSION + GTK2_PATCH_VERSION + ${GTK2_GTK_INCLUDE_DIR}/gtk/gtkversion.h) + set(GTK2_VERSION + ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION}) + if(GTK2_FIND_VERSION_EXACT) + if(GTK2_VERSION VERSION_EQUAL GTK2_FIND_VERSION) + set(GTK2_FAILED_VERSION_CHECK false) + endif() + else() + if(GTK2_VERSION VERSION_EQUAL GTK2_FIND_VERSION OR + GTK2_VERSION VERSION_GREATER GTK2_FIND_VERSION) + set(GTK2_FAILED_VERSION_CHECK false) + endif() + endif() + else() + # If we can't find the GTK include dir, we can't do version checking + if(GTK2_FIND_REQUIRED AND NOT GTK2_FIND_QUIETLY) + message(FATAL_ERROR "Could not find GTK2 include directory") + endif() + return() + endif() + + if(GTK2_FAILED_VERSION_CHECK) + if(GTK2_FIND_REQUIRED AND NOT GTK2_FIND_QUIETLY) + if(GTK2_FIND_VERSION_EXACT) + message(FATAL_ERROR "GTK2 version check failed. Version ${GTK2_VERSION} was found, version ${GTK2_FIND_VERSION} is needed exactly.") + else() + message(FATAL_ERROR "GTK2 version check failed. Version ${GTK2_VERSION} was found, at least version ${GTK2_FIND_VERSION} is required") + endif() + endif() + + # If the version check fails, exit out of the module here + return() + endif() +endif() + +# +# On MSVC, according to https://wiki.gnome.org/gtkmm/MSWindows, the /vd2 flag needs to be +# passed to the compiler in order to use gtkmm +# +if(MSVC) + foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) + if(_GTK2_component STREQUAL "gtkmm") + set(GTK2_DEFINITIONS "/vd2") + elseif(_GTK2_component STREQUAL "glademm") + set(GTK2_DEFINITIONS "/vd2") + endif() + endforeach() +endif() + +# +# Find all components +# + +find_package(Freetype QUIET) +if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) + list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) +endif() + +foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) + if(_GTK2_component STREQUAL "gtk") + # Left for compatibility with previous versions. + _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) + _GTK2_FIND_INCLUDE_DIR(X11 X11/Xlib.h) + + _GTK2_FIND_INCLUDE_DIR(GLIB glib.h) + _GTK2_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h) + _GTK2_FIND_LIBRARY (GLIB glib false true) + _GTK2_ADD_TARGET (GLIB) + + _GTK2_FIND_INCLUDE_DIR(GOBJECT glib-object.h) + _GTK2_FIND_LIBRARY (GOBJECT gobject false true) + _GTK2_ADD_TARGET (GOBJECT GTK2_DEPENDS glib) + + _GTK2_FIND_INCLUDE_DIR(ATK atk/atk.h) + _GTK2_FIND_LIBRARY (ATK atk false true) + _GTK2_ADD_TARGET (ATK GTK2_DEPENDS gobject glib) + + _GTK2_FIND_LIBRARY (GIO gio false true) + _GTK2_ADD_TARGET (GIO GTK2_DEPENDS gobject glib) + + _GTK2_FIND_LIBRARY (GTHREAD gthread false true) + _GTK2_ADD_TARGET (GTHREAD GTK2_DEPENDS glib) + + _GTK2_FIND_LIBRARY (GMODULE gmodule false true) + _GTK2_ADD_TARGET (GMODULE GTK2_DEPENDS glib) + + _GTK2_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) + _GTK2_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true) + _GTK2_ADD_TARGET (GDK_PIXBUF GTK2_DEPENDS gobject glib) + + _GTK2_FIND_INCLUDE_DIR(CAIRO cairo.h) + _GTK2_FIND_LIBRARY (CAIRO cairo false false) + _GTK2_ADD_TARGET (CAIRO) + + _GTK2_FIND_INCLUDE_DIR(HARFBUZZ hb.h) + _GTK2_FIND_LIBRARY (HARFBUZZ harfbuzz false false) + _GTK2_ADD_TARGET (HARFBUZZ) + + _GTK2_FIND_INCLUDE_DIR(PANGO pango/pango.h) + _GTK2_FIND_LIBRARY (PANGO pango false true) + _GTK2_ADD_TARGET (PANGO GTK2_DEPENDS gobject glib + GTK2_OPTIONAL_DEPENDS harfbuzz) + + _GTK2_FIND_LIBRARY (PANGOCAIRO pangocairo false true) + _GTK2_ADD_TARGET (PANGOCAIRO GTK2_DEPENDS pango cairo gobject glib) + + _GTK2_FIND_LIBRARY (PANGOFT2 pangoft2 false true) + _GTK2_ADD_TARGET (PANGOFT2 GTK2_DEPENDS pango gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) + + _GTK2_FIND_LIBRARY (PANGOXFT pangoxft false true) + _GTK2_ADD_TARGET (PANGOXFT GTK2_DEPENDS pangoft2 pango gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) + + _GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h) + _GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h) + if(UNIX) + if(APPLE) + _GTK2_FIND_LIBRARY (GDK gdk-quartz false true) + endif() + _GTK2_FIND_LIBRARY (GDK gdk-x11 false true) + else() + _GTK2_FIND_LIBRARY (GDK gdk-win32 false true) + endif() + _GTK2_ADD_TARGET (GDK GTK2_DEPENDS pango gdk_pixbuf gobject glib + GTK2_OPTIONAL_DEPENDS pangocairo cairo) + + _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h) + if(UNIX) + if(APPLE) + _GTK2_FIND_LIBRARY (GTK gtk-quartz false true) + endif() + _GTK2_FIND_LIBRARY (GTK gtk-x11 false true) + else() + _GTK2_FIND_LIBRARY (GTK gtk-win32 false true) + endif() + _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk pangoft2 pango gdk_pixbuf gthread gobject glib + GTK2_OPTIONAL_DEPENDS gio pangocairo cairo) + + elseif(_GTK2_component STREQUAL "gtkmm") + + _GTK2_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h) + _GTK2_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h) + _GTK2_FIND_LIBRARY (SIGC++ sigc true true) + _GTK2_ADD_TARGET (SIGC++) + # Since sigc++ 2.5.1 c++11 support is required + if(GTK2_SIGC++CONFIG_INCLUDE_DIR) + _GTK2_SIGCXX_GET_VERSION(GTK2_SIGC++_VERSION_MAJOR + GTK2_SIGC++_VERSION_MINOR + GTK2_SIGC++_VERSION_MICRO + ${GTK2_SIGC++CONFIG_INCLUDE_DIR}/sigc++config.h) + if(NOT ${GTK2_SIGC++_VERSION_MAJOR}.${GTK2_SIGC++_VERSION_MINOR}.${GTK2_SIGC++_VERSION_MICRO} VERSION_LESS 2.5.1) + # These are the features needed by clients in order to include the + # project headers: + set_property(TARGET GTK2::sigc++ + PROPERTY INTERFACE_COMPILE_FEATURES cxx_alias_templates + cxx_auto_type + cxx_decltype + cxx_deleted_functions + cxx_noexcept + cxx_nullptr + cxx_right_angle_brackets + cxx_rvalue_references + cxx_variadic_templates) + endif() + endif() + + _GTK2_FIND_INCLUDE_DIR(GLIBMM glibmm.h) + _GTK2_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h) + _GTK2_FIND_LIBRARY (GLIBMM glibmm true true) + _GTK2_ADD_TARGET (GLIBMM GTK2_DEPENDS gobject sigc++ glib) + + _GTK2_FIND_INCLUDE_DIR(GIOMM giomm.h) + _GTK2_FIND_INCLUDE_DIR(GIOMMCONFIG giommconfig.h) + _GTK2_FIND_LIBRARY (GIOMM giomm true true) + _GTK2_ADD_TARGET (GIOMM GTK2_DEPENDS gio glibmm gobject sigc++ glib) + + _GTK2_FIND_INCLUDE_DIR(ATKMM atkmm.h) + _GTK2_FIND_LIBRARY (ATKMM atkmm true true) + _GTK2_ADD_TARGET (ATKMM GTK2_DEPENDS atk glibmm gobject sigc++ glib) + + _GTK2_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h) + _GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h) + _GTK2_FIND_LIBRARY (CAIROMM cairomm true true) + _GTK2_ADD_TARGET (CAIROMM GTK2_DEPENDS cairo sigc++ + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) + + _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h) + _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) + _GTK2_FIND_LIBRARY (PANGOMM pangomm true true) + _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm sigc++ pango gobject glib + GTK2_OPTIONAL_DEPENDS cairomm pangocairo cairo + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) + + _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h) + _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) + _GTK2_FIND_LIBRARY (GDKMM gdkmm true true) + _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) + + _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h) + _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) + _GTK2_FIND_LIBRARY (GTKMM gtkmm true true) + _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) + + elseif(_GTK2_component STREQUAL "glade") + + _GTK2_FIND_INCLUDE_DIR(GLADE glade/glade.h) + _GTK2_FIND_LIBRARY (GLADE glade false true) + _GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 gdk_pixbuf pango gobject glib + GTK2_OPTIONAL_DEPENDS pangocairo cairo + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) + + elseif(_GTK2_component STREQUAL "glademm") + + _GTK2_FIND_INCLUDE_DIR(GLADEMM libglademm.h) + _GTK2_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h) + _GTK2_FIND_LIBRARY (GLADEMM glademm true true) + _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK2_FONTCONFIG_INCLUDE_DIR} + ${GTK2_X11_INCLUDE_DIR}) + + else() + message(FATAL_ERROR "Unknown GTK2 component ${_component}") + endif() +endforeach() + +# +# Solve for the GTK2 version if we haven't already +# +if(NOT GTK2_FIND_VERSION AND GTK2_GTK_INCLUDE_DIR) + _GTK2_GET_VERSION(GTK2_MAJOR_VERSION + GTK2_MINOR_VERSION + GTK2_PATCH_VERSION + ${GTK2_GTK_INCLUDE_DIR}/gtk/gtkversion.h) + set(GTK2_VERSION ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION}) +endif() + +# +# Try to enforce components +# + +set(_GTK2_did_we_find_everything true) # This gets set to GTK2_FOUND + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + +foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) + string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER) + + set(GTK2_${_COMPONENT_UPPER}_FIND_QUIETLY ${GTK2_FIND_QUIETLY}) + + set(FPHSA_NAME_MISMATCHED 1) + if(_GTK2_component STREQUAL "gtk") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found." + GTK2_GTK_LIBRARY + GTK2_GTK_INCLUDE_DIR + + GTK2_GDK_INCLUDE_DIR + GTK2_GDKCONFIG_INCLUDE_DIR + GTK2_GDK_LIBRARY + + GTK2_GLIB_INCLUDE_DIR + GTK2_GLIBCONFIG_INCLUDE_DIR + GTK2_GLIB_LIBRARY + ) + elseif(_GTK2_component STREQUAL "gtkmm") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found." + GTK2_GTKMM_LIBRARY + GTK2_GTKMM_INCLUDE_DIR + GTK2_GTKMMCONFIG_INCLUDE_DIR + + GTK2_GDKMM_INCLUDE_DIR + GTK2_GDKMMCONFIG_INCLUDE_DIR + GTK2_GDKMM_LIBRARY + + GTK2_GLIBMM_INCLUDE_DIR + GTK2_GLIBMMCONFIG_INCLUDE_DIR + GTK2_GLIBMM_LIBRARY + + FREETYPE_INCLUDE_DIR_ft2build + FREETYPE_INCLUDE_DIR_freetype2 + ) + elseif(_GTK2_component STREQUAL "glade") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found." + GTK2_GLADE_LIBRARY + GTK2_GLADE_INCLUDE_DIR + ) + elseif(_GTK2_component STREQUAL "glademm") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glademm library was not found." + GTK2_GLADEMM_LIBRARY + GTK2_GLADEMM_INCLUDE_DIR + GTK2_GLADEMMCONFIG_INCLUDE_DIR + ) + endif() + unset(FPHSA_NAME_MISMATCHED) + + if(NOT GTK2_${_COMPONENT_UPPER}_FOUND) + set(_GTK2_did_we_find_everything false) + endif() +endforeach() + +if(GTK2_USE_IMPORTED_TARGETS) + set(GTK2_LIBRARIES ${GTK2_TARGETS}) +endif() + + +if(_GTK2_did_we_find_everything AND NOT GTK2_VERSION_CHECK_FAILED) + set(GTK2_FOUND true) +else() + # Unset our variables. + set(GTK2_FOUND false) + set(GTK2_VERSION) + set(GTK2_VERSION_MAJOR) + set(GTK2_VERSION_MINOR) + set(GTK2_VERSION_PATCH) + set(GTK2_INCLUDE_DIRS) + set(GTK2_LIBRARIES) + set(GTK2_TARGETS) + set(GTK2_DEFINITIONS) +endif() + +if(GTK2_INCLUDE_DIRS) + list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS) +endif() diff --git a/games/vegastrike/cmake/FindPackageHandleStandardArgs.cmake b/games/vegastrike/cmake/FindPackageHandleStandardArgs.cmake new file mode 100644 index 0000000000..4fb08259a0 --- /dev/null +++ b/games/vegastrike/cmake/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,466 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPackageHandleStandardArgs +----------------------------- + +This module provides a function intended to be used in :ref:`Find Modules` +implementing :command:`find_package(<PackageName>)` calls. It handles the +``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``. +It also sets the ``<PackageName>_FOUND`` variable. The package is +considered found if all variables listed contain valid results, e.g. +valid filepaths. + +.. command:: find_package_handle_standard_args + + There are two signatures:: + + find_package_handle_standard_args(<PackageName> + (DEFAULT_MSG|<custom-failure-message>) + <required-var>... + ) + + find_package_handle_standard_args(<PackageName> + [FOUND_VAR <result-var>] + [REQUIRED_VARS <required-var>...] + [VERSION_VAR <version-var>] + [HANDLE_COMPONENTS] + [CONFIG_MODE] + [NAME_MISMATCHED] + [REASON_FAILURE_MESSAGE <reason-failure-message>] + [FAIL_MESSAGE <custom-failure-message>] + ) + + The ``<PackageName>_FOUND`` variable will be set to ``TRUE`` if all + the variables ``<required-var>...`` are valid and any optional + constraints are satisfied, and ``FALSE`` otherwise. A success or + failure message may be displayed based on the results and on + whether the ``REQUIRED`` and/or ``QUIET`` option was given to + the :command:`find_package` call. + + The options are: + + ``(DEFAULT_MSG|<custom-failure-message>)`` + In the simple signature this specifies the failure message. + Use ``DEFAULT_MSG`` to ask for a default message to be computed + (recommended). Not valid in the full signature. + + ``FOUND_VAR <result-var>`` + Obsolete. Specifies either ``<PackageName>_FOUND`` or + ``<PACKAGENAME>_FOUND`` as the result variable. This exists only + for compatibility with older versions of CMake and is now ignored. + Result variables of both names are always set for compatibility. + + ``REQUIRED_VARS <required-var>...`` + Specify the variables which are required for this package. + These may be named in the generated failure message asking the + user to set the missing variable values. Therefore these should + typically be cache entries such as ``FOO_LIBRARY`` and not output + variables like ``FOO_LIBRARIES``. This option is mandatory if + ``HANDLE_COMPONENTS`` is not specified. + + ``VERSION_VAR <version-var>`` + Specify the name of a variable that holds the version of the package + that has been found. This version will be checked against the + (potentially) specified required version given to the + :command:`find_package` call, including its ``EXACT`` option. + The default messages include information about the required + version and the version which has been actually found, both + if the version is ok or not. + + ``HANDLE_COMPONENTS`` + Enable handling of package components. In this case, the command + will report which components have been found and which are missing, + and the ``<PackageName>_FOUND`` variable will be set to ``FALSE`` + if any of the required components (i.e. not the ones listed after + the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are + missing. + + ``CONFIG_MODE`` + Specify that the calling find module is a wrapper around a + call to ``find_package(<PackageName> NO_MODULE)``. This implies + a ``VERSION_VAR`` value of ``<PackageName>_VERSION``. The command + will automatically check whether the package configuration file + was found. + + ``REASON_FAILURE_MESSAGE <reason-failure-message>`` + Specify a custom message of the reason for the failure which will be + appended to the default generated message. + + ``FAIL_MESSAGE <custom-failure-message>`` + Specify a custom failure message instead of using the default + generated message. Not recommended. + + ``NAME_MISMATCHED`` + Indicate that the ``<PackageName>`` does not match + ``${CMAKE_FIND_PACKAGE_NAME}``. This is usually a mistake and raises a + warning, but it may be intentional for usage of the command for components + of a larger package. + +Example for the simple signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibXml2 DEFAULT_MSG + LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) + +The ``LibXml2`` package is considered to be found if both +``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid. +Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found +and ``REQUIRED`` was used, it fails with a +:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was +used or not. If it is found, success will be reported, including +the content of the first ``<required-var>``. On repeated CMake runs, +the same message will not be printed again. + +.. note:: + + If ``<PackageName>`` does not match ``CMAKE_FIND_PACKAGE_NAME`` for the + calling module, a warning that there is a mismatch is given. The + ``FPHSA_NAME_MISMATCHED`` variable may be set to bypass the warning if using + the old signature and the ``NAME_MISMATCHED`` argument using the new + signature. To avoid forcing the caller to require newer versions of CMake for + usage, the variable's value will be used if defined when the + ``NAME_MISMATCHED`` argument is not passed for the new signature (but using + both is an error).. + +Example for the full signature: + +.. code-block:: cmake + + find_package_handle_standard_args(LibArchive + REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR + VERSION_VAR LibArchive_VERSION) + +In this case, the ``LibArchive`` package is considered to be found if +both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid. +Also the version of ``LibArchive`` will be checked by using the version +contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given, +the default messages will be printed. + +Another example for the full signature: + +.. code-block:: cmake + + find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) + find_package_handle_standard_args(Automoc4 CONFIG_MODE) + +In this case, a ``FindAutmoc4.cmake`` module wraps a call to +``find_package(Automoc4 NO_MODULE)`` and adds an additional search +directory for ``automoc4``. Then the call to +``find_package_handle_standard_args`` produces a proper success/failure +message. +#]=======================================================================] + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) + +# internal helper macro +macro(_FPHSA_FAILURE_MESSAGE _msg) + set (__msg "${_msg}") + if (FPHSA_REASON_FAILURE_MESSAGE) + string(APPEND __msg "\n Reason given by package: ${FPHSA_REASON_FAILURE_MESSAGE}\n") + endif() + if (${_NAME}_FIND_REQUIRED) + message(FATAL_ERROR "${__msg}") + else () + if (NOT ${_NAME}_FIND_QUIETLY) + message(STATUS "${__msg}") + endif () + endif () +endmacro() + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # <PackageName>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + if(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + else() + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + if(${_NAME}_CONSIDERED_CONFIGS) + set(configsText "") + list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + math(EXPR configsCount "${configsCount} - 1") + foreach(currentConfigIndex RANGE ${configsCount}) + list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + string(APPEND configsText "\n ${filename} (version ${version})") + endforeach() + if (${_NAME}_NOT_FOUND_MESSAGE) + if (FPHSA_REASON_FAILURE_MESSAGE) + string(PREPEND FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}\n ") + else() + set(FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}") + endif() + else() + string(APPEND configsText "\n") + endif() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:${configsText}") + + else() + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + endif() + endif() +endmacro() + + +function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + + # Set up the arguments for `cmake_parse_arguments`. + set(options CONFIG_MODE HANDLE_COMPONENTS NAME_MISMATCHED) + set(oneValueArgs FAIL_MESSAGE REASON_FAILURE_MESSAGE VERSION_VAR FOUND_VAR) + set(multiValueArgs REQUIRED_VARS) + + # Check whether we are in 'simple' or 'extended' mode: + set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + unset(FPHSA_NAME_MISMATCHED_override) + if (DEFINED FPHSA_NAME_MISMATCHED) + # If the variable NAME_MISMATCHED variable is set, error if it is passed as + # an argument. The former is for old signatures, the latter is for new + # signatures. + list(FIND ARGN "NAME_MISMATCHED" name_mismatched_idx) + if (NOT name_mismatched_idx EQUAL "-1") + message(FATAL_ERROR + "The `NAME_MISMATCHED` argument may only be specified by the argument or " + "the variable, not both.") + endif () + + # But use the variable if it is not an argument to avoid forcing minimum + # CMake version bumps for calling modules. + set(FPHSA_NAME_MISMATCHED_override "${FPHSA_NAME_MISMATCHED}") + endif () + + if(${INDEX} EQUAL -1) + set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + set(FPHSA_REQUIRED_VARS ${ARGN}) + set(FPHSA_VERSION_VAR) + else() + cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + if(FPHSA_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT FPHSA_FAIL_MESSAGE) + set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + endif() + + # In config-mode, we rely on the variable <PackageName>_CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + if(FPHSA_CONFIG_MODE) + list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + set(FPHSA_VERSION_VAR ${_NAME}_VERSION) + endif() + + if(NOT FPHSA_REQUIRED_VARS AND NOT FPHSA_HANDLE_COMPONENTS) + message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + endif() + endif() + + if (DEFINED FPHSA_NAME_MISMATCHED_override) + set(FPHSA_NAME_MISMATCHED "${FPHSA_NAME_MISMATCHED_override}") + endif () + + if (DEFINED CMAKE_FIND_PACKAGE_NAME + AND NOT FPHSA_NAME_MISMATCHED + AND NOT _NAME STREQUAL CMAKE_FIND_PACKAGE_NAME) + message(AUTHOR_WARNING + "The package name passed to `find_package_handle_standard_args` " + "(${_NAME}) does not match the name of the calling package " + "(${CMAKE_FIND_PACKAGE_NAME}). This can lead to problems in calling " + "code that expects `find_package` result variables (e.g., `_FOUND`) " + "to follow a certain pattern.") + endif () + +# now that we collected all arguments, process them + + if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG") + set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + endif() + + if (FPHSA_REQUIRED_VARS) + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + endif() + + string(TOUPPER ${_NAME} _NAME_UPPER) + string(TOLOWER ${_NAME} _NAME_LOWER) + + if(FPHSA_FOUND_VAR) + set(_FOUND_VAR_UPPER ${_NAME_UPPER}_FOUND) + set(_FOUND_VAR_MIXED ${_NAME}_FOUND) + if(FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_MIXED OR FPHSA_FOUND_VAR STREQUAL _FOUND_VAR_UPPER) + set(_FOUND_VAR ${FPHSA_FOUND_VAR}) + else() + message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_FOUND_VAR_MIXED}\" and \"${_FOUND_VAR_UPPER}\" are valid names.") + endif() + else() + set(_FOUND_VAR ${_NAME_UPPER}_FOUND) + endif() + + # collect all variables which were not found, so they can be printed, so the + # user knows better what went wrong (#6375) + set(MISSING_VARS "") + set(DETAILS "") + # check if all passed variables are valid + set(FPHSA_FOUND_${_NAME} TRUE) + foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + if(NOT ${_CURRENT_VAR}) + set(FPHSA_FOUND_${_NAME} FALSE) + string(APPEND MISSING_VARS " ${_CURRENT_VAR}") + else() + string(APPEND DETAILS "[${${_CURRENT_VAR}}]") + endif() + endforeach() + if(FPHSA_FOUND_${_NAME}) + set(${_NAME}_FOUND TRUE) + set(${_NAME_UPPER}_FOUND TRUE) + else() + set(${_NAME}_FOUND FALSE) + set(${_NAME_UPPER}_FOUND FALSE) + endif() + + # component handling + unset(FOUND_COMPONENTS_MSG) + unset(MISSING_COMPONENTS_MSG) + + if(FPHSA_HANDLE_COMPONENTS) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(${_NAME}_${comp}_FOUND) + + if(NOT DEFINED FOUND_COMPONENTS_MSG) + set(FOUND_COMPONENTS_MSG "found components:") + endif() + string(APPEND FOUND_COMPONENTS_MSG " ${comp}") + + else() + + if(NOT DEFINED MISSING_COMPONENTS_MSG) + set(MISSING_COMPONENTS_MSG "missing components:") + endif() + string(APPEND MISSING_COMPONENTS_MSG " ${comp}") + + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + string(APPEND MISSING_VARS " ${comp}") + endif() + + endif() + endforeach() + set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") + string(APPEND DETAILS "[c${COMPONENT_MSG}]") + endif() + + # version handling: + set(VERSION_MSG "") + set(VERSION_OK TRUE) + + # check with DEFINED here as the requested or found version may be "0" + if (DEFINED ${_NAME}_FIND_VERSION) + if(DEFINED ${FPHSA_VERSION_VAR}) + set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}}) + + if(${_NAME}_FIND_VERSION_EXACT) # exact version required + # count the dots in the version string + string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}") + # add one dot because there is one dot more than there are components + string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS) + if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT) + # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT + # is at most 4 here. Therefore a simple lookup table is used. + if (${_NAME}_FIND_VERSION_COUNT EQUAL 1) + set(_VERSION_REGEX "[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2) + set(_VERSION_REGEX "[^.]*\\.[^.]*") + elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3) + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*") + else () + set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*") + endif () + string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}") + unset(_VERSION_REGEX) + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") + endif () + unset(_VERSION_HEAD) + else () + if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")") + endif () + endif () + unset(_VERSION_DOTS) + + else() # minimum version specified: + if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION) + set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + set(VERSION_OK FALSE) + else () + set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")") + endif () + endif() + + else() + + # if the package was not found, but a version was given, add that to the output: + if(${_NAME}_FIND_VERSION_EXACT) + set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + else() + set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + endif() + + endif() + else () + # Check with DEFINED as the found version may be 0. + if(DEFINED ${FPHSA_VERSION_VAR}) + set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")") + endif() + endif () + + if(VERSION_OK) + string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]") + else() + set(${_NAME}_FOUND FALSE) + endif() + + + # print the result: + if (${_NAME}_FOUND) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}") + else () + + if(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + else() + if(NOT VERSION_OK) + set(RESULT_MSG) + if (_FIRST_REQUIRED_VAR) + string (APPEND RESULT_MSG "found ${${_FIRST_REQUIRED_VAR}}") + endif() + if (COMPONENT_MSG) + if (RESULT_MSG) + string (APPEND RESULT_MSG ", ") + endif() + string (APPEND RESULT_MSG "${FOUND_COMPONENTS_MSG}") + endif() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (${RESULT_MSG})") + else() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}") + endif() + endif() + + endif () + + set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) + set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE) +endfunction() diff --git a/games/vegastrike/cmake/FindPackageMessage.cmake b/games/vegastrike/cmake/FindPackageMessage.cmake new file mode 100644 index 0000000000..0628b98169 --- /dev/null +++ b/games/vegastrike/cmake/FindPackageMessage.cmake @@ -0,0 +1,48 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPackageMessage +------------------ + +.. code-block:: cmake + + find_package_message(<name> "message for user" "find result details") + +This function is intended to be used in FindXXX.cmake modules files. +It will print a message once for each unique find result. This is +useful for telling the user where a package was found. The first +argument specifies the name (XXX) of the package. The second argument +specifies the message to display. The third argument lists details +about the find result so that if they change the message will be +displayed again. The macro also obeys the QUIET argument to the +find_package command. + +Example: + +.. code-block:: cmake + + if(X11_FOUND) + find_package_message(X11 "Found X11: ${X11_X11_LIB}" + "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") + else() + ... + endif() +#]=======================================================================] + +function(find_package_message pkg msg details) + # Avoid printing a message repeatedly for the same find result. + if(NOT ${pkg}_FIND_QUIETLY) + string(REPLACE "\n" "" details "${details}") + set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg}) + if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}") + # The message has not yet been printed. + message(STATUS "${msg}") + + # Save the find details in the cache to avoid printing the same + # message again. + set("${DETAILS_VAR}" "${details}" + CACHE INTERNAL "Details about finding ${pkg}") + endif() + endif() +endfunction() diff --git a/games/vegastrike/cmake/SelectLibraryConfigurations.cmake b/games/vegastrike/cmake/SelectLibraryConfigurations.cmake new file mode 100644 index 0000000000..4c0e9a8c0a --- /dev/null +++ b/games/vegastrike/cmake/SelectLibraryConfigurations.cmake @@ -0,0 +1,80 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +SelectLibraryConfigurations +--------------------------- + +.. code-block:: cmake + + select_library_configurations(basename) + +This macro takes a library base name as an argument, and will choose +good values for the variables + +:: + + basename_LIBRARY + basename_LIBRARIES + basename_LIBRARY_DEBUG + basename_LIBRARY_RELEASE + +depending on what has been found and set. + +If only ``basename_LIBRARY_RELEASE`` is defined, ``basename_LIBRARY`` will +be set to the release value, and ``basename_LIBRARY_DEBUG`` will be set +to ``basename_LIBRARY_DEBUG-NOTFOUND``. If only ``basename_LIBRARY_DEBUG`` +is defined, then ``basename_LIBRARY`` will take the debug value, and +``basename_LIBRARY_RELEASE`` will be set to ``basename_LIBRARY_RELEASE-NOTFOUND``. + +If the generator supports configuration types, then ``basename_LIBRARY`` +and ``basename_LIBRARIES`` will be set with debug and optimized flags +specifying the library to be used for the given configuration. If no +build type has been set or the generator in use does not support +configuration types, then ``basename_LIBRARY`` and ``basename_LIBRARIES`` +will take only the release value, or the debug value if the release one +is not set. +#]=======================================================================] + +# This macro was adapted from the FindQt4 CMake module and is maintained by Will +# Dicharry <wdicharry@stellarscience.com>. + +macro(select_library_configurations basename) + if(NOT ${basename}_LIBRARY_RELEASE) + set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + if(NOT ${basename}_LIBRARY_DEBUG) + set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.") + endif() + + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND + NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND + ( _isMultiConfig OR CMAKE_BUILD_TYPE ) ) + # if the generator is multi-config or if CMAKE_BUILD_TYPE is set for + # single-config generators, set optimized and debug libraries + set( ${basename}_LIBRARY "" ) + foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE ) + list( APPEND ${basename}_LIBRARY optimized "${_libname}" ) + endforeach() + foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG ) + list( APPEND ${basename}_LIBRARY debug "${_libname}" ) + endforeach() + elseif( ${basename}_LIBRARY_RELEASE ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + elseif( ${basename}_LIBRARY_DEBUG ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} ) + else() + set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND") + endif() + + set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" ) + + if( ${basename}_LIBRARY ) + set( ${basename}_FOUND TRUE ) + endif() + + mark_as_advanced( ${basename}_LIBRARY_RELEASE + ${basename}_LIBRARY_DEBUG + ) +endmacro() diff --git a/games/vegastrike/patches/patch-0.5.1.r1_2 b/games/vegastrike/patches/patch-0.5.1.r1_2 index 7780674c0c..8f6d622177 100644 --- a/games/vegastrike/patches/patch-0.5.1.r1_2 +++ b/games/vegastrike/patches/patch-0.5.1.r1_2 @@ -1,6 +1,6 @@ -diff -ruN ./CMakeLists.txt ../c/CMakeLists.txt +diff -ruN ./CMakeLists.txt ../b/CMakeLists.txt --- ./CMakeLists.txt 2012-03-26 02:50:49.000000000 +0200 -+++ ../c/CMakeLists.txt 2020-09-03 16:25:55.870086658 +0200 ++++ ../b/CMakeLists.txt 2020-09-02 22:37:20.707393347 +0200 @@ -10,7 +10,7 @@ project (vsUTCS) @@ -10,7 +10,56 @@ diff -ruN ./CMakeLists.txt ../c/CMakeLists.txt include_directories(${vsUTCS_SOURCE_DIR}/src ${vsUTCS_SOURCE_DIR}/src/cmd -@@ -828,33 +828,33 @@ +@@ -685,14 +685,42 @@ + SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${vsUTCS_SOURCE_DIR}) + + +-find_package(PythonLibs REQUIRED) +-IF(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH) +- SET(TST_INCLUDES ${PYTHON_INCLUDE_PATH}) ++#find_package(PythonLibs REQUIRED) ++#IF(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH) ++# SET(TST_INCLUDES ${PYTHON_INCLUDE_PATH}) ++# SET(TST_LIBS ${PYTHON_LIBRARIES}) ++# SET(HAVE_PYTHON 1) ++#ELSE(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH) ++# message(FATAL_ERROR "Can't find python") ++#ENDIF(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH) ++ ++# Python 3 has a SASL compatibility issue which causes an error ++# on some installations that prefer Python 3 ++# -- Python 2.7 is default for now ++OPTION(USE_PYTHON_3 "Use Python 3 instead of Python 2.7 (default is 2.7)" OFF) ++IF (USE_PYTHON_3) ++ # We want at least Python 3.4, but we prefer newer versions ++ SET(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 3.5 3.4) ++ELSE (USE_PYTHON_3) ++ SET(Python_ADDITIONAL_VERSIONS 2.7) ++ENDIF (USE_PYTHON_3) ++# If we don't unset cache variables ++# ccmake won't pick up changes to the USE_PYTHON_3 option ++UNSET(PYTHON_INCLUDE_DIR CACHE) ++UNSET(PYTHON_LIBRARY CACHE) ++# The python version we want is set via Python_ADDITIONAL_VERSIONS ++MESSAGE("++ Python release(s) searched for : ${Python_ADDITIONAL_VERSIONS}") ++FIND_PACKAGE(PythonLibs REQUIRED) ++MESSAGE("++ Python library : ${PYTHON_LIBRARY} (${PYTHONLIBS_VERSION_STRING})") ++MESSAGE("++ Python include dir : ${PYTHON_INCLUDE_DIR}") ++IF (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS) ++ SET(TST_INCLUDES ${PYTHON_INCLUDE_DIRS}) + SET(TST_LIBS ${PYTHON_LIBRARIES}) + SET(HAVE_PYTHON 1) +-ELSE(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH) +- message(FATAL_ERROR "Can't find python") +-ENDIF(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH) ++ELSE (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS) ++ MESSAGE(FATAL_ERROR "Can't find python") ++ENDIF (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS) ++ + + # Find Boost with boost_python library + OPTION(USE_SYSTEM_BOOST "Use system boost" OFF) +@@ -828,33 +856,33 @@ #Find FFMpeg @@ -68,7 +117,7 @@ diff -ruN ./CMakeLists.txt ../c/CMakeLists.txt IF(NOT BEOS) FIND_LIBRARY(UTIL_LIB util) -@@ -977,12 +977,12 @@ +@@ -977,12 +1005,12 @@ HAVE_AVFORMAT_H HAVE_AVCODEC_H HAVE_AVIO_H @@ -86,9 +135,9 @@ diff -ruN ./CMakeLists.txt ../c/CMakeLists.txt GTK2_ATK_INCLUDE_DIR GTK2_ATK_LIBRARY GTK2_CAIRO_INCLUDE_DIR -diff -ruN ./objconv/basemaker/base_maker_texture.cpp ../c/objconv/basemaker/base_maker_texture.cpp +diff -ruN ./objconv/basemaker/base_maker_texture.cpp ../b/objconv/basemaker/base_maker_texture.cpp --- ./objconv/basemaker/base_maker_texture.cpp 2010-03-10 03:56:23.000000000 +0100 -+++ ../c/objconv/basemaker/base_maker_texture.cpp 2020-09-03 16:25:55.871086646 +0200 ++++ ../b/objconv/basemaker/base_maker_texture.cpp 2020-09-02 15:08:07.760351554 +0200 @@ -6,9 +6,12 @@ #define XMD_H #define HAVE_BOOLEAN @@ -102,9 +151,9 @@ diff -ruN ./objconv/basemaker/base_maker_texture.cpp ../c/objconv/basemaker/base } #define strip_16 true -diff -ruN ./objconv/mesher/to_OgreMesh.cpp ../c/objconv/mesher/to_OgreMesh.cpp +diff -ruN ./objconv/mesher/to_OgreMesh.cpp ../b/objconv/mesher/to_OgreMesh.cpp --- ./objconv/mesher/to_OgreMesh.cpp 2011-06-02 01:47:36.000000000 +0200 -+++ ../c/objconv/mesher/to_OgreMesh.cpp 2020-09-03 16:25:55.872086633 +0200 ++++ ../b/objconv/mesher/to_OgreMesh.cpp 2020-09-02 15:08:07.762351529 +0200 @@ -1078,10 +1078,15 @@ Ogre::VertexDeclaration *newDcl = data->vertexDeclaration->getAutoOrganisedDeclaration( @@ -187,9 +236,9 @@ diff -ruN ./objconv/mesher/to_OgreMesh.cpp ../c/objconv/mesher/to_OgreMesh.cpp void DoneMeshes( void *outputcontext ) { -diff -ruN ./objconv/mesher/to_OgreMesh.h ../c/objconv/mesher/to_OgreMesh.h +diff -ruN ./objconv/mesher/to_OgreMesh.h ../b/objconv/mesher/to_OgreMesh.h --- ./objconv/mesher/to_OgreMesh.h 2010-02-25 16:22:25.000000000 +0100 -+++ ../c/objconv/mesher/to_OgreMesh.h 2020-09-03 16:25:55.873086621 +0200 ++++ ../b/objconv/mesher/to_OgreMesh.h 2020-09-02 15:08:07.763351517 +0200 @@ -20,7 +20,7 @@ float RadialSize( void *outputcontext ); //returns the size of the resulting mesh (it's maximum distance from 0,0,0). Useful for LODding. @@ -199,9 +248,9 @@ diff -ruN ./objconv/mesher/to_OgreMesh.h ../c/objconv/mesher/to_OgreMesh.h void AutoEdgeList( void *outputcontext ); //a good idea - prepares the mesh for stencil shadows void AutoTangents( void *outputcontext ); //prepares the mesh for normal mapping (only needed if the material uses normal mapping) } -diff -ruN ./setup/src/c/setup.cpp ../c/setup/src/c/setup.cpp +diff -ruN ./setup/src/c/setup.cpp ../b/setup/src/c/setup.cpp --- ./setup/src/c/setup.cpp 2011-03-15 01:28:47.000000000 +0100 -+++ ../c/setup/src/c/setup.cpp 2020-09-03 16:25:55.873086621 +0200 ++++ ../b/setup/src/c/setup.cpp 2020-09-02 15:08:07.764351504 +0200 @@ -110,10 +110,22 @@ return 1; } @@ -250,9 +299,9 @@ diff -ruN ./setup/src/c/setup.cpp ../c/setup/src/c/setup.cpp //Win32 data should be "." char tmppath[16384]; for (vector< string >::iterator vsit = data_paths.begin(); vsit != data_paths.end(); vsit++) { -diff -ruN ./setup/src/include/central.cpp ../c/setup/src/include/central.cpp +diff -ruN ./setup/src/include/central.cpp ../b/setup/src/include/central.cpp --- ./setup/src/include/central.cpp 2004-10-25 04:27:13.000000000 +0200 -+++ ../c/setup/src/include/central.cpp 2020-09-03 17:45:35.786329482 +0200 ++++ ../b/setup/src/include/central.cpp 2020-09-03 02:22:34.948442084 +0200 @@ -20,6 +20,8 @@ struct group GROUPS; struct global_settings CONFIG; @@ -271,9 +320,9 @@ diff -ruN ./setup/src/include/central.cpp ../c/setup/src/include/central.cpp } struct catagory *GetCatStruct(char *name) { -diff -ruN ./src/cmd/music.cpp ../c/src/cmd/music.cpp +diff -ruN ./src/cmd/music.cpp ../b/src/cmd/music.cpp --- ./src/cmd/music.cpp 2012-03-19 09:20:14.000000000 +0100 -+++ ../c/src/cmd/music.cpp 2020-09-03 16:25:55.874086608 +0200 ++++ ../b/src/cmd/music.cpp 2020-09-02 15:08:07.765351492 +0200 @@ -448,7 +448,9 @@ if (foundcache) { *me->music_load_info = wherecache->second; @@ -285,9 +334,9 @@ diff -ruN ./src/cmd/music.cpp ../c/src/cmd/music.cpp } if (me->freeWav && docacheme) { me->freeWav = false; -diff -ruN ./src/cmd/unit.cpp ../c/src/cmd/unit.cpp +diff -ruN ./src/cmd/unit.cpp ../b/src/cmd/unit.cpp --- ./src/cmd/unit.cpp 2012-03-19 09:20:14.000000000 +0100 -+++ ../c/src/cmd/unit.cpp 2020-09-03 16:25:55.875086596 +0200 ++++ ../b/src/cmd/unit.cpp 2020-09-02 15:56:51.644797969 +0200 @@ -80,6 +80,7 @@ template < class UnitType >GameUnit< UnitType >::GameUnit( int ) : sparkle_accum( 0 ) , phalos( new HaloSystem() ) @@ -311,9 +360,9 @@ diff -ruN ./src/cmd/unit.cpp ../c/src/cmd/unit.cpp } template < class UnitType >GameUnit< UnitType >::~GameUnit() -diff -ruN ./src/cmd/unit_collide.h ../c/src/cmd/unit_collide.h +diff -ruN ./src/cmd/unit_collide.h ../b/src/cmd/unit_collide.h --- ./src/cmd/unit_collide.h 2012-03-19 09:20:14.000000000 +0100 -+++ ../c/src/cmd/unit_collide.h 2020-09-03 17:34:09.178913256 +0200 ++++ ../b/src/cmd/unit_collide.h 2020-09-02 21:27:47.524565312 +0200 @@ -94,9 +94,9 @@ { if ( !hugeobjects.empty() ) @@ -326,9 +375,30 @@ diff -ruN ./src/cmd/unit_collide.h ../c/src/cmd/unit_collide.h hb.clear(); acc_huge.clear(); act_huge.clear(); -diff -ruN ./src/cmd/unit_generic.cpp ../c/src/cmd/unit_generic.cpp +diff -ruN ./src/cmd/unit_generic.cpp ../b/src/cmd/unit_generic.cpp --- ./src/cmd/unit_generic.cpp 2012-03-19 09:20:14.000000000 +0100 -+++ ../c/src/cmd/unit_generic.cpp 2020-09-03 16:25:55.879086546 +0200 ++++ ../b/src/cmd/unit_generic.cpp 2020-09-02 21:47:36.695698627 +0200 +@@ -630,13 +630,13 @@ + jump.drive = -1; + } + +-float copysign( float x, float y ) +-{ +- if (y > 0) +- return x; +- else +- return -x; +-} ++//float copysign( float x, float y ) ++//{ ++// if (y > 0) ++// return x; ++// else ++// return -x; ++//} + + float rand01() + { @@ -4903,16 +4903,26 @@ static const string LOAD_FAILED = "LOAD_FAILED"; @@ -423,9 +493,9 @@ diff -ruN ./src/cmd/unit_generic.cpp ../c/src/cmd/unit_generic.cpp if (tmpammo > mounts[jmod].ammo) { cancompletefully = true; if (touchme) -diff -ruN ./src/cmd/unit_jump.h ../c/src/cmd/unit_jump.h +diff -ruN ./src/cmd/unit_jump.h ../b/src/cmd/unit_jump.h --- ./src/cmd/unit_jump.h 2012-03-19 09:20:14.000000000 +0100 -+++ ../c/src/cmd/unit_jump.h 2020-09-03 16:25:55.880086533 +0200 ++++ ../b/src/cmd/unit_jump.h 2020-09-02 15:08:07.766351479 +0200 @@ -108,7 +108,7 @@ (tester = *i) != NULL; ++i)
if (tester->isUnit() == UNITPTR && tester != this)
@@ -435,9 +505,21 @@ diff -ruN ./src/cmd/unit_jump.h ../c/src/cmd/unit_jump.h *( 4*( this->rSize()+tester->rSize() ) ) );
DealPossibleJumpDamage( this );
static int jumparrive = AUDCreateSound( vs_config->getVariable( "unitaudio", "jumparrive", "sfx43.wav" ), false );
-diff -ruN ./src/gfx/cockpit_xml.cpp ../c/src/gfx/cockpit_xml.cpp +diff -ruN ./src/cmd/unit_physics.h ../b/src/cmd/unit_physics.h +--- ./src/cmd/unit_physics.h 2012-03-19 09:20:14.000000000 +0100 ++++ ../b/src/cmd/unit_physics.h 2020-09-03 00:27:15.498947107 +0200 +@@ -41,7 +41,7 @@ + #include "networking/lowlevel/vsnet_clientstate.h"
+ #include "networking/netclient.h"
+
+-extern float copysign( float x, float y );
++//extern float copysign( float x, float y );
+
+ extern unsigned int apply_float_to_unsigned_int( float tmp ); //short fix
+
+diff -ruN ./src/gfx/cockpit_xml.cpp ../b/src/gfx/cockpit_xml.cpp --- ./src/gfx/cockpit_xml.cpp 2010-12-15 09:53:40.000000000 +0100 -+++ ../c/src/gfx/cockpit_xml.cpp 2020-09-03 16:30:00.313030701 +0200 ++++ ../b/src/gfx/cockpit_xml.cpp 2020-09-03 00:14:13.810719555 +0200 @@ -315,7 +315,7 @@ for (counter = 0; counter < 4; ++counter) if (!replaced[counter]) { @@ -447,9 +529,9 @@ diff -ruN ./src/gfx/cockpit_xml.cpp ../c/src/gfx/cockpit_xml.cpp } break; case UnitImages< void >::SHIELD4: -diff -ruN ./src/gfx/quadsquare.cpp ../c/src/gfx/quadsquare.cpp +diff -ruN ./src/gfx/quadsquare.cpp ../b/src/gfx/quadsquare.cpp --- ./src/gfx/quadsquare.cpp 2010-03-10 06:27:01.000000000 +0100 -+++ ../c/src/gfx/quadsquare.cpp 2020-09-03 16:25:55.881086521 +0200 ++++ ../b/src/gfx/quadsquare.cpp 2020-09-02 15:08:07.767351467 +0200 @@ -13,9 +13,9 @@ #include <float.h> #include <math.h> @@ -461,9 +543,9 @@ diff -ruN ./src/gfx/quadsquare.cpp ../c/src/gfx/quadsquare.cpp using std::vector; unsigned int*quadsquare::VertexAllocated; -diff -ruN ./src/gui/text_area.cpp ../c/src/gui/text_area.cpp +diff -ruN ./src/gui/text_area.cpp ../b/src/gui/text_area.cpp --- ./src/gui/text_area.cpp 2010-02-25 15:26:53.000000000 +0100 -+++ ../c/src/gui/text_area.cpp 2020-09-03 17:46:51.883378138 +0200 ++++ ../b/src/gui/text_area.cpp 2020-09-03 00:05:06.687559535 +0200 @@ -32,6 +32,8 @@ * }; */ @@ -482,9 +564,9 @@ diff -ruN ./src/gui/text_area.cpp ../c/src/gui/text_area.cpp if (type == 1) return search->name; else return search->description; -diff -ruN ./src/networking/lowlevel/packetmem.cpp ../c/src/networking/lowlevel/packetmem.cpp +diff -ruN ./src/networking/lowlevel/packetmem.cpp ../b/src/networking/lowlevel/packetmem.cpp --- ./src/networking/lowlevel/packetmem.cpp 2008-03-31 10:20:19.000000000 +0200 -+++ ../c/src/networking/lowlevel/packetmem.cpp 2020-09-03 16:25:55.881086521 +0200 ++++ ../b/src/networking/lowlevel/packetmem.cpp 2020-09-02 15:08:07.768351454 +0200 @@ -102,7 +102,7 @@ } else @@ -494,9 +576,21 @@ diff -ruN ./src/networking/lowlevel/packetmem.cpp ../c/src/networking/lowlevel/p _len = 0; } } -diff -ruN ./src/pk3.cpp ../c/src/pk3.cpp +diff -ruN ./src/physics.h ../b/src/physics.h +--- ./src/physics.h 2011-02-12 04:19:03.000000000 +0100 ++++ ../b/src/physics.h 2020-09-02 21:32:31.049020768 +0200 +@@ -27,7 +27,7 @@ + static const float oocc = (float) 0.0000000000000000111265005605; //1/c^2 + static const float c = (float) 299792458.0; + static const float co10 = (float) 29979245.8; +-float copysign( float x, float y ); ++//float copysign( float x, float y ); + + struct Force + { +diff -ruN ./src/pk3.cpp ../b/src/pk3.cpp --- ./src/pk3.cpp 2012-03-19 09:20:14.000000000 +0100 -+++ ../c/src/pk3.cpp 2020-09-03 16:31:12.819124250 +0200 ++++ ../b/src/pk3.cpp 2020-09-02 23:06:42.933362491 +0200 @@ -356,7 +356,7 @@ } //if the file isn't in the archive @@ -506,9 +600,59 @@ diff -ruN ./src/pk3.cpp ../c/src/pk3.cpp int flength = GetFileLen( index ); buffer = new char[flength]; -diff -ruN ./src/vsfilesystem.cpp ../c/src/vsfilesystem.cpp +diff -ruN ./src/python/python_compile.h ../b/src/python/python_compile.h +--- ./src/python/python_compile.h 2010-02-25 16:44:43.000000000 +0100 ++++ ../b/src/python/python_compile.h 2020-09-02 21:07:32.272758050 +0200 +@@ -10,6 +10,7 @@ + #include "hashtable.h" + #include <string> + #include <compile.h> ++#include <boost/version.hpp> + + extern Hashtable< std::string, PyCodeObject, 1023 >compiled_python; + +@@ -40,8 +41,11 @@ + switch (type) + { + case MYSTRING: ++#if BOOST_VERSION <= 104500 + return PyString_FromString( objects.c_str() ); +- ++#else ++ return PyUnicode_FromString( objects.c_str() ); ++#endif + case MYLONG: + return PyLong_FromLong( objecti ); + +diff -ruN ./src/ship_commands.cpp ../b/src/ship_commands.cpp +--- ./src/ship_commands.cpp 2012-03-19 09:20:14.000000000 +0100 ++++ ../b/src/ship_commands.cpp 2020-09-03 00:11:42.010617317 +0200 +@@ -5,14 +5,14 @@ + #include "universe_util.h" + #include "gldrv/winsys.h" + +-static inline float fmin( float a, float b ) +-{ +- return (a < b) ? a : b; +-} +-static inline float fmax( float a, float b ) +-{ +- return (a > b) ? a : b; +-} ++//static inline float fmin( float a, float b ) ++//{ ++// return (a < b) ? a : b; ++//} ++//static inline float fmax( float a, float b ) ++//{ ++// return (a > b) ? a : b; ++//} + + class ShipCommands + { +diff -ruN ./src/vsfilesystem.cpp ../b/src/vsfilesystem.cpp --- ./src/vsfilesystem.cpp 2012-03-19 09:20:14.000000000 +0100 -+++ ../c/src/vsfilesystem.cpp 2020-09-03 16:25:55.882086508 +0200 ++++ ../b/src/vsfilesystem.cpp 2020-09-02 16:02:24.060642199 +0200 @@ -460,13 +460,15 @@ int vs_fprintf( FILE *fp, const char *format, ... ) diff --git a/games/vegastrike/vegastrike.SlackBuild b/games/vegastrike/vegastrike.SlackBuild index 77f7eebd21..4842fca4e9 100644 --- a/games/vegastrike/vegastrike.SlackBuild +++ b/games/vegastrike/vegastrike.SlackBuild @@ -84,6 +84,8 @@ tar xvf $CWD/$PRGSRCNAME$PRGSRCSUF cd $PRGSRCNAME +cp "$CWD/cmake"/*.cmake . + declare patchdir="$CWD/patches" patch -p0 < "$patchdir/patch-${VERSION}_$BUILD" @@ -113,6 +115,8 @@ cmake \ -DCMAKE_INSTALL_DOCDIR=/usr/doc/$PRGNAM-$VERSION \ -DCMAKE_SYSTEM_PROCESSOR=$ARCH \ -DDISABLE_SERVER=${DISABLE_SERVER:-ON} \ + -DUSE_SYSTEM_BOOST=${USE_SYSTEM_BOOST:-ON} \ + -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD:-11} \ .. make |