Skip to content

Commit

Permalink
Changes for window conda build
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 committed Oct 22, 2021
1 parent ae6d145 commit e4f965a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ Ray tracing using CUDA, accessible from Python.

## Installation from source

Requires CMake 3.10 or higher, either system CMake or

pip install cmake
Requires CMake 3.10 or higher to build.

To install RTXpy from source use

Expand All @@ -26,9 +24,9 @@ To install RTXpy from source use
`cupy` is an optional runtime dependency. If you know the version of the CUDA
toolkit you have installed, which can be obtained by running `nvcc --version`,
you can install the appropriate `cupy` wheel. For example, for CUDA toolkit
10.1 use
11.2 use

pip install cupy-cuda101
pip install cupy-cuda112

To run tests

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"cmake>=3.10",
"setuptools>=42",
"wheel",
]
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ classifiers =
License :: OSI Approved :: MIT License
Operating System :: Microsoft :: Windows
Operating System :: POSIX :: Linux
Programming Language :: C
Programming Language :: C++
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Expand Down
16 changes: 13 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@ def build_extension(self, ext):
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir]
cfg = 'Debug' if self.debug else 'Release'
build_args = ['--config', cfg]
conda_build = os.environ.get("CONDA_BUILD", 0)

if platform.system() == "Windows":
cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(
cfg.upper(),
extdir)]
if sys.maxsize > 2**32:
# CMake lets you override the generator, as is done in conda build.
# If using NMake for generator, do not use arch specifier as not supported.
cmake_generator = os.environ.get("CMAKE_GENERATOR", "")
if sys.maxsize > 2**32 and not cmake_generator.startswith("NMake"):
cmake_args += ['-A', 'x64']
build_args += ['--', '/m']
if not conda_build:
build_args += ['--', '/m']
else:
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
build_args += ['--', '-j2']
Expand All @@ -64,8 +69,13 @@ def build_extension(self, ext):
cwd=self.build_temp, env=env)
subprocess.check_call(['cmake', '--build', '.'] + build_args,
cwd=self.build_temp)

if platform.system() == "Windows":
src = self.build_temp + "\\" + cfg + "\\" + ext.moduleName + ".dll"
src = self.build_temp
if not conda_build:
src += "\\" + cfg
src += "\\" + ext.moduleName + ".dll"

dst = extdir + "\\" + ext.moduleName + ".dll"
copyfile(src, dst)

Expand Down

0 comments on commit e4f965a

Please sign in to comment.