Skip to content

Commit

Permalink
Clean-Up: build.sh logic for -std=...
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Jan 18, 2022
1 parent 252a06e commit 440a160
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
5 changes: 2 additions & 3 deletions recipe/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if errorlevel 1 exit 1

for %%d in (1 2 3 RZ) do (
cmake ^
-S . -B build ^
-S %SRC_DIR% -B build ^
-G "Ninja" ^
-DCMAKE_BUILD_TYPE=RelWithDebInfo ^
-DCMAKE_C_COMPILER=clang-cl ^
Expand All @@ -22,8 +22,7 @@ for %%d in (1 2 3 RZ) do (
-DWarpX_openpmd_internal=OFF ^
-DWarpX_PSATD=ON ^
-DWarpX_QED=ON ^
-DWarpX_DIMS=%%d ^
%SRC_DIR%
-DWarpX_DIMS=%%d
if errorlevel 1 exit 1

cmake --build build --config RelWithDebInfo --parallel 2
Expand Down
20 changes: 5 additions & 15 deletions recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/usr/bin/env bash

# find out toolchain C++ standard
CXX_STANDARD=14
# avoid side-injection of -std=c++14 flag in some toolchains
if [[ ${CXXFLAGS} == *"-std=c++14"* ]]; then
echo "14"
CXX_STANDARD=14
elif [[ ${CXXFLAGS} == *"-std=c++17"* ]]; then
echo "17"
CXX_STANDARD=17
elif [[ ${CXXFLAGS} == *"-std="* ]]; then
echo "ERROR: unknown C++ standard in toolchain!"
echo ${CXXFLAGS}
exit 1
echo "14 -> 17"
export CXXFLAGS="${CXXFLAGS} -std=c++17"
fi

# IPO/LTO does only work with certain toolchains
Expand All @@ -23,10 +15,9 @@ fi
for dim in "1" "2" "3" "RZ"
do
cmake \
-S . -B build \
-S ${SRC_DIR} -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_CXX_STANDARD=${CXX_STANDARD} \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DWarpX_openpmd_internal=OFF \
Expand All @@ -37,8 +28,7 @@ do
-DWarpX_OPENPMD=ON \
-DWarpX_PSATD=ON \
-DWarpX_QED=ON \
-DWarpX_DIMS=${dim} \
${SRC_DIR}
-DWarpX_DIMS=${dim}

cmake --build build --parallel ${CPU_COUNT}

Expand Down

0 comments on commit 440a160

Please sign in to comment.