Skip to content

peFix/buildin #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: experemental
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions .github/workflows/autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
default: '10.2'
env:
CUDA_ARCH: 30
TRIMESH_VERS: 2020.03.04
jobs:
linux-build:
runs-on: ubuntu-18.04
Expand All @@ -17,21 +18,23 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: universal-cmake

- name: Install GLM and OpenMP
run: apt update && apt install -y libglm-dev libgomp1
- name: Install GLM, OpenMP and Boost
run: |
apt update &&
apt install -y software-properties-common
add-apt-repository ppa:mhier/libboost-latest &&
apt update &&
apt install -y libglm-dev libgomp1 libboost1.70-dev
- name: Build Trimesh2
run: |
apt update
apt install -y git mesa-common-dev libglu1-mesa-dev libxi-dev
git clone -b 2020.03.04 https://github.com/Forceflow/trimesh2.git ../trimesh2
cd ../trimesh2 && make all -j 2 && cd -
git clone -b ${TRIMESH_VERS} https://github.com/Forceflow/trimesh2.git ../trimesh2
cd ../trimesh2 && make all -j $(nproc) && cd -
- name: Install CMake
run: |
apt install -y wget
wget https://github.com/Kitware/CMake/releases/download/v3.13.0/cmake-3.13.0-Linux-x86_64.sh -q -O ./cmake-install.sh
wget https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh -q -O ./cmake-install.sh
chmod u+x ./cmake-install.sh
mkdir ./cmake
./cmake-install.sh --skip-license --prefix=./cmake
Expand All @@ -41,9 +44,11 @@ jobs:
mkdir ./build
cd ./build
../cmake/bin/cmake -DTrimesh2_INCLUDE_DIR="../../trimesh2/include" -DTrimesh2_LINK_DIR="../../trimesh2/lib.Linux64" -DCUDA_ARCH=${CUDA_ARCH} ..
../cmake/bin/cmake --build . -j 2
../cmake/bin/cmake --build . -j $(nproc)
- name: Test
run: ./build/cuda_voxelizer -f ./test_models/bunny.OBJ -s 64 -cpu
run: |
cd ./build
./cuda_voxelizer -i ../test_models/bunny.OBJ -s 64 --cpu

windows-build:
runs-on: windows-2019
Expand All @@ -53,8 +58,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: universal-cmake

- name: Install CUDA 10.1
run: |
Invoke-WebRequest http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_win10.exe -OutFile .\cuda.exe
Expand All @@ -75,7 +79,7 @@ jobs:
- name: Build Trimesh2
if: steps.trimesh2-cache.outputs.cache-hit != 'true'
run: |
git clone -b 2020.03.04 https://github.com/Forceflow/trimesh2.git ..\trimesh2
git clone -b $env:TRIMESH_VERS https://github.com/Forceflow/trimesh2.git ..\trimesh2
cd ..\trimesh2
& 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe' .\msvc\vs2019\trimesh2.sln -nologo -m:2 /t:libsrc /p:Configuration=Release /p:Platform=x64
mkdir ..\trimesh2-build
Expand All @@ -88,7 +92,10 @@ jobs:
run: |
$trimeshDir = "..\trimesh2-build"
mkdir .\build
& cmake -A x64 -DCMAKE_TOOLCHAIN_FILE:FILEPATH="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DTrimesh2_INCLUDE_DIR:PATH="$trimeshDir\include" -DTrimesh2_LINK_DIR:PATH="$trimeshDir\lib.Win64.vs142" -DCUDA_ARCH:STRING=$env:CUDA_ARCH -DCMAKE_BUILD_TYPE=Release -S . -B .\build
& cmake --build .\build -j 2 --target ALL_BUILD --config Release
& cmake -A x64 -DBoost_DIR="$BOOST_ROOT_1_72_0\lib\cmake\Boost-1.72.0" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DTrimesh2_INCLUDE_DIR:PATH="$trimeshDir\include" -DTrimesh2_LINK_DIR:PATH="$trimeshDir\lib.Win64.vs142" -DCUDA_ARCH:STRING="$env:CUDA_ARCH" -DCMAKE_BUILD_TYPE=Debug -S . -B .\build
& cmake --build .\build -j 2 --target ALL_BUILD --config Debug
cd .\build\Debug
- name: Test cuda_voxelizer
run: .\build\Release\cuda_voxelizer.exe -f .\test_models\bunny.OBJ -s 64 -cpu
run: |
cd .\build\Debug
.\cuda_voxelizer.exe -i ...\..\test_models\bunny.OBJ -s 64 --cpu
32 changes: 20 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 3.17 FATAL_ERROR)

PROJECT(CudaVoxelize LANGUAGES CXX CUDA)

FIND_PACKAGE(GLM REQUIRED)
FIND_PACKAGE(glm REQUIRED)
FIND_PACKAGE(OpenMP REQUIRED)
FIND_PACKAGE(Boost 1.7 REQUIRED COMPONENTS filesystem program_options log log_setup)
FIND_PACKAGE(CUDAToolkit REQUIRED)

