From 2bc0bdd92ebb198a862594d9b7334266833b44a0 Mon Sep 17 00:00:00 2001 From: Qwinci <32550582+Qwinci@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:48:59 +0300 Subject: [PATCH] misc: Add github workflow --- .github/workflows/it-compiles-test.yml | 40 ++++++++++++++++++++++++++ CMakeLists.txt | 4 +++ cmake/toolchain_clang_aarch64.cmake | 2 ++ 3 files changed, 46 insertions(+) create mode 100644 .github/workflows/it-compiles-test.yml diff --git a/.github/workflows/it-compiles-test.yml b/.github/workflows/it-compiles-test.yml new file mode 100644 index 0000000..3582e04 --- /dev/null +++ b/.github/workflows/it-compiles-test.yml @@ -0,0 +1,40 @@ +name: It Compiles! +on: [push, workflow_dispatch] +jobs: + build: + runs-on: ubuntu-24.04 + steps: + - name: Install llvm + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 19 + sudo rm -f $(which clang) $(which clang++) + sudo rm -f /usr/bin/clang /usr/bin/clang++ + sudo ln -s $(which clang-19) /usr/bin/clang + sudo ln -s $(which clang++-19) /usr/bin/clang++ + + - name: Install dependencies + run: | + sudo apt-get update && sudo apt-get install binutils gcc g++ cmake ninja-build xorriso acpica-tools git -y + + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: true + + - name: Build (x86_64 Clang) + run: | + LDFLAGS="-fuse-ld=lld" cmake -B build_x86_64_clang -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + ninja -C build_x86_64_clang + + - name: Build (x86_64 Gcc) + run: | + cmake -B build_x86_64_gcc -G Ninja + ninja -C build_x86_64_gcc + + - name: Build (Aarch64 Clang) + run: | + cmake -B build_aarch64_clang -G Ninja -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_clang_aarch64.cmake + ninja -C build_aarch64_clang + diff --git a/CMakeLists.txt b/CMakeLists.txt index 755f547..4adb751 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,10 @@ endif() add_subdirectory(src) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options(crescent PRIVATE -Wno-unused-command-line-argument) +endif() + if(ARCH STREQUAL "x86_64") target_compile_options(crescent PRIVATE -fPIE) target_compile_definitions(crescent PRIVATE ARCH_X86_64) diff --git a/cmake/toolchain_clang_aarch64.cmake b/cmake/toolchain_clang_aarch64.cmake index af4af12..2d19088 100644 --- a/cmake/toolchain_clang_aarch64.cmake +++ b/cmake/toolchain_clang_aarch64.cmake @@ -2,6 +2,8 @@ set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_C_COMPILER clang) set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld") +set(CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld") set(CMAKE_C_FLAGS "-mno-outline-atomics") set(CMAKE_CXX_FLAGS "-mno-outline-atomics") set(CMAKE_C_COMPILER_TARGET "aarch64-linux-gnu")