Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty OpenMP_CXX_FLAGS correctly #2884

Merged
merged 2 commits into from
Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions HISTORY.md
Expand Up @@ -40,6 +40,9 @@
* Remove unused `ElemType` template parameter from `DecisionTree` and
`RandomForest` (#2874).

* Fix Python binding build when the CMake variable `USE_OPENMP` is set to
`OFF` (#2884).

### mlpack 3.4.2
###### 2020-10-26
* Added Mean Absolute Percentage Error.
Expand Down
13 changes: 5 additions & 8 deletions src/mlpack/bindings/python/setup.py.in
Expand Up @@ -52,18 +52,15 @@ if os.getenv('NO_BUILD') == '1':
else:
cxx_flags = '${CMAKE_CXX_FLAGS}'.strip()
cxx_flags = re.sub(' +', ' ', cxx_flags)
extra_args = ['-DBINDING_TYPE=BINDING_TYPE_PYX', '-std=c++11']
if '${OpenMP_CXX_FLAGS}' != '':
extra_args.append('${OpenMP_CXX_FLAGS}')
if cxx_flags:
extra_args = ['-DBINDING_TYPE=BINDING_TYPE_PYX',
'-std=c++11',
'${OpenMP_CXX_FLAGS}'] + cxx_flags.split(' ')
else:
extra_args = ['-DBINDING_TYPE=BINDING_TYPE_PYX',
'-std=c++11',
'${OpenMP_CXX_FLAGS}']
extra_args.extend(cxx_flags.split(' '))

# Extra options for MSVC compiler.
if platform.system() == 'Windows':
extra_args = extra_args + ['/MD', '/O2', '/Ob2', '/DNDEBUG']
extra_args.extend(['/MD', '/O2', '/Ob2', '/DNDEBUG'])

# This is used for parallel builds; CMake will set PYX_TO_BUILD accordingly.
if module is not None:
Expand Down