Skip to content

Commit

Permalink
Weird osx build error fix in .yml and .sh
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaiaeroastro committed Jul 24, 2024
1 parent fb3a24f commit 96e5046
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- run: sh cmake/GenerateMake.sh "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"
- run: sh cmake/GenerateMake.sh
- run: cmake --build .
working-directory: ./build
- run: ctest -V
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- run: sh cmake/GenerateMake.sh "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64 -DCMAKE_BUILD_TYPE=Debug"
- run: sh cmake/GenerateMake.sh "Debug"
- run: cmake --build .
working-directory: ./build
- run: ctest -V
Expand Down
20 changes: 19 additions & 1 deletion cmake/GenerateMake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,22 @@ basepath="$(cd "$(dirname "$0")" && pwd)"
builddir="$basepath/../build"
mkdir -p "$builddir"
cd "$builddir"
cmake .. -G "Unix Makefiles" "$@"

# Check if we are on macOS
if [ "$(uname)" = "Darwin" ]; then
# Check if the first argument is Debug mode
if [ "$1" = "Debug" ]; then
shift # Remove the first argument to pass remaining arguments
cmake .. -G "Unix Makefiles" -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE=Debug "$@"
else
cmake .. -G "Unix Makefiles" -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE=Release "$@"
fi
else
# For Linux and other OSes
if [ "$1" = "Debug" ]; then
shift # Remove the first argument to pass remaining arguments
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug "$@"
else
cmake .. -G "Unix Makefiles" "$@"
fi
fi

0 comments on commit 96e5046

Please sign in to comment.