diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..41c7f2d2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.vs +.vscode +Builds/* +Testing/* +.idea +cmake-build-debug +cmake-build-release +build +external/vcpkg diff --git a/.gitignore b/.gitignore index c95cf8d0..0e6a9610 100644 --- a/.gitignore +++ b/.gitignore @@ -37,5 +37,6 @@ Builds/* Testing/* .idea cmake-build-debug +cmake-build-release build external/vcpkg diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e6050ce..734f0125 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ find_package(PCL 1.12 CONFIG REQUIRED COMPONENTS common io filters visualization # Includes include_directories(include) include_directories($ENV{OptiX_INSTALL_DIR}/include) +include_directories(${spdlog_SOURCE_DIR}/include) # Compile OptiX device programs (pipeline) and embed the binary in a library as a char[] add_library(optixProgramsPtx OBJECT src/gpu/optixPrograms.cu) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 9d5c82fb..00000000 --- a/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM nvidia/cuda:11.2.0-devel-ubuntu20.04 -WORKDIR /code -RUN apt update -y && DEBIAN_FRONTEND=noninteractive apt install -y git python3-pip -RUN pip3 install cmake --upgrade # Install from PIP since 3.17 is needed - - diff --git a/DockerfileLatest b/DockerfileLatest new file mode 100644 index 00000000..f3c301ed --- /dev/null +++ b/DockerfileLatest @@ -0,0 +1,25 @@ +FROM nvidia/cuda:11.7.1-devel-ubuntu22.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update + +RUN apt install -y cmake + +# Install vcpkg dependencies +RUN apt install -y \ + git \ + curl \ + zip \ + unzip \ + tar \ + pkg-config \ + freeglut3-dev \ + python3 + +# Install RGL dependencies via vcpkg +COPY setup.bash / +RUN /setup.bash +RUN rm /setup.bash + +WORKDIR /code diff --git a/DockerfileMinimal b/DockerfileMinimal new file mode 100644 index 00000000..5102d4cd --- /dev/null +++ b/DockerfileMinimal @@ -0,0 +1,28 @@ +FROM nvidia/cuda:11.2.0-devel-ubuntu20.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update + +# Install cmake from PIP since 3.17 is needed +RUN apt install -y \ + python3-pip +RUN pip3 install cmake --upgrade + +# Install vcpkg dependencies +RUN apt install -y \ + git \ + curl \ + zip \ + unzip \ + tar \ + pkg-config \ + freeglut3-dev \ + python3 + +# Install RGL dependencies via vcpkg +COPY setup.bash / +RUN /setup.bash +RUN rm /setup.bash + +WORKDIR /code diff --git a/README.md b/README.md index f7ac73df..a63c168a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,20 @@ And more: An introduction to the RGL API along with an example can be found [here](docs/Usage.md). +## Building in Docker (Linux) + +Two dockerfiles are prepared: +- `DockerfileMinimal` - image designed to meet RGL minimal requirements +- `DockerfileLatest` - image with latest Ubuntu and CUDA Toolkit version + +Build instructions: +1. Download [NVidia OptiX](https://developer.nvidia.com/designworks/optix/download) 7.2 +2. `export OptiX_INSTALL_DIR=` +3. `docker build . -f DockerfileMinimal --tag rgl:minimal` +4. Set up [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker) +5. `docker run --net=host --gpus all -v $(pwd):/code -v ${OptiX_INSTALL_DIR}:/optix -e OptiX_INSTALL_DIR=/optix -e NVIDIA_DRIVER_CAPABILITIES=all -it rgl:minimal /bin/bash` +6. `./setup.bash --cmake --make -j` + ## Building on Ubuntu 1. Install [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads) 11.2+. diff --git a/setup.bash b/setup.bash index d86ca097..2f72b74d 100755 --- a/setup.bash +++ b/setup.bash @@ -7,6 +7,13 @@ CUDA_MIN_VER_MAJOR="11" CUDA_MIN_VER_MINOR="2" VCPKG_INSTALL_DIR="external/vcpkg" VCPKG_TAG="2022.08.15" +INSIDE_DOCKER=false + +if [ -f /.dockerenv ]; then + VCPKG_INSTALL_DIR="/rgldep/vcpkg" + INSIDE_DOCKER=true + echo "Setup inside docker" +fi CMAKE_ARGS=() MAKE_ARGS=() @@ -38,21 +45,23 @@ if [ "$CUDA_MAJOR" -lt $CUDA_MIN_VER_MAJOR ] || echo "CUDA version not supported! Get $CUDA_MIN_VER_MAJOR.$CUDA_MIN_VER_MINOR+" && exit 1; fi -# Check OptiX_INSTALL_DIR -if [ -z "$OptiX_INSTALL_DIR" ]; then +# Check OptiX_INSTALL_DIR if building RGL +if [ -z "$OptiX_INSTALL_DIR" ] && { [ "$DO_CMAKE" = true ] || [ "$DO_MAKE" = true ]; }; then echo "OptiX not found! Make sure you export environment variable OptiX_INSTALL_DIR" && exit 1; fi # Install PCL using vcpkg if [ ! -d "$VCPKG_INSTALL_DIR" ]; then - echo "Installing dependencies for vcpkg..." - sudo apt update - sudo apt install git curl zip unzip tar freeglut3-dev + if [ "$INSIDE_DOCKER" = false ]; then # Inside docker already provided + echo "Installing dependencies for vcpkg..." + sudo apt update + sudo apt install git curl zip unzip tar freeglut3-dev + fi git clone -b $VCPKG_TAG --single-branch --depth 1 https://github.com/microsoft/vcpkg $VCPKG_INSTALL_DIR fi if [ ! -f $VCPKG_INSTALL_DIR"/vcpkg" ]; then $VCPKG_INSTALL_DIR"/bootstrap-vcpkg.sh"; fi -$VCPKG_INSTALL_DIR"/vcpkg" "install" "pcl[core,visualization]" +$VCPKG_INSTALL_DIR"/vcpkg" "install" "--clean-after-build" "pcl[core,visualization]" # Build if [ ! -d "build" ]; then mkdir build; fi