Skip to content
Snippets Groups Projects
Commit 1acb0a17 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Also generate CMakeLists.txt

parent 56b5304c
Branches
Tags
No related merge requests found
Pipeline #21517 canceled
waLBerla_link_files_to_builddir( *.prm )
waLBerla_add_executable ( NAME autogen
FILES {%- for f in files_to_compile %}
{{ f }}
{%- endfor %}
DEPENDS blockforest core cuda field lbm geometry timeloop gui )
...@@ -53,6 +53,14 @@ class WalberlaModule(JinjaCppFile): ...@@ -53,6 +53,14 @@ class WalberlaModule(JinjaCppFile):
JinjaCppFile.__init__(self, ast_dict) JinjaCppFile.__init__(self, ast_dict)
class CMakeLists(JinjaCppFile):
TEMPLATE = read_template_from_file(join(dirname(__file__), 'CMakeLists.tmpl.txt'))
def __init__(self, files_to_compile):
ast_dict = {'files_to_compile': files_to_compile} # we try to avoid evil globbing
JinjaCppFile.__init__(self, ast_dict)
class WalberlaMain(JinjaCppFile): class WalberlaMain(JinjaCppFile):
TEMPLATE = jinja2.Template(""" TEMPLATE = jinja2.Template("""
......
...@@ -17,7 +17,7 @@ import pystencils ...@@ -17,7 +17,7 @@ import pystencils
import pystencils_walberla.codegen import pystencils_walberla.codegen
from pystencils.astnodes import Block, EmptyLine from pystencils.astnodes import Block, EmptyLine
from pystencils_autodiff.walberla import ( from pystencils_autodiff.walberla import (
AllocateAllFields, DefinitionsHeader, InitBoundaryHandling, LbCommunicationSetup, AllocateAllFields, CMakeLists, DefinitionsHeader, InitBoundaryHandling, LbCommunicationSetup,
ResolveUndefinedSymbols, RunTimeLoop, SweepCreation, SweepOverAllBlocks, TimeLoop, ResolveUndefinedSymbols, RunTimeLoop, SweepCreation, SweepOverAllBlocks, TimeLoop,
UniformBlockforestFromConfig, WalberlaMain, WalberlaModule) UniformBlockforestFromConfig, WalberlaMain, WalberlaModule)
...@@ -104,10 +104,21 @@ class WaldUndWiesenSimulation(): ...@@ -104,10 +104,21 @@ class WaldUndWiesenSimulation():
self._codegen_context.write_file("UserDefinitions.h", self._codegen_context.write_file("UserDefinitions.h",
str(DefinitionsHeader(self._lb_model_name, self._flag_field_dtype))) str(DefinitionsHeader(self._lb_model_name, self._flag_field_dtype)))
def _create_cmake_file(self):
try:
self._codegen_context.write_file("CMakeLists.txt",
str(CMakeLists([f for f in self._codegen_context.files_written()
if f.endswith('.cpp') or f.endswith('.cu')])))
except AttributeError:
self._codegen_context.write_file("CMakeLists.txt",
str(CMakeLists([f for f in self._codegen_context.files.keys()
if f.endswith('.cpp') or f.endswith('.cu')])))
def write_files(self): def write_files(self):
self._create_helper_files() self._create_helper_files()
self._create_module() self._create_module()
self._create_defintions_header() self._create_defintions_header()
self._create_cmake_file() # has to be called last
@property @property
def boundary_conditions(self): def boundary_conditions(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment