Due to a key rollover of our WebSSO provider there might be a short downtime of this Gitlab server on Friday 2.

Commit 9aea8976 authored by Dominik Thoennes's avatar Dominik Thoennes

Merge branch 'cmake-boost-python' into 'master'

Update CMake boost python logic and std::filesystem usage

See merge request !319
parents cf2af49a 33f4fc56
Pipeline #25795 failed with stages
in 387 minutes and 51 seconds
......@@ -652,9 +652,14 @@ else()
list ( APPEND waLBerla_OPTIONAL_BOOST_COMPONENTS system )
endif()
if ( WALBERLA_BUILD_WITH_PYTHON AND WALBERLA_CXX_COMPILER_IS_MSVC )
if ( WALBERLA_BUILD_WITH_PYTHON )
if( WALBERLA_CXX_COMPILER_IS_MSVC )
get_filename_component(PYTHON_REQUIRED_LIB ${PYTHON_LIBRARY} NAME_WE)
list( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS ${PYTHON_REQUIRED_LIB} )
elseif( WALBERLA_USE_STD_FILESYSTEM OR WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM )
list( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS system )
list( REMOVE_ITEM waLBerla_OPTIONAL_BOOST_COMPONENTS system )
endif()
endif()
# This variable is necessary, if the CMAKE version used is not aware of a more recent boost version (keep this up to date!)
......@@ -749,11 +754,13 @@ if ( WALBERLA_BUILD_WITH_PYTHON AND NOT WALBERLA_CXX_COMPILER_IS_MSVC)
SET(_boost_MULTITHREADED "-mt")
endif()
if( PYTHON_LIBRARY MATCHES "python3" )
string(REPLACE "." ";" VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
list(GET VERSION_LIST 0 PY_VER_MAJOR)
list(GET VERSION_LIST 1 PY_VER_MINOR)
find_library( BOOST_PYTHON_LIBRARY NAMES
boost_python37${_boost_MULTITHREADED} boost_python36${_boost_MULTITHREADED} boost_python35${_boost_MULTITHREADED}
boost_python-py37${_boost_MULTITHREADED} boost_python-py36${_boost_MULTITHREADED} boost_python-py35${_boost_MULTITHREADED}
boost_python-py34${_boost_MULTITHREADED} boost_python-py33${_boost_MULTITHREADED}
boost_python3${_boost_MULTITHREADED}
boost_python${PY_VER_MAJOR}${PY_VER_MINOR}${_boost_MULTITHREADED}
boost_python-py${PY_VER_MAJOR}${PY_VER_MINOR}${_boost_MULTITHREADED}
boost_python${PY_VER_MAJOR}${_boost_MULTITHREADED}
boost_python${_boost_MULTITHREADED}
PATHS ${Boost_LIBRARY_DIRS} NO_DEFAULT_PATH )
else()
......
......@@ -77,17 +77,21 @@ namespace python_coupling {
std::string cwd(cwd_buf);
std::free(cwd_buf);
path = filesystem::absolute( path, cwd );
#else
filesystem::path cwd = filesystem::current_path();
path = filesystem::absolute( path );
#endif
path = filesystem::absolute( path, cwd );
if ( path.extension() == ".py" )
{
moduleName = path.stem().string();
if ( ! path.parent_path().empty() ) {
#ifdef CURRENT_PATH_WORKAROUND
std::string p = filesystem::canonical(path.parent_path(), cwd).string();
#else
std::string p = filesystem::canonical(path.parent_path()).string();
#endif
code << "sys.path.append( r'" << p << "')" << "\n";
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment