From 0888fba482769382c82e32e2a5c36f00a6c6b488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Gl=C3=A4=C3=9Fle?= Date: Sun, 15 Dec 2024 23:50:34 +0100 Subject: [PATCH] Better parametrization and defaults for madx build script --- .github/build/linux/cpymad.sh | 2 +- .github/build/linux/madx.sh | 19 ++++++++++--------- .github/workflows/build.yml | 8 +++++--- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/build/linux/cpymad.sh b/.github/build/linux/cpymad.sh index fa09f45e..1de9c8cd 100755 --- a/.github/build/linux/cpymad.sh +++ b/.github/build/linux/cpymad.sh @@ -12,7 +12,7 @@ set -ex # Build variables: -export MADXDIR=$(readlink -nf "$1") +export MADXDIRDIR="$(readlink -nf "${1:-/mnt/dist/MAD-X}")" export X11=0 BLAS=0 LAPACK=0 export CFLAGS="-fno-lto" export LDFLAGS="-fno-lto" diff --git a/.github/build/linux/madx.sh b/.github/build/linux/madx.sh index d398d96b..c5bca58a 100755 --- a/.github/build/linux/madx.sh +++ b/.github/build/linux/madx.sh @@ -5,21 +5,22 @@ # # Arguments: # : root directory of MAD-X sources -# -# Outputs: -# /build: cmake build directory -# /dist: MAD-X installation directory (binary distribution) +# : cmake build directory +# : MAD-X installation directory (binary distribution) set -ex -cd "$1" -mkdir -p build -cd build +SRCDIR="$(readlink -nf "${1:-/mnt/src/MAD-X}")" +BUILDDIR="$(readlink -nf "${2:-/mnt/build/MAD-X}")" +INSTALLDIR="$(readlink -nf "${3:-/mnt/dist/MAD-X}")" + +mkdir -p "$BUILDDIR" +cd "$BUILDDIR" if [[ ! -f CMakeCache.txt ]]; then - cmake .. \ + cmake "$SRCDIR" \ -DBUILD_SHARED_LIBS=OFF \ -DMADX_STATIC=ON \ - -DCMAKE_INSTALL_PREFIX=../dist \ + -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_FLAGS="-fvisibility=hidden" \ -DCMAKE_CXX_FLAGS="-fvisibility=hidden" \ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 547def10..7d138fc8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,7 +64,7 @@ jobs: -w /mnt \ -v `pwd`:/mnt \ builder \ - .github/build/linux/madx.sh src/MAD-X + .github/build/linux/madx.sh src/MAD-X build/MAD-X dist/MAD-X shell: bash - name: Build cpymad wheels @@ -73,14 +73,16 @@ jobs: -w /mnt \ -v `pwd`:/mnt \ builder \ - .github/build/linux/cpymad.sh src/MAD-X/dist + .github/build/linux/cpymad.sh dist/MAD-X shell: bash - name: Upload cpymad wheels uses: actions/upload-artifact@v4 with: name: dist-linux-${{ matrix.base }} - path: dist + path: | + dist/ + !dist/MAD-X build_windows: name: "Build: Windows"