Skip to content

Commit

Permalink
review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
scottwittenburg committed Dec 13, 2023
1 parent f90bf31 commit 0786486
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 162 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/pypackaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Python Packaging

on:
workflow_dispatch:
inputs:
overrideVersion:
description: Manually force a version
pull_request:
push:
branches:
Expand All @@ -10,18 +13,20 @@ on:
types:
- published

env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.overrideVersion }}

jobs:
make_sdist:
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build SDist
run: pipx run build --sdist
env:
# TODO: debug only, prevents upload failure due to "local" version
SETUPTOOLS_SCM_PRETEND_VERSION: "2.9.2.post431"

- uses: actions/upload-artifact@v3
with:
Expand All @@ -38,13 +43,13 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pypa/cibuildwheel@v2.16
env:
# TODO: CIBW_BUILD: cp*-manylinux_x86_64
CIBW_BUILD: cp39-manylinux_x86_64
# TODO: debug only, prevents upload failure due to "local" version
SETUPTOOLS_SCM_PRETEND_VERSION: "2.9.2.post431"

- name: Upload wheels
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -74,8 +79,7 @@ jobs:
id-token: write
runs-on: ubuntu-latest
# Upload to Test PyPI for every commit on main branch
# TODO: if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
if: github.event_name == 'pull_request' && github.event.action == 'synchronize' && github.event.pull_request.head.ref == 'add-pip-packaging'
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -86,5 +90,3 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true

6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ setup_version(2.9.0)
project(ADIOS2 VERSION ${ADIOS2_VERSION})

# Advanced option to tell CMake the build is on behalf of pip
set(ADIOS2_PIP_INSTALL OFF CACHE BOOL "Turn on for pip install")
mark_as_advanced(ADIOS2_PIP_INSTALL)
set(ADIOS2_USE_PIP OFF CACHE BOOL "Turn on for pip install")
mark_as_advanced(ADIOS2_USE_PIP)

if (ADIOS2_PIP_INSTALL)
if (ADIOS2_USE_PIP)
# Required for shared library placement.
if (WIN32)
# Defaults are fine; handled by `delvewheel`.
Expand Down
33 changes: 11 additions & 22 deletions bindings/Python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,22 @@ set_target_properties(adios2_py PROPERTIES
)

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if (ADIOS2_PIP_INSTALL)
set_target_properties(adios2_py PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_RPATH}"
)
else()
if (NOT ADIOS2_USE_PIP)
string(REGEX REPLACE "[^/]+" ".." relative_base "${CMAKE_INSTALL_PYTHONDIR}/adios2")
set_target_properties(adios2_py PROPERTIES
INSTALL_RPATH "$ORIGIN/${relative_base}/${CMAKE_INSTALL_LIBDIR}"
)
endif()
endif()

if (ADIOS2_PIP_INSTALL)
install(TARGETS adios2_py
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT adios2_python-python)
install(FILES ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/adios2/__init__.py
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT adios2_python-python)
else ()
install(TARGETS adios2_py
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}
COMPONENT adios2_python-python
)
install(FILES ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/adios2/__init__.py
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}
COMPONENT adios2_python-python
)
endif ()
set(install_location ${CMAKE_INSTALL_PYTHONDIR})
if (ADIOS2_USE_PIP)
set(install_location ${CMAKE_INSTALL_LIBDIR})
endif()

install(TARGETS adios2_py
DESTINATION ${install_location}
COMPONENT adios2_python-python)
install(FILES ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/adios2/__init__.py
DESTINATION ${install_location}
COMPONENT adios2_python-python)
2 changes: 1 addition & 1 deletion cmake/DetectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ if(NOT SHARED_LIBS_SUPPORTED)
endif()
endif()

if(ADIOS2_PIP_INSTALL)
if(ADIOS2_USE_PIP)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development.Module NumPy)
elseif(ADIOS2_USE_Python STREQUAL AUTO)
find_package(Python 3 COMPONENTS Interpreter Development NumPy)
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ wheel.packages = ["adios2"]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"

[tool.setuptools_scm] # Section required
write_to = "_version.py"
version_scheme = "post-release"

[tool.cibuildwheel.linux]
environment-pass = ["SETUPTOOLS_SCM_PRETEND_VERSION"]

[tool.scikit-build.cmake.define]
ADIOS2_USE_PIP = "ON"
ADIOS2_USE_Python = "ON"
ADIOS2_USE_Fortran = "OFF"
ADIOS2_USE_MPI = "OFF"
Expand All @@ -55,6 +55,5 @@ ADIOS2_USE_DataMan = "OFF"
ADIOS2_USE_SZ = "OFF"
ADIOS2_USE_ZeroMQ = "OFF"
ADIOS2_USE_ZFP = "OFF"
ADIOS2_PIP_INSTALL = "ON"
BUILD_TESTING = "OFF"
ADIOS2_INSTALL_GENERATE_CONFIG = "OFF"
5 changes: 4 additions & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#------------------------------------------------------------------------------#

add_subdirectory(adios2)
add_subdirectory(utils)

if (NOT ADIOS2_PIP_INSTALL)
add_subdirectory(utils)
endif()

if(ADIOS2_HAVE_HDF5_VOL)
add_subdirectory(h5vol)
Expand Down
4 changes: 3 additions & 1 deletion source/adios2/toolkit/sst/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ if(CMAKE_VERSION VERSION_LESS 3.14)
endforeach()
endif()

add_subdirectory(util)
if (NOT ADIOS2_PIP_INSTALL)
add_subdirectory(util)
endif ()
36 changes: 17 additions & 19 deletions source/adios2/toolkit/sst/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@
# accompanying file Copyright.txt for details.
#------------------------------------------------------------------------------#

if (NOT ADIOS2_PIP_INSTALL)
if(ADIOS2_HAVE_MPI)
set(maybe_adios2_core_mpi adios2_core_mpi)
else()
set(maybe_adios2_core_mpi)
endif()
if(ADIOS2_HAVE_MPI)
set(maybe_adios2_core_mpi adios2_core_mpi)
else()
set(maybe_adios2_core_mpi)
endif()

# stt_conn_tool
add_executable(sst_conn_tool sst_conn_tool.c sst_conn_tool.cxx)
target_link_libraries(sst_conn_tool ${maybe_adios2_core_mpi} adios2_core)
set_property(TARGET sst_conn_tool PROPERTY OUTPUT_NAME sst_conn_tool${ADIOS2_EXECUTABLE_SUFFIX})
# stt_conn_tool
add_executable(sst_conn_tool sst_conn_tool.c sst_conn_tool.cxx)
target_link_libraries(sst_conn_tool ${maybe_adios2_core_mpi} adios2_core)
set_property(TARGET sst_conn_tool PROPERTY OUTPUT_NAME sst_conn_tool${ADIOS2_EXECUTABLE_SUFFIX})

if(WIN32)
target_link_libraries(sst_conn_tool getopt)
endif()
if(WIN32)
target_link_libraries(sst_conn_tool getopt)
endif()

target_link_libraries(sst_conn_tool sst adios2::thirdparty::EVPath)
target_link_libraries(sst_conn_tool sst adios2::thirdparty::EVPath)

target_include_directories(sst_conn_tool PRIVATE .. ../cp )
target_include_directories(sst_conn_tool PRIVATE .. ../cp )

install(TARGETS sst_conn_tool EXPORT adios2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT adios2_tools-runtime
)
endif ()
install(TARGETS sst_conn_tool EXPORT adios2
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT adios2_tools-runtime
)
Loading

0 comments on commit 0786486

Please sign in to comment.