Skip to content

Commit

Permalink
Octree: Add initial source files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ACapo authored and Squareys committed Aug 9, 2018
1 parent 98385ba commit c78e0b4
Show file tree
Hide file tree
Showing 23 changed files with 1,494 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
# Vladimír Vondruš <[email protected]>
# Copyright © 2015 Andrea Capobianco <[email protected]>
# Copyright © 2015, 2018 Jonathan Hale <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -64,6 +66,7 @@ cmake_dependent_option(BUILD_GL_TESTS "Build unit tests for OpenGL code" OFF "BU
option(BUILD_STATIC "Build static libraries (default are dynamic)" OFF)
cmake_dependent_option(BUILD_STATIC_PIC "Build static libraries with position-independent code" ON "BUILD_STATIC" OFF)

option(WITH_OCTREE "Build Octree library" OFF)
option(WITH_UI "Build Ui library" OFF)
cmake_dependent_option(WITH_UI_GALLERY "Build magnum-ui-gallery executable" OFF "WITH_UI" OFF)

Expand Down
1 change: 1 addition & 0 deletions modules/FindMagnumExtras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#
# This command alone is useless without specifying the components:
#
# Octree - Octree library
# Ui - Ui library
# ui-gallery - magnum-ui-gallery executable
#
Expand Down
3 changes: 2 additions & 1 deletion package/ci/appveyor-desktop-gles.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cmake .. ^
-DWITH_DEBUGTOOLS=OFF ^
-DWITH_MESHTOOLS=OFF ^
-DWITH_PRIMITIVES=OFF ^
-DWITH_SCENEGRAPH=OFF ^
-DWITH_SCENEGRAPH=ON ^
-DWITH_SHADERS=OFF ^
-DWITH_SHAPES=OFF ^
-DWITH_TEXT=%TARGET_GLES3% ^
Expand All @@ -49,6 +49,7 @@ cmake .. ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DCMAKE_PREFIX_PATH=%APPVEYOR_BUILD_FOLDER%/SDL ^
-DWITH_OCTREE=ON ^
-DWITH_UI=%TARGET_GLES3% ^
-DWITH_UI_GALLERY=%TARGET_GLES3% ^
-DBUILD_TESTS=ON ^
Expand Down
3 changes: 2 additions & 1 deletion package/ci/appveyor-desktop-mingw.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cmake .. ^
-DWITH_DEBUGTOOLS=OFF ^
-DWITH_MESHTOOLS=OFF ^
-DWITH_PRIMITIVES=OFF ^
-DWITH_SCENEGRAPH=OFF ^
-DWITH_SCENEGRAPH=ON ^
-DWITH_SHADERS=OFF ^
-DWITH_SHAPES=OFF ^
-DWITH_TEXT=ON ^
Expand All @@ -49,6 +49,7 @@ cmake .. ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DCMAKE_PREFIX_PATH=%APPVEYOR_BUILD_FOLDER%/SDL ^
-DWITH_OCTREE=ON ^
-DWITH_UI=ON ^
-DWITH_UI_GALLERY=ON ^
-DBUILD_TESTS=ON ^
Expand Down
3 changes: 2 additions & 1 deletion package/ci/appveyor-desktop.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cmake .. ^
-DWITH_DEBUGTOOLS=OFF ^
-DWITH_MESHTOOLS=OFF ^
-DWITH_PRIMITIVES=OFF ^
-DWITH_SCENEGRAPH=OFF ^
-DWITH_SCENEGRAPH=ON ^
-DWITH_SHADERS=OFF ^
-DWITH_SHAPES=OFF ^
-DWITH_TEXT=ON ^
Expand All @@ -46,6 +46,7 @@ cmake .. ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DCMAKE_PREFIX_PATH=%APPVEYOR_BUILD_FOLDER%/SDL ^
-DWITH_OCTREE=ON ^
-DWITH_UI=ON ^
-DWITH_UI_GALLERY=ON ^
-DBUILD_TESTS=ON ^
Expand Down
3 changes: 2 additions & 1 deletion package/ci/appveyor-rt.bat
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cmake .. ^
-DWITH_DEBUGTOOLS=OFF ^
-DWITH_MESHTOOLS=OFF ^
-DWITH_PRIMITIVES=OFF ^
-DWITH_SCENEGRAPH=OFF ^
-DWITH_SCENEGRAPH=ON ^
-DWITH_SHADERS=OFF ^
-DWITH_SHAPES=OFF ^
-DWITH_TEXT=%TARGET_GLES3% ^
Expand All @@ -78,6 +78,7 @@ cmake .. ^
-DOPENGLES2_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%/angle/include ^
-DOPENGLES3_LIBRARY=%APPVEYOR_BUILD_FOLDER%/angle/winrt/10/src/Release_x64/lib/libGLESv2.lib ^
-DOPENGLES3_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%/angle/include ^
-DWITH_OCTREE=ON ^
-DBUILD_STATIC=ON ^
-DWITH_UI=%TARGET_GLES3% ^
-DWITH_UI_GALLERY=OFF ^
Expand Down
3 changes: 2 additions & 1 deletion package/ci/travis-android-arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ cmake .. \
-DWITH_DEBUGTOOLS=OFF \
-DWITH_MESHTOOLS=OFF \
-DWITH_PRIMITIVES=OFF \
-DWITH_SCENEGRAPH=OFF \
-DWITH_SCENEGRAPH=ON \
-DWITH_SHADERS=OFF \
-DWITH_SHAPES=OFF \
-DWITH_TEXT=$TARGET_GLES3 \
Expand All @@ -79,6 +79,7 @@ cmake .. \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_FIND_ROOT_PATH=$HOME/deps \
-DWITH_OCTREE=ON \
-DWITH_UI=$TARGET_GLES3 \
-DWITH_UI_GALLERY=OFF \
-DBUILD_TESTS=ON \
Expand Down
3 changes: 2 additions & 1 deletion package/ci/travis-desktop-gles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cmake .. \
-DWITH_DEBUGTOOLS=OFF \
-DWITH_MESHTOOLS=OFF \
-DWITH_PRIMITIVES=OFF \
-DWITH_SCENEGRAPH=OFF \
-DWITH_SCENEGRAPH=ON \
-DWITH_SHADERS=OFF \
-DWITH_SHAPES=OFF \
-DWITH_TEXT=$TARGET_GLES3 \
Expand All @@ -52,6 +52,7 @@ cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_OCTREE=ON \
-DWITH_UI=$TARGET_GLES3 \
-DWITH_UI_GALLERY=$TARGET_GLES3 \
-DBUILD_TESTS=ON \
Expand Down
3 changes: 2 additions & 1 deletion package/ci/travis-desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cmake .. \
-DWITH_DEBUGTOOLS=OFF \
-DWITH_MESHTOOLS=OFF \
-DWITH_PRIMITIVES=OFF \
-DWITH_SCENEGRAPH=OFF \
-DWITH_SCENEGRAPH=ON \
-DWITH_SHADERS=OFF \
-DWITH_SHAPES=OFF \
-DWITH_TEXT=ON \
Expand All @@ -50,6 +50,7 @@ cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_OCTREE=ON \
-DWITH_UI=ON \
-DWITH_UI_GALLERY=ON \
-DBUILD_TESTS=ON \
Expand Down
3 changes: 2 additions & 1 deletion package/ci/travis-emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ cmake .. \
-DWITH_DEBUGTOOLS=OFF \
-DWITH_MESHTOOLS=OFF \
-DWITH_PRIMITIVES=OFF \
-DWITH_SCENEGRAPH=OFF \
-DWITH_SCENEGRAPH=ON \
-DWITH_SHADERS=OFF \
-DWITH_SHAPES=OFF \
-DWITH_TEXT=$TARGET_GLES3 \
Expand Down Expand Up @@ -91,6 +91,7 @@ cmake .. \
-DCMAKE_EXE_LINKER_FLAGS_RELEASE="-O1" \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_FIND_ROOT_PATH=$HOME/deps \
-DWITH_OCTREE=ON \
-DWITH_UI=$TARGET_GLES3 \
-DWITH_UI_GALLERY=$TARGET_GLES3 \
-DBUILD_TESTS=ON \
Expand Down
3 changes: 2 additions & 1 deletion package/ci/travis-ios-simulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ cmake .. \
-DWITH_DEBUGTOOLS=OFF \
-DWITH_MESHTOOLS=OFF \
-DWITH_PRIMITIVES=OFF \
-DWITH_SCENEGRAPH=OFF \
-DWITH_SCENEGRAPH=ON \
-DWITH_SHADERS=OFF \
-DWITH_SHAPES=OFF \
-DWITH_TEXT=$TARGET_GLES3 \
Expand Down Expand Up @@ -94,6 +94,7 @@ cmake .. \
-DWITH_UI_GALLERY=$TARGET_GLES3 \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-DWITH_OCTREE=ON \
-G Xcode
set -o pipefail && cmake --build . --config Release | xcpretty

