Skip to content

Commit 3381600

Browse files
committed
Some minor revisions.
1 parent b4eb4a0 commit 3381600

File tree

4 files changed

+24
-30
lines changed

4 files changed

+24
-30
lines changed

CMakeLists.txt

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.18...3.27)
1+
cmake_minimum_required(VERSION 3.18)
22
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION} LANGUAGES CXX)
33

44
# General settings
@@ -21,37 +21,28 @@ if(CMAKE_CUDA_COMPILER)
2121
message(STATUS "CMAKE_CUDA_COMPILER = ${CMAKE_CUDA_COMPILER}")
2222
message(STATUS "CMAKE_CUDA_COMPILER_ID = ${CMAKE_CUDA_COMPILER_ID}")
2323
message(STATUS "CMAKE_CUDA_COMPILER_VERSION = ${CUDA_V}")
24-
2524
else()
26-
message(STATUS "NO CUDA INSTALLATION FOUND, INSTALLING CPU VERSION ONLY!")
27-
# execute_process(COMMAND ${Python_EXECUTABLE} -m pip uninstall -y torch)
28-
# execute_process(COMMAND ${Python_EXECUTABLE} -m pip install -v torch --extra-index-url https://download.pytorch.org/whl/cpu)
25+
message(WARNING "NO CUDA INSTALLATION FOUND, TRYING TO INSTALL CPU VERSION ONLY!")
2926
endif()
3027

3128
set(CMAKE_CXX_STANDARD 17)
3229
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3330
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
3431

3532
if(MSVC)
36-
add_definitions(-DNOMINMAX)
33+
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/utf-8>")
34+
add_compile_options("$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=/utf-8>")
35+
add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)
3736
endif()
3837

3938
# Find packages
40-
find_package(Python REQUIRED COMPONENTS Interpreter Development)
39+
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
4140
find_package(pybind11 CONFIG REQUIRED)
42-
43-
# OpenMP
4441
find_package(OpenMP)
45-
if (OPENMP_FOUND)
46-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
47-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
48-
endif()
4942

50-
# PyTorch settings
51-
find_package(Torch REQUIRED)
43+
find_package(Torch CONFIG REQUIRED)
5244
find_library(TORCH_PYTHON_LIBRARY torch_python PATH "${TORCH_INSTALL_PREFIX}/lib")
5345
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
5446

5547
add_subdirectory(cxx)
56-
5748
install(TARGETS ${BUILD_TARGET} LIBRARY DESTINATION .)

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
torchmcubes: marching cubes for PyTorch
2-
===
1+
# torchmcubes: marching cubes for PyTorch
32

43
[![Build (CPU)](https://github.com/tatsy/torchmcubes/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/tatsy/torchmcubes/actions/workflows/build.yml)
54

@@ -12,9 +11,9 @@ torchmcubes: marching cubes for PyTorch
1211
- Python (3.9 or later)
1312
- NumPy (1.x is preferable)
1413
- PyTorch
15-
- cmake (3.18 or later)
14+
- CMake (3.18 or later)
1615

17-
Make sure that you have nvcc CUDA compiler
16+
Make sure that you have nvcc CUDA compiler with the following command.
1817

1918
```shell
2019
nvcc --version
@@ -27,7 +26,6 @@ export CUDA_HOME=/usr/local/cuda/
2726
export PATH=$CUDA_HOME/bin:$PATH
2827
```
2928

30-
3129
### Pip installation
3230

3331
```shell

cxx/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
include_directories(${TORCH_INCLUDE_DIRS})
2-
1+
include_directories (${TORCH_INCLUDE_DIRS})
32
Python_add_library(${BUILD_TARGET}
43
mcubes.cpp
54
mcubes_cpu.cpp
@@ -17,7 +16,8 @@ endif()
1716
target_link_libraries(${BUILD_TARGET} PRIVATE
1817
pybind11::headers
1918
${TORCH_LIBRARIES}
20-
${TORCH_PYTHON_LIBRARY})
19+
${TORCH_PYTHON_LIBRARY}
20+
)
2121

2222
if (OPENMP_FOUND)
2323
target_link_libraries(${BUILD_TARGET} PRIVATE OpenMP::OpenMP_CXX)

pyproject.toml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,24 @@ dependencies=["numpy", "torch"]
1919

2020
[tool.scikit-build]
2121
build-dir = "build"
22-
wheel.license-files = []
23-
minimum-version = "0.2"
24-
logging.level = "INFO"
22+
minimum-version = "0.10"
2523
ninja.make-fallback = true
24+
logging.level = "INFO"
25+
build.verbose = true
26+
messages.after-success = "SUCCESS!!"
27+
messages.after-failure = "FAILURE!!"
2628

2729
[tool.scikit-build.cmake]
28-
minimum-version = "3.18"
29-
verbose = true
30+
version = ">=3.15"
3031
source-dir = "."
3132
args = []
3233

34+
[tool.scikit-build.wheel]
35+
license-files = ["LICENSE"]
36+
exclude = ["**/.mypy_cache/**", "**/build/**", "**/.vscode/**"]
37+
3338
[build-system]
34-
requires = ["scikit-build-core>=0.2", "pybind11>=2.10"]
39+
requires = ["scikit-build-core>=0.10", "pybind11>=2.10", "cmake", "ninja"]
3540
build-backend = "scikit_build_core.build"
3641

3742
[tool.isort]

0 commit comments

Comments
 (0)