tdlight-java-natives/.github/workflows/toolchains/toolchain_i386.cmake

72 lines
2.7 KiB
CMake
Raw Normal View History

2023-05-12 01:34:32 +02:00
set(CMAKE_CROSSCOMPILING TRUE)
SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR i386)
set(TARGET_TRIPLE i386-linux-gnu)
2023-05-14 02:07:58 +02:00
if(EXISTS "/usr/bin/clang-14")
2023-05-14 01:19:06 +02:00
set(CMAKE_C_COMPILER /usr/bin/clang-14)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-14)
set(CMAKE_ASM_COMPILER /usr/bin/clang-14)
set(CMAKE_AR "/usr/bin/llvm-ar-14" CACHE FILEPATH "" FORCE)
2023-05-14 02:07:58 +02:00
elseif(EXISTS "/usr/bin/clang-12")
set(CMAKE_C_COMPILER /usr/bin/clang-12)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-12)
set(CMAKE_ASM_COMPILER /usr/bin/clang-12)
set(CMAKE_AR "/usr/bin/llvm-ar-12" CACHE FILEPATH "" FORCE)
2023-05-12 01:34:32 +02:00
else()
set(CMAKE_C_COMPILER /usr/bin/clang)
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
set(CMAKE_ASM_COMPILER /usr/bin/clang)
set(CMAKE_AR "/usr/bin/llvm-ar" CACHE FILEPATH "" FORCE)
endif()
set(CMAKE_C_COMPILER_TARGET ${TARGET_TRIPLE})
set(CMAKE_CXX_COMPILER_TARGET ${TARGET_TRIPLE})
set(CMAKE_ASM_COMPILER_TARGET ${TARGET_TRIPLE})
set(CMAKE_FIND_ROOT_PATH /usr/i386-linux-gnu /usr/lib/i386-linux-gnu /usr/include/i386-linux-gnu /usr/bin/i386-linux-gnu)
set(CMAKE_INCLUDE_PATH /usr/include/i386-linux-gnu)
set(CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu)
set(CMAKE_PROGRAM_PATH /usr/bin/i386-linux-gnu)
#set(CMAKE_SYSROOT /usr/lib/i386-linux-gnu)
#set(OPENSSL_INCLUDE_DIR /usr/include/openssl)
#include_directories("/usr/include/openssl")
# Set various compiler flags
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind")
2023-05-14 01:41:23 +02:00
set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++ -std=c++14")
2023-05-12 01:34:32 +02:00
# Use our definitions for compiler tools
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Search for libraries and headers in the target directories only
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# This must be set or compiler checks fail when linking
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
#include_directories("${CROSS_OPENJDK_PATH}/include/linux")
SET(JAVA_HOME "/usr/lib/jvm/default-java/")
2023-05-13 13:09:41 +02:00
if(EXISTS "/usr/lib/jvm/java-17-openjdk-i386")
2023-05-14 11:10:07 +02:00
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-17-openjdk-i386")
2023-05-13 13:09:41 +02:00
else()
SET(JAVA_CROSS_HOME "/usr/lib/jvm/java-8-openjdk-i386")
endif()
2023-05-12 01:34:32 +02:00
SET(JAVA_INCLUDE_PATH "${JAVA_HOME}/include")
SET(JAVA_AWT_INCLUDE_PATH "${JAVA_HOME}/include")
SET(JAVA_INCLUDE_PATH2 "${JAVA_HOME}/include/linux")
2023-05-12 01:51:21 +02:00
SET(JAVA_JVM_LIBRARY "${JAVA_CROSS_HOME}/lib/server/libjvm.so")
SET(JAVA_AWT_LIBRARY "${JAVA_CROSS_HOME}/lib/libawt.so")
2023-05-12 01:34:32 +02:00
# Use LLD on linux
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
#add_link_options("-fuse-ld=lld")