Expand Down
6 changes: 6 additions & 0 deletions src/Magnum/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
# Vladimír Vondruš <[email protected]>
# Copyright © 2015 Andrea Capobianco <[email protected]>
# Copyright © 2015, 2018 Jonathan Hale <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand All @@ -23,6 +25,10 @@
# DEALINGS IN THE SOFTWARE.
#

if(WITH_OCTREE)
add_subdirectory(Octree)
endif()

if(WITH_UI)
add_subdirectory(Ui)
endif()
62 changes: 62 additions & 0 deletions src/Magnum/Octree/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
# Vladimír Vondruš <[email protected]>
# Copyright © 2015 Andrea Capobianco <[email protected]>
# Copyright © 2015, 2018 Jonathan Hale <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#

cmake_minimum_required(VERSION 2.8.12)

find_package(Magnum REQUIRED OPTIONAL_COMPONENTS SceneGraph)

set(MagnumOctree_SOURCES
instantiation.cpp)

set(MagnumOctree_HEADERS
Octree.h
Octree.hpp

visibility.h)

# Build with Octree based view culling for SceneGraph if found
if(Magnum_SceneGraph_FOUND)
list(APPEND MagnumOctree_HEADERS
OctreeDrawableGroup.h
OctreeDrawableGroup.hpp)
endif()

add_library(MagnumOctree STATIC ${MagnumOctree_SOURCES} ${MagnumOctree_HEADERS})
target_include_directories(MagnumOctree PUBLIC
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src)
target_link_libraries(MagnumOctree Magnum::Magnum)

install(TARGETS MagnumOctree
RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumOctree_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Octree)

if(BUILD_TESTS)
add_subdirectory(Test)
endif()
Loading

0 comments on commit c78e0b4

Please sign in to comment.