-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed MFEM build by setup.py in OSX to use the same -isysroot optio…
…n with Python itself. This avoids build warning/errores due to inconsistent use of Development Framework between MFEM/PyMFEM (I still see some warning wtih Metis)
- Loading branch information
Showing
2 changed files
with
55 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,12 +57,14 @@ | |
"libceed": "https://github.com/CEED/libCEED.git", | ||
"gklib": "https://github.com/KarypisLab/GKlib", | ||
"metis": "https://github.com/KarypisLab/METIS", } | ||
|
||
repos_sha = { | ||
# "mfem": "00b2a0705f647e17a1d4ffcb289adca503f28d42", # version 4.5.2 | ||
# "mfem": "962774d5ffa84ceed3bc670e52388250ee028da1", # version 4.5.2 + distsolve | ||
#"mfem": "69fbae732d5279c8d0f42c5430c4fd5656731d00", # version 4.6 | ||
#"mfem": "8bb929c2ff86cdf2ee9bb058cc75e59acb07bb94", # doftrans simplification (Nov. 15. 2023) | ||
"mfem": "4a45c70d1269d293266b77a3a025a9756d10ed8f", # after socket connection fix (Nov. 29 2023) | ||
# "mfem": "69fbae732d5279c8d0f42c5430c4fd5656731d00", # version 4.6 | ||
# "mfem": "8bb929c2ff86cdf2ee9bb058cc75e59acb07bb94", # doftrans simplification (Nov. 15. 2023) | ||
# after socket connection fix (Nov. 29 2023) | ||
"mfem": "4a45c70d1269d293266b77a3a025a9756d10ed8f", | ||
"gklib": "a7f8172703cf6e999dd0710eb279bba513da4fec", | ||
"metis": "94c03a6e2d1860128c2d0675cbbb86ad4f261256", } | ||
|
||
|
@@ -71,22 +73,32 @@ | |
if not os.path.exists(extdir): | ||
os.mkdir(os.path.join(rootdir, 'external')) | ||
|
||
|
||
osx_sysroot = '' | ||
|
||
if platform == "linux" or platform == "linux2": | ||
dylibext = '.so' | ||
elif platform == "darwin": | ||
# OS X | ||
dylibext = '.dylib' | ||
import sysconfig | ||
for i, x in enumerate(sysconfig.get_config_vars()['CFLAGS'].split()): | ||
if x == '-isysroot': | ||
osx_sysroot = sysconfig.get_config_vars()['CFLAGS'].split()[i+1] | ||
break | ||
|
||
elif platform == "win32": | ||
# Windows... | ||
assert False, "Windows is not supported yet. Contribution is welcome" | ||
|
||
use_metis_gklib = False | ||
|
||
### global variables | ||
# global variables | ||
is_configured = False | ||
prefix = '' | ||
|
||
verbose = -1 | ||
git_sshclone = False | ||
swig_only = False | ||
skip_install = False | ||
run_swig = False | ||
|
@@ -123,7 +135,7 @@ | |
gslibs_prefix = '' | ||
gslibp_prefix = '' | ||
gslib_only = False | ||
mfem_debug=False | ||
mfem_debug = False | ||
|
||
enable_suitesparse = False | ||
suitesparse_prefix = "/usr/" | ||
|
@@ -318,7 +330,7 @@ def make_call(command, target='', force_verbose=False): | |
raise subprocess.CalledProcessError(p.returncode, | ||
" ".join(command)) | ||
|
||
#subprocess.check_call(command, **kwargs) | ||
# subprocess.check_call(command, **kwargs) | ||
# except subprocess.CalledProcessError: | ||
# print(stdout) | ||
|
||
|
@@ -390,17 +402,28 @@ def gitclone(xxx, use_sha=False, branch='master'): | |
cwd = os.getcwd() | ||
repo_xxx = os.path.join(extdir, xxx) | ||
if os.path.exists(repo_xxx): | ||
print("Deleting the existing " + xxx) | ||
shutil.rmtree(repo_xxx) | ||
os.chdir(repo_xxx) | ||
command = ['git', 'checkout', branch] | ||
make_call(command) | ||
command = ['git', 'pull'] | ||
make_call(command) | ||
|
||
os.chdir(extdir) | ||
command = ['git', 'clone', repos[xxx], xxx] | ||
make_call(command) | ||
# print("Deleting the existing " + xxx) | ||
# shutil.rmtree(repo_xxx) | ||
else: | ||
repo = repos[xxx] | ||
if git_sshclone: | ||
repo = repo.replace("https://github.com/", "[email protected]:") | ||
|
||
os.chdir(extdir) | ||
command = ['git', 'clone', repo, xxx] | ||
make_call(command) | ||
|
||
if not dry_run: | ||
if not os.path.exists(repo_xxx): | ||
print(repo_xxx + " does not exist. Check if git clone worked") | ||
os.chdir(repo_xxx) | ||
|
||
if use_sha: | ||
sha = repos_sha[xxx] | ||
command = ['git', 'checkout', sha] | ||
|
@@ -439,6 +462,9 @@ def cmake(path, **kwargs): | |
command = ['cmake', path] | ||
for key, value in kwargs.items(): | ||
command.append('-' + key + '=' + value) | ||
|
||
if osx_sysroot != '': | ||
command.append('-DCMAKE_OSX_SYSROOT=' + osx_sysroot) | ||
make_call(command) | ||
|
||
|
||
|
@@ -547,7 +573,7 @@ def make_metis_gklib(use_int64=False, use_real64=False): | |
cmake('..', **cmake_opts) | ||
make('gklib') | ||
make_install('gklib') | ||
#command = ['make', 'prefix=' + metis_prefix, 'cc=' + cc_command] | ||
# command = ['make', 'prefix=' + metis_prefix, 'cc=' + cc_command] | ||
os.chdir(pwd) | ||
|
||
''' | ||
|
@@ -573,7 +599,7 @@ def make_metis_gklib(use_int64=False, use_real64=False): | |
options.append('r64=1') | ||
|
||
command = ['make', 'config', 'shared=1'] + options | ||
#command = ['make', 'config'] + options | ||
# command = ['make', 'config'] + options | ||
command = command + ['prefix=' + metis_prefix, 'cc=' + cc_command] | ||
make_call(command) | ||
|
||
|
@@ -1239,7 +1265,7 @@ def configure_install(self): | |
''' | ||
called when install workflow is used | ||
''' | ||
global prefix, dry_run, verbose, ext_prefix | ||
global prefix, dry_run, verbose, ext_prefix, git_sshclone | ||
global clean_swig, run_swig, swig_only, skip_install, skip_swig | ||
global build_mfem, build_mfemp, build_parallel, build_serial | ||
|
||
|
@@ -1262,6 +1288,8 @@ def configure_install(self): | |
if dry_run: | ||
verbose = True | ||
|
||
git_sshclone = bool(self.git_sshclone) | ||
|
||
prefix = abspath(self.prefix) | ||
mfem_source = abspath(self.mfem_source) | ||
|
||
|
@@ -1339,7 +1367,7 @@ def configure_install(self): | |
mfem_prefix = ext_prefix | ||
mfems_prefix = os.path.join(ext_prefix, 'ser') | ||
mfemp_prefix = os.path.join(ext_prefix, 'par') | ||
#enable_gslib = True | ||
# enable_gslib = True | ||
|
||
if self.mfem_branch != '': | ||
mfem_branch = self.mfem_branch | ||
|
@@ -1484,7 +1512,7 @@ def configure_bdist(self): | |
else: | ||
build_mfem = True | ||
build_serial = True | ||
#build_gslib = True | ||
# build_gslib = True | ||
run_swig = True | ||
|
||
global is_configured | ||
|
@@ -1528,6 +1556,8 @@ class Install(_install): | |
'libHYPRE.so must exits under <hypre-prefix>/lib'), | ||
('metis-prefix=', None, 'Specify locaiton of metis' + | ||
'libmetis.so must exits under <metis-prefix>/lib'), | ||
('git-sshclone', None, 'Use SSH for git clone', | ||
'try if default git clone using https fails (need Github account and setting for SSH)'), | ||
('swig', None, 'Run Swig and exit'), | ||
('skip-swig', None, | ||
'Skip running swig (used when wrapper is generated for the MFEM C++ library to be used'), | ||
|
@@ -1569,6 +1599,7 @@ def initialize_options(self): | |
self.skip_swig = False | ||
self.ext_only = False | ||
|
||
self.git_sshclone = False | ||
self.skip_ext = False | ||
self.with_parallel = False | ||
self.build_only = False | ||
|
@@ -1632,9 +1663,9 @@ def finalize_options(self): | |
global verbose | ||
verbose = bool(self.vv) | ||
if given_prefix: | ||
#global ext_prefix | ||
# global ext_prefix | ||
self.prefix = abspath(prefix) | ||
#ext_prefix = abspath(prefix) | ||
# ext_prefix = abspath(prefix) | ||
else: | ||
if '--user' in sys.argv: | ||
path = site.getusersitepackages() | ||
|
@@ -1752,7 +1783,7 @@ def finalize_options(self): | |
def _has_ext_modules(): | ||
return True | ||
from setuptools.dist import Distribution | ||
#Distribution.is_pure = _is_pure | ||
# Distribution.is_pure = _is_pure | ||
self.distribution.has_ext_modules = _has_ext_modules | ||
_bdist_wheel.finalize_options(self) | ||
|
||
|
@@ -1764,7 +1795,7 @@ def run(self): | |
print_config() | ||
self.run_command("build") | ||
_bdist_wheel.run(self) | ||
#assert False, "bdist install is not supported, use source install" | ||
# assert False, "bdist install is not supported, use source install" | ||
|
||
# Ensure that there is a basic library build for bdist_egg to pull from. | ||
# self.run_command("build") | ||
|
@@ -1880,7 +1911,7 @@ def run_setup(): | |
packages=find_packages(), | ||
extras_require={}, | ||
package_data={'mfem._par': ['*.so'], 'mfem._ser': ['*.so']}, | ||
#data_files=[('data', datafiles)], | ||
# data_files=[('data', datafiles)], | ||
entry_points={}, | ||
**setup_args) | ||
|
||
|