Skip to content

Commit

Permalink
using env vars to changeopts
Browse files Browse the repository at this point in the history
  • Loading branch information
teseoch committed Apr 15, 2022
1 parent 842336d commit f64e824
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ def run(self):
self.build_extension(ext)

def build_extension(self, ext):
use_cholmod = os.environ.get( "USE_CHOLMOD", "1" )
n_threads_str = os.environ.get( "N_THREADS", "1" )
n_threads = int(n_threads_str)

cholmod_str = "-DPOLYSOLVE_WITH_CHOLMOD=OFF" if use_cholmod == "0" else "-DPOLYSOLVE_WITH_CHOLMOD=ON"


extdir = os.path.join(os.path.abspath(os.path.dirname(
self.get_ext_fullpath(ext.name))), "polyfempy")

Expand All @@ -49,6 +56,7 @@ def build_extension(self, ext):
'-DPYTHON_EXECUTABLE=' + sys.executable,
'-DPYTHON_INCLUDE_DIR=' + python_include_directory,
'-DPOLYSOLVE_WITH_PARDISO=OFF',
cholmod_str,
# '-DPOLYFEM_THREADING=NONE',
'-DPOLYFEM_NO_UI=ON',
'-DPOLYFEM_WITH_APPS=OFF',
Expand All @@ -69,7 +77,7 @@ def build_extension(self, ext):
cmake_args += ['-A', 'x64']
# build_args += ['--', '/m']
else:
build_args += ['--', '-j2']
build_args += ['--', '-j{}'.format(n_threads)]

env = os.environ.copy()
env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(
Expand Down

0 comments on commit f64e824

Please sign in to comment.