Skip to content

Commit

Permalink
Merge pull request #33 from sparcians/dev/bdutro/conda-fixes
Browse files Browse the repository at this point in the history
Tweak stfpy build/install flow to work better with in a conda packaging enivronment
  • Loading branch information
bdutro authored Mar 20, 2024
2 parents 48a3226 + 53f636b commit a348e45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 5 additions & 4 deletions stfpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ find_package(Python3 COMPONENTS Interpreter Development)

include_directories(${STF_BASE}/stf-inc)

add_compile_options(-Wno-sign-conversion -Wno-deprecated-declarations -Wno-deprecated-copy)
add_compile_options(-Wno-sign-conversion -Wno-deprecated-declarations -Wno-deprecated-copy -Wno-implicit-int-conversion -Wno-missing-field-initializers)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-ignored-optimization-argument -Wno-unknown-warning-option)
Expand Down Expand Up @@ -68,9 +68,10 @@ add_custom_command(

add_custom_target(stfpy ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/stfpy.stamp)

if(STFPY_INSTALL_DIR)
install(CODE "execute_process(COMMAND pip install --prefix ${STFPY_INSTALL_DIR} --no-index --find-links=${CMAKE_CURRENT_BINARY_DIR} stfpy)")
endif()
if(STF_INSTALL_DIR)
file(GLOB whl_file "${CMAKE_CURRENT_BINARY_DIR}/stfpy*.whl")
install(CODE "execute_process(COMMAND pip install --prefix ${STF_INSTALL_DIR} ${whl_file})")
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tools/stfpython DESTINATION ${STF_INSTALL_DIR})
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tools/stfpy_init.py DESTINATION ${STF_INSTALL_DIR}/lib)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tools/stfpy_init.py DESTINATION ${STF_INSTALL_DIR})
endif()
10 changes: 6 additions & 4 deletions stfpy/tools/stfpython
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
SCRIPTPATH="$( cd -- "$(dirname "$(realpath "$0")")" >/dev/null 2>&1 ; pwd -P )"
LIBPATH=${SCRIPTPATH}/lib

site_packages_dir=$(find ${LIBPATH} -type d -name "site-packages")
if [ -d $LIBPATH ]; then
site_packages_dir=$(find ${LIBPATH} -type d -name "site-packages")

export PYTHONPATH=${site_packages_dir}:$PYTHONPATH
export PYTHONSTARTUP=${LIBPATH}/stfpy_init.py
python $@
export PYTHONPATH=${site_packages_dir}:$PYTHONPATH
fi

PYTHONSTARTUP=${SCRIPTPATH}/stfpy_init.py python $@

0 comments on commit a348e45

Please sign in to comment.