Skip to content

Commit

Permalink
switch into clang
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Jan 29, 2025
1 parent 8a8d0ae commit 7136bc7
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
sudo apt-get install -y qemu-user
elif [ "${{ matrix.os }}" = "win" ]; then
sudo apt-get install -y mingw-w64
fi
- name: Download GMP Source
run: |
Expand All @@ -69,27 +68,28 @@ jobs:
cd gmp-${GMP_VERSION}
if [ "${{ matrix.arch }}" = "x86" ]; then
./configure \
CC=clang CXX=clang++ \
--host=i686-pc-linux-gnu \
--enable-shared --disable-static --enable-fat --enable-cxx
elif [ "${{ matrix.arch }}" = "arm64" ]; then
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ \
./configure \
CC=aarch64-linux-gnu-clang CXX=aarch64-linux-gnu-clang++ \
--host=aarch64-linux-gnu \
--enable-shared --disable-static --enable-fat --enable-cxx
elif [ "${{ matrix.arch }}" = "arm" ]; then
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ \
./configure \
CC=arm-linux-gnueabihf-clang CXX=arm-linux-gnueabihf-clang++ \
--host=arm-linux-gnueabihf \
--enable-shared --disable-static --enable-fat --enable-cxx
elif [ "${{ matrix.os }}" = "win" ]; then
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \
./configure \
CC=x86_64-w64-mingw32-clang CXX=x86_64-w64-mingw32-clang++ \
--host=x86_64-w64-mingw32 \
--enable-shared --disable-static --enable-fat --enable-cxx
else
./configure \
CC=clang CXX=clang++ \
--enable-shared --disable-static --enable-fat --enable-cxx
fi
- name: Build GMP
run: |
Expand Down Expand Up @@ -117,36 +117,34 @@ jobs:
else
strip --strip-unneeded ${{ matrix.gmp_so }}
strip --strip-unneeded ${{ matrix.gmp_cpp_so }}
fi
- name: Compile C Program
run: |
if [ "${{ matrix.arch }}" = "x86" ]; then
gcc -m32 -o factorial_gmp .github/workflows/factorial_gmp.c \
clang -m32 -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
elif [ "${{ matrix.arch }}" = "arm64" ]; then
aarch64-linux-gnu-gcc -o factorial_gmp .github/workflows/factorial_gmp.c \
aarch64-linux-gnu-clang -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
elif [ "${{ matrix.arch }}" = "arm" ]; then
arm-linux-gnueabihf-gcc -o factorial_gmp .github/workflows/factorial_gmp.c \
arm-linux-gnueabihf-clang -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
elif [ "${{ matrix.os }}" = "win" ]; then
x86_64-w64-mingw32-gcc -o factorial_gmp.exe .github/workflows/factorial_gmp.c \
x86_64-w64-mingw32-clang -o factorial_gmp.exe .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
else
gcc -o factorial_gmp .github/workflows/factorial_gmp.c \
clang -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
fi
- name: Run C Program
run: |
Expand All @@ -158,7 +156,6 @@ jobs:
echo "Skipping execution for Windows cross-compiled binary."
else
LD_LIBRARY_PATH=${{ github.workspace }}/gmp-${GMP_VERSION}/.libs ./factorial_gmp
fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 7136bc7

Please sign in to comment.