-
-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add a flag to allow size_t(-1) and similar shenanigans (SOL_ALL_INTEGER_VALUES_FIT) - Half-fix, but not fully, for #1183, #1072, #1038, #965 - Fix #1126 - Prepare for #1061
- Loading branch information
Showing
116 changed files
with
2,127 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Mac OSX | ||
name: Mac OS | ||
|
||
on: [push] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# # # # sol2 | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2013-2021 Rapptz, ThePhD, and contributors | ||
# | ||
# 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. | ||
|
||
# # # # sol2 - cmake - basic project configuration | ||
|
||
include_guard(DIRECTORY) | ||
|
||
list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Packages") | ||
list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules") | ||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") | ||
list(APPEND CMAKE_MESSAGE_CONTEXT "${PROJECT_NAME}") | ||
|
||
# # Standard Project version | ||
if (NOT CMAKE_CXX_STANDARD GREATER_EQUAL 17) | ||
set(CMAKE_CXX_STANDARD 17) | ||
endif() | ||
|
||
if (NOT CMAKE_C_STANDARD GREATER_EQUAL 11) | ||
set(CMAKE_C_STANDARD 11) | ||
endif() | ||
|
||
# # CMake and sol2 Includes | ||
# CMake | ||
include(CheckCXXCompilerFlag) | ||
include(CheckCCompilerFlag) | ||
include(CheckIPOSupported) | ||
include(CMakeDependentOption) | ||
include(CMakePrintHelpers) | ||
include(GNUInstallDirs) | ||
include(FeatureSummary) | ||
include(FetchContent) | ||
include(CTest) | ||
# sol2 | ||
include(CheckCompilerDiagnostic) | ||
include(CheckCompilerFlag) | ||
include(FindVersion) | ||
|
||
# # Check environment/prepare generator expressions | ||
# Basic/Normal flags | ||
check_compiler_flag(disable-permissive MSVC /permissive- GCC -pedantic) | ||
check_compiler_flag(utf8-literal-encoding MSVC /execution-charset:utf-8 GCC -fexec-charset=utf-8) | ||
check_compiler_flag(utf8-source-encoding MSVC /source-charset:utf-8 GCC -finput-charset=utf-8) | ||
check_compiler_flag(extra-constexpr-depth MSVC /constexpr:depth2147483647 GCC -fconstexpr-depth=2147483647 CLANG -fconstexpr-depth=2147483647) | ||
check_compiler_flag(extra-constexpr-steps MSVC /constexpr:steps2147483647 GCC -fconstexpr-ops-limit=2147483647 CLANG -fconstexpr-steps=2147483647) | ||
check_compiler_flag(template-debugging-mode GCC -ftemplate-backtrace-limit=0) | ||
check_compiler_flag(big-obj MSVC /bigobj) | ||
# Overall warning flags | ||
check_compiler_flag(pedantic GCC -pedantic) | ||
check_compiler_flag(warn-pedantic GCC -Wpedantic) | ||
check_compiler_flag(warn-all MSVC /W4 GCC -Wall) | ||
check_compiler_flag(warn-extra GCC -Wextra) | ||
check_compiler_flag(warn-errors MSVC /WX GCC -Werror) | ||
# Individual warnings/errors | ||
check_compiler_diagnostic(unknown-warning) | ||
check_compiler_diagnostic(unknown-warning-option) | ||
check_compiler_diagnostic(microsoft-cast) | ||
check_compiler_diagnostic(noexcept-type) | ||
check_compiler_diagnostic(unreachable-code MSVC 4702) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# # # # sol2 | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2013-2021 Rapptz, ThePhD, and contributors | ||
# | ||
# 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. | ||
|
||
# # # # sol2 - cmake - compiler diagnostic checking | ||
|
||
include_guard(GLOBAL) | ||
|
||
include(CheckCXXCompilerFlag) | ||
include(CheckCCompilerFlag) | ||
|
||
#[[ | ||
Given a diagnostic name and flag, like | ||
check_cxx_compiler_diagnostic(pig MSVC 1312) | ||
or | ||
check_cxx_compiler_diagnostic(pig GCC acab) | ||
we check if the given flag works C++ compiler. If it does, we then generate | ||
a --warn, --allow, --deny, and --forbid prefixed set of variables. Users are | ||
then free to simply apply them to targets at will. | ||
]] | ||
function (check_compiler_diagnostic diagnostic) | ||
cmake_parse_arguments(diagnostic "" "GCC;MSVC;CLANG" "" ${ARGN}) | ||
if (NOT diagnostic_GCC) | ||
set(diagnostic_GCC ${diagnostic}) | ||
endif() | ||
if (NOT diagnostic_MSVC) | ||
set(diagnostic_MSVC ${diagnostic}) | ||
endif() | ||
if (NOT diagnostic_CLANG) | ||
set(diagnostic_CLANG ${diagnostic_GCC}) | ||
endif() | ||
string(MAKE_C_IDENTIFIER "${diagnostic}" suffix) | ||
string(TOUPPER "${suffix}" suffix) | ||
get_property(enabled-languages GLOBAL PROPERTY ENABLED_LANGUAGES) | ||
if (CXX IN_LIST enabled-languages) | ||
if (MSVC) | ||
check_cxx_compiler_flag(-wo${diagnostic_MSVC} CXX_DIAGNOSTIC_${suffix}) | ||
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) | ||
check_cxx_compiler_flag(-W${diagnostic_CLANG} CXX_DIAGNOSTIC_${suffix}) | ||
else() | ||
check_cxx_compiler_flag(-W${diagnostic_GCC} CXX_DIAGNOSTIC_${suffix}) | ||
endif() | ||
endif() | ||
if (C IN_LIST enabled-languages) | ||
if (MSVC) | ||
check_c_compiler_flag(-wo${diagnostic_MSVC} C_DIAGNOSTIC_${suffix}) | ||
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) | ||
check_c_compiler_flag(-W${diagnostic_CLANG} C_DIAGNOSTIC_${suffix}) | ||
else() | ||
check_c_compiler_flag(-W${diagnostic_GCC} C_DIAGNOSTIC_${suffix}) | ||
endif() | ||
endif() | ||
string(CONCAT when $<OR: | ||
$<AND:$<BOOL:${CXX_DIAGNOSTIC_${suffix}}>,$<COMPILE_LANGUAGE:CXX>>, | ||
$<AND:$<BOOL:${C_DIAGNOSTIC_${suffix}}>,$<COMPILE_LANGUAGE:C>> | ||
>) | ||
string(CONCAT diagnostic_flag | ||
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:${diagnostic_MSVC}> | ||
$<$<COMPILE_LANG_AND_ID:C,MSVC>:${diagnostic_MSVC}> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GCC>:${diagnostic_GCC}> | ||
$<$<COMPILE_LANG_AND_ID:C,GCC>:${diagnostic_GCC}> | ||
$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:${diagnostic_CLANG}> | ||
$<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:${diagnostic_CLANG}> | ||
) | ||
set(forbid_prefix $<IF:$<BOOL:${MSVC}>,-we,-Werror=>) | ||
set(allow_prefix $<IF:$<BOOL:${MSVC}>,-wd,-Wno->) | ||
set(warn_prefix $<IF:$<BOOL:${MSVC}>,-w1,-W>) | ||
|
||
set(--forbid-${diagnostic} $<${when}:${forbid_prefix}${diagnostic_flag}> PARENT_SCOPE) | ||
set(--allow-${diagnostic} $<${when}:${allow_prefix}${diagnostic_flag}> PARENT_SCOPE) | ||
# Set these warnings to level 1 warnings, so they appear by default | ||
set(--warn-${diagnostic} $<${when}:${warn_prefix}${diagnostic_flag}> PARENT_SCOPE) | ||
|
||
set(--deny-${diagnostic} ${--forbid-${diagnostic_flag}} PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# # # # sol2 | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2013-2021 Rapptz, ThePhD, and contributors | ||
# | ||
# 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. | ||
|
||
# # # # sol2 - cmake - compiler flag checking | ||
|
||
include_guard(GLOBAL) | ||
|
||
include(CheckCXXCompilerFlag) | ||
include(CheckCCompilerFlag) | ||
|
||
#[[ | ||
Given a flag name and the actual flag, like | ||
check_cxx_compiler_flag(strict-conformance MSVC /permissive- GCC -pedantic) | ||
we check if the given flag works C++ compiler. If it is, then | ||
--strict-conformance will be the provided flag. MSVC and GCC are the 2 different | ||
"style" of flags to be tested for. | ||
]] | ||
function (check_compiler_flag flag_name) | ||
cmake_parse_arguments(PARSE_ARGV 1 flag "" "" "GCC;MSVC;CLANG") | ||
if (NOT flag_MSVC) | ||
set(flag_MSVC /${flag_name}) | ||
endif() | ||
if (NOT flag_GCC) | ||
set(flag_GCC ${flag_name}) | ||
endif() | ||
if (NOT flag_CLANG) | ||
set(flag_CLANG ${flag_GCC}) | ||
endif() | ||
string(MAKE_C_IDENTIFIER "${flag_name}" suffix) | ||
string(TOUPPER "${suffix}" suffix) | ||
get_property(enabled-languages GLOBAL PROPERTY ENABLED_LANGUAGES) | ||
if (CXX IN_LIST enabled-languages) | ||
if (MSVC) | ||
check_cxx_compiler_flag(${flag_MSVC} CXX_CHECK_FLAG_${suffix}) | ||
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) | ||
check_cxx_compiler_flag(${flag_CLANG} CXX_CHECK_FLAG_${suffix}) | ||
else() | ||
check_cxx_compiler_flag(${flag_GCC} CXX_CHECK_FLAG_${suffix}) | ||
endif() | ||
endif() | ||
if (C IN_LIST enabled-languages) | ||
if (MSVC) | ||
check_c_compiler_flag(${flag_MSVC} C_CHECK_FLAG_${suffix}) | ||
elseif (CMAKE_C_COMPILER_ID MATCHES Clang) | ||
check_c_compiler_flag(${flag_CLANG} C_CHECK_FLAG_${suffix}) | ||
else() | ||
check_c_compiler_flag(${flag_GCC} C_CHECK_FLAG_${suffix}) | ||
endif() | ||
endif() | ||
string(CONCAT when $<OR: | ||
$<AND:$<BOOL:${CXX_CHECK_FLAG_${suffix}}>,$<COMPILE_LANGUAGE:CXX>>, | ||
$<AND:$<BOOL:${C_CHECK_FLAG_${suffix}}>,$<COMPILE_LANGUAGE:C>> | ||
>) | ||
string(CONCAT compiler_flag | ||
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:${flag_MSVC}> | ||
$<$<COMPILE_LANG_AND_ID:C,MSVC>:${flag_MSVC}> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GCC>:${flag_GCC}> | ||
$<$<COMPILE_LANG_AND_ID:C,GCC>:${flag_GCC}> | ||
$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:${flag_CLANG}> | ||
$<$<COMPILE_LANG_AND_ID:C,Clang,AppleClang>:${flag_CLANG}> | ||
) | ||
|
||
set(--${flag_name} $<${when}:${compiler_flag}> PARENT_SCOPE) | ||
endfunction() |
Oops, something went wrong.