mirror of
https://github.com/shadps4-emu/ext-cryptopp-cmake.git
synced 2024-11-26 19:10:22 +00:00
style: reformat consistently using gersemi
https://github.com/BlankSpruce/gersemi
This commit is contained in:
parent
de72309d53
commit
243569fbaa
@ -1,291 +1,237 @@
|
||||
{
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "base",
|
||||
"description": "Base preset",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||
"installDir": "${sourceDir}/out/install/${presetName}",
|
||||
"environment": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CRYPTOPP_BUILD_TESTING": "ON",
|
||||
"USE_CCACHE": "ON"
|
||||
}
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "base",
|
||||
"description": "Base preset",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||
"installDir": "${sourceDir}/out/install/${presetName}",
|
||||
"environment": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CRYPTOPP_BUILD_TESTING": "ON",
|
||||
"USE_CCACHE": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"description": "Debug build",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"description": "Release build",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64",
|
||||
"description": "64bit build (on windows)",
|
||||
"hidden": true,
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "compiler-clang",
|
||||
"hidden": true,
|
||||
"description": "Use clang as the C/C++ compiler",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "/usr/bin/clang",
|
||||
"CMAKE_CXX_COMPILER": "/usr/bin/clang++"
|
||||
},
|
||||
"condition": {
|
||||
"type": "inList",
|
||||
"string": "${hostSystemName}",
|
||||
"list": [
|
||||
"Linux",
|
||||
"Darwin"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "compiler-gcc",
|
||||
"hidden": true,
|
||||
"description": "Use GCC as the C/C++ compiler",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "/usr/bin/gcc",
|
||||
"CMAKE_CXX_COMPILER": "/usr/bin/g++"
|
||||
},
|
||||
"condition": {
|
||||
"type": "inList",
|
||||
"string": "${hostSystemName}",
|
||||
"list": [
|
||||
"Linux",
|
||||
"Darwin"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-windows",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": [
|
||||
"base",
|
||||
"debug",
|
||||
"x64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dev-linux",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": [
|
||||
"base",
|
||||
"debug",
|
||||
"compiler-clang"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dev-mac",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": [
|
||||
"base",
|
||||
"debug",
|
||||
"compiler-clang"
|
||||
],
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-clang",
|
||||
"description": "Basic build in a dev environment using clang",
|
||||
"inherits": [
|
||||
"base",
|
||||
"debug",
|
||||
"compiler-clang"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dev-gcc",
|
||||
"description": "Basic build in a dev environment using clang",
|
||||
"inherits": [
|
||||
"base",
|
||||
"debug",
|
||||
"compiler-gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rel-windows",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": [
|
||||
"base",
|
||||
"release",
|
||||
"x64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rel-linux",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": [
|
||||
"base",
|
||||
"release",
|
||||
"compiler-clang"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rel-mac",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": [
|
||||
"base",
|
||||
"release",
|
||||
"compiler-clang"
|
||||
],
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "dev-base",
|
||||
"hidden": true,
|
||||
"jobs": 4,
|
||||
"verbose": true
|
||||
},
|
||||
{
|
||||
"name": "dev-windows",
|
||||
"configurePreset": "dev-windows",
|
||||
"inherits": [
|
||||
"dev-base"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dev-clang",
|
||||
"configurePreset": "dev-clang",
|
||||
"inherits": [
|
||||
"dev-base"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dev-linux",
|
||||
"configurePreset": "dev-linux",
|
||||
"inherits": [
|
||||
"dev-clang"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dev-mac",
|
||||
"configurePreset": "dev-mac",
|
||||
"inherits": [
|
||||
"dev-clang"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dev-gcc",
|
||||
"configurePreset": "dev-gcc",
|
||||
"inherits": [
|
||||
"dev-base"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rel-base",
|
||||
"hidden": true,
|
||||
"jobs": 4,
|
||||
"verbose": true
|
||||
},
|
||||
{
|
||||
"name": "rel-windows",
|
||||
"configurePreset": "rel-windows",
|
||||
"inherits": [
|
||||
"rel-base"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rel-linux",
|
||||
"configurePreset": "rel-linux",
|
||||
"inherits": [
|
||||
"rel-base"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rel-mac",
|
||||
"configurePreset": "rel-mac",
|
||||
"inherits": [
|
||||
"rel-base"
|
||||
]
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "test-base",
|
||||
"description": "Enable output on failure",
|
||||
"hidden": true,
|
||||
"output": {
|
||||
"outputOnFailure": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-test-windows",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-windows"
|
||||
},
|
||||
{
|
||||
"name": "rel-test-windows",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "rel-windows"
|
||||
},
|
||||
{
|
||||
"name": "dev-test-linux",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-linux"
|
||||
},
|
||||
{
|
||||
"name": "rel-test-linux",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "rel-linux"
|
||||
},
|
||||
{
|
||||
"name": "dev-test-mac",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-mac"
|
||||
},
|
||||
{
|
||||
"name": "rel-test-mac",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "rel-mac"
|
||||
},
|
||||
{
|
||||
"name": "dev-test-clang",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-clang"
|
||||
},
|
||||
{
|
||||
"name": "dev-test-gcc",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-gcc"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"name": "debug",
|
||||
"description": "Debug build",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"description": "Release build",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64",
|
||||
"description": "64bit build (on windows)",
|
||||
"hidden": true,
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "compiler-clang",
|
||||
"hidden": true,
|
||||
"description": "Use clang as the C/C++ compiler",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "/usr/bin/clang",
|
||||
"CMAKE_CXX_COMPILER": "/usr/bin/clang++"
|
||||
},
|
||||
"condition": {
|
||||
"type": "inList",
|
||||
"string": "${hostSystemName}",
|
||||
"list": ["Linux", "Darwin"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "compiler-gcc",
|
||||
"hidden": true,
|
||||
"description": "Use GCC as the C/C++ compiler",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "/usr/bin/gcc",
|
||||
"CMAKE_CXX_COMPILER": "/usr/bin/g++"
|
||||
},
|
||||
"condition": {
|
||||
"type": "inList",
|
||||
"string": "${hostSystemName}",
|
||||
"list": ["Linux", "Darwin"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-windows",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": ["base", "debug", "x64"]
|
||||
},
|
||||
{
|
||||
"name": "dev-linux",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": ["base", "debug", "compiler-clang"]
|
||||
},
|
||||
{
|
||||
"name": "dev-mac",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": ["base", "debug", "compiler-clang"],
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-clang",
|
||||
"description": "Basic build in a dev environment using clang",
|
||||
"inherits": ["base", "debug", "compiler-clang"]
|
||||
},
|
||||
{
|
||||
"name": "dev-gcc",
|
||||
"description": "Basic build in a dev environment using clang",
|
||||
"inherits": ["base", "debug", "compiler-gcc"]
|
||||
},
|
||||
{
|
||||
"name": "rel-windows",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": ["base", "release", "x64"]
|
||||
},
|
||||
{
|
||||
"name": "rel-linux",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": ["base", "release", "compiler-clang"]
|
||||
},
|
||||
{
|
||||
"name": "rel-mac",
|
||||
"description": "Default build in a dev environment",
|
||||
"inherits": ["base", "release", "compiler-clang"],
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "dev-base",
|
||||
"hidden": true,
|
||||
"jobs": 4,
|
||||
"verbose": true
|
||||
},
|
||||
{
|
||||
"name": "dev-windows",
|
||||
"configurePreset": "dev-windows",
|
||||
"inherits": ["dev-base"]
|
||||
},
|
||||
{
|
||||
"name": "dev-clang",
|
||||
"configurePreset": "dev-clang",
|
||||
"inherits": ["dev-base"]
|
||||
},
|
||||
{
|
||||
"name": "dev-linux",
|
||||
"configurePreset": "dev-linux",
|
||||
"inherits": ["dev-clang"]
|
||||
},
|
||||
{
|
||||
"name": "dev-mac",
|
||||
"configurePreset": "dev-mac",
|
||||
"inherits": ["dev-clang"]
|
||||
},
|
||||
{
|
||||
"name": "dev-gcc",
|
||||
"configurePreset": "dev-gcc",
|
||||
"inherits": ["dev-base"]
|
||||
},
|
||||
{
|
||||
"name": "rel-base",
|
||||
"hidden": true,
|
||||
"jobs": 4,
|
||||
"verbose": true
|
||||
},
|
||||
{
|
||||
"name": "rel-windows",
|
||||
"configurePreset": "rel-windows",
|
||||
"inherits": ["rel-base"]
|
||||
},
|
||||
{
|
||||
"name": "rel-linux",
|
||||
"configurePreset": "rel-linux",
|
||||
"inherits": ["rel-base"]
|
||||
},
|
||||
{
|
||||
"name": "rel-mac",
|
||||
"configurePreset": "rel-mac",
|
||||
"inherits": ["rel-base"]
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "test-base",
|
||||
"description": "Enable output on failure",
|
||||
"hidden": true,
|
||||
"output": {
|
||||
"outputOnFailure": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev-test-windows",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-windows"
|
||||
},
|
||||
{
|
||||
"name": "rel-test-windows",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "rel-windows"
|
||||
},
|
||||
{
|
||||
"name": "dev-test-linux",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-linux"
|
||||
},
|
||||
{
|
||||
"name": "rel-test-linux",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "rel-linux"
|
||||
},
|
||||
{
|
||||
"name": "dev-test-mac",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-mac"
|
||||
},
|
||||
{
|
||||
"name": "rel-test-mac",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "rel-mac"
|
||||
},
|
||||
{
|
||||
"name": "dev-test-clang",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-clang"
|
||||
},
|
||||
{
|
||||
"name": "dev-test-gcc",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "dev-gcc"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -7,25 +7,29 @@
|
||||
set(CPM_DOWNLOAD_VERSION 0.35.5)
|
||||
|
||||
if(CPM_SOURCE_CACHE)
|
||||
# Expand relative path. This is important if the provided path contains a
|
||||
# tilde (~)
|
||||
get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE)
|
||||
set(CPM_DOWNLOAD_LOCATION
|
||||
"${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
# Expand relative path. This is important if the provided path contains a
|
||||
# tilde (~)
|
||||
get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE)
|
||||
set(CPM_DOWNLOAD_LOCATION
|
||||
"${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake"
|
||||
)
|
||||
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
|
||||
set(CPM_DOWNLOAD_LOCATION
|
||||
"$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
set(CPM_DOWNLOAD_LOCATION
|
||||
"$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake"
|
||||
)
|
||||
else()
|
||||
set(CPM_DOWNLOAD_LOCATION
|
||||
"${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
set(CPM_DOWNLOAD_LOCATION
|
||||
"${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
|
||||
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
|
||||
file(
|
||||
DOWNLOAD
|
||||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
||||
${CPM_DOWNLOAD_LOCATION})
|
||||
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
|
||||
file(
|
||||
DOWNLOAD
|
||||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
||||
${CPM_DOWNLOAD_LOCATION}
|
||||
)
|
||||
endif()
|
||||
|
||||
include(${CPM_DOWNLOAD_LOCATION})
|
||||
|
@ -10,29 +10,33 @@ include(CMakePackageConfigHelpers)
|
||||
# Generate module config files for cmake and pkgconfig
|
||||
# ------------------------------------------------------------------------------
|
||||
function(_module_cmake_config_files)
|
||||
message(STATUS "[cryptopp] Generating cmake package config files")
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cryptoppConfigVersion.cmake
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
message(STATUS "[cryptopp] Generating cmake package config files")
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cryptoppConfigVersion.cmake
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(_module_pkgconfig_files)
|
||||
message(STATUS "[cryptopp] Generating pkgconfig files")
|
||||
set(MODULE_PKGCONFIG_FILE cryptopp.pc)
|
||||
message(STATUS "[cryptopp] Generating pkgconfig files")
|
||||
set(MODULE_PKGCONFIG_FILE cryptopp.pc)
|
||||
|
||||
if(CMAKE_BUILD_TYPE EQUAL "Debug")
|
||||
get_target_property(target_debug_postfix cryptopp DEBUG_POSTFIX)
|
||||
if(${target_debug_postfix} MATCHES "-NOTFOUND$")
|
||||
set(target_debug_postfix "")
|
||||
if(CMAKE_BUILD_TYPE EQUAL "Debug")
|
||||
get_target_property(target_debug_postfix cryptopp DEBUG_POSTFIX)
|
||||
if(${target_debug_postfix} MATCHES "-NOTFOUND$")
|
||||
set(target_debug_postfix "")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(MODULE_LINK_LIBS "-lcryptopp${target_debug_postfix}")
|
||||
set(MODULE_LINK_LIBS "-lcryptopp${target_debug_postfix}")
|
||||
|
||||
configure_file(config.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${MODULE_PKGCONFIG_FILE} @ONLY)
|
||||
configure_file(
|
||||
config.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${MODULE_PKGCONFIG_FILE}
|
||||
@ONLY
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(create_module_config_files)
|
||||
_module_cmake_config_files()
|
||||
_module_pkgconfig_files()
|
||||
_module_cmake_config_files()
|
||||
_module_pkgconfig_files()
|
||||
endfunction()
|
||||
|
@ -10,23 +10,14 @@
|
||||
|
||||
find_program(CCACHE_TOOL_PATH ccache)
|
||||
|
||||
if(NOT WIN32
|
||||
AND USE_CCACHE
|
||||
AND CCACHE_TOOL_PATH)
|
||||
message(STATUS "Using ccache (${CCACHE_TOOL_PATH}) (via wrapper).")
|
||||
# see https://github.com/TheLartians/Ccache.cmake enables CCACHE support
|
||||
# through the USE_CCACHE flag possible values are: YES, NO or equivalent
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/CPM.cmake")
|
||||
cpmaddpackage("gh:TheLartians/Ccache.cmake@1.2.3")
|
||||
elseif(
|
||||
WIN32
|
||||
AND USE_CCACHE
|
||||
AND CCACHE_TOOL_PATH)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER
|
||||
${CCACHE_TOOL_PATH}
|
||||
CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER
|
||||
${CCACHE_TOOL_PATH}
|
||||
CACHE STRING "" FORCE)
|
||||
message(STATUS "Using ccache (${CCACHE_TOOL_PATH}).")
|
||||
if(NOT WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH)
|
||||
message(STATUS "Using ccache (${CCACHE_TOOL_PATH}) (via wrapper).")
|
||||
# see https://github.com/TheLartians/Ccache.cmake enables CCACHE support
|
||||
# through the USE_CCACHE flag possible values are: YES, NO or equivalent
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/CPM.cmake")
|
||||
cpmaddpackage("gh:TheLartians/Ccache.cmake@1.2.3")
|
||||
elseif(WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
|
||||
message(STATUS "Using ccache (${CCACHE_TOOL_PATH}).")
|
||||
endif()
|
||||
|
@ -5,36 +5,39 @@
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
|
||||
include(FetchContent)
|
||||
set (version_underscore "${cryptopp-cmake_VERSION_MAJOR}_${cryptopp-cmake_VERSION_MINOR}_${cryptopp-cmake_VERSION_PATCH}")
|
||||
set(version_underscore
|
||||
"${cryptopp-cmake_VERSION_MAJOR}_${cryptopp-cmake_VERSION_MINOR}_${cryptopp-cmake_VERSION_PATCH}"
|
||||
)
|
||||
if(GIT_FOUND)
|
||||
if(${CRYPTOPP_USE_MASTER_BRANCH})
|
||||
set(source_location "master")
|
||||
else()
|
||||
set(source_location
|
||||
"CRYPTOPP_${version_underscore}"
|
||||
if(${CRYPTOPP_USE_MASTER_BRANCH})
|
||||
set(source_location "master")
|
||||
else()
|
||||
set(source_location "CRYPTOPP_${version_underscore}")
|
||||
endif()
|
||||
fetchcontent_declare(
|
||||
cryptopp
|
||||
GIT_REPOSITORY ${cryptopp-cmake_HOMEPAGE_URL}
|
||||
GIT_TAG ${source_location}
|
||||
QUIET
|
||||
SOURCE_DIR
|
||||
${CRYPTOPP_INCLUDE_PREFIX}
|
||||
)
|
||||
endif()
|
||||
FetchContent_Declare(
|
||||
cryptopp
|
||||
GIT_REPOSITORY ${cryptopp-cmake_HOMEPAGE_URL}
|
||||
GIT_TAG ${source_location}
|
||||
QUIET
|
||||
SOURCE_DIR ${CRYPTOPP_INCLUDE_PREFIX})
|
||||
else()
|
||||
message(STATUS "Downloading crypto++ from URL...")
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
set(source_location "${cryptopp-cmake_HOMEPAGE_URL}/")
|
||||
if(NOT ${CRYPTOPP_USE_MASTER_BRANCH})
|
||||
string(APPEND source_location
|
||||
"releases/download/CRYPTOPP_${version_underscore}/cryptopp${cryptopp-cmake_VERSION_MAJOR}${cryptopp-cmake_VERSION_MINOR}${cryptopp-cmake_VERSION_PATCH}")
|
||||
else()
|
||||
string(APPEND source_location "archive/refs/heads/master")
|
||||
endif()
|
||||
FetchContent_Declare(
|
||||
cryptopp
|
||||
URL "${source_location}.zip"
|
||||
QUIET
|
||||
SOURCE_DIR ${CRYPTOPP_INCLUDE_PREFIX}
|
||||
)
|
||||
message(STATUS "Downloading crypto++ from URL...")
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
set(source_location "${cryptopp-cmake_HOMEPAGE_URL}/")
|
||||
if(NOT ${CRYPTOPP_USE_MASTER_BRANCH})
|
||||
string(
|
||||
APPEND
|
||||
source_location
|
||||
"releases/download/CRYPTOPP_${version_underscore}/cryptopp${cryptopp-cmake_VERSION_MAJOR}${cryptopp-cmake_VERSION_MINOR}${cryptopp-cmake_VERSION_PATCH}"
|
||||
)
|
||||
else()
|
||||
string(APPEND source_location "archive/refs/heads/master")
|
||||
endif()
|
||||
fetchcontent_declare(
|
||||
cryptopp
|
||||
URL "${source_location}.zip" QUIET SOURCE_DIR ${CRYPTOPP_INCLUDE_PREFIX}
|
||||
)
|
||||
endif()
|
||||
FetchContent_Populate(cryptopp)
|
||||
fetchcontent_populate(cryptopp)
|
||||
|
@ -30,7 +30,7 @@
|
||||
# at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
@ -39,90 +39,88 @@ set(__get_git_revision_description YES)
|
||||
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_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
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()
|
||||
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)
|
||||
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")
|
||||
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)
|
||||
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var}
|
||||
"HEAD-HASH-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe ${hash} ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe ${hash} ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
@ -19,16 +19,16 @@
|
||||
# We use this module to strip compiler options that are not really needed but
|
||||
# will cause compatibility issues with `ccache`.
|
||||
if(MSVC AND USE_CCACHE)
|
||||
# As of ccache 4.6, /Zi option automatically added by cmake is unsupported.
|
||||
# Given that we are doing ccache only in development environments (USE_CCACHE
|
||||
# controls if ccache is enabled), we can just strip that option.
|
||||
macro(strip_unwanted_options_from cmake_flags)
|
||||
if(${cmake_flags} MATCHES "/Zi")
|
||||
string(REPLACE "/Zi" "/Z7" ${cmake_flags} ${${cmake_flags}})
|
||||
endif()
|
||||
endmacro()
|
||||
strip_unwanted_options_from(CMAKE_CXX_FLAGS_DEBUG_INIT)
|
||||
strip_unwanted_options_from(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT)
|
||||
strip_unwanted_options_from(CMAKE_C_FLAGS_DEBUG_INIT)
|
||||
strip_unwanted_options_from(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT)
|
||||
# As of ccache 4.6, /Zi option automatically added by cmake is unsupported.
|
||||
# Given that we are doing ccache only in development environments (USE_CCACHE
|
||||
# controls if ccache is enabled), we can just strip that option.
|
||||
macro(strip_unwanted_options_from cmake_flags)
|
||||
if(${cmake_flags} MATCHES "/Zi")
|
||||
string(REPLACE "/Zi" "/Z7" ${cmake_flags} ${${cmake_flags}})
|
||||
endif()
|
||||
endmacro()
|
||||
strip_unwanted_options_from(CMAKE_CXX_FLAGS_DEBUG_INIT)
|
||||
strip_unwanted_options_from(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT)
|
||||
strip_unwanted_options_from(CMAKE_C_FLAGS_DEBUG_INIT)
|
||||
strip_unwanted_options_from(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT)
|
||||
endif()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,56 +13,61 @@ set(cryptopp_known_comps static shared)
|
||||
set(cryptopp_comp_static NO)
|
||||
set(cryptopp_comp_shared NO)
|
||||
foreach(cryptopp_comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
|
||||
if(cryptopp_comp IN_LIST cryptopp_known_comps)
|
||||
set(cryptopp_comp_${cryptopp_comp} YES)
|
||||
else()
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"cryptopp does not recognize component `${cryptopp_comp}`.")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
if(cryptopp_comp IN_LIST cryptopp_known_comps)
|
||||
set(cryptopp_comp_${cryptopp_comp} YES)
|
||||
else()
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"cryptopp does not recognize component `${cryptopp_comp}`."
|
||||
)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(cryptopp_comp_static AND cryptopp_comp_shared)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"cryptopp `static` and `shared` components are mutually exclusive.")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"cryptopp `static` and `shared` components are mutually exclusive."
|
||||
)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(cryptopp_static_targets
|
||||
"${CMAKE_CURRENT_LIST_DIR}/cryptopp-static-targets.cmake")
|
||||
"${CMAKE_CURRENT_LIST_DIR}/cryptopp-static-targets.cmake"
|
||||
)
|
||||
set(cryptopp_shared_targets
|
||||
"${CMAKE_CURRENT_LIST_DIR}/cryptopp-shared-targets.cmake")
|
||||
"${CMAKE_CURRENT_LIST_DIR}/cryptopp-shared-targets.cmake"
|
||||
)
|
||||
|
||||
macro(cryptopp_load_targets type)
|
||||
if(NOT EXISTS "${cryptopp_${type}_targets}")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"cryptopp `${type}` libraries were requested but not found.")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
include("${cryptopp_${type}_targets}")
|
||||
if(NOT EXISTS "${cryptopp_${type}_targets}")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"cryptopp `${type}` libraries were requested but not found."
|
||||
)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
endif()
|
||||
include("${cryptopp_${type}_targets}")
|
||||
endmacro()
|
||||
|
||||
if(cryptopp_comp_static)
|
||||
cryptopp_load_targets(static)
|
||||
cryptopp_load_targets(static)
|
||||
elseif(cryptopp_comp_shared)
|
||||
cryptopp_load_targets(shared)
|
||||
cryptopp_load_targets(shared)
|
||||
elseif(DEFINED cryptopp_SHARED_LIBS AND cryptopp_SHARED_LIBS)
|
||||
cryptopp_load_targets(shared)
|
||||
cryptopp_load_targets(shared)
|
||||
elseif(DEFINED cryptopp_SHARED_LIBS AND NOT cryptopp_SHARED_LIBS)
|
||||
cryptopp_load_targets(static)
|
||||
cryptopp_load_targets(static)
|
||||
elseif(BUILD_SHARED_LIBS)
|
||||
if(EXISTS "${cryptopp_shared_targets}")
|
||||
cryptopp_load_targets(shared)
|
||||
else()
|
||||
cryptopp_load_targets(static)
|
||||
endif()
|
||||
if(EXISTS "${cryptopp_shared_targets}")
|
||||
cryptopp_load_targets(shared)
|
||||
else()
|
||||
cryptopp_load_targets(static)
|
||||
endif()
|
||||
else()
|
||||
if(EXISTS "${cryptopp_static_targets}")
|
||||
cryptopp_load_targets(static)
|
||||
else()
|
||||
cryptopp_load_targets(shared)
|
||||
endif()
|
||||
if(EXISTS "${cryptopp_static_targets}")
|
||||
cryptopp_load_targets(static)
|
||||
else()
|
||||
cryptopp_load_targets(shared)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -179,7 +179,8 @@ set(cryptopp_SOURCES
|
||||
xts.cpp
|
||||
zdeflate.cpp
|
||||
zinflate.cpp
|
||||
zlib.cpp)
|
||||
zlib.cpp
|
||||
)
|
||||
|
||||
# ***** Library headers *****
|
||||
set(cryptopp_HEADERS
|
||||
@ -370,7 +371,8 @@ set(cryptopp_HEADERS
|
||||
xts.h
|
||||
zdeflate.h
|
||||
zinflate.h
|
||||
zlib.h)
|
||||
zlib.h
|
||||
)
|
||||
|
||||
# ***** Test sources *****
|
||||
set(cryptopp_SOURCES_TEST
|
||||
@ -396,37 +398,39 @@ set(cryptopp_SOURCES_TEST
|
||||
regtest1.cpp
|
||||
regtest2.cpp
|
||||
regtest3.cpp
|
||||
regtest4.cpp)
|
||||
regtest4.cpp
|
||||
)
|
||||
|
||||
# ***** Test headers *****
|
||||
set(cryptopp_HEADERS_TEST bench.h factory.h validate.h)
|
||||
|
||||
list(
|
||||
REMOVE_ITEM
|
||||
cryptopp_SOURCES
|
||||
cryptlib.cpp
|
||||
cpu.cpp
|
||||
integer.cpp
|
||||
pch.cpp
|
||||
simple.cpp)
|
||||
REMOVE_ITEM
|
||||
cryptopp_SOURCES
|
||||
cryptlib.cpp
|
||||
cpu.cpp
|
||||
integer.cpp
|
||||
pch.cpp
|
||||
simple.cpp
|
||||
)
|
||||
set(cryptopp_SOURCES cryptlib.cpp cpu.cpp integer.cpp ${cryptopp_SOURCES})
|
||||
|
||||
# Build the sources lists with full paths
|
||||
set(sources_tmp)
|
||||
foreach(src ${cryptopp_SOURCES})
|
||||
list(APPEND sources_tmp "${cryptopp_SOURCE_DIR}/${src}")
|
||||
list(APPEND sources_tmp "${cryptopp_SOURCE_DIR}/${src}")
|
||||
endforeach()
|
||||
set(cryptopp_SOURCES ${sources_tmp})
|
||||
|
||||
set(sources_tmp)
|
||||
foreach(src ${cryptopp_SOURCES_TEST})
|
||||
list(APPEND sources_tmp "${cryptopp_SOURCE_DIR}/${src}")
|
||||
list(APPEND sources_tmp "${cryptopp_SOURCE_DIR}/${src}")
|
||||
endforeach()
|
||||
set(cryptopp_SOURCES_TEST ${sources_tmp})
|
||||
|
||||
set(sources_tmp)
|
||||
foreach(src ${cryptopp_HEADERS})
|
||||
list(APPEND sources_tmp "${cryptopp_SOURCE_DIR}/${src}")
|
||||
list(APPEND sources_tmp "${cryptopp_SOURCE_DIR}/${src}")
|
||||
endforeach()
|
||||
set(cryptopp_HEADERS ${sources_tmp})
|
||||
|
||||
@ -437,7 +441,10 @@ set(cryptopp_SOURCES_ASM)
|
||||
|
||||
# Adjust for Android
|
||||
if(ANDROID)
|
||||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
||||
list(APPEND cryptopp_SOURCES
|
||||
${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
||||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
||||
list(
|
||||
APPEND
|
||||
cryptopp_SOURCES
|
||||
${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c
|
||||
)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user