Skip to content

Commit

Permalink
CMake: Fix List of Pip Options
Browse files Browse the repository at this point in the history
We were not yet able to pass lists of options to `pip`
commands in our `pip` CMake helper targets. This fixes it.
  • Loading branch information
ax3l committed Oct 9, 2024
1 parent b710896 commit 2268997
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -714,9 +714,9 @@ endforeach()
#
if(WarpX_PYTHON)
set(PY_PIP_OPTIONS "-v" CACHE STRING
"Additional parameters to pass to `pip`")
"Additional parameters to pass to `pip` as ; separated list")
set(PY_PIP_INSTALL_OPTIONS "" CACHE STRING
"Additional parameters to pass to `pip install`")
"Additional parameters to pass to `pip install` as ; separated list")

# ensure all targets are built before we package them in a wheel
set(pyWarpX_INSTALL_TARGET_NAMES)
Expand All @@ -739,7 +739,8 @@ if(WarpX_PYTHON)
${CMAKE_COMMAND} -E rm -f -r warpx-whl
COMMAND
${CMAKE_COMMAND} -E env PYWARPX_LIB_DIR=$<TARGET_FILE_DIR:pyWarpX_${WarpX_DIMS_LAST}>
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} wheel --no-build-isolation --no-deps --wheel-dir=warpx-whl ${WarpX_SOURCE_DIR}
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} wheel --no-build-isolation --no-deps --wheel-dir=warpx-whl "${WarpX_SOURCE_DIR}"
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${WarpX_BINARY_DIR}
DEPENDS
Expand All @@ -754,6 +755,7 @@ if(WarpX_PYTHON)
endif()
add_custom_target(${WarpX_CUSTOM_TARGET_PREFIX}pip_install_requirements
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install ${PY_PIP_INSTALL_OPTIONS} -r "${WarpX_SOURCE_DIR}/${pyWarpX_REQUIREMENT_FILE}"
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${WarpX_BINARY_DIR}
)
Expand All @@ -771,6 +773,7 @@ if(WarpX_PYTHON)
add_custom_target(${WarpX_CUSTOM_TARGET_PREFIX}pip_install
${CMAKE_COMMAND} -E env WARPX_MPI=${WarpX_MPI}
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install --force-reinstall --no-index --no-deps ${PY_PIP_INSTALL_OPTIONS} --find-links=warpx-whl pywarpx
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${WarpX_BINARY_DIR}
DEPENDS
Expand All @@ -784,6 +787,7 @@ if(WarpX_PYTHON)
add_custom_target(${WarpX_CUSTOM_TARGET_PREFIX}pip_install_nodeps
${CMAKE_COMMAND} -E env WARPX_MPI=${WarpX_MPI}
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install --force-reinstall --no-index --no-deps ${PY_PIP_INSTALL_OPTIONS} --find-links=warpx-whl pywarpx
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${WarpX_BINARY_DIR}
DEPENDS
Expand Down
10 changes: 5 additions & 5 deletions Docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ For example, this builds WarpX in all geometries, enables Python bindings and Nv
Build Options
-------------

============================= ============================================ =========================================================
============================= ============================================ ===========================================================
CMake Option Default & Values Description
============================= ============================================ =========================================================
============================= ============================================ ===========================================================
``CMAKE_BUILD_TYPE`` RelWithDebInfo/**Release**/Debug `Type of build, symbols & optimizations <https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html>`__
``CMAKE_INSTALL_PREFIX`` system-dependent path `Install path prefix <https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html>`__
``CMAKE_VERBOSE_MAKEFILE`` ON/**OFF** `Print all compiler commands to the terminal during build <https://cmake.org/cmake/help/latest/variable/CMAKE_VERBOSE_MAKEFILE.html>`__
Expand All @@ -105,9 +105,9 @@ CMake Option Default & Values Descr
``WarpX_QED_TABLES_GEN_OMP`` **AUTO**/ON/OFF Enables OpenMP support for QED lookup tables generation
``WarpX_SENSEI`` ON/**OFF** SENSEI in situ visualization
``Python_EXECUTABLE`` (newest found) Path to Python executable
``PY_PIP_OPTIONS`` ``-v`` Additional options for ``pip``, e.g., ``-vvv``
``PY_PIP_INSTALL_OPTIONS`` Additional options for ``pip install``, e.g., ``--user``
============================= ============================================ =========================================================
``PY_PIP_OPTIONS`` ``-v`` Additional options for ``pip``, e.g., ``-vvv;-q``
``PY_PIP_INSTALL_OPTIONS`` Additional options for ``pip install``, e.g., ``--user;-q``
============================= ============================================ ===========================================================

WarpX can be configured in further detail with options from AMReX, which are documented in the AMReX manual:

Expand Down

0 comments on commit 2268997

Please sign in to comment.