From 84a7785b3bbb1bdd8e9bf122a01f46e7f8426d4e Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 1 Mar 2021 16:33:32 -0800 Subject: [PATCH] Python Layer - remove hard-coded dependencies - add pywarpx (PICMI) interface package --- recipe/bld.bat | 25 +++++++++++++++++-------- recipe/build.sh | 16 +++++++++++----- recipe/meta.yaml | 9 +++++++++ 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/recipe/bld.bat b/recipe/bld.bat index d6d5186..3ee8844 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -1,6 +1,4 @@ -echo "CXXFLAGS: %CXXFLAGS%" - for %%d in (2 3 RZ) do ( cmake ^ -S . -B build ^ @@ -9,10 +7,9 @@ for %%d in (2 3 RZ) do ( -DCMAKE_C_COMPILER=clang-cl ^ -DCMAKE_CXX_COMPILER=clang-cl ^ -DCMAKE_VERBOSE_MAKEFILE=ON ^ - -DWarpX_amrex_branch=%PKG_VERSION% ^ -DWarpX_openpmd_internal=OFF ^ - -DWarpX_picsar_branch=47c269eb242815f9382da61a110c0c8f12be2d08 ^ -DWarpX_ASCENT=OFF ^ + -DWarpX_LIB=ON ^ -DWarpX_MPI=OFF ^ -DWarpX_OPENPMD=ON ^ -DWarpX_PSATD=OFF ^ @@ -23,12 +20,14 @@ for %%d in (2 3 RZ) do ( cmake --build build --config RelWithDebInfo --parallel 2 if errorlevel 1 exit 1 -) -:: future: test + :: future (if skipping AMReX headers) + :: cmake --build build --config RelWithDebInfo --target install + :: if errorlevel 1 exit 1 +) -:: future: install -:: now: copy all warpx*.exe files +:: simple install +:: copy all warpx*.exe and warpx*.dll files if not exist %LIBRARY_PREFIX%\bin md %LIBRARY_PREFIX%\bin if errorlevel 1 exit 1 @@ -38,3 +37,13 @@ for /r "build\bin" %%f in (*.exe) do ( copy build\bin\%%~nf.exe %LIBRARY_PREFIX%\bin\ if errorlevel 1 exit 1 ) +for /r "build\lib" %%f in (*.dll) do ( + echo %%~nf + dir + copy build\lib\%%~nf.dll %LIBRARY_PREFIX%\lib\ + if errorlevel 1 exit 1 +) + +:: add Python API (PICMI interface) +PYWARPX_LIB_DIR=%LIBRARY_PREFIX%\lib python3 -m pip wheel . +python3 -m pip install pywarpx-*whl diff --git a/recipe/build.sh b/recipe/build.sh index 4f3c7f9..59b3e60 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -23,10 +23,9 @@ do -DCMAKE_CXX_STANDARD=${CXX_STANDARD} \ -DCMAKE_INSTALL_LIBDIR=lib \ -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -DWarpX_amrex_branch=${PKG_VERSION} \ -DWarpX_openpmd_internal=OFF \ - -DWarpX_picsar_branch=47c269eb242815f9382da61a110c0c8f12be2d08 \ -DWarpX_ASCENT=OFF \ + -DWarpX_LIB=ON \ -DWarpX_OPENPMD=ON \ -DWarpX_PSATD=OFF \ -DWarpX_QED=ON \ @@ -37,10 +36,17 @@ do # future: #CTEST_OUTPUT_ON_FAILURE=1 make ${VERBOSE_CM} test + + # future (if skipping AMReX headers) + #cmake --build build --target install done -# future: -#make install -mkdir -p ${PREFIX}/bin +# simple install +# copy all binaries and libwarpx* files +mkdir -p ${PREFIX}/bin ${PREFIX}/lib cp build/bin/warpx.* ${PREFIX}/bin/ +cp build/lib/libwarpx.* ${PREFIX}/lib/ +# add Python API (PICMI interface) +PYWARPX_LIB_DIR=$PREFIX/lib python3 -m pip wheel . +python3 -m pip install pywarpx-*whl diff --git a/recipe/meta.yaml b/recipe/meta.yaml index baf586f..d517d2f 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -30,13 +30,22 @@ requirements: - llvm-openmp # [osx or win] host: - boost-cpp + - mpi4py - openmpi # [unix] - openpmd-api * mpi_openmpi_* # [unix] - openpmd-api # [win] + - pip + - setuptools + - wheel # future # - fftw * mpi_openmpi_* # [unix] # - fftw # [win] # a variant could provide CUDA support + run: + - numpy + - periodictable + - python + - scipy test: commands: