Skip to content

Commit

Permalink
Attempt to fix build
Browse files Browse the repository at this point in the history
- setup.py: use `cmake --build` for all systems
- switch filename suffix pyd back to dll for windows
  • Loading branch information
subhacom committed Jun 12, 2024
1 parent 035ee0e commit 965d1a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pybind11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if(WIN32)
set_target_properties(moose PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/python/moose
PREFIX "_"
SUFFIX ".pyd")
SUFFIX ".dll")
else()
set_target_properties(moose PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/python/moose
Expand Down
20 changes: 7 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,9 @@ def finalize_options(self):
else:
if self.with_gsl_static:
self.cmake_options['GSL_USE_STATIC_LIBRARIES'] = 'ON'
if self.debug is not None:
self.cmake_options['CMAKE_BUILD_TYPE'] = 'Debug'
else:
if self.debug is None:
self.debug = 0
self.cmake_options['CMAKE_BUILD_TYPE'] = 'Release'


def run(self):
if self.no_build:
return
Expand All @@ -137,14 +134,10 @@ def build_cmake(self, ext):
for k, v in self.cmake_options.items():
cmake_args.append(f'-D{k}={v}')
os.chdir(str(builddir_))
self.spawn(['cmake', str(sdir_)] + cmake_args)
if not self.dry_run and platform.system() != 'Windows':
self.spawn(['make', f'-j{numCores_:d}'])
else:
cmd = ['cmake', '--build', '.']
if not self.debug:
cmd += ['--config', self.cmake_options['CMAKE_BUILD_TYPE']]
self.spawn(cmd)
# cmd = ['cmake', '--build', '.', f'-j{numCores_:d}'] + cmake_args
cmd = ['cmake', '--build', str(sdir_), f'-j{numCores_:d}'] + cmake_args
cmd += ['--config', 'Debug' if self.debug else 'Release']
self.spawn(cmd)
os.chdir(str(sdir_))


Expand Down Expand Up @@ -176,6 +169,7 @@ def build_cmake(self, ext):
'rdesigneur': os.path.join(sdir_, 'python', 'rdesigneur'),
'moose': os.path.join(sdir_, 'python', 'moose'),
},

package_data={
'moose': [
'_moose.so',
Expand Down

0 comments on commit 965d1a1

Please sign in to comment.