Commit a44ca303 authored by Dominik Thoennes's avatar Dominik Thoennes
Browse files

first steps in adding pystencils and lbmpy as submodules

parent 997402d4
[submodule "extern/pybind11"]
path = extern/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "extern/lbmpy"]
path = extern/lbmpy
url = ../../pycodegen/lbmpy
[submodule "extern/pystencils"]
path = extern/pystencils
url = ../../pycodegen/pystencils
......@@ -552,15 +552,18 @@ endif ( )
#############################################################################################################################
if ( WALBERLA_BUILD_WITH_CODEGEN )
find_package( PythonInterp 3 QUIET REQUIRED)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import lbmpy"
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import lbmpy; import pystencils"
RESULT_VARIABLE LBMPY_FOUND )
if(NOT LBMPY_FOUND EQUAL 0)
message(FATAL_ERROR "WALBERLA_BUILD_WITH_CODEGEN activated but pystencils or lbmpy package not found.
Please install lbmpy e.g.: 'pip3 install lbmpy'")
git_update_submodules()
endif()
set(ENV{PYTHONPATH} ${walberla_SOURCE_DIR}/extern/pystencils:$ENV{PYTHONPATH})
message(STATUS $ENV{PYTHONPATH})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from pystencils.include import get_pystencils_include_path; print(get_pystencils_include_path())"
OUTPUT_VARIABLE PYSTENCILS_INCLUDE_PATH)
include_directories( ${PYSTENCILS_INCLUDE_PATH} )
string(STRIP ${PYSTENCILS_INCLUDE_PATH} PYSTENCILS_INCLUDE_PATH_TMP)
message( STATUS "Found pystencils: ${PYSTENCILS_INCLUDE_PATH_TMP}" )
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import jinja2"
RESULT_VARIABLE JINJA2_FOUND )
......@@ -604,19 +607,7 @@ if ( WALBERLA_BUILD_WITH_PYTHON )
string(STRIP "${PYBIND11_CMAKE_PATH}" PYBIND11_CMAKE_PATH)
find_package(pybind11 PATHS "${PYBIND11_CMAKE_PATH}" NO_DEFAULT_PATH REQUIRED)
else()
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
if(WALBERLA_GIT_SUBMODULE_AUTO)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
git_update_submodules()
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/pybind11/CMakeLists.txt")
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
......
......@@ -74,7 +74,7 @@ function( waLBerla_generate_target_from_python )
string(REPLACE "\"" "\\\"" pythonParameters ${pythonParameters}) # even one more quoting level required
string(REPLACE "\n" "" pythonParameters ${pythonParameters}) # remove newline characters
set( WALBERLA_PYTHON_DIR ${walberla_SOURCE_DIR}/python)
set( WALBERLA_PYTHON_DIR ${walberla_SOURCE_DIR}/python:${walberla_SOURCE_DIR}/extern/pystencils:${walberla_SOURCE_DIR}/extern/lbmpy)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${codegenCfg}")
add_custom_command(OUTPUT ${generatedWithAbsolutePath}
......@@ -303,3 +303,25 @@ function( set_version VERSION_MAJOR VERSION_PATCH )
mark_as_advanced( WALBERLA_MAJOR_VERSION WALBERLA_PATCH_LEVEL )
endfunction()
#######################################################################################################################
#######################################################################################################################
#
# updates all submodules in the walberla repository
#
#######################################################################################################################
function( git_update_submodules )
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
if(WALBERLA_GIT_SUBMODULE_AUTO)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
endfunction()
#######################################################################################################################
\ No newline at end of file
Subproject commit 91a0cfad3cc6bf65a5024d7489a157d35191dcc6
Subproject commit b075b723d18d39b58d643d26fe0b69e354e7f921
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