Skip to content

Commit

Permalink
Merge pull request #2884 from rcurtin/python-omp-fix
Browse files Browse the repository at this point in the history
Handle empty OpenMP_CXX_FLAGS correctly
  • Loading branch information
rcurtin committed Mar 21, 2021
2 parents 3aa9a72 + ab182f9 commit 4654b8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 4654b8f

Please sign in to comment.