Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Fix List of Pip Options #377

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ endif()
# pip helpers for the amrex package ###########################################
#
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")

# add a prefix to custom targets so we do not collide if used as a subproject
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
Expand All @@ -292,7 +292,8 @@ add_custom_target(${pyAMReX_CUSTOM_TARGET_PREFIX}pip_wheel
${CMAKE_COMMAND} -E rm -f -r amrex-whl
COMMAND
${CMAKE_COMMAND} -E env PYAMREX_LIBDIR=${CMAKE_PYTHON_OUTPUT_DIRECTORY}/amrex/
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} wheel --no-build-isolation --no-deps --wheel-dir=amrex-whl ${pyAMReX_SOURCE_DIR}
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} wheel --no-build-isolation --no-deps --wheel-dir=amrex-whl "${pyAMReX_SOURCE_DIR}"
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${pyAMReX_BINARY_DIR}
DEPENDS
Expand All @@ -302,6 +303,7 @@ add_custom_target(${pyAMReX_CUSTOM_TARGET_PREFIX}pip_wheel
# this will also upgrade/downgrade dependencies, e.g., when the version of numpy changes
add_custom_target(${pyAMReX_CUSTOM_TARGET_PREFIX}pip_install_requirements
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install ${PY_PIP_INSTALL_OPTIONS} -r "${pyAMReX_SOURCE_DIR}/requirements.txt"
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${pyAMReX_BINARY_DIR}
)
Expand All @@ -312,6 +314,7 @@ add_custom_target(${pyAMReX_CUSTOM_TARGET_PREFIX}pip_install_requirements
add_custom_target(${pyAMReX_CUSTOM_TARGET_PREFIX}pip_install
${CMAKE_COMMAND} -E env AMREX_MPI=${AMReX_MPI}
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install --force-reinstall --no-index --no-deps ${PY_PIP_INSTALL_OPTIONS} --find-links=amrex-whl amrex
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${pyAMReX_BINARY_DIR}
DEPENDS
Expand All @@ -323,7 +326,8 @@ add_custom_target(${pyAMReX_CUSTOM_TARGET_PREFIX}pip_install
# this is for package managers only
add_custom_target(${pyAMReX_CUSTOM_TARGET_PREFIX}pip_install_nodeps
${CMAKE_COMMAND} -E env AMREX_MPI=${AMReX_MPI}
${Python_EXECUTABLE} -m pip install --force-reinstall --no-index --no-deps ${PY_PIP_INSTALL_OPTIONS} --find-links=amrex-whl amrex
${Python_EXECUTABLE} -m pip ${PY_PIP_OPTIONS} install --force-reinstall --no-index --no-deps ${PY_PIP_INSTALL_OPTIONS} --find-links=amrex-whl amrex
COMMAND_EXPAND_LISTS VERBATIM
WORKING_DIRECTORY
${pyAMReX_BINARY_DIR}
DEPENDS
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ If you are using the pip-driven install, selected [AMReX CMake options](https://
| `PYAMREX_LIBDIR` | *None* | If set, search for pre-built a pyAMReX library |
| `PYAMREX_CCACHE` | **ON**/OFF | Search and use CCache to speed up rebuilds |
| `PYAMREX_IPO` | **ON**/OFF | Compile with interprocedural/link optimization (IPO/LTO) |
| `PY_PIP_OPTIONS` | `-v` | Additional options for ``pip``, e.g., ``-vvv`` |
| `PY_PIP_INSTALL_OPTIONS` | *None* | Additional options for ``pip install``, e.g., ``--user`` |
| `PY_PIP_OPTIONS` | `-v` | Additional options for ``pip``, e.g., ``-vvv;-q`` |
| `PY_PIP_INSTALL_OPTIONS` | *None* | Additional options for ``pip install``, e.g., ``--user;-q`` |

Furthermore, pyAMReX adds a few selected CMake build options:

Expand Down
4 changes: 2 additions & 2 deletions docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ CMake Option Default & Values Des
``AMReX_SPACEDIM`` ``3`` Dimension(s) of AMReX as a ``;``-separated list
``AMReX_BUILD_SHARED_LIBS`` ON/**OFF** Build AMReX library as shared (required for app extensions)
``pyAMReX_INSTALL`` **ON**/OFF Enable install targets for pyAMReX
``PY_PIP_OPTIONS`` ``-v`` Additional options for ``pip``, e.g., ``-vvv``
``PY_PIP_INSTALL_OPTIONS`` *None* Additional options for ``pip install``, e.g., ``--user``
``PY_PIP_OPTIONS`` ``-v`` Additional options for ``pip``, e.g., ``-vvv;-q``
``PY_PIP_INSTALL_OPTIONS`` *None* Additional options for ``pip install``, e.g., ``--user;-q``
``Python_EXECUTABLE`` (newest found) Path to Python executable
=============================== ============================================ ===========================================================

Expand Down
Loading