Browse Source

Initial scaffolding for Hunter package support.

simd
Pascal Thomet 8 years ago committed by Vladimír Vondruš
parent
commit
91b41a7297
  1. 10
      CMakeLists.txt
  2. 36
      package/hunter/HunterAddPackages.cmake
  3. 46
      package/hunter/HunterInit.cmake

10
CMakeLists.txt

@ -49,8 +49,18 @@ endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.4.0 AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
set(LANG CXX)
endif()
option(HUNTER_ENABLED "Get dependencies (Corrade, GLFW, SDL2, ...) via Hunter" OFF)
if(HUNTER_ENABLED)
include(${CMAKE_CURRENT_LIST_DIR}/package/hunter/HunterInit.cmake)
endif()
project(Magnum ${LANG})
if(HUNTER_ENABLED)
include(${CMAKE_CURRENT_LIST_DIR}/package/hunter/HunterAddPackages.cmake)
endif()
# Use folders for nice tree in Visual Studio and XCode
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

36
package/hunter/HunterAddPackages.cmake

@ -0,0 +1,36 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
# Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2018 Pascal Thomet <pthomet@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
hunter_add_package(corrade)
if(WITH_GLFWAPPLICATION)
hunter_add_package(glfw)
endif()
if(WITH_SDL2APPLICATION)
hunter_add_package(SDL2)
endif()
if(WITH_AUDIO)
hunter_add_package(OpenAL)
endif()

46
package/hunter/HunterInit.cmake

@ -0,0 +1,46 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
# Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2018 Pascal Thomet <pthomet@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
set(_HUNTER_GATE_FILE ${CMAKE_CURRENT_BINARY_DIR}/HunterGate.cmake)
if(NOT EXISTS ${_HUNTER_GATE_FILE})
file(DOWNLOAD
https://raw.githubusercontent.com/hunter-packages/gate/c4e5b3e4d1c97fb46ae86af7f59baac95f7f1cf0/cmake/HunterGate.cmake
${_HUNTER_GATE_FILE}
EXPECTED_HASH SHA1=b59156338f5722d6ef84321c8ccef5ecf2ac24e6
STATUS _HUNTER_GATE_FILE_STATUS)
# If download fails, remove the bad file so it tries to download it again
# next time
list(GET _HUNTER_GATE_FILE_STATUS 0 _HUNTER_GATE_FILE_STATUS_CODE)
if(NOT _HUNTER_GATE_FILE_STATUS_CODE EQUAL 0)
file(REMOVE ${_HUNTER_GATE_FILE})
message(FATAL_ERROR "Error downloading HunterGate.cmake. Please retry the CMake configure step.")
endif()
endif()
include(${_HUNTER_GATE_FILE})
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.65.tar.gz"
SHA1 "00e252171605c290390a3cc90a372beeeb406d3c")
Loading…
Cancel
Save