summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
diff options
context:
space:
mode:
authorDavid Lindauer <touchstone222@runbox.com>2023-06-25 01:23:39 (GMT)
committerBrad King <brad.king@kitware.com>2023-09-25 16:27:29 (GMT)
commit531b4fe64377b2e2ce5918535df389be0a754b04 (patch)
tree67d6dca1cb123bb8473aa9542cc7e647bff5efa3 /Modules/Compiler
parent10f435a58f97a71f6718bfdd0cacb72175a906ef (diff)
downloadCMake-531b4fe64377b2e2ce5918535df389be0a754b04.zip
CMake-531b4fe64377b2e2ce5918535df389be0a754b04.tar.gz
CMake-531b4fe64377b2e2ce5918535df389be0a754b04.tar.bz2
OrangeC: Add support for OrangeC compiler
Add compiler information modules. Update the test suite. Fixes: #25032 Co-authored-by: Brad King <brad.king@kitware.com>
Diffstat (limited to 'Modules/Compiler')
-rw-r--r--Modules/Compiler/OrangeC-ASM.cmake7
-rw-r--r--Modules/Compiler/OrangeC-C.cmake20
-rw-r--r--Modules/Compiler/OrangeC-CXX.cmake25
-rw-r--r--Modules/Compiler/OrangeC-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/OrangeC.cmake33
5 files changed, 92 insertions, 0 deletions
diff --git a/Modules/Compiler/OrangeC-ASM.cmake b/Modules/Compiler/OrangeC-ASM.cmake
new file mode 100644
index 0000000..fe78911
--- /dev/null
+++ b/Modules/Compiler/OrangeC-ASM.cmake
@@ -0,0 +1,7 @@
+include(Compiler/OrangeC)
+__compiler_orangec(ASM)
+
+set(CMAKE_ASM_OUTPUT_EXTENSION ".o")
+set(CMAKE_ASM_VERBOSE_FLAG "-yyyyy")
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm;nas)
diff --git a/Modules/Compiler/OrangeC-C.cmake b/Modules/Compiler/OrangeC-C.cmake
new file mode 100644
index 0000000..15a6476
--- /dev/null
+++ b/Modules/Compiler/OrangeC-C.cmake
@@ -0,0 +1,20 @@
+include(Compiler/OrangeC)
+include(Compiler/CMakeCommonCompilerMacros)
+
+set(CMAKE_C_OUTPUT_EXTENSION ".o")
+set(CMAKE_C_VERBOSE_FLAG "-yyyyy")
+set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
+
+set(CMAKE_C90_STANDARD_COMPILE_OPTION -std=c89)
+set(CMAKE_C90_EXTENSION_COMPILE_OPTION -std=c89)
+set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C99_STANDARD_COMPILE_OPTION -std=c99)
+set(CMAKE_C99_EXTENSION_COMPILE_OPTION -std=c99)
+set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11)
+set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=c11)
+set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+
+__compiler_orangec(C)
+#- 6.38 is the earliest version which version info is available in the preprocessor
+__compiler_check_default_language_standard(C 6.38 11)
diff --git a/Modules/Compiler/OrangeC-CXX.cmake b/Modules/Compiler/OrangeC-CXX.cmake
new file mode 100644
index 0000000..3f9d59c
--- /dev/null
+++ b/Modules/Compiler/OrangeC-CXX.cmake
@@ -0,0 +1,25 @@
+include(Compiler/OrangeC)
+include(Compiler/CMakeCommonCompilerMacros)
+
+set(_ORANGEC_COMPILE_CXX " -x c++")
+set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
+
+set(CMAKE_CXX_OUTPUT_EXTENSION ".o")
+set(CMAKE_CXX_VERBOSE_FLAG "-yyyyy")
+
+
+
+#- OrangeC is a little lax when accepting compiler version specifications.
+# Usually changing the version only changes the value of __cplusplus.
+# Also we don't support CXX98
+set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
+set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+
+set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14")
+set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+
+__compiler_orangec(CXX)
+#- 6.38 is the earliest version which version info is available in the preprocessor
+__compiler_check_default_language_standard(CXX 6.38 14)
diff --git a/Modules/Compiler/OrangeC-DetermineCompiler.cmake b/Modules/Compiler/OrangeC-DetermineCompiler.cmake
new file mode 100644
index 0000000..2ecc140
--- /dev/null
+++ b/Modules/Compiler/OrangeC-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+set(_compiler_id_pp_test "defined(__ORANGEC__)")
+
+set(_compiler_id_version_compute "
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ORANGEC_MAJOR__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ORANGEC_MINOR__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ORANGEC_PATCHLEVEL__)")
diff --git a/Modules/Compiler/OrangeC.cmake b/Modules/Compiler/OrangeC.cmake
new file mode 100644
index 0000000..fbb245b
--- /dev/null
+++ b/Modules/Compiler/OrangeC.cmake
@@ -0,0 +1,33 @@
+include_guard()
+
+macro(__compiler_orangec lang)
+ if ("x${lang}" MATCHES "^x(C|CXX)$")
+ set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> ${_ORANGEC_COMPILE_${lang}} -! <SOURCE> <DEFINES> <INCLUDES> <FLAGS> +i -o <PREPROCESSED_SOURCE>")
+ set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> ${_ORANGEC_COMPILE_${lang}} -! <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -S -o <ASSEMBLY_SOURCE>")
+ endif()
+ set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> ${_ORANGEC_COMPILE_${lang}} -! -c <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
+ unset(_ORANGEC_COMPILE_${lang})
+
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>")
+ set(CMAKE_${lang}_DEPFILE_FORMAT gcc)
+ set(CMAKE_${lang}_DEPENDS_USE_COMPILER TRUE)
+
+ string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
+ string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O2 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG")
+ string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
+
+ set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
+ "<CMAKE_${lang}_COMPILER> -! -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
+ set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> -! <FLAGS> -o <TARGET> --out-implib <TARGET_IMPLIB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>")
+ set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
+ "<CMAKE_${lang}_COMPILER> -! <FLAGS> -o <TARGET> --out-implib <TARGET_IMPLIB> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <OBJECTS> <LINK_LIBRARIES>")
+ set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}")
+
+ set(CMAKE_LIBRARY_PATH_FLAG "-L")
+ set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-! -shared")
+
+ set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@")
+ set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
+endmacro()