Skip to content

Commit

Permalink
Additional cleanup for windows build with sys python
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdawkins committed Jul 26, 2023
1 parent 9afd72b commit 36d97c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
22 changes: 15 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -567,25 +567,33 @@ if( VIAME_ENABLE_PYTHON )
set( VIAME_PYTHON_INSTALL ${PYBASE} CACHE INTERNAL "VIAME Python install path" )
set( VIAME_PYTHON_USERBASE "${VIAME_INSTALL_PREFIX}" )

# Add PYTHON_PATH variables internal to the VIAME build tree, e.g. things installed
# just for VIAME not in an external Python environment or install
set( PYTHON_PATH_DESC "Pythonpath for all files installed as a part of VIAME" )
if( WIN32 )
string( REPLACE "/" "\\" VIAME_PYTHON_USERBASE "${VIAME_PYTHON_USERBASE}" )
# Add PYTHON_PATH variables internal to the VIAME build tree, e.g. things installed
# just for VIAME not in an external Python environment or install
set( VIAME_PYTHON_PATH
${PYBASE};${PYBASE}/site-packages;${PYBASE}/dist-packages
CACHE INTERNAL "Pythonpath for all files installed as a part of VIAME" )
CACHE INTERNAL ${PYTHON_PATH_DESC} )
if( NOT VIAME_ENABLE_PYTHON-INTERNAL )
# If using system python on windows, add all possible path locations for
# python packages in the system install just so they can be used in addition
# to the ones within the VIAME install tree
set( VIAME_PYTHON_PATH
${VIAME_PYTHON_PATH};${PYTHON_STDLIB};${PYTHON_SITELIB};${PYTHON_RUNTIME_LIBRARY_DIRS}/DLLs
CACHE INTERNAL "Pythonpath for all files installed as a part of VIAME" )
if( EXISTS "${PYTHON_STDLIB}" AND EXISTS "${PYTHON_SITELIB}" )
set( VIAME_PYTHON_PATH
${VIAME_PYTHON_PATH};${PYTHON_STDLIB};${PYTHON_SITELIB}
CACHE INTERNAL ${PYTHON_PATH_DESC} )
endif()
if( EXISTS "${PYTHON_RUNTIME_LIBRARY_DIRS}/DLLs" )
set( VIAME_PYTHON_PATH
${VIAME_PYTHON_PATH};${PYTHON_RUNTIME_LIBRARY_DIRS}/DLLs
CACHE INTERNAL ${PYTHON_PATH_DESC} )
endif()
endif()
else()
set( VIAME_PYTHON_PATH
${PYBASE}:${PYBASE}/site-packages:${PYBASE}/dist-packages
CACHE INTERNAL "Pythonpath for all files installed as a part of VIAME")
CACHE INTERNAL ${PYTHON_PATH_DESC} )
endif()

# Configure PYTHON_DEP_ENV_VARS, this is used to set the environment used for
Expand Down
12 changes: 7 additions & 5 deletions cmake/add_project_python_deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
# ------------------------------ ADD ANY BASIC PYTHON DEPS HERE ----------------------------------
# Basic dependencies are installed jointly in one local pip installation call

set( VIAME_PYTHON_BASIC_DEPS "wheel" )

if( VIAME_FIXUP_BUNDLE )
set( VIAME_PYTHON_BASIC_DEPS "numpy==1.19.3" )
list( APPEND VIAME_PYTHON_BASIC_DEPS "numpy==1.19.3" )
else()
set( VIAME_PYTHON_BASIC_DEPS "numpy<=1.23.5" )
list( APPEND VIAME_PYTHON_BASIC_DEPS "numpy<=1.23.5" )
endif()

if( VIAME_BUILD_TESTS )
set( VIAME_PYTHON_BASIC_DEPS "pytest" )
list( APPEND VIAME_PYTHON_BASIC_DEPS "pytest" )
endif()

# Setuptools < 58.0 required for current version of gdal on windows or earlier python
Expand Down Expand Up @@ -132,9 +134,9 @@ if( VIAME_ENABLE_PYTORCH AND VIAME_ENABLE_PYTORCH-INTERNAL )
endif()

if( VIAME_ENABLE_PYTORCH AND VIAME_ENABLE_PYTORCH-MMDET )
if( WIN32 )
if( WIN32 AND Python_VERSION VERSION_LESS "3.9" )
list( APPEND VIAME_PYTHON_BASIC_DEPS "pycocotools-windows" )
else()
elseif( NOT WIN32 )
list( APPEND VIAME_PYTHON_BASIC_DEPS "pycocotools" )
endif()
endif()
Expand Down

0 comments on commit 36d97c4

Please sign in to comment.