Initial Commit
This commit is contained in:
100
externals/cmake-modules/CitraHandleSystemLibs.cmake
vendored
Normal file
100
externals/cmake-modules/CitraHandleSystemLibs.cmake
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
option(USE_SYSTEM_LIBS "Use system libraries over bundled ones" OFF)
|
||||
|
||||
# System library options
|
||||
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_QT "Use the system Qt lib (instead of the bundled one)" OFF "ENABLE_QT;MSVC OR APPLE" ON)
|
||||
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF)
|
||||
option(USE_SYSTEM_SDL2 "Use the system SDL2 lib (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_BOOST "Use the system Boost libs (instead of the bundled ones)" OFF)
|
||||
option(USE_SYSTEM_OPENSSL "Use the system OpenSSL libs (instead of the bundled LibreSSL)" OFF)
|
||||
option(USE_SYSTEM_LIBUSB "Use the system libusb (instead of the bundled libusb)" OFF)
|
||||
option(USE_SYSTEM_CPP_JWT "Use the system cpp-jwt (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_SOUNDTOUCH "Use the system SoundTouch (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_CPP_HTTPLIB "Use the system cpp-httplib (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_JSON "Use the system JSON (nlohmann-json3) package (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_DYNARMIC "Use the system dynarmic (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_FMT "Use the system fmt (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_XBYAK "Use the system xbyak (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_INIH "Use the system inih (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_FFMPEG_HEADERS "Use the system FFmpeg headers (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_GLSLANG "Use the system glslang and SPIR-V libraries (instead of the bundled ones)" OFF)
|
||||
option(USE_SYSTEM_ZSTD "Use the system Zstandard library (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_ENET "Use the system libenet (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_CRYPTOPP "Use the system cryptopp (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_CUBEB "Use the system cubeb (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_LODEPNG "Use the system lodepng (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_OPENAL "Use the system OpenAL (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_VMA "Use the system VulkanMemoryAllocator (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_VULKAN_HEADERS "Use the system Vulkan headers (instead of the bundled ones)" OFF)
|
||||
option(USE_SYSTEM_CATCH2 "Use the system Catch2 (instead of the bundled one)" OFF)
|
||||
|
||||
# Qt and MoltenVK are handled separately
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_SDL2 "Disable system SDL2" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_BOOST "Disable system Boost" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_OPENSSL "Disable system OpenSSL" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_LIBUSB "Disable system LibUSB" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CPP_JWT "Disable system cpp-jwt" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_SOUNDTOUCH "Disable system SoundTouch" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CPP_HTTPLIB "Disable system cpp-httplib" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_JSON "Disable system JSON" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_DYNARMIC "Disable system Dynarmic" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_FMT "Disable system fmt" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_XBYAK "Disable system xbyak" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_INIH "Disable system inih" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_FFMPEG_HEADERS "Disable system ffmpeg" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_GLSLANG "Disable system glslang" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_ZSTD "Disable system Zstandard" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_ENET "Disable system libenet" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CRYPTOPP "Disable system cryptopp" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CUBEB "Disable system cubeb" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_LODEPNG "Disable system lodepng" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_OPENAL "Disable system OpenAL" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_VMA "Disable system VulkanMemoryAllocator" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_VULKAN_HEADERS "Disable system Vulkan headers" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CATCH2 "Disable system Catch2" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
|
||||
set(LIB_VAR_LIST
|
||||
SDL2
|
||||
BOOST
|
||||
OPENSSL
|
||||
LIBUSB
|
||||
CPP_JWT
|
||||
SOUNDTOUCH
|
||||
CPP_HTTPLIB
|
||||
JSON
|
||||
DYNARMIC
|
||||
FMT
|
||||
XBYAK
|
||||
INIH
|
||||
FFMPEG_HEADERS
|
||||
GLSLANG
|
||||
ZSTD
|
||||
ENET
|
||||
CRYPTOPP
|
||||
CUBEB
|
||||
LODEPNG
|
||||
OPENAL
|
||||
VMA
|
||||
VULKAN_HEADERS
|
||||
CATCH2
|
||||
)
|
||||
|
||||
# First, check that USE_SYSTEM_XXX is not used with USE_SYSTEM_LIBS
|
||||
|
||||
if(USE_SYSTEM_LIBS)
|
||||
foreach(CURRENT_LIB IN LISTS LIB_VAR_LIST)
|
||||
if(USE_SYSTEM_${CURRENT_LIB})
|
||||
unset(USE_SYSTEM_${CURRENT_LIB})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Next, set which libraries to use
|
||||
|
||||
foreach(CURRENT_LIB IN LISTS LIB_VAR_LIST)
|
||||
if(NOT DISABLE_SYSTEM_${CURRENT_LIB})
|
||||
set(USE_SYSTEM_${CURRENT_LIB} ON CACHE BOOL "Using system ${CURRENT_LIB}" FORCE)
|
||||
else()
|
||||
# Explicitly disable this in case of multiple CMake invocations
|
||||
set(USE_SYSTEM_${CURRENT_LIB} OFF CACHE BOOL "Using system ${CURRENT_LIB}" FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
46
externals/cmake-modules/FindCppHttp.cmake
vendored
Normal file
46
externals/cmake-modules/FindCppHttp.cmake
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
if(NOT CppHttp_FOUND)
|
||||
pkg_check_modules(CPP_HTTPLIB cpp-httplib)
|
||||
|
||||
if (CPP_HTTPLIB_FOUND)
|
||||
find_path(HTTPLIB_INCLUDE_DIR NAMES httplib.h
|
||||
PATHS
|
||||
${CPP_HTTPLIB_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(HTTPLIB_LIBRARY NAMES cpp-httplib
|
||||
PATHS
|
||||
${CPP_HTTPLIB_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
set(HTTPLIB_VERSION ${CPP_HTTPLIB_VERSION})
|
||||
|
||||
if (NOT TARGET cpp-httplib::cpp-httplib)
|
||||
add_library(cpp-httplib::cpp-httplib INTERFACE IMPORTED)
|
||||
set_target_properties(cpp-httplib::cpp-httplib PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${HTTPLIB_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${HTTPLIB_LIBRARY}"
|
||||
IMPORTED_LOCATION "${HTTPLIB_LIBRARY}"
|
||||
)
|
||||
add_library(httplib::httplib ALIAS cpp-httplib::cpp-httplib)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Cpp-httplib not found via pkg-config, trying CMake...")
|
||||
find_package(httplib)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(CppHttp REQUIRED_VARS HTTPLIB_INCLUDE_DIR HTTPLIB_LIBRARY VERSION_VAR HTTPLIB_VERSION)
|
||||
|
||||
endif()
|
||||
|
||||
if(CppHttp_FOUND AND NOT TARGET cpp-httplib::cpp-httplib)
|
||||
add_library(cpp-httplib::cpp-httplib INTERFACE IMPORTED)
|
||||
set_target_properties(cpp-httplib::cpp-httplib PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CPP-HTTP_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${CPP-HTTP_LIBRARIES}"
|
||||
IMPORTED_LOCATION "${CPP-HTTP_LIBRARIES}"
|
||||
)
|
||||
endif()
|
43
externals/cmake-modules/FindLibUSB.cmake
vendored
Normal file
43
externals/cmake-modules/FindLibUSB.cmake
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
# - Find libusb-1.0 library
|
||||
# This module defines
|
||||
# LIBUSB_INCLUDE_DIR, where to find bluetooth.h
|
||||
# LIBUSB_LIBRARIES, the libraries needed to use libusb-1.0.
|
||||
# LIBUSB_FOUND, If false, do not try to use libusb-1.0.
|
||||
#
|
||||
# Copyright (c) 2009, Michal Cihar, <michal@cihar.com>
|
||||
#
|
||||
# vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
if(ANDROID)
|
||||
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "libusb-1.0 not found.")
|
||||
elseif (NOT LIBUSB_FOUND)
|
||||
pkg_check_modules (LIBUSB_PKG libusb-1.0)
|
||||
|
||||
find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
|
||||
PATHS
|
||||
${LIBUSB_PKG_INCLUDE_DIRS}
|
||||
/usr/include/libusb-1.0
|
||||
/usr/include
|
||||
/usr/local/include/libusb-1.0
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb
|
||||
PATHS
|
||||
${LIBUSB_PKG_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
|
||||
else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
|
||||
message(STATUS "libusb-1.0 not found.")
|
||||
endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
|
||||
|
||||
mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
|
||||
endif ()
|
||||
|
36
externals/cmake-modules/FindOpenAL.cmake
vendored
Normal file
36
externals/cmake-modules/FindOpenAL.cmake
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
if(NOT OPENAL_FOUND)
|
||||
pkg_check_modules(OPENAL_TMP openal)
|
||||
|
||||
find_path(OPENAL_INCLUDE_DIRS NAMES al.h
|
||||
PATHS
|
||||
${OPENAL_TMP_INCLUDE_DIRS}
|
||||
/usr/include/AL
|
||||
/usr/include
|
||||
/usr/local/include/AL
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(OPENAL_LIBRARY_DIRS NAMES openal
|
||||
PATHS
|
||||
${OPENAL_TMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(OPENAL_INCLUDE_DIRS AND OPENAL_LIBRARY_DIRS)
|
||||
set(OPENAL_FOUND TRUE CACHE INTERNAL "OpenAL found")
|
||||
message(STATUS "Found OpenAL: ${OPENAL_LIBRARY_DIRS}, ${OPENAL_INCLUDE_DIRS}")
|
||||
else()
|
||||
set(OPENAL_FOUND FALSE CACHE INTERNAL "OpenAL found")
|
||||
message(STATUS "OpenAL not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL)
|
||||
add_library(OpenAL::OpenAL UNKNOWN IMPORTED)
|
||||
set_target_properties(OpenAL::OpenAL PROPERTIES
|
||||
INCLUDE_DIRECTORIES ${OPENAL_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES ${OPENAL_LIBRARY_DIRS}
|
||||
IMPORTED_LOCATION ${OPENAL_LIBRARY_DIRS}
|
||||
)
|
||||
endif()
|
240
externals/cmake-modules/FindSDL2.cmake
vendored
Normal file
240
externals/cmake-modules/FindSDL2.cmake
vendored
Normal file
@ -0,0 +1,240 @@
|
||||
|
||||
# This module defines
|
||||
# SDL2_LIBRARY, the name of the library to link against
|
||||
# SDL2_FOUND, if false, do not try to link to SDL2
|
||||
# SDL2_INCLUDE_DIR, where to find SDL.h
|
||||
# SDL2_DLL_DIR, where to find SDL2.dll if it exists
|
||||
#
|
||||
# This module responds to the the flag:
|
||||
# SDL2_BUILDING_LIBRARY
|
||||
# If this is defined, then no SDL2main will be linked in because
|
||||
# only applications need main().
|
||||
# Otherwise, it is assumed you are building an application and this
|
||||
# module will attempt to locate and set the the proper link flags
|
||||
# as part of the returned SDL2_LIBRARY variable.
|
||||
#
|
||||
# Don't forget to include SDLmain.h and SDLmain.m your project for the
|
||||
# OS X framework based version. (Other versions link to -lSDL2main which
|
||||
# this module will try to find on your behalf.) Also for OS X, this
|
||||
# module will automatically add the -framework Cocoa on your behalf.
|
||||
#
|
||||
#
|
||||
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
|
||||
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
|
||||
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
|
||||
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
|
||||
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
|
||||
# as appropriate. These values are used to generate the final SDL2_LIBRARY
|
||||
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
|
||||
#
|
||||
#
|
||||
# $SDL2DIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$SDL2DIR
|
||||
# used in building SDL2.
|
||||
# l.e.galup 9-20-02
|
||||
#
|
||||
# Modified by Eric Wing.
|
||||
# Added code to assist with automated building by using environmental variables
|
||||
# and providing a more controlled/consistent search behavior.
|
||||
# Added new modifications to recognize OS X frameworks and
|
||||
# additional Unix paths (FreeBSD, etc).
|
||||
# Also corrected the header search path to follow "proper" SDL guidelines.
|
||||
# Added a search for SDL2main which is needed by some platforms.
|
||||
# Added a search for threads which is needed by some platforms.
|
||||
# Added needed compile switches for MinGW.
|
||||
#
|
||||
# On OSX, this will prefer the Framework version (if found) over others.
|
||||
# People will have to manually change the cache values of
|
||||
# SDL2_LIBRARY to override this selection or set the CMake environment
|
||||
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||
#
|
||||
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
|
||||
# This needed to change because "proper" SDL convention
|
||||
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
|
||||
# reasons because not all systems place things in SDL2/ (see FreeBSD).
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2003-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License").
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# CMake - Cross Platform Makefile Generator
|
||||
# Copyright 2000-2016 Kitware, Inc.
|
||||
# Copyright 2000-2011 Insight Software Consortium
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
# nor the names of their contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# The above copyright and license notice applies to distributions of
|
||||
# CMake in source and binary form. Some source files contain additional
|
||||
# notices of original copyright by their contributors; see each source
|
||||
# for details. Third-party software packages supplied with CMake under
|
||||
# compatible licenses provide their own copyright notices documented in
|
||||
# corresponding subdirectories.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# CMake was initially developed by Kitware with the following sponsorship:
|
||||
#
|
||||
# * National Library of Medicine at the National Institutes of Health
|
||||
# as part of the Insight Segmentation and Registration Toolkit (ITK).
|
||||
#
|
||||
# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
|
||||
# Visualization Initiative.
|
||||
#
|
||||
# * National Alliance for Medical Image Computing (NAMIC) is funded by the
|
||||
# National Institutes of Health through the NIH Roadmap for Medical Research,
|
||||
# Grant U54 EB005149.
|
||||
#
|
||||
# * Kitware, Inc.
|
||||
#
|
||||
|
||||
message("<FindSDL2.cmake>")
|
||||
|
||||
SET(SDL2_SEARCH_PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/usr/include/SDL # Budgie
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
${SDL2_PATH}
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(VC_LIB_PATH_SUFFIX lib/x64)
|
||||
else()
|
||||
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||
endif()
|
||||
|
||||
FIND_LIBRARY(SDL2_LIBRARY_TEMP
|
||||
NAMES SDL2
|
||||
HINTS
|
||||
$ENV{SDL2DIR}
|
||||
PATH_SUFFIXES lib64 lib ${VC_LIB_PATH_SUFFIX}
|
||||
PATHS ${SDL2_SEARCH_PATHS}
|
||||
)
|
||||
|
||||
IF(SDL2_LIBRARY_TEMP)
|
||||
if(MSVC)
|
||||
get_filename_component(SDL2_DLL_DIR_TEMP ${SDL2_LIBRARY_TEMP} DIRECTORY)
|
||||
if(EXISTS ${SDL2_DLL_DIR_TEMP}/SDL2.dll)
|
||||
set(SDL2_DLL_DIR ${SDL2_DLL_DIR_TEMP})
|
||||
unset(SDL2_DLL_DIR_TEMP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
|
||||
HINTS
|
||||
$ENV{SDL2DIR}
|
||||
PATH_SUFFIXES include/SDL2 include
|
||||
PATHS ${SDL2_SEARCH_PATHS}
|
||||
)
|
||||
|
||||
IF(NOT SDL2_BUILDING_LIBRARY)
|
||||
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
||||
# Non-OS X framework versions expect you to also dynamically link to
|
||||
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
|
||||
# seem to provide SDL2main for compatibility even though they don't
|
||||
# necessarily need it.
|
||||
FIND_LIBRARY(SDL2MAIN_LIBRARY
|
||||
NAMES SDL2main
|
||||
HINTS
|
||||
$ENV{SDL2DIR}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${SDL2_SEARCH_PATHS}
|
||||
)
|
||||
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
||||
ENDIF(NOT SDL2_BUILDING_LIBRARY)
|
||||
|
||||
# SDL2 may require threads on your system.
|
||||
# The Apple build may not need an explicit flag because one of the
|
||||
# frameworks may already provide it.
|
||||
# But for non-OSX systems, I will use the CMake Threads package.
|
||||
IF(NOT APPLE)
|
||||
FIND_PACKAGE(Threads)
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
# MinGW needs an additional library, mwindows
|
||||
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
|
||||
# (Actually on second look, I think it only needs one of the m* libraries.)
|
||||
IF(MINGW)
|
||||
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
|
||||
ENDIF(MINGW)
|
||||
|
||||
# For SDL2main
|
||||
IF(NOT SDL2_BUILDING_LIBRARY)
|
||||
IF(SDL2MAIN_LIBRARY)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||
ENDIF(SDL2MAIN_LIBRARY)
|
||||
ENDIF(NOT SDL2_BUILDING_LIBRARY)
|
||||
|
||||
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
|
||||
# CMake doesn't display the -framework Cocoa string in the UI even
|
||||
# though it actually is there if I modify a pre-used variable.
|
||||
# I think it has something to do with the CACHE STRING.
|
||||
# So I use a temporary variable until the end so I can set the
|
||||
# "real" variable in one-shot.
|
||||
IF(APPLE)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
|
||||
ENDIF(APPLE)
|
||||
|
||||
# For threads, as mentioned Apple doesn't need this.
|
||||
# In fact, there seems to be a problem if I used the Threads package
|
||||
# and try using this line, so I'm just skipping it entirely for OS X.
|
||||
IF(NOT APPLE)
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
# For MinGW library
|
||||
IF(MINGW)
|
||||
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||
ENDIF(MINGW)
|
||||
|
||||
# Set the final string here so the GUI reflects the final state.
|
||||
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
|
||||
|
||||
# Unset the temp variable to INTERNAL so it is not seen in the CMake GUI
|
||||
UNSET(SDL2_LIBRARY_TEMP)
|
||||
ENDIF(SDL2_LIBRARY_TEMP)
|
||||
|
||||
message("</FindSDL2.cmake>")
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
|
27
externals/cmake-modules/FindSoundTouch.cmake
vendored
Normal file
27
externals/cmake-modules/FindSoundTouch.cmake
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
if(NOT SOUNDTOUCH_FOUND)
|
||||
pkg_check_modules(SOUNDTOUCH_TMP soundtouch)
|
||||
|
||||
find_path(SOUNDTOUCH_INCLUDE_DIRS NAMES SoundTouch.h
|
||||
PATHS
|
||||
${SOUNDTOUCH_TMP_INCLUDE_DIRS}
|
||||
/usr/include/soundtouch
|
||||
/usr/include
|
||||
/usr/local/include/soundtouch
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(SOUNDTOUCH_LIBRARIES NAMES SoundTouch
|
||||
PATHS
|
||||
${SOUNDTOUCH_TMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(SOUNDTOUCH_INCLUDE_DIRS AND SOUNDTOUCH_LIBRARIES)
|
||||
set(SOUNDTOUCH_FOUND TRUE CACHE INTERNAL "SoundTouch found")
|
||||
message(STATUS "Found SoundTouch: ${SOUNDTOUCH_INCLUDE_DIRS}, ${SOUNDTOUCH_LIBRARIES}")
|
||||
else()
|
||||
set(SOUNDTOUCH_FOUND FALSE CACHE INTERNAL "SoundTouch found")
|
||||
message(STATUS "SoundTouch not found.")
|
||||
endif()
|
||||
endif()
|
35
externals/cmake-modules/Findcryptopp.cmake
vendored
Normal file
35
externals/cmake-modules/Findcryptopp.cmake
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
if(NOT CRYPTOPP_FOUND)
|
||||
pkg_search_module(CRYPTOPP_TMP crypto++ cryptopp)
|
||||
|
||||
find_path(CRYPTOPP_INCLUDE_DIRS NAMES cryptlib.h
|
||||
PATHS
|
||||
${CRYPTOPP_TMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
PATH_SUFFIXES crypto++ cryptopp
|
||||
)
|
||||
|
||||
find_library(CRYPTOPP_LIBRARY_DIRS NAMES crypto++ cryptopp
|
||||
PATHS
|
||||
${CRYPTOPP_TMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(CRYPTOPP_INCLUDE_DIRS AND CRYPTOPP_LIBRARY_DIRS)
|
||||
set(CRYPTOPP_FOUND TRUE CACHE INTERNAL "Found cryptopp")
|
||||
message(STATUS "Found cryptopp: ${CRYPTOPP_LIBRARY_DIRS}, ${CRYPTOPP_INCLUDE_DIRS}")
|
||||
else()
|
||||
set(CRYPTOPP_FOUND FALSE CACHE INTERNAL "Found cryptopp")
|
||||
message(STATUS "Cryptopp not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CRYPTOPP_FOUND AND NOT TARGET cryptopp::cryptopp)
|
||||
add_library(cryptopp::cryptopp UNKNOWN IMPORTED)
|
||||
set_target_properties(cryptopp::cryptopp PROPERTIES
|
||||
INCLUDE_DIRECTORIES ${CRYPTOPP_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES ${CRYPTOPP_LIBRARY_DIRS}
|
||||
IMPORTED_LOCATION ${CRYPTOPP_LIBRARY_DIRS}
|
||||
)
|
||||
endif()
|
63
externals/cmake-modules/Findinih.cmake
vendored
Normal file
63
externals/cmake-modules/Findinih.cmake
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
if(NOT inih_FOUND)
|
||||
# Inih includes both a base library and INIReader
|
||||
# We must link against both to avoid linker errors.
|
||||
|
||||
pkg_check_modules(INIR_TEMP INIReader)
|
||||
pkg_check_modules(INIH_TEMP inih)
|
||||
|
||||
|
||||
find_path(INIR_INCLUDE_DIR NAMES INIReader.h
|
||||
PATHS
|
||||
${INIR_TEMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_path(INIH_INCLUDE_DIR NAMES ini.h
|
||||
PATHS
|
||||
${INIH_TEMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/use/local/include
|
||||
)
|
||||
|
||||
find_library(INIR_LIBRARIES NAMES INIReader
|
||||
PATHS
|
||||
${INIR_TEMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
find_library(INIH_LIBRARIES NAMES inih
|
||||
PATHS
|
||||
${INIH_TEMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(INIR_INCLUDE_DIR AND INIH_INCLUDE_DIR AND INIR_LIBRARIES AND INIH_LIBRARIES)
|
||||
set(inih_FOUND TRUE CACHE INTERNAL "Found inih library")
|
||||
message(STATUS "Found inih ${INIR_INCLUDE_DIR} ${INIH_INCLUDE_DIR} ${INIR_LIBRARIES} ${INIH_LIBRARIES}")
|
||||
else()
|
||||
set(inih_FOUND FALSE CACHE INTERNAL "Found inih library")
|
||||
message(STATUS "Inih not found.")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(inih_FOUND AND NOT TARGET inih::inir OR NOT TARGET inih::inih)
|
||||
add_library(inih::inir INTERFACE IMPORTED)
|
||||
set_target_properties(inih::inir PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INIR_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${INIR_LIBRARIES}"
|
||||
IMPORTED_LOCATION "${INIR_LIBRARIES}"
|
||||
)
|
||||
|
||||
add_library(inih::inih INTERFACE IMPORTED)
|
||||
set_target_properties(inih::inih PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INIH_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${INIH_LIBRARES}"
|
||||
IMPORTED_LOCATION ${INIH_LIBRARIES}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
34
externals/cmake-modules/Findlibenet.cmake
vendored
Normal file
34
externals/cmake-modules/Findlibenet.cmake
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
if(NOT libenet_FOUND)
|
||||
pkg_check_modules(ENET_TMP libenet)
|
||||
|
||||
find_path(libenet_INCLUDE_DIRS NAMES enet.h PATH_SUFFIXES enet
|
||||
PATHS
|
||||
${ENET_TMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(libenet_LIBRARY_DIRS NAMES enet
|
||||
PATHS
|
||||
${ENET_TMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(libenet_INCLUDE_DIRS AND libenet_LIBRARY_DIRS)
|
||||
set(libenet_FOUND TRUE CACHE INTERNAL "Found libenet")
|
||||
message(STATUS "Found libenet ${libenet_LIBRARY_DIRS}, ${libenet_INCLUDE_DIRS}")
|
||||
else()
|
||||
set(libenet_FOUND FALSE CACHE INTERNAL "Found libenet")
|
||||
message(STATUS "Libenet not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(libenet_FOUND AND NOT TARGET libenet::libenet)
|
||||
add_library(libenet::libenet UNKNOWN IMPORTED)
|
||||
set_target_properties(libenet::libenet PROPERTIES
|
||||
INCLUDE_DIRECTORIES ${libenet_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES ${libenet_LIBRARY_DIRS}
|
||||
IMPORTED_LOCATION ${libenet_LIBRARY_DIRS}
|
||||
)
|
||||
endif()
|
31
externals/cmake-modules/Findlodepng.cmake
vendored
Normal file
31
externals/cmake-modules/Findlodepng.cmake
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
if(NOT LODEPNG_FOUND)
|
||||
find_path(LODEPNG_INCLUDE_DIRS NAMES lodepng.h
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(LODEPNG_LIBRARY_DIRS NAMES lodepng
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(LODEPNG_INCLUDE_DIRS AND LODEPNG_LIBRARY_DIRS)
|
||||
set(LODEPNG_FOUND TRUE CACHE INTERNAL "Found lodepng")
|
||||
message(STATUS "Found lodepng: ${LODEPNG_LIBRARY_DIRS}, ${LODEPNG_INCLUDE_DIRS}")
|
||||
else()
|
||||
set(LODEPNG_FOUND FALSE CACHE INTERNAL "Found lodepng")
|
||||
message(STATUS "Lodepng not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LODEPNG_FOUND AND NOT TARGET lodepng::lodepng)
|
||||
add_library(lodepng::lodepng UNKNOWN IMPORTED)
|
||||
set_target_properties(lodepng::lodepng PROPERTIES
|
||||
INCLUDE_DIRECTORIES ${LODEPNG_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES ${LODEPNG_LIBRARY_DIRS}
|
||||
IMPORTED_LOCATION ${LODEPNG_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
endif()
|
158
externals/cmake-modules/GetGitRevisionDescription.cmake
vendored
Normal file
158
externals/cmake-modules/GetGitRevisionDescription.cmake
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
endwhile()
|
||||
# check if this is a submodule
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
|
||||
endif()
|
||||
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_branch_name _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_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_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
#get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
#if(NOT hash)
|
||||
# set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
# return()
|
||||
#endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
42
externals/cmake-modules/GetGitRevisionDescription.cmake.in
vendored
Normal file
42
externals/cmake-modules/GetGitRevisionDescription.cmake.in
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
#
|
||||
# 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)
|
||||
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
set(HEAD_HASH "${HEAD_REF}")
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
if(EXISTS "@GIT_DATA@/head-ref")
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
else()
|
||||
set(HEAD_HASH "Unknown")
|
||||
endif()
|
||||
endif()
|
Reference in New Issue
Block a user