Skip to content

Commit

Permalink
consolidate compile options
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Jan 30, 2025
1 parent 38c65c9 commit dc65f48
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
elif [ "${{ matrix.os }}" = "win" ]; then
sudo apt-get install -y mingw-w64
sudo apt-get install -y wine
fi
- name: Download GMP Source
run: |
Expand Down Expand Up @@ -101,31 +102,19 @@ jobs:
- name: Compile C Program
run: |
COMPILE_OPTIONS=".github/workflows/factorial_gmp.c -I${{ github.workspace }}/gmp-${GMP_VERSION} -L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs -lgmp"
if [ "${{ matrix.arch }}" = "x86" ]; then
gcc -m32 -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
gcc -m32 -o factorial_gmp $COMPILE_OPTIONS
elif [ "${{ matrix.arch }}" = "arm64" ]; then
aarch64-linux-gnu-gcc -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
aarch64-linux-gnu-gcc -o factorial_gmp $COMPILE_OPTIONS
elif [ "${{ matrix.arch }}" = "arm" ]; then
arm-linux-gnueabihf-gcc -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
arm-linux-gnueabihf-gcc -o factorial_gmp $COMPILE_OPTIONS
elif [ "${{ matrix.os }}" = "win" ]; then
x86_64-w64-mingw32-gcc -o factorial_gmp.exe .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
x86_64-w64-mingw32-gcc -o factorial_gmp.exe $COMPILE_OPTIONS
else
gcc -o factorial_gmp .github/workflows/factorial_gmp.c \
-I${{ github.workspace }}/gmp-${GMP_VERSION} \
-L${{ github.workspace }}/gmp-${GMP_VERSION}/.libs \
-lgmp
gcc -o factorial_gmp $COMPILE_OPTIONS
fi
- name: Run C Program
run: |
Expand All @@ -138,6 +127,7 @@ jobs:
wine ${GITHUB_WORKSPACE}/factorial_gmp.exe
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 dc65f48

Please sign in to comment.