aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-09-13 19:08:52 +0200
committerSven Gothel <[email protected]>2013-09-13 19:08:52 +0200
commit389ae1f767bfad6116e21306fc3cdf89a4cbcc0a (patch)
tree6f18d64a576a403a41bb82c09f3d63f78cc470b9 /cmake
parent0df1e1ad30a0990591be4779ccc3d0034a3b33e5 (diff)
Add clang cmake.toolchain macros; Fix glibc-compat-symbols.h to work w/ clang (nop)
Diffstat (limited to 'cmake')
-rw-r--r--cmake/glibc-compat-symbols.h20
-rw-r--r--cmake/toolchain.clang-default.cmake13
-rw-r--r--cmake/toolchain.clang-x86_32.cmake17
3 files changed, 44 insertions, 6 deletions
diff --git a/cmake/glibc-compat-symbols.h b/cmake/glibc-compat-symbols.h
index 135a8d6d..5dc1a18b 100644
--- a/cmake/glibc-compat-symbols.h
+++ b/cmake/glibc-compat-symbols.h
@@ -3,6 +3,9 @@
/**
*
+ * Note: Patching a specific glibc symbol version is only required if *not* statically linking glibc,
+ * which should be preferred.
+ *
* Note: JogAmp's minimum GLIBC is 2.4 due to '__stack_chk_fail' (stack overflow checking)
*
* GLIBC 2.4 - March 2006 - Standard for LSB 4.0, Used in SLES 10
@@ -12,13 +15,18 @@
*
* Check build-in macro definitions via 'gcc -dM -E - < /dev/null'
*/
-#if defined(__arm__)
- #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.4");
-#elif defined(__amd64__)
- #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5");
+#if defined(__GNUC__) && !defined(__clang__)
+ #if defined(__arm__)
+ #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.4");
+ #elif defined(__amd64__)
+ #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5");
+ #else
+ #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5");
+ #endif /*__amd64__*/
#else
- #define GLIBC_COMPAT_SYMBOL(FFF) __asm__(".symver " #FFF "," #FFF "@GLIBC_2.2.5");
-#endif /*__amd64__*/
+ #warning GLIBC_COMPAT_SYMBOL not supported with current compiler
+ #define GLIBC_COMPAT_SYMBOL(FFF)
+#endif
GLIBC_COMPAT_SYMBOL(memcpy)
diff --git a/cmake/toolchain.clang-default.cmake b/cmake/toolchain.clang-default.cmake
new file mode 100644
index 00000000..693f55c8
--- /dev/null
+++ b/cmake/toolchain.clang-default.cmake
@@ -0,0 +1,13 @@
+# For normal clang compilation
+
+# set(CMAKE_C_FLAGS "-include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+# set(LINKER_FLAGS "-static-libgcc")
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+
diff --git a/cmake/toolchain.clang-x86_32.cmake b/cmake/toolchain.clang-x86_32.cmake
new file mode 100644
index 00000000..db2b7a27
--- /dev/null
+++ b/cmake/toolchain.clang-x86_32.cmake
@@ -0,0 +1,17 @@
+# For multiarch gcc crosscompile, i.e. x86_32 target on x86_64 host
+
+set(CMAKE_SYSTEM_PROCESSOR "x86")
+
+link_directories("/usr/lib32")
+
+# set(CMAKE_C_FLAGS "-m32 -include ${CMAKE_MODULE_PATH}/glibc-compat-symbols.h")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c++ flags")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
+
+# set(LINKER_FLAGS "-m32 -static-libgcc")
+
+set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE)
+