SET(CUDA_VOXELIZER_EXECUTABLE cuda_voxelizer)

SET(Trimesh2_INCLUDE_DIR CACHE PATH "Path to Trimesh2 includes")
SET(CUDA_ARCH CACHE STRING "CUDA compute capability. It is prefer to set native value for your video card. Example: 61")

IF(NOT CUDA_ARCH)
MESSAGE(FATAL_ERROR "You must set CUDA_ARCH variable. For example: 61")
MESSAGE(FATAL_ERROR "You must set CUDA_ARCH variable. For example: 61.")
ENDIF()

IF(NOT Trimesh2_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "You need to set variable Trimesh2_INCLUDE_DIR")
ENDIF()

IF(NOT EXISTS "${Trimesh2_INCLUDE_DIR}")
MESSAGE(FATAL_ERROR "You need set path to Trimesh2 include directory")
ENDIF()

FIND_FILE(Trimesh2_TriMesh_h TriMesh.h ${Trimesh2_INCLUDE_DIR})
IF(NOT Trimesh2_TriMesh_h)
MESSAGE(FATAL_ERROR "Can't find TriMesh.h in ${Trimesh2_INCLUDE_DIR}")
message(FATAL_ERROR "Can't find TriMesh.h in ${Trimesh2_INCLUDE_DIR}")
ENDIF()
MARK_AS_ADVANCED(Trimesh2_TriMesh_h)

SET(Trimesh2_LINK_DIR CACHE PATH "Path to Trimesh2 libraries")
SET(Trimesh2_LINK_DIR CACHE PATH "Path to Trimesh2 library dir.")

IF(NOT Trimesh2_LINK_DIR)
MESSAGE(FATAL_ERROR "You need to set variable Trimesh2_LINK_DIR")
ENDIF()

IF(NOT EXISTS "${Trimesh2_LINK_DIR}")
MESSAGE(FATAL_ERROR "You need to set path to Trimesh2 libraries")
MESSAGE(FATAL_ERROR "Trimesh2 library dir does not exist")
ENDIF()

FIND_LIBRARY(Trimesh2_LIBRARY trimesh ${Trimesh2_LINK_DIR})

IF(NOT Trimesh2_LIBRARY)
MESSAGE(FATAL_ERROR "Can't find librray in ${Trimesh2_LINK_DIR}")
message(SEND_ERROR "Can't find libtrimesh.a in ${Trimesh2_LINK_DIR}")
ENDIF()
MARK_AS_ADVANCED(Trimesh2_LIBRARY)

MESSAGE(STATUS "CUDA compute capability set to ${CUDA_ARCH}")
MESSAGE(STATUS "Found Trimesh2 include: ${Trimesh2_TriMesh_h}")
Expand Down Expand Up @@ -79,5 +78,14 @@ SET(CUDA_VOXELIZER_SRCS
ADD_EXECUTABLE(${CUDA_VOXELIZER_EXECUTABLE} ${CUDA_VOXELIZER_SRCS})
TARGET_COMPILE_FEATURES(${CUDA_VOXELIZER_EXECUTABLE} PUBLIC cxx_std_14)
TARGET_INCLUDE_DIRECTORIES( ${CUDA_VOXELIZER_EXECUTABLE} PRIVATE ${Trimesh2_INCLUDE_DIR})
TARGET_LINK_LIBRARIES ( ${CUDA_VOXELIZER_EXECUTABLE} PRIVATE ${Trimesh2_LIBRARY} PRIVATE glm PRIVATE Boost::filesystem PRIVATE Boost::program_options PRIVATE Boost::log_setup PRIVATE Boost::log)
TARGET_LINK_LIBRARIES ( ${CUDA_VOXELIZER_EXECUTABLE} PRIVATE ${Trimesh2_LIBRARY} Boost::log_setup PRIVATE Boost::log PRIVATE Boost::dynamic_linking PRIVATE glm PRIVATE OpenMP::OpenMP_CXX PRIVATE Boost::filesystem PRIVATE Boost::program_options PRIVATE CUDA::cudart)
TARGET_COMPILE_OPTIONS(${CUDA_VOXELIZER_EXECUTABLE} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-gencode arch=compute_${CUDA_ARCH},code=sm_${CUDA_ARCH}>)

add_custom_command(TARGET ${CUDA_VOXELIZER_EXECUTABLE} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy
${CMAKE_CURRENT_SOURCE_DIR}/src/logsettings.ini
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/logsettings.ini"
COMMAND "${CMAKE_COMMAND}" -E copy
${CMAKE_CURRENT_SOURCE_DIR}/src/logsettings.ini
"${CMAKE_CURRENT_BINARY_DIR}>/logsettings.ini"
COMMENT "Copying logsettings")
63 changes: 0 additions & 63 deletions cmake/FindGLM.cmake

This file was deleted.