diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 1036017..a4784f4 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -18,13 +18,19 @@ jobs: build: name: Build runs-on: macos-latest + # Set environment variables + #env: + # We globally set CC and CXX. + # CC: x86_64-elf-gcc + # CXX: x86_64-elf-g++ steps: - name: Clone repository uses: actions/checkout@v3 - name: Install dependencies run: | - brew install x86_64-elf-gcc git cmake nasm + brew install git cmake nasm + # x86_64-elf-binutils x86_64-elf-gcc - name: Build run: | - cmake -DCMAKE_C_COMPILER=x86_64-elf-gcc -DCMAKE_CXX_COMPILER=x86_64-elf-g++ -B build + cmake -B build cmake --build build --parallel 2 diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index 3c96674..59a7bed 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -29,6 +29,12 @@ else() set(CMAKE_ASM_COMPILE_OBJECT " -f elf -g -O3 -o ") endif() + +if((${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") OR APPLE) + set(CMAKE_C_COMPILER x86_64-elf-gcc) + set(CMAKE_CXX_COMPILER x86_64-elf-g++) +endif() + # ============================================================================= # C WARNINGs # ============================================================================= diff --git a/mentos/CMakeLists.txt b/mentos/CMakeLists.txt index ddbeb0c..af0f679 100644 --- a/mentos/CMakeLists.txt +++ b/mentos/CMakeLists.txt @@ -47,6 +47,11 @@ else() set(CMAKE_ASM_COMPILE_OBJECT " -f elf -g -O3 -o ") endif() +if((${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") OR APPLE) + set(CMAKE_C_COMPILER x86_64-elf-gcc) + set(CMAKE_CXX_COMPILER x86_64-elf-g++) +endif() + # ============================================================================= # C WARNINGs # ============================================================================= diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index 1c016ea..d7bd9ab 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.1...3.22) # Initialize the project. project(programs C) +if((${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") OR APPLE) + set(CMAKE_C_COMPILER x86_64-elf-gcc) + set(CMAKE_CXX_COMPILER x86_64-elf-g++) +endif() + # ============================================================================= # List of programs. # ============================================================================= diff --git a/programs/tests/CMakeLists.txt b/programs/tests/CMakeLists.txt index 59bd3d3..971483b 100644 --- a/programs/tests/CMakeLists.txt +++ b/programs/tests/CMakeLists.txt @@ -6,6 +6,11 @@ cmake_minimum_required(VERSION 3.1...3.22) # Initialize the project. project(tests C) +if((${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") OR APPLE) + set(CMAKE_C_COMPILER x86_64-elf-gcc) + set(CMAKE_CXX_COMPILER x86_64-elf-g++) +endif() + # ============================================================================= # List of programs. # =============================================================================