Skip to content

Commit

Permalink
Added missing CMake files for IntersectTriangleCylinder.
Browse files Browse the repository at this point in the history
I forgot to add the CMake files for the sample application that illustrates
the test-intersection query for a triangle and a cylinder.
  • Loading branch information
davideberly committed May 22, 2021
1 parent 9dd6e1d commit f22fc97
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 0 deletions.
1 change: 1 addition & 0 deletions GTE/Samples/Intersection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_subdirectory(IntersectInfiniteCylinders)
add_subdirectory(IntersectPlaneConvexPolyhedron)
add_subdirectory(IntersectSphereCone)
add_subdirectory(IntersectTriangleBox)
add_subdirectory(IntersectTriangleCylinder)
add_subdirectory(IntersectTriangles2D)
add_subdirectory(MovingCircleRectangle)
add_subdirectory(MovingSphereBox)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Debug Static",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/DebugStatic/${workspaceFolderBasename}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "Launch Release Static",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/ReleaseStatic/${workspaceFolderBasename}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "Launch Debug Shared",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/DebugShared/${workspaceFolderBasename}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "Launch Release Shared",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/ReleaseShared/${workspaceFolderBasename}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}
56 changes: 56 additions & 0 deletions GTE/Samples/Intersection/IntersectTriangleCylinder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
if(COMMAND cmake_policy)
# Allow VERSION in the project() statement.
cmake_policy(SET CMP0048 NEW)
endif()

project(IntersectTriangleBox)

cmake_minimum_required(VERSION 3.8)
option(BUILD_RELEASE_LIB, "Build release library" OFF)
option(BUILD_SHARED_LIB, "Build shared library" OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH)
add_compile_options(-c -Wall -Werror)
if(BUILD_RELEASE_LIB)
add_compile_definitions(NDEBUG)
add_compile_options(-O3)
else()
add_compile_definitions(_DEBUG)
add_compile_options(-g)
endif()

set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..)
set(GTE_INC_DIR ${GTE_ROOT})
set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE})
set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE})
if(BUILD_SHARED_LIB)
set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared)
set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared)
else()
set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static)
set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static)
endif()
set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE)
SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR})

include_directories(${GTE_INC_DIR})

add_executable(${PROJECT_NAME}
${PROJECT_NAME}Main.cpp
${PROJECT_NAME}Window3.cpp)

find_package(PNG REQUIRED)
find_package(Threads REQUIRED)
target_link_directories(${PROJECT_NAME} PUBLIC ${GTE_LIB_DIR})
target_link_libraries(${PROJECT_NAME}
gtapplications
gtmathematicsgpu
gtgraphics
GL
EGL
X11
PNG::PNG
Threads::Threads)
35 changes: 35 additions & 0 deletions GTE/Samples/Intersection/IntersectTriangleCylinder/CMakeSample.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# usage: ./CMakeSample.sh BUILD_TYPE LIBRARY_TYPE
# where BUILD_TYPE is in {Debug,Release}
# and where LIBRARY_TYPE is in {Static,Shared}

BUILD_TYPE=$1
LIBRARY_TYPE=$2
GCC=gcc
GXX=g++

if [[ ! "${BUILD_TYPE}" = "Debug" && ! "${BUILD_TYPE}" = "Release" ]]; then
echo "Invalid build type: ${BUILD_TYPE}, must be in {Debug, Release}"
exit 1
fi

if [[ ! "${LIBRARY_TYPE}" = "Static" && ! "${LIBRARY_TYPE}" = "Shared" ]]; then
echo "Invalid library type: ${LIBRARY_TYPE}, must be in {Static, Shared}"
exit 2
fi

if [ "${BUILD_TYPE}" = "Debug" ]; then
if [ "${LIBRARY_TYPE}" = "Static" ]; then
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DBUILD_RELEASE_LIB:BOOL=FALSE -DBUILD_SHARED_LIB:BOOL=FALSE -DCMAKE_C_COMPILER:FILEPATH=${GCC} -DCMAKE_CXX_COMPILER:FILEPATH=${GXX} -B./build -G "Unix Makefiles"
else
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DBUILD_RELEASE_LIB:BOOL=FALSE -DBUILD_SHARED_LIB:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=${GCC} -DCMAKE_CXX_COMPILER:FILEPATH=${GXX} -B./build -G "Unix Makefiles"
fi
cmake --build ./build --config Debug --target all -- -j 10
else
if [ "${LIBRARY_TYPE}" = "Static" ]; then
cmake -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_RELEASE_LIB:BOOL=TRUE -DBUILD_SHARED_LIB:BOOL=FALSE -DCMAKE_C_COMPILER:FILEPATH=${GCC} -DCMAKE_CXX_COMPILER:FILEPATH=${GXX} -B./build -G "Unix Makefiles"
else
cmake -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_RELEASE_LIB:BOOL=TRUE -DBUILD_SHARED_LIB:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=${GCC} -DCMAKE_CXX_COMPILER:FILEPATH=${GXX} -B./build -G "Unix Makefiles"
fi
cmake --build ./build --config Release --target all -- -j 10
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"build_type": {
"default": "debug",
"description": "The CMake build type to use",
"choices": {
"debug": {
"short": "Debug",
"long": "Emit debug information without performing optimizations",
"buildType": "Debug",
"settings": {
"BUILD_RELEASE_LIB": false
}
},
"release": {
"short": "Release",
"long": "Enable optimizations, omit debug info",
"buildType": "Release",
"settings": {
"BUILD_RELEASE_LIB": true
}
}
}
},
"library_type": {
"default": "static",
"description": "Selects the library type to build for",
"choices": {
"static": {
"short": "Static",
"long": "Builds the static library",
"settings": {
"BUILD_SHARED_LIB": false
}
},
"shared": {
"short": "Shared",
"long": "Builds the shared library",
"settings": {
"BUILD_SHARED_LIB": true
}
}
}
}
}

0 comments on commit f22fc97

Please sign in to comment.