Skip to content

Commit

Permalink
refactor toolchain files
Browse files Browse the repository at this point in the history
  • Loading branch information
fealebenpae committed May 17, 2023
1 parent 64b5f7a commit 8b1671a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 43 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ endif()
# Just use -lz and let Xcode figure it out
# Emscripten does provide Zlib, but it doesn't work with find_package and is handled specially
if(NOT APPLE AND NOT EMSCRIPTEN AND NOT TARGET ZLIB::ZLIB)
if(WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_CROSSCOMPILING))
if(WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND REALM_LINUX_TOOLCHAIN))
realm_acquire_dependency(zlib ${DEP_ZLIB_VERSION} ZLIB_CMAKE_INCLUDE_FILE)
include(${ZLIB_CMAKE_INCLUDE_FILE})
elseif(ANDROID)
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def doCheckInDocker(Map options = [:]) {
}

if (options.useToolchain) {
cmakeDefinitions += " -DCMAKE_TOOLCHAIN_FILE=\"${env.WORKSPACE}/tools/cmake/x86_64.toolchain.cmake\""
cmakeDefinitions += " -DCMAKE_TOOLCHAIN_FILE=\"${env.WORKSPACE}/tools/cmake/x86_64-linux-gnu.toolchain.cmake\""
}

def buildSteps = { String dockerArgs = "" ->
Expand Down Expand Up @@ -388,7 +388,7 @@ def doBuildLinux(String buildType) {
rm -rf build-dir
mkdir build-dir
cd build-dir
cmake -DCMAKE_BUILD_TYPE=${buildType} -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/x86_64.toolchain.cmake -DREALM_NO_TESTS=1 -DREALM_VERSION="${gitDescribeVersion}" -G Ninja ..
cmake -DCMAKE_BUILD_TYPE=${buildType} -DCMAKE_TOOLCHAIN_FILE=../tools/cmake/x86_64-linux-gnu.toolchain.cmake -DREALM_NO_TESTS=1 -DREALM_VERSION="${gitDescribeVersion}" -G Ninja ..
ninja
cpack -G TGZ
"""
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/RealmConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ find_dependency(Threads)
# so for an iOS build it'll use the path from the Device plaform, which is an error on Simulator.
# Just use -lz and let Xcode figure it out
if(TARGET Realm::Sync AND NOT APPLE AND NOT TARGET ZLIB::ZLIB)
if(WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_CROSSCOMPILING))
if(WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND REALM_LINUX_TOOLCHAIN))
realm_acquire_dependency(zlib @DEP_ZLIB_VERSION@ ZLIB_CMAKE_INCLUDE_FILE)
include(${ZLIB_CMAKE_INCLUDE_FILE})
elseif(ANDROID)
Expand Down
3 changes: 3 additions & 0 deletions tools/cmake/aarch64-linux-gnu.toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(_TRIPLET "aarch64-unknown-linux-gnu")
set(_TOOLCHAIN_MD5 a3a14d87f98904c2558b43bbd310f337)
include("${CMAKE_CURRENT_LIST_DIR}/linux.toolchain.base.cmake")
18 changes: 0 additions & 18 deletions tools/cmake/armhf.toolchain.cmake

This file was deleted.

3 changes: 3 additions & 0 deletions tools/cmake/armv7-linux-gnueabihf.toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(_TRIPLET "armv7-unknown-linux-gnueabihf")
set(_TOOLCHAIN_MD5 fbf817b1428bb35c93be8e6c15f73d7d)
include("${CMAKE_CURRENT_LIST_DIR}/linux.toolchain.base.cmake")
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" OR NOT CMAKE_HOST_SYSTEM_PROCESSO
message(FATAL_ERROR "This toolchain can only be used on x86_64 Linux.")
endif()

set(_TRIPLET "aarch64-unknown-linux-gnu")
file(DOWNLOAD https://static.realm.io/toolchains/v3/${_TRIPLET}.tar.zst ${CMAKE_BINARY_DIR}/${_TRIPLET}.tar.zst
EXPECTED_HASH MD5=a3a14d87f98904c2558b43bbd310f337 STATUS _DOWNLOAD_STATUS)
EXPECTED_HASH MD5=${_TOOLCHAIN_MD5} STATUS _DOWNLOAD_STATUS)
list(GET _DOWNLOAD_STATUS 0 _DOWNLOAD_STATUS_CODE)
if(NOT ${_DOWNLOAD_STATUS_CODE} EQUAL 0)
message(FATAL_ERROR "Error downloading ${_TRIPLET}.tar.zst: ${_DOWNLOAD_STATUS}")
Expand All @@ -16,3 +15,5 @@ include("${CMAKE_BINARY_DIR}/${_TRIPLET}/toolchain.cmake")
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Xlinker --exclude-libs=libgcc.a,libstdc++.a -static-libgcc -static-libstdc++")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Xlinker --exclude-libs=libgcc.a,libstdc++.a -static-libgcc -static-libstdc++")
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-Xlinker --exclude-libs=libgcc.a,libstdc++.a -static-libgcc -static-libstdc++")

set(REALM_LINUX_TOOLCHAIN ON)
3 changes: 3 additions & 0 deletions tools/cmake/x86_64-linux-gnu.toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(_TRIPLET "x86_64-unknown-linux-gnu")
set(_TOOLCHAIN_MD5 aa99fc16d85adf1bb2f8b63b83542044)
include("${CMAKE_CURRENT_LIST_DIR}/linux.toolchain.base.cmake")
19 changes: 0 additions & 19 deletions tools/cmake/x86_64.toolchain.cmake

This file was deleted.

0 comments on commit 8b1671a

Please sign in to comment.