Fix toolchains

This commit is contained in:
Andrea Cavalli 2023-05-07 16:29:58 +02:00
parent 3bb2b20141
commit 5c0d4a0242
7 changed files with 42 additions and 21 deletions

View File

@ -1,10 +1,7 @@
#!/bin/bash -ex #!/bin/bash -ex
# Debian 10+ # Ubuntu 20.04
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}" REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
TOOLCHAIN_HOST_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain-cmake-host-ubuntu2004.cmake)"
export CC="ccache /usr/bin/clang-10"
export CXX="ccache /usr/bin/clang++-10"
export CXXFLAGS="-stdlib=libc++"
# Create missing dirs # Create missing dirs
rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
@ -20,6 +17,7 @@ cmake \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \ -DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \ -DTD_ENABLE_JNI=ON \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \
.. ..
cmake --build . --target prepare_cross_compiling "-j$(nproc)" cmake --build . --target prepare_cross_compiling "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(nproc)" cmake --build . --target td_generate_java_api "-j$(nproc)"
@ -46,6 +44,7 @@ cmake \
-DTD_ENABLE_JNI=ON \ -DTD_ENABLE_JNI=ON \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \ -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \ -DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \
.. ..
cmake --build . --target install --config Release "-j$(nproc)" cmake --build . --target install --config Release "-j$(nproc)"
cd ../../../ cd ../../../
@ -62,6 +61,7 @@ cmake \
-DJAVA_SRC_DIR="../src/main/java" \ -DJAVA_SRC_DIR="../src/main/java" \
-DJava_JAVADOC_EXECUTABLE="/bin/true" \ -DJava_JAVADOC_EXECUTABLE="/bin/true" \
-DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \ -DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \
../src/main/cpp ../src/main/cpp
cmake --build . --target install --config Release "-j$(nproc)" cmake --build . --target install --config Release "-j$(nproc)"
cd .. cd ..

View File

@ -1,9 +1,7 @@
#!/bin/bash -ex #!/bin/bash -ex
# Ubuntu 22.04
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}" REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
TOOLCHAIN_HOST_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain-cmake-host-ubuntu2204.cmake)"
export CC="ccache /usr/bin/clang-14"
export CXX="ccache /usr/bin/clang++-14"
export CXXFLAGS="-stdlib=libc++"
# Create missing dirs # Create missing dirs
rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs rm -rf implementations/tdlight/td_tools_build implementations/tdlight/build api/target-legacy api/target api/.ci-friendly-pom.xml implementations/tdlight/td/generate/auto natives/src/main/java/it/tdlight/jni natives/build natives/tdjni_bin natives/tdjni_docs
@ -19,6 +17,7 @@ cmake \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \ -DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \ -DTD_ENABLE_JNI=ON \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \
.. ..
cmake --build . --target prepare_cross_compiling "-j$(nproc)" cmake --build . --target prepare_cross_compiling "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(nproc)" cmake --build . --target td_generate_java_api "-j$(nproc)"
@ -45,6 +44,7 @@ cmake \
-DTD_ENABLE_JNI=ON \ -DTD_ENABLE_JNI=ON \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \ -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \ -DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \
.. ..
cmake --build . --target install --config Release "-j$(nproc)" cmake --build . --target install --config Release "-j$(nproc)"
cd ../../../ cd ../../../
@ -61,6 +61,7 @@ cmake \
-DJAVA_SRC_DIR="../src/main/java" \ -DJAVA_SRC_DIR="../src/main/java" \
-DJava_JAVADOC_EXECUTABLE="/bin/true" \ -DJava_JAVADOC_EXECUTABLE="/bin/true" \
-DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \ -DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \
../src/main/cpp ../src/main/cpp
cmake --build . --target install --config Release "-j$(nproc)" cmake --build . --target install --config Release "-j$(nproc)"
cd .. cd ..

View File

@ -1,6 +1,7 @@
#!/bin/bash -ex #!/bin/bash -ex
# Debian 10+ # Ubuntu 20.04
REVISION="${REVISION:-1.0.0.0-SNAPSHOT}" REVISION="${REVISION:-1.0.0.0-SNAPSHOT}"
TOOLCHAIN_HOST_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain-cmake-host-ubuntu2004.cmake)"
TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain-arm64.cmake)" TOOLCHAIN_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain-arm64.cmake)"
# Create missing dirs # Create missing dirs
@ -17,6 +18,7 @@ cmake \
-DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \
-DTD_ENABLE_LTO=OFF \ -DTD_ENABLE_LTO=OFF \
-DTD_ENABLE_JNI=ON \ -DTD_ENABLE_JNI=ON \
-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \
.. ..
cmake --build . --target prepare_cross_compiling "-j$(nproc)" cmake --build . --target prepare_cross_compiling "-j$(nproc)"
cmake --build . --target td_generate_java_api "-j$(nproc)" cmake --build . --target td_generate_java_api "-j$(nproc)"

View File

@ -70,16 +70,6 @@ jobs:
echo "REVISION: $REVISION" echo "REVISION: $REVISION"
./.github/workflows/scripts/build-api.sh ./.github/workflows/scripts/build-api.sh
- id: getfilename
shell: bash
run: echo "::set-output name=file::$(cd api/target; ls tdli*-api-*-SNAPSHOT.jar)"
- id: getfilepath
shell: bash
run: echo "::set-output name=file::$(ls api/target/tdli*-api-*-SNAPSHOT.jar)"
- uses: actions/upload-artifact@v2
with:
name: ${{ steps.getfilename.outputs.file }}
path: ${{ steps.getfilepath.outputs.file }}
- name: Deploy to Maven (Snapshot) - name: Deploy to Maven (Snapshot)
if: github.ref != 'refs/heads/master' if: github.ref != 'refs/heads/master'
shell: bash shell: bash

View File

@ -1,6 +1,6 @@
SET(CMAKE_SYSTEM_NAME Linux) SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64) set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(triple arm-linux-gnueabihf) set(triple aarch64-linux-gnu)
set(CMAKE_SYSROOT /usr/aarch64-linux-gnu) set(CMAKE_SYSROOT /usr/aarch64-linux-gnu)
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu) set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)

View File

@ -0,0 +1,14 @@
SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER clang-10)
set(CMAKE_CXX_COMPILER clang++-10)
set(CMAKE_AR llvm-ar)
# Set various compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi --specs=nosys.specs -fdata-sections -ffunction-sections -Wl,--gc-sections")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -stdlib=libc++ -fno-exceptions")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi")
# Use LLD on linux
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
add_link_options("-fuse-ld=lld" "-v")

View File

@ -0,0 +1,14 @@
SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER clang-14)
set(CMAKE_CXX_COMPILER clang++-14)
set(CMAKE_AR llvm-ar)
# Set various compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi --specs=nosys.specs -fdata-sections -ffunction-sections -Wl,--gc-sections")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -stdlib=libc++ -fno-exceptions")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi")
# Use LLD on linux
#add_link_options("-fuse-ld=lld" "-rtlib=compiler-rt" "-unwindlib=libunwind" "-Wl,--as-needed")
add_link_options("-fuse-ld=lld" "-v")