From 0986527495291b4430d4e5202625ddd63f924e27 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 13 Jan 2022 21:31:01 +0100 Subject: [PATCH] build: Use ld.lld as linker --- .github/workflows/analysis.yml | 9 +++++--- .github/workflows/build.yml | 42 +++++++++++++++++++++------------- .github/workflows/tests.yml | 9 +++++--- dist/get_deps_archlinux.sh | 13 ++++++----- dist/get_deps_debian.sh | 1 + dist/get_deps_fedora.sh | 19 +++++++-------- dist/get_deps_msys2.sh | 21 +++++++++-------- dist/msys2/PKGBUILD | 1 + 8 files changed, 68 insertions(+), 47 deletions(-) diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index efa5c603e..68e601614 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -42,10 +42,13 @@ jobs: run: | mkdir -p build cd build - CC=gcc-10 CXX=g++-10 cmake \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + CC=gcc-10 CXX=g++-10 cmake \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_INSTALL_PREFIX="$PWD/install" \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_FLAGS="-fuse-ld=lld" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ .. make -j 4 install diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 136e6eecb..6c5324c8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,11 +50,14 @@ jobs: run: | mkdir -p build cd build - CC=gcc-10 CXX=g++-10 cmake \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + CC=gcc-10 CXX=g++-10 cmake \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_INSTALL_PREFIX="$PWD/install" \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DRUST_PATH="$HOME/.cargo/bin/" \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_FLAGS="-fuse-ld=lld" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ + -DRUST_PATH="$HOME/.cargo/bin/" \ .. make -j 4 install @@ -128,6 +131,7 @@ jobs: msystem: mingw64 pacboy: >- gcc:p + lld:p cmake:p make:p ccache:p @@ -169,13 +173,16 @@ jobs: PYTHON_LIB_NAME=$(pkg-config --libs-only-l python3 | sed 's/^-l//' | sed 's/ //') PYTHON_LIB_PATH=$(cygpath -m $(which lib${PYTHON_LIB_NAME}.dll)) - cmake -G "MinGW Makefiles" \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - -DCMAKE_INSTALL_PREFIX="$PWD/install" \ - -DCREATE_PACKAGE=ON \ - -DPython_LIBRARY="$PYTHON_LIB_PATH" \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DRUST_PATH="$USERPROFILE/.cargo/bin/" \ + cmake -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_INSTALL_PREFIX="$PWD/install" \ + -DCREATE_PACKAGE=ON \ + -DPython_LIBRARY="$PYTHON_LIB_PATH" \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_FLAGS="-fuse-ld=lld" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ + -DRUST_PATH="$USERPROFILE/.cargo/bin/" \ .. mingw32-make -j4 install cpack @@ -225,11 +232,14 @@ jobs: CXX=$(brew --prefix llvm)/bin/clang++ \ PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \ MACOSX_DEPLOYMENT_TARGET="10.15" \ - cmake \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ - -DCREATE_BUNDLE=ON \ - -DCREATE_PACKAGE=ON \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + cmake \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCREATE_BUNDLE=ON \ + -DCREATE_PACKAGE=ON \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_FLAGS="-fuse-ld=lld" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ .. make -j4 package diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f5c8944a7..7835979dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,10 +39,13 @@ jobs: run: | mkdir -p build cd build - CC=gcc-10 CXX=g++-10 cmake \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + CC=gcc-10 CXX=g++-10 cmake \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_INSTALL_PREFIX="$PWD/install" \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_FLAGS="-fuse-ld=lld" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ .. make -j4 unit_tests install diff --git a/dist/get_deps_archlinux.sh b/dist/get_deps_archlinux.sh index ad71417bb..4ce6910ef 100755 --- a/dist/get_deps_archlinux.sh +++ b/dist/get_deps_archlinux.sh @@ -1,11 +1,12 @@ #!/usr/bin/env sh pacman -S --needed \ - cmake \ - gcc \ - glfw \ - file \ - mbedtls \ - python3 \ + cmake \ + gcc \ + lld \ + glfw \ + file \ + mbedtls \ + python3 \ freetype2 \ gtk3 diff --git a/dist/get_deps_debian.sh b/dist/get_deps_debian.sh index 873dc6389..ec906a6c5 100755 --- a/dist/get_deps_debian.sh +++ b/dist/get_deps_debian.sh @@ -14,6 +14,7 @@ apt install -y \ build-essential \ gcc-10 \ g++-10 \ + lld \ ${PKGCONF:-} \ cmake \ make \ diff --git a/dist/get_deps_fedora.sh b/dist/get_deps_fedora.sh index ad81e9a55..1c49f91a7 100755 --- a/dist/get_deps_fedora.sh +++ b/dist/get_deps_fedora.sh @@ -1,12 +1,13 @@ #!/usr/bin/env sh -dnf install \ - cmake \ - gcc-c++ \ - file-devel \ - glfw-devel \ - mesa-libGL-devel \ - mbedtls-devel \ - python-devel \ - freetype-devel \ +dnf install \ + cmake \ + gcc-c++ \ + lld \ + file-devel \ + glfw-devel \ + mesa-libGL-devel \ + mbedtls-devel \ + python-devel \ + freetype-devel \ gtk3-devel diff --git a/dist/get_deps_msys2.sh b/dist/get_deps_msys2.sh index 634a9388e..3eedd6aae 100755 --- a/dist/get_deps_msys2.sh +++ b/dist/get_deps_msys2.sh @@ -1,13 +1,14 @@ #!/usr/bin/env sh -pacman -S --needed --noconfirm \ - mingw-w64-x86_64-gcc \ - mingw-w64-x86_64-cmake \ - mingw-w64-x86_64-make \ - mingw-w64-x86_64-ccache \ - mingw-w64-x86_64-glfw \ - mingw-w64-x86_64-file \ - mingw-w64-x86_64-mbedtls \ - mingw-w64-x86_64-python \ - mingw-w64-x86_64-freetype \ +pacman -S --needed --noconfirm \ + mingw-w64-x86_64-gcc \ + mingw-w64-x86_64-lld \ + mingw-w64-x86_64-cmake \ + mingw-w64-x86_64-make \ + mingw-w64-x86_64-ccache \ + mingw-w64-x86_64-glfw \ + mingw-w64-x86_64-file \ + mingw-w64-x86_64-mbedtls \ + mingw-w64-x86_64-python \ + mingw-w64-x86_64-freetype \ mingw-w64-x86_64-dlfcn diff --git a/dist/msys2/PKGBUILD b/dist/msys2/PKGBUILD index 4a6c6e955..5b86e9a50 100644 --- a/dist/msys2/PKGBUILD +++ b/dist/msys2/PKGBUILD @@ -9,6 +9,7 @@ url="https://github.com/WerWolv/ImHex" license=('GPLv2') depends=("${MINGW_PACKAGE_PREFIX}-python") makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" + "${MINGW_PACKAGE_PREFIX}-lld" "${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-make" "${MINGW_PACKAGE_PREFIX}-dlfcn"