diff --git a/.github/workflows/scripts/build-linux-amd64-ssl1.sh b/.github/workflows/scripts/build-linux-amd64-ssl1.sh index b9b4029..18d36d8 100755 --- a/.github/workflows/scripts/build-linux-amd64-ssl1.sh +++ b/.github/workflows/scripts/build-linux-amd64-ssl1.sh @@ -1,10 +1,7 @@ #!/bin/bash -ex -# Debian 10+ +# Ubuntu 20.04 REVISION="${REVISION:-1.0.0.0-SNAPSHOT}" - -export CC="ccache /usr/bin/clang-10" -export CXX="ccache /usr/bin/clang++-10" -export CXXFLAGS="-stdlib=libc++" +TOOLCHAIN_HOST_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain-cmake-host-ubuntu2004.cmake)" # 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 @@ -20,6 +17,7 @@ cmake \ -DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \ -DTD_ENABLE_LTO=OFF \ -DTD_ENABLE_JNI=ON \ + -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \ .. cmake --build . --target prepare_cross_compiling "-j$(nproc)" cmake --build . --target td_generate_java_api "-j$(nproc)" @@ -46,6 +44,7 @@ cmake \ -DTD_ENABLE_JNI=ON \ -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \ -DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \ + -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \ .. cmake --build . --target install --config Release "-j$(nproc)" cd ../../../ @@ -62,6 +61,7 @@ cmake \ -DJAVA_SRC_DIR="../src/main/java" \ -DJava_JAVADOC_EXECUTABLE="/bin/true" \ -DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \ + -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \ ../src/main/cpp cmake --build . --target install --config Release "-j$(nproc)" cd .. diff --git a/.github/workflows/scripts/build-linux-amd64-ssl3.sh b/.github/workflows/scripts/build-linux-amd64-ssl3.sh index 8bd39f0..58f7d1e 100755 --- a/.github/workflows/scripts/build-linux-amd64-ssl3.sh +++ b/.github/workflows/scripts/build-linux-amd64-ssl3.sh @@ -1,9 +1,7 @@ #!/bin/bash -ex +# Ubuntu 22.04 REVISION="${REVISION:-1.0.0.0-SNAPSHOT}" - -export CC="ccache /usr/bin/clang-14" -export CXX="ccache /usr/bin/clang++-14" -export CXXFLAGS="-stdlib=libc++" +TOOLCHAIN_HOST_FILE="$(readlink -e ./.github/workflows/toolchains/toolchain-cmake-host-ubuntu2204.cmake)" # 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 @@ -19,6 +17,7 @@ cmake \ -DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \ -DTD_ENABLE_LTO=OFF \ -DTD_ENABLE_JNI=ON \ + -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \ .. cmake --build . --target prepare_cross_compiling "-j$(nproc)" cmake --build . --target td_generate_java_api "-j$(nproc)" @@ -45,6 +44,7 @@ cmake \ -DTD_ENABLE_JNI=ON \ -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX" \ -DCMAKE_INSTALL_BINDIR:PATH="$INSTALL_BINDIR" \ + -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \ .. cmake --build . --target install --config Release "-j$(nproc)" cd ../../../ @@ -61,6 +61,7 @@ cmake \ -DJAVA_SRC_DIR="../src/main/java" \ -DJava_JAVADOC_EXECUTABLE="/bin/true" \ -DTDNATIVES_CPP_SRC_DIR="../src/main/cpp" \ + -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \ ../src/main/cpp cmake --build . --target install --config Release "-j$(nproc)" cd .. diff --git a/.github/workflows/scripts/build-linux-arm64-ssl1.sh b/.github/workflows/scripts/build-linux-arm64-ssl1.sh index c657c47..e5efe31 100755 --- a/.github/workflows/scripts/build-linux-arm64-ssl1.sh +++ b/.github/workflows/scripts/build-linux-arm64-ssl1.sh @@ -1,6 +1,7 @@ #!/bin/bash -ex -# Debian 10+ +# Ubuntu 20.04 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)" # Create missing dirs @@ -17,6 +18,7 @@ cmake \ -DCMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG" \ -DTD_ENABLE_LTO=OFF \ -DTD_ENABLE_JNI=ON \ + -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_HOST_FILE}" \ .. cmake --build . --target prepare_cross_compiling "-j$(nproc)" cmake --build . --target td_generate_java_api "-j$(nproc)" diff --git a/.github/workflows/tdapi_file.yaml b/.github/workflows/tdapi_file.yaml index 7d4e30f..591896d 100644 --- a/.github/workflows/tdapi_file.yaml +++ b/.github/workflows/tdapi_file.yaml @@ -70,16 +70,6 @@ jobs: echo "REVISION: $REVISION" ./.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) if: github.ref != 'refs/heads/master' shell: bash diff --git a/.github/workflows/toolchains/toolchain-arm64.cmake b/.github/workflows/toolchains/toolchain-arm64.cmake index 3f8975f..848c302 100644 --- a/.github/workflows/toolchains/toolchain-arm64.cmake +++ b/.github/workflows/toolchains/toolchain-arm64.cmake @@ -1,6 +1,6 @@ SET(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR aarch64) -set(triple arm-linux-gnueabihf) +set(triple aarch64-linux-gnu) set(CMAKE_SYSROOT /usr/aarch64-linux-gnu) set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu) diff --git a/.github/workflows/toolchains/toolchain-cmake-host-ubuntu2004.cmake b/.github/workflows/toolchains/toolchain-cmake-host-ubuntu2004.cmake new file mode 100644 index 0000000..e07762c --- /dev/null +++ b/.github/workflows/toolchains/toolchain-cmake-host-ubuntu2004.cmake @@ -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") diff --git a/.github/workflows/toolchains/toolchain-cmake-host-ubuntu2204.cmake b/.github/workflows/toolchains/toolchain-cmake-host-ubuntu2204.cmake new file mode 100644 index 0000000..50bfc7e --- /dev/null +++ b/.github/workflows/toolchains/toolchain-cmake-host-ubuntu2204.cmake @@ -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")