diff options
author | makise-homura <akemi_homura@kurisa.ch> | 2021-10-05 19:41:02 (GMT) |
---|---|---|
committer | makise-homura <akemi_homura@kurisa.ch> | 2021-10-15 02:05:19 (GMT) |
commit | e5d9fce03feeece7f53451da9fb958db2613d31e (patch) | |
tree | a8e5fc2001514dce2f4f390f48f416f650db456e /Tests/RunCMake | |
parent | 2b9ef77944cab3a330fa547dbe7e87aefd80b795 (diff) | |
download | CMake-e5d9fce03feeece7f53451da9fb958db2613d31e.zip CMake-e5d9fce03feeece7f53451da9fb958db2613d31e.tar.gz CMake-e5d9fce03feeece7f53451da9fb958db2613d31e.tar.bz2 |
LCC: Add dedicated support for MCST LCC compiler
Divert LCC compiler as a new one, instead of treating it as GNU.
Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been
passing checks for GNU compilers, so it has been identified as GNU.
Now, with intent of seriously upstreaming its support, it has been
added as a separate LCC compiler, and its version displays not a
supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead
of GNU 7.3.0).
This commit adds its support for detection, and also converts basically
every check like 'is this compiler GNU?' to 'is this compiler GNU or
LCC?'. The only places where this check is untouched, is where it
regards other platforms where LCC is unavailable (primarily non-Linux),
and where it REALLY differs from GNU compiler.
Note: this transition may break software that are already ported to
Elbrus, but hardly relies that LCC will be detected as GNU; still such
software is not known.
Diffstat (limited to 'Tests/RunCMake')
14 files changed, 20 insertions, 18 deletions
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 27bbff6..06f416b 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -159,6 +159,7 @@ endif() if ((RunCMake_GENERATOR STREQUAL "Unix Makefiles" AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" + OR CMAKE_C_COMPILER_ID STREQUAL "LCC" OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")) OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles" diff --git a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake index e547ef5..7395827 100644 --- a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake @@ -12,6 +12,6 @@ if(NOT RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND run_CMP0119(WARN) run_CMP0119(OLD) endif() -if((CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|MSVC|Borland|Embarcadero|Intel|TI)")) +if((CMAKE_C_COMPILER_ID MATCHES "(GNU|LCC|Clang|MSVC|Borland|Embarcadero|Intel|TI)")) run_CMP0119(NEW) endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e24ef58..c87c1b6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -256,7 +256,7 @@ endif() add_RunCMake_test(ArtifactOutputDirs) if(NOT DEFINED CMake_TEST_BuildDepends_GNU_AS - AND CMAKE_C_COMPILER_ID STREQUAL "GNU" + AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "LCC") AND CMAKE_GENERATOR MATCHES "^Ninja" ) execute_process(COMMAND "${CMAKE_C_COMPILER}" -print-prog-name=as @@ -682,7 +682,7 @@ set_property(TEST RunCMake.CheckCompilerFlag add_RunCMake_test(CheckModules) add_RunCMake_test(CheckIPOSupported) if (CMAKE_SYSTEM_NAME MATCHES "(Linux|Darwin)" - AND (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "GNU")) + AND (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|LCC" OR CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC")) add_RunCMake_test(CheckLinkerFlag -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_Fortran_COMPILER_ID=${CMAKE_Fortran_COMPILER_ID} -DCMake_TEST_CUDA=${CMake_TEST_CUDA} diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake index e9cebbf..1d21dec 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -1,7 +1,7 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) # Some compilers do not add build id to binaries by default. -if(CMAKE_CXX_COMPILER_ID MATCHES "^(IntelLLVM|PGI|NVHPC)$") +if(CMAKE_CXX_COMPILER_ID MATCHES "^(LCC|IntelLLVM|PGI|NVHPC)$") string(APPEND CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id") string(APPEND CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id") endif() diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake index 6483f11..79d67e5 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake @@ -9,14 +9,14 @@ if(SHOULD_FAIL) message(SEND_ERROR "invalid C compile flag didn't fail.") endif() -if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") +if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") check_compiler_flag(C "-x c" SHOULD_WORK) if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed") endif() endif() -if(CMAKE_C_COMPILER_ID STREQUAL "GNU") +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti instead of failing, so skip it here. check_compiler_flag(C "-frtti" SHOULD_FAIL_RTTI) if(SHOULD_FAIL_RTTI) message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed") diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake index 60e9755..4b20ebd 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake @@ -9,7 +9,7 @@ if(SHOULD_FAIL) message(SEND_ERROR "invalid CXX compile flag didn't fail.") endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") check_compiler_flag(CXX "-x c++" SHOULD_WORK) if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed") diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake index 7bb88b1..236f37b 100644 --- a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake +++ b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake @@ -8,7 +8,7 @@ if(SHOULD_FAIL) message(SEND_ERROR "invalid Fortran compile flag didn't fail.") endif() -if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") +if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU|LCC") check_compiler_flag(Fortran "-Wall" SHOULD_WORK) if(NOT SHOULD_WORK) message(SEND_ERROR "${CMAKE_Fortran_COMPILER_ID} compiler flag '-Wall' check failed") diff --git a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake index 5e5bff6..39fc430 100644 --- a/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckLinkerFlag/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") +if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU|LCC") run_cmake(CheckCLinkerFlag) run_cmake(CheckCXXLinkerFlag) if (APPLE) @@ -9,7 +9,7 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") endif() endif() -if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU") +if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU|LCC") run_cmake(CheckFortranLinkerFlag) endif() diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index 6cf57a3..92a64f9 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -731,7 +731,7 @@ def gen_check_targets(c, g, inSource): read_codemodel_json_data("targets/generated_exe.json"), ] - if cxx_compiler_id in ['Clang', 'AppleClang', 'GNU', 'Intel', 'IntelLLVM', 'MSVC', 'Embarcadero'] and g["name"] != "Xcode": + if cxx_compiler_id in ['Clang', 'AppleClang', 'LCC', 'GNU', 'Intel', 'IntelLLVM', 'MSVC', 'Embarcadero'] and g["name"] != "Xcode": for e in expected: if e["name"] == "cxx_exe": if matches(g["name"], "^(Visual Studio |Ninja Multi-Config)"): diff --git a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake index 6efa0d4..468b80a 100644 --- a/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake +++ b/Tests/RunCMake/PositionIndependentCode/RunCMakeTest.cmake @@ -26,6 +26,7 @@ if (PIE_SUPPORTED OR NO_PIE_SUPPORTED) if ((READELF OR OTOOL) AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + OR CMAKE_CXX_COMPILER_ID STREQUAL "LCC" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) macro(run_cmake_target test subtest) diff --git a/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake index 3e7fb30..ac3bf59 100644 --- a/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake +++ b/Tests/RunCMake/PrecompileHeaders/PchWarnInvalid-check.cmake @@ -1,4 +1,4 @@ -if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU|Intel" OR +if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Intel" OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND CMAKE_HOST_WIN32)) return() endif() diff --git a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake index 806ae79..f726759 100644 --- a/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_compile_options/RunCMakeTest.cmake @@ -2,7 +2,7 @@ include(RunCMake) run_cmake(empty_keyword_args) -if (CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") +if (CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang") macro(run_cmake_target test subtest target) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) set(RunCMake_TEST_OUTPUT_MERGE 1) @@ -28,7 +28,7 @@ function(run_Order) run_cmake_command(Order-build ${CMAKE_COMMAND} --build . --verbose --config Custom) endfunction() if(RunCMake_GENERATOR MATCHES "Ninja|Make" AND - CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$" AND + CMAKE_C_COMPILER_ID MATCHES "^(GNU|LCC|Clang|AppleClang)$" AND NOT CMAKE_C_SIMULATE_ID STREQUAL "MSVC") run_Order() endif() diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index fffb038..28a990d 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -26,7 +26,7 @@ run_cmake(TargetTypeInvalid) run_cmake(TargetTypeStatic) if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND - CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|Clang|AppleClang)$") + CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$") set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) run_cmake(LinkOptions) unset (RunCMake_TEST_OPTIONS) @@ -60,10 +60,10 @@ if(CMake_TEST_ISPC) endif() run_cmake(ISPCDuplicateTarget${ninja}) endif() -if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) +if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) run_cmake(CStandardGNU) endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4) run_cmake(CxxStandardGNU) endif() diff --git a/Tests/RunCMake/try_run/RunCMakeTest.cmake b/Tests/RunCMake/try_run/RunCMakeTest.cmake index fa30eb4..d74add0 100644 --- a/Tests/RunCMake/try_run/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_run/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) run_cmake(BadLinkLibraries) if (CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$" AND - CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|Clang|AppleClang)$") + CMAKE_C_COMPILER_ID MATCHES "^(MSVC|GNU|LCC|Clang|AppleClang)$") set (RunCMake_TEST_OPTIONS -DRunCMake_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) run_cmake(LinkOptions) unset (RunCMake_TEST_OPTIONS) |