Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _build_system/build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ def process_cmd_options(command_obj, cfs):
else:
setattr(command_obj, attr, False)

if len(cfs) != 0:
assert False, "Following build options are undefined: " + ", ".join(list(cfs))


def process_setup_options(command_obj, args):
for item in args:
Expand Down
25 changes: 21 additions & 4 deletions _build_system/build_pymfem.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,19 @@ def check_new(ifile):
return os.path.getmtime(ifile) > os.path.getmtime(wfile)

def update_integrator_exts():
pwd = chdir(os.path.join(rootdir, 'mfem', 'common'))
commdir = os.path.join(rootdir, 'mfem', 'common')
pwd = chdir(commdir)

for filename in ('bilininteg_ext.i', 'lininteg_ext.i'):
fid = open(filename, "w")
fid.close()

os.chdir(pwd)
for filename in ['lininteg.i', 'bilininteg.i']:
command = [swig_command] + swigflag + serflag + [filename]
make_call(command)

os.chdir(commdir)
command1 = [sys.executable, "generate_lininteg_ext.py"]
command2 = [sys.executable, "generate_bilininteg_ext.py"]
make_call(command1)
Expand Down Expand Up @@ -192,9 +204,10 @@ def update_header_exists(mfem_source):
serflag.append('-I' + os.path.join(bglb.suitesparse_prefix,
'include', 'suitesparse'))

for filename in ['lininteg.i', 'bilininteg.i']:
command = [swig_command] + swigflag + serflag + [filename]
make_call(command)
# generate xxinteg_ext.i
# create empty files
# run swig with *.i files
# call update scripts
update_integrator_exts()

commands = []
Expand All @@ -208,6 +221,10 @@ def update_header_exists(mfem_source):
with mp_pool:
mp_pool.map(subprocess.run, commands)

#for c in commands:
# print(" ".join(c))
# subprocess.run(c)

if not do_parallel:
os.chdir(pwd)
return
Expand Down
21 changes: 12 additions & 9 deletions _build_system/build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
__all__ = ["read_mfem_tplflags", "abspath", "external_install_prefix",
"make_call", "chdir", "remove_files",
"make", "make_install", "download", "gitclone",
"record_mfem_sha", "cmake",
"record_mfem_sha", "cmake",
"get_numpy_inc", "get_mpi4py_inc", "find_libpath_from_prefix",
"clean_so", ]

Expand Down Expand Up @@ -102,18 +102,24 @@ def make_call(command, target='', force_verbose=False, env=None):
env.update(os.environ)

myverbose = bglb.verbose or force_verbose
if not myverbose:
kwargs['stdout'] = subprocess.DEVNULL
kwargs['stderr'] = subprocess.DEVNULL

kwargs['stdout'] = subprocess.PIPE
kwargs['stderr'] = subprocess.PIPE

p = subprocess.Popen(command, **kwargs)
p.communicate()
stdout, stderr = p.communicate()
if p.returncode != 0:
if target == '':
target = " ".join(command)

print("!!!!!!!!!!!!!!! make call faield !!!!!!!!!!!!!!!!!")
print("Failed when calling command: " + target)
print(stdout)
print(stderr)
raise subprocess.CalledProcessError(p.returncode,
" ".join(command))
if myverbose:
print(stdout)


def chdir(path):
Expand Down Expand Up @@ -246,7 +252,6 @@ def cmake(path, **kwargs):
make_call(command)



def get_numpy_inc():

python = sys.executable
Expand Down Expand Up @@ -307,6 +312,7 @@ def find_libpath_from_prefix(lib, prefix0):

return ''


def clean_so(all=None):
python = sys.executable
command = [python, "setup.py", "clean"]
Expand All @@ -330,6 +336,3 @@ def clean_so(all=None):
make_call(command)

chdir(pwd)



Loading