Skip to content
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
37 changes: 36 additions & 1 deletion 3rd_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,54 @@ set(PYTHON_EXECUTABLE ""
set(Python3_ROOT_DIR ""
CACHE PATH "Optional root dir for the selected Python installation")


# =========== This block just finds the right python version and sets a relative install path, since adios2.10.1 was misbihaving
# =========== remove this if newer versions of adios2 behave like the other libraries
# Get the exact name of where the python bindings should be installed for ADIOS2.
## Set the python executable
if(PYTHON_EXECUTABLE)
if(NOT EXISTS "${PYTHON_EXECUTABLE}")
message(FATAL_ERROR "PYTHON_EXECUTABLE does not exist: ${PYTHON_EXECUTABLE}")
endif()
set(_third_party_python_exe "${PYTHON_EXECUTABLE}")
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
set(_third_party_python_exe "${Python3_EXECUTABLE}")
endif()
## Execute python to see obtain its version
execute_process(
COMMAND "${_third_party_python_exe}" -c
"import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"
OUTPUT_VARIABLE THIRD_PARTY_PYTHON_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
## Set the variable that adios2 can use
set(THIRD_PARTY_PYTHONDIR
"${THIRD_PARTY_LIBDIR}/python${THIRD_PARTY_PYTHON_VERSION}/site-packages"
CACHE STRING "Relative install dir for Python packages under the third-party prefix")
#===============================================================

file(MAKE_DIRECTORY "${THIRD_PARTY_INSTALL_PREFIX}")
file(MAKE_DIRECTORY "${THIRD_PARTY_DOWNLOAD_DIR}")
file(MAKE_DIRECTORY "${THIRD_PARTY_BUILD_DIR}")
file(MAKE_DIRECTORY "${THIRD_PARTY_INSTALL_PREFIX}/${THIRD_PARTY_BINDIR}")
file(MAKE_DIRECTORY "${THIRD_PARTY_INSTALL_PREFIX}/${THIRD_PARTY_INCLUDEDIR}")
file(MAKE_DIRECTORY "${THIRD_PARTY_INSTALL_PREFIX}/${THIRD_PARTY_LIBDIR}")

# Create enviroment sh to export paths for installed libraries
configure_file(
"${CMAKE_SOURCE_DIR}/env.sh.in"
"${THIRD_PARTY_INSTALL_PREFIX}/env.sh"
@ONLY
)

message(STATUS "Third-party install prefix: ${THIRD_PARTY_INSTALL_PREFIX}")
message(STATUS "Third-party download dir: ${THIRD_PARTY_DOWNLOAD_DIR}")
message(STATUS "Third-party build dir: ${THIRD_PARTY_BUILD_DIR}")
message(STATUS "Third-party bin dir: ${THIRD_PARTY_BINDIR}")
message(STATUS "Third-party include dir: ${THIRD_PARTY_INCLUDEDIR}")
message(STATUS "Third-party lib dir: ${THIRD_PARTY_LIBDIR}")
message(STATUS "Third-party python3 dir: ${THIRD_PARTY_PYTHONDIR}")

if(PYTHON_EXECUTABLE)
message(STATUS "Requested Python executable: ${PYTHON_EXECUTABLE}")
Expand Down Expand Up @@ -124,4 +159,4 @@ endif()

if(INSTALL_PARAVIEW)
include(${CMAKE_SOURCE_DIR}/cmake/paraview.cmake)
endif()
endif()
3 changes: 2 additions & 1 deletion 3rd_party/cmake/adios2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ ExternalProject_Add(adios2_ext
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DADIOS2_USE_ZeroMQ=OFF
-DCMAKE_INSTALL_PYTHONDIR=${THIRD_PARTY_INSTALL_PREFIX}/${THIRD_PARTY_PYTHONDIR}
${_fortran_arg}
${_python_args}
${_bzip2_args}

DEPENDS ${_adios2_depends}
)
)
20 changes: 0 additions & 20 deletions 3rd_party/env.sh

This file was deleted.

15 changes: 15 additions & 0 deletions 3rd_party/env.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

_this_script="${BASH_SOURCE[0]}"
_third_party_prefix="$(cd "$(dirname "$_this_script")" && pwd)"

export THIRD_PARTY_PREFIX="$_third_party_prefix"
export PATH="$THIRD_PARTY_PREFIX/@THIRD_PARTY_BINDIR@:$PATH"
export LD_LIBRARY_PATH="$THIRD_PARTY_PREFIX/@THIRD_PARTY_LIBDIR@:$THIRD_PARTY_PREFIX/lib64:${LD_LIBRARY_PATH:-}"
export LIBRARY_PATH="$THIRD_PARTY_PREFIX/@THIRD_PARTY_LIBDIR@:$THIRD_PARTY_PREFIX/lib64:${LIBRARY_PATH:-}"
export CPATH="$THIRD_PARTY_PREFIX/@THIRD_PARTY_INCLUDEDIR@:${CPATH:-}"
export CMAKE_PREFIX_PATH="$THIRD_PARTY_PREFIX:${CMAKE_PREFIX_PATH:-}"
export PKG_CONFIG_PATH="$THIRD_PARTY_PREFIX/@THIRD_PARTY_LIBDIR@/pkgconfig:$THIRD_PARTY_PREFIX/lib64/pkgconfig:$THIRD_PARTY_PREFIX/share/pkgconfig:${PKG_CONFIG_PATH:-}"

# Python packages installed under the local prefix
export PYTHONPATH="$THIRD_PARTY_PREFIX/@THIRD_PARTY_PYTHONDIR@:${PYTHONPATH:-}"