diff --git a/CMakeLists.txt b/CMakeLists.txt index c99395c..53909ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,9 @@ project(cTrack) if (BUILD_LIBTORCH) + if(APPLE) + message(FATAL_ERROR "Cannot build libtorch on macs") + endif() execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import torch; print(torch.utils.cmake_prefix_path)" RESULT_VARIABLE result OUTPUT_VARIABLE CMAKE_PREFIX_PATH @@ -12,7 +15,11 @@ if (BUILD_LIBTORCH) find_package(Torch REQUIRED) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS} -fopenmp -O3") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -O3") + if(APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -O3") + endif() endif() @@ -23,7 +30,7 @@ if(SKBUILD) "import pybind11; print(pybind11.get_cmake_dir())" OUTPUT_VARIABLE _tmp_dir OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT) - list(APPEND CMAKE_PREFIX_PATH "${_tmp_dir}") + list(PREPEND CMAKE_PREFIX_PATH "${_tmp_dir}") find_package(pybind11 CONFIG REQUIRED) endif() @@ -32,9 +39,9 @@ endif() pybind11_add_module(cTrack MODULE SYRIPY/Tracking/cTrack/Bindings.cpp SYRIPY/Tracking/cTrack/Field.cpp SYRIPY/Tracking/cTrack/Track.cpp ) - if (BUILD_LIBTORCH) +if (BUILD_LIBTORCH) target_link_libraries(cTrack PRIVATE ${Python_LIBRARIES} ${TORCH_LIBRARIES}) target_compile_definitions(cTrack PRIVATE USE_TORCH=1) endif() -install(TARGETS cTrack LIBRARY DESTINATION .) \ No newline at end of file +install(TARGETS cTrack LIBRARY DESTINATION .) diff --git a/pyproject.toml b/pyproject.toml index eeb556b..4e73815 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [build-system] requires = [ + "pybind11>=2.10", "setuptools", "wheel", - "pybind11", "cmake", "scikit-build", "torch" -] \ No newline at end of file +] diff --git a/setup.py b/setup.py index 71d4a94..990c107 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,4 @@ def set_cmake_args(): install_requires=[ 'numpy', 'matplotlib', - 'torch' - ], -) \ No newline at end of file + 'torch'])