Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
cc404108
Commit
cc404108
authored
Jan 21, 2020
by
keith
Committed by
Francisco Massa
Jan 20, 2020
Browse files
Make C++ build with CUDA support optional (#1772)
parent
9a22a8a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
CMakeLists.txt
CMakeLists.txt
+20
-10
README.rst
README.rst
+1
-0
No files found.
CMakeLists.txt
View file @
cc404108
cmake_minimum_required
(
VERSION 2.8
)
project
(
torchvision
)
set
(
CMAKE_CXX_STANDARD 14
)
enable_language
(
CUDA
)
add_definitions
(
-D__CUDA_NO_HALF_OPERATORS__
)
option
(
WITH_CUDA
"Enable CUDA support"
OFF
)
if
(
WITH_CUDA
)
enable_language
(
CUDA
)
add_definitions
(
-D__CUDA_NO_HALF_OPERATORS__
)
endif
()
find_package
(
Torch REQUIRED
)
find_package
(
pybind11 REQUIRED
)
...
...
@@ -11,18 +15,24 @@ find_package(pybind11 REQUIRED)
include_directories
(
${
PYTHON_INCLUDE_DIR
}
)
file
(
GLOB HEADERS torchvision/csrc/*.h
)
file
(
GLOB
CPU_HEADER
S torchvision/csrc/cpu/
vision_cpu.h
)
file
(
GLOB CPU_SOURCES torchvision/csrc/cuda/*.h torchvision/csrc/cpu/*.cpp
)
file
(
GLOB
CUDA_HEADERS torchvision/csrc/cuda/vision_cuda.h
)
file
(
GLOB CUDA_SOURCES torchvision/csrc/cuda/*.h torchvision/csrc/cuda/*.cu
)
file
(
GLOB
OPERATOR_SOURCE
S torchvision/csrc/cpu/
*.h torchvision/csrc/cpu/*.cpp
)
if
(
WITH_CUDA
)
file
(
GLOB
OPERATOR_SOURCES
${
OPERATOR_SOURCES
}
torchvision/csrc/cuda/*.h torchvision/csrc/cuda/*.cu
)
endif
(
)
file
(
GLOB MODELS_HEADERS torchvision/csrc/models/*.h
)
file
(
GLOB MODELS_SOURCES torchvision/csrc/models/*.h torchvision/csrc/models/*.cpp
)
add_library
(
${
PROJECT_NAME
}
SHARED
${
MODELS_SOURCES
}
${
CPU_SOURCES
}
${
CUDA
_SOURCES
}
)
add_library
(
${
PROJECT_NAME
}
SHARED
${
MODELS_SOURCES
}
${
OPERATOR
_SOURCES
}
)
target_link_libraries
(
${
PROJECT_NAME
}
PUBLIC
"
${
TORCH_LIBRARIES
}
"
)
install
(
TARGETS
${
PROJECT_NAME
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/lib
)
install
(
FILES
${
HEADERS
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/include/
${
PROJECT_NAME
}
)
install
(
FILES
${
CPU_HEADERS
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/include/
${
PROJECT_NAME
}
/cpu
)
install
(
FILES
${
CUDA_HEADERS
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/include/
${
PROJECT_NAME
}
/cuda
)
install
(
FILES
torchvision/csrc/cpu/vision_cpu.h
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/include/
${
PROJECT_NAME
}
/cpu
)
if
(
WITH_CUDA
)
install
(
FILES
torchvision/csrc/cuda/vision_cuda.h
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/include/
${
PROJECT_NAME
}
/cuda
)
endif
()
install
(
FILES
${
MODELS_HEADERS
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/include/
${
PROJECT_NAME
}
/models
)
\ No newline at end of file
README.rst
View file @
cc404108
...
...
@@ -70,6 +70,7 @@ Installation From source:
mkdir build
cd build
# Add -DWITH_CUDA=on support for the CUDA if needed
cmake ..
make
make install
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment