diff options
author | Sven Gothel <[email protected]> | 2023-05-04 16:02:10 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-05-04 16:02:10 +0200 |
commit | b283181227d23648c041c845d701684abd537baf (patch) | |
tree | c14a4ec042d0dbe51dee3e80625aa0d291cf050f | |
parent | ab91b7d3a7f017608be97675dac8df037750b4c9 (diff) |
cmake/{customconfig->toolchain}.* and add LINKER_FLAGS '-static-libstdc++' -> min '-static-libgcc -static-libstdc++'
-rw-r--r-- | cmake/toolchain.android.cmake | 2 | ||||
-rw-r--r-- | cmake/toolchain.clang-default.cmake (renamed from cmake/customconfig.clang-default.cmake) | 9 | ||||
-rw-r--r-- | cmake/toolchain.clang-x86_32.cmake (renamed from cmake/customconfig.clang-x86_32.cmake) | 9 | ||||
-rw-r--r-- | cmake/toolchain.gcc-default.cmake (renamed from cmake/customconfig.gcc-default.cmake) | 9 | ||||
-rw-r--r-- | cmake/toolchain.gcc-x86_32.cmake (renamed from cmake/customconfig.gcc-x86_32.cmake) | 9 | ||||
-rw-r--r-- | cmake/toolchain.linux-gcc-aarch64.cmake | 11 | ||||
-rw-r--r-- | cmake/toolchain.linux-gcc-armv6hf.cmake | 10 |
7 files changed, 36 insertions, 23 deletions
diff --git a/cmake/toolchain.android.cmake b/cmake/toolchain.android.cmake index 169cb04b..e56c35e2 100644 --- a/cmake/toolchain.android.cmake +++ b/cmake/toolchain.android.cmake @@ -193,7 +193,7 @@ message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") message(STATUS "NDK_CPU_ARM: ${NDK_CPU_ARM}") message(STATUS "NDK_CPU_ARM64: ${NDK_CPU_ARM64}") -set(LINKER_FLAGS "--sysroot=${ANDROID_NDK_SYSROOT0} -L\"${ANDROID_NDK_SYSROOT1_LIB1}\" -Wl,-rpath-link=\"${ANDROID_NDK_SYSROOT1_LIB1}\" -L\"${ANDROID_NDK_SYSROOT1_LIB2}\" -target ${ANDROID_LLVM_TRIPLE} -static-libstdc++") +set(LINKER_FLAGS "--sysroot=${ANDROID_NDK_SYSROOT0} -L\"${ANDROID_NDK_SYSROOT1_LIB1}\" -Wl,-rpath-link=\"${ANDROID_NDK_SYSROOT1_LIB1}\" -L\"${ANDROID_NDK_SYSROOT1_LIB2}\" -target ${ANDROID_LLVM_TRIPLE} -static-libgcc -static-libstdc++") #set(LINKER_FLAGS "${LINKER_FLAGS} -v") message(STATUS "ARM32_LINKER_OPTS: ${ARM32_LINKER_OPTS}") diff --git a/cmake/customconfig.clang-default.cmake b/cmake/toolchain.clang-default.cmake index bd6cada8..bf12514f 100644 --- a/cmake/customconfig.clang-default.cmake +++ b/cmake/toolchain.clang-default.cmake @@ -1,7 +1,9 @@ # For normal clang compilation -set(CMAKE_C_FLAGS "-include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") -set(CMAKE_CXX_FLAGS "-include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") +if(NOT APPLE) + set(CMAKE_C_FLAGS "-include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") + set(CMAKE_CXX_FLAGS "-include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") +endif() if(APPLE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.5") @@ -21,8 +23,7 @@ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") message(STATUS "CMAKE_C_FLAGS : ${CMAKE_C_FLAGS}") message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") -# set(LINKER_FLAGS "-static-libgcc") - +set(LINKER_FLAGS "-static-libgcc -static-libstdc++") message(STATUS "LINKER_FLAGS: ${LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) diff --git a/cmake/customconfig.clang-x86_32.cmake b/cmake/toolchain.clang-x86_32.cmake index a33e18b0..d2e0e9ed 100644 --- a/cmake/customconfig.clang-x86_32.cmake +++ b/cmake/toolchain.clang-x86_32.cmake @@ -4,8 +4,10 @@ set(CMAKE_SYSTEM_PROCESSOR "x86") link_directories("/usr/lib32") -set(CMAKE_C_FLAGS "-m32 -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") -set(CMAKE_CXX_FLAGS "-m32 -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") +if(NOT APPLE) + set(CMAKE_C_FLAGS "-m32 -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") + set(CMAKE_CXX_FLAGS "-m32 -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") +endif() if(APPLE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.5") @@ -20,8 +22,7 @@ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") message(STATUS "CMAKE_C_FLAGS : ${CMAKE_C_FLAGS}") message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") -# set(LINKER_FLAGS "-m32 -static-libgcc") - +set(LINKER_FLAGS "-static-libgcc -static-libstdc++") message(STATUS "LINKER_FLAGS: ${LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) diff --git a/cmake/customconfig.gcc-default.cmake b/cmake/toolchain.gcc-default.cmake index 43294ab0..9c185af7 100644 --- a/cmake/customconfig.gcc-default.cmake +++ b/cmake/toolchain.gcc-default.cmake @@ -1,12 +1,15 @@ # For normal gcc compilation, but use static-libgcc -set(CMAKE_C_FLAGS "-include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") -set(CMAKE_CXX_FLAGS "-include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") +if(NOT APPLE) + set(CMAKE_C_FLAGS "-include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") + set(CMAKE_CXX_FLAGS "-include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") +endif() 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(LINKER_FLAGS "-static-libgcc -static-libstdc++") +message(STATUS "LINKER_FLAGS: ${LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) diff --git a/cmake/customconfig.gcc-x86_32.cmake b/cmake/toolchain.gcc-x86_32.cmake index 502378ab..62895703 100644 --- a/cmake/customconfig.gcc-x86_32.cmake +++ b/cmake/toolchain.gcc-x86_32.cmake @@ -4,13 +4,16 @@ set(CMAKE_SYSTEM_PROCESSOR "x86") link_directories("/usr/lib32") -set(CMAKE_C_FLAGS "-m32 -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") -set(CMAKE_CXX_FLAGS "-m32 -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") +if(NOT APPLE) + set(CMAKE_C_FLAGS "-m32 -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") + set(CMAKE_CXX_FLAGS "-m32 -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h") +endif() 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(LINKER_FLAGS "-m32 -static-libgcc -static-libstdc++") +message(STATUS "LINKER_FLAGS: ${LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) diff --git a/cmake/toolchain.linux-gcc-aarch64.cmake b/cmake/toolchain.linux-gcc-aarch64.cmake index 74c2b07c..da43bad6 100644 --- a/cmake/toolchain.linux-gcc-aarch64.cmake +++ b/cmake/toolchain.linux-gcc-aarch64.cmake @@ -5,14 +5,17 @@ set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_FIND_ROOT_PATH ${TARGET_PLATFORM_SYSROOT} ${TARGET_PLATFORM_USRROOT}) -# -idirafter will be searched after implicit system-dir include '-I =/usr/include' from TARGET_PLATFORM_SYSROOT -set(CMAKE_C_FLAGS "-fpic -march=armv8-a -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h -idirafter /usr/include") -set(CMAKE_CXX_FLAGS "-fpic -march=armv8-a -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h -idirafter /usr/include") +if(NOT APPLE) + # -idirafter will be searched after implicit system-dir include '-I =/usr/include' from TARGET_PLATFORM_SYSROOT + set(CMAKE_C_FLAGS "-fpic -march=armv8-a -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h -idirafter /usr/include") + set(CMAKE_CXX_FLAGS "-fpic -march=armv8-a -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h -idirafter /usr/include") +endif() 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 "-fpic -march=armv8-a -static-libgcc -L${TARGET_PLATFORM_USRLIBS} -static-libgcc") +set(LINKER_FLAGS "-fpic -march=armv8-a -static-libgcc -static-libstdc++ -L${TARGET_PLATFORM_USRLIBS} -static-libgcc -static-libstdc++") +message(STATUS "LINKER_FLAGS: ${LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) diff --git a/cmake/toolchain.linux-gcc-armv6hf.cmake b/cmake/toolchain.linux-gcc-armv6hf.cmake index a9fe01e8..c5a01168 100644 --- a/cmake/toolchain.linux-gcc-armv6hf.cmake +++ b/cmake/toolchain.linux-gcc-armv6hf.cmake @@ -5,14 +5,16 @@ set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_FIND_ROOT_PATH ${TARGET_PLATFORM_SYSROOT} ${TARGET_PLATFORM_USRROOT}) -# -idirafter will be searched after implicit system-dir include '-I =/usr/include' from TARGET_PLATFORM_SYSROOT -set(CMAKE_C_FLAGS "-fpic -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h -idirafter /usr/include") -set(CMAKE_CXX_FLAGS "-fpic -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h -idirafter /usr/include") +if(NOT APPLE) + # -idirafter will be searched after implicit system-dir include '-I =/usr/include' from TARGET_PLATFORM_SYSROOT + set(CMAKE_C_FLAGS "-fpic -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h -idirafter /usr/include") + set(CMAKE_CXX_FLAGS "-fpic -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -include ${PROJECT_SOURCE_DIR}/cmake/glibc-compat-symbols.h -idirafter /usr/include") +endif() 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 "-fpic -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -static-libgcc -L${TARGET_PLATFORM_USRLIBS} -static-libgcc") +set(LINKER_FLAGS "-fpic -march=armv6 -mfpu=vfp -mfloat-abi=hard -marm -static-libgcc -static-libstdc++ -L${TARGET_PLATFORM_USRLIBS} -static-libgcc -static-libstdc++") set(CMAKE_SHARED_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) set(CMAKE_MODULE_LINKER_FLAGS "${LINKER_FLAGS}" CACHE STRING "linker flags" FORCE) |