From 77cc5dba4972318478351ba655dbbfb29dab5500 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 26 May 2015 22:52:12 +0200 Subject: [PATCH] Moving onscreen gui into its own module --- include/openspace/engine/openspaceengine.h | 6 +- modules/onscreengui/CMakeLists.txt | 61 +++++++++++++++++++ .../onscreengui/ext}/imgui/.gitignore | 0 .../onscreengui/ext}/imgui/CMakeLists.txt | 0 .../onscreengui/ext}/imgui/LICENSE | 0 .../onscreengui/ext}/imgui/README.md | 0 .../onscreengui/ext}/imgui/imconfig.h | 0 .../onscreengui/ext}/imgui/imgui.cpp | 0 .../onscreengui/ext}/imgui/imgui.h | 0 .../onscreengui/ext}/imgui/stb_rect_pack.h | 0 .../onscreengui/ext}/imgui/stb_textedit.h | 0 .../onscreengui/ext}/imgui/stb_truetype.h | 0 modules/onscreengui/include.cmake | 1 + .../gui => modules/onscreengui/include}/gui.h | 10 +-- .../onscreengui/include}/guicomponent.h | 0 .../onscreengui/include}/guihelpcomponent.h | 2 +- .../onscreengui/include}/guiorigincomponent.h | 2 +- .../include}/guiperformancecomponent.h | 2 +- .../include}/guipropertycomponent.h | 2 +- .../onscreengui/include}/guitimecomponent.h | 2 +- modules/onscreengui/onscreenguimodule.cpp | 40 ++++++++++++ modules/onscreengui/onscreenguimodule.h | 40 ++++++++++++ .../onscreengui/shaders}/gui_fs.glsl | 0 .../onscreengui/shaders}/gui_vs.glsl | 0 {src/gui => modules/onscreengui/src}/gui.cpp | 9 ++- .../onscreengui/src}/guicomponent.cpp | 2 +- .../onscreengui/src}/guihelpcomponent.cpp | 2 +- .../onscreengui/src}/guiorigincomponent.cpp | 2 +- .../src}/guiperformancecomponent.cpp | 2 +- .../onscreengui/src}/guipropertycomponent.cpp | 2 +- .../onscreengui/src}/guitimecomponent.cpp | 2 +- src/CMakeLists.txt | 14 ----- src/engine/openspaceengine.cpp | 5 +- src/scene/scene.cpp | 5 +- support/cmake/handle_external_library.cmake | 45 ++++++++++++++ support/cmake/module_definition.cmake | 3 +- support/cmake/support_macros.cmake | 14 ----- 37 files changed, 224 insertions(+), 51 deletions(-) create mode 100644 modules/onscreengui/CMakeLists.txt rename {ext => modules/onscreengui/ext}/imgui/.gitignore (100%) rename {ext => modules/onscreengui/ext}/imgui/CMakeLists.txt (100%) rename {ext => modules/onscreengui/ext}/imgui/LICENSE (100%) rename {ext => modules/onscreengui/ext}/imgui/README.md (100%) rename {ext => modules/onscreengui/ext}/imgui/imconfig.h (100%) rename {ext => modules/onscreengui/ext}/imgui/imgui.cpp (100%) rename {ext => modules/onscreengui/ext}/imgui/imgui.h (100%) rename {ext => modules/onscreengui/ext}/imgui/stb_rect_pack.h (100%) rename {ext => modules/onscreengui/ext}/imgui/stb_textedit.h (100%) rename {ext => modules/onscreengui/ext}/imgui/stb_truetype.h (100%) create mode 100644 modules/onscreengui/include.cmake rename {include/openspace/gui => modules/onscreengui/include}/gui.h (91%) rename {include/openspace/gui => modules/onscreengui/include}/guicomponent.h (100%) rename {include/openspace/gui => modules/onscreengui/include}/guihelpcomponent.h (97%) rename {include/openspace/gui => modules/onscreengui/include}/guiorigincomponent.h (98%) rename {include/openspace/gui => modules/onscreengui/include}/guiperformancecomponent.h (97%) rename {include/openspace/gui => modules/onscreengui/include}/guipropertycomponent.h (98%) rename {include/openspace/gui => modules/onscreengui/include}/guitimecomponent.h (98%) create mode 100644 modules/onscreengui/onscreenguimodule.cpp create mode 100644 modules/onscreengui/onscreenguimodule.h rename {shaders => modules/onscreengui/shaders}/gui_fs.glsl (100%) rename {shaders => modules/onscreengui/shaders}/gui_vs.glsl (100%) rename {src/gui => modules/onscreengui/src}/gui.cpp (99%) rename {src/gui => modules/onscreengui/src}/guicomponent.cpp (97%) rename {src/gui => modules/onscreengui/src}/guihelpcomponent.cpp (97%) rename {src/gui => modules/onscreengui/src}/guiorigincomponent.cpp (99%) rename {src/gui => modules/onscreengui/src}/guiperformancecomponent.cpp (98%) rename {src/gui => modules/onscreengui/src}/guipropertycomponent.cpp (99%) rename {src/gui => modules/onscreengui/src}/guitimecomponent.cpp (98%) create mode 100644 support/cmake/handle_external_library.cmake diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 78956f5a6a..11f1eee190 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -25,7 +25,8 @@ #ifndef __OPENSPACEENGINE_H__ #define __OPENSPACEENGINE_H__ -#include +#include +#include #include #include @@ -49,6 +50,9 @@ class ModuleEngine; namespace interaction { class InteractionHandler; } +namespace gui { + class GUI; +} namespace scripting { class ScriptEngine; } diff --git a/modules/onscreengui/CMakeLists.txt b/modules/onscreengui/CMakeLists.txt new file mode 100644 index 0000000000..21375eea6c --- /dev/null +++ b/modules/onscreengui/CMakeLists.txt @@ -0,0 +1,61 @@ +######################################################################################### +# # +# OpenSpace # +# # +# Copyright (c) 2014-2015 # +# # +# 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. # +######################################################################################### + +include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) + +set(HEADER_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/include/gui.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/guicomponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/guihelpcomponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/guiorigincomponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/guiperformancecomponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/guipropertycomponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/guitimecomponent.h +) +source_group("Header Files" FILES ${HEADER_FILES}) + +set(SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/src/gui.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guicomponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guihelpcomponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guiorigincomponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guiperformancecomponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guipropertycomponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guitimecomponent.cpp +) +source_group("Source Files" FILES ${SOURCE_FILES}) + +set(SHADER_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gui_fs.glsl + ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gui_vs.glsl +) +source_group("Shader Files" FILES ${SHADER_FILES}) + +create_new_module( + "OnScreenGUI" + onscreengui_module + ${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES} +) + +include_external_library(${onscreengui_module} Imgui ${CMAKE_CURRENT_SOURCE_DIR}/ext/imgui) diff --git a/ext/imgui/.gitignore b/modules/onscreengui/ext/imgui/.gitignore similarity index 100% rename from ext/imgui/.gitignore rename to modules/onscreengui/ext/imgui/.gitignore diff --git a/ext/imgui/CMakeLists.txt b/modules/onscreengui/ext/imgui/CMakeLists.txt similarity index 100% rename from ext/imgui/CMakeLists.txt rename to modules/onscreengui/ext/imgui/CMakeLists.txt diff --git a/ext/imgui/LICENSE b/modules/onscreengui/ext/imgui/LICENSE similarity index 100% rename from ext/imgui/LICENSE rename to modules/onscreengui/ext/imgui/LICENSE diff --git a/ext/imgui/README.md b/modules/onscreengui/ext/imgui/README.md similarity index 100% rename from ext/imgui/README.md rename to modules/onscreengui/ext/imgui/README.md diff --git a/ext/imgui/imconfig.h b/modules/onscreengui/ext/imgui/imconfig.h similarity index 100% rename from ext/imgui/imconfig.h rename to modules/onscreengui/ext/imgui/imconfig.h diff --git a/ext/imgui/imgui.cpp b/modules/onscreengui/ext/imgui/imgui.cpp similarity index 100% rename from ext/imgui/imgui.cpp rename to modules/onscreengui/ext/imgui/imgui.cpp diff --git a/ext/imgui/imgui.h b/modules/onscreengui/ext/imgui/imgui.h similarity index 100% rename from ext/imgui/imgui.h rename to modules/onscreengui/ext/imgui/imgui.h diff --git a/ext/imgui/stb_rect_pack.h b/modules/onscreengui/ext/imgui/stb_rect_pack.h similarity index 100% rename from ext/imgui/stb_rect_pack.h rename to modules/onscreengui/ext/imgui/stb_rect_pack.h diff --git a/ext/imgui/stb_textedit.h b/modules/onscreengui/ext/imgui/stb_textedit.h similarity index 100% rename from ext/imgui/stb_textedit.h rename to modules/onscreengui/ext/imgui/stb_textedit.h diff --git a/ext/imgui/stb_truetype.h b/modules/onscreengui/ext/imgui/stb_truetype.h similarity index 100% rename from ext/imgui/stb_truetype.h rename to modules/onscreengui/ext/imgui/stb_truetype.h diff --git a/modules/onscreengui/include.cmake b/modules/onscreengui/include.cmake new file mode 100644 index 0000000000..ffea0ac430 --- /dev/null +++ b/modules/onscreengui/include.cmake @@ -0,0 +1 @@ +set(DEFAULT_MODULE ON) diff --git a/include/openspace/gui/gui.h b/modules/onscreengui/include/gui.h similarity index 91% rename from include/openspace/gui/gui.h rename to modules/onscreengui/include/gui.h index a874b35147..00e2c623cb 100644 --- a/include/openspace/gui/gui.h +++ b/modules/onscreengui/include/gui.h @@ -25,11 +25,11 @@ #ifndef __GUI_H__ #define __GUI_H__ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace openspace { diff --git a/include/openspace/gui/guicomponent.h b/modules/onscreengui/include/guicomponent.h similarity index 100% rename from include/openspace/gui/guicomponent.h rename to modules/onscreengui/include/guicomponent.h diff --git a/include/openspace/gui/guihelpcomponent.h b/modules/onscreengui/include/guihelpcomponent.h similarity index 97% rename from include/openspace/gui/guihelpcomponent.h rename to modules/onscreengui/include/guihelpcomponent.h index bad3e6faf7..cfa228b466 100644 --- a/include/openspace/gui/guihelpcomponent.h +++ b/modules/onscreengui/include/guihelpcomponent.h @@ -25,7 +25,7 @@ #ifndef __GUIHELPCOMPONENT_H__ #define __GUIHELPCOMPONENT_H__ -#include +#include namespace openspace { namespace gui { diff --git a/include/openspace/gui/guiorigincomponent.h b/modules/onscreengui/include/guiorigincomponent.h similarity index 98% rename from include/openspace/gui/guiorigincomponent.h rename to modules/onscreengui/include/guiorigincomponent.h index 06657ac365..914a875ee3 100644 --- a/include/openspace/gui/guiorigincomponent.h +++ b/modules/onscreengui/include/guiorigincomponent.h @@ -25,7 +25,7 @@ #ifndef __GUIORIGINCOMPONENT_H__ #define __GUIORIGINCOMPONENT_H__ -#include +#include namespace openspace { diff --git a/include/openspace/gui/guiperformancecomponent.h b/modules/onscreengui/include/guiperformancecomponent.h similarity index 97% rename from include/openspace/gui/guiperformancecomponent.h rename to modules/onscreengui/include/guiperformancecomponent.h index 913720cc5a..00c87997f9 100644 --- a/include/openspace/gui/guiperformancecomponent.h +++ b/modules/onscreengui/include/guiperformancecomponent.h @@ -25,7 +25,7 @@ #ifndef __GUIPERFORMANCECOMPONENT_H__ #define __GUIPERFORMANCECOMPONENT_H__ -#include +#include namespace ghoul { class SharedMemory; diff --git a/include/openspace/gui/guipropertycomponent.h b/modules/onscreengui/include/guipropertycomponent.h similarity index 98% rename from include/openspace/gui/guipropertycomponent.h rename to modules/onscreengui/include/guipropertycomponent.h index c6f356299c..acc282fa84 100644 --- a/include/openspace/gui/guipropertycomponent.h +++ b/modules/onscreengui/include/guipropertycomponent.h @@ -25,7 +25,7 @@ #ifndef __GUIPROPERTYCOMPONENT_H__ #define __GUIPROPERTYCOMPONENT_H__ -#include +#include #include #include diff --git a/include/openspace/gui/guitimecomponent.h b/modules/onscreengui/include/guitimecomponent.h similarity index 98% rename from include/openspace/gui/guitimecomponent.h rename to modules/onscreengui/include/guitimecomponent.h index d8a8b286e8..1694517363 100644 --- a/include/openspace/gui/guitimecomponent.h +++ b/modules/onscreengui/include/guitimecomponent.h @@ -25,7 +25,7 @@ #ifndef __GUITIMECOMPONENT_H__ #define __GUITIMECOMPONENT_H__ -#include +#include namespace openspace { diff --git a/modules/onscreengui/onscreenguimodule.cpp b/modules/onscreengui/onscreenguimodule.cpp new file mode 100644 index 0000000000..ac024bc300 --- /dev/null +++ b/modules/onscreengui/onscreenguimodule.cpp @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2015 * + * * + * 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. * + ****************************************************************************************/ + +#include + +namespace openspace { + +OnScreenGUIModule::OnScreenGUIModule() { + setName("OnScreenGUI"); +} + +bool OnScreenGUIModule::initialize() { + bool success = OpenSpaceModule::initialize(); + if (!success) + return false; + return true; +} + +} // namespace openspace diff --git a/modules/onscreengui/onscreenguimodule.h b/modules/onscreengui/onscreenguimodule.h new file mode 100644 index 0000000000..0479d78b99 --- /dev/null +++ b/modules/onscreengui/onscreenguimodule.h @@ -0,0 +1,40 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2015 * + * * + * 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. * + ****************************************************************************************/ + +#ifndef __ONSCREENGUIMODULE_H__ +#define __ONSCREENGUIMODULE_H__ + +#include + +namespace openspace { + +class OnScreenGUIModule : public OpenSpaceModule { +public: + OnScreenGUIModule(); + bool initialize() override; +}; + +} // namespace openspace + +#endif // __ONSCREENGUIMODULE_H__ diff --git a/shaders/gui_fs.glsl b/modules/onscreengui/shaders/gui_fs.glsl similarity index 100% rename from shaders/gui_fs.glsl rename to modules/onscreengui/shaders/gui_fs.glsl diff --git a/shaders/gui_vs.glsl b/modules/onscreengui/shaders/gui_vs.glsl similarity index 100% rename from shaders/gui_vs.glsl rename to modules/onscreengui/shaders/gui_vs.glsl diff --git a/src/gui/gui.cpp b/modules/onscreengui/src/gui.cpp similarity index 99% rename from src/gui/gui.cpp rename to modules/onscreengui/src/gui.cpp index d4538f2fdc..b5ba647efb 100644 --- a/src/gui/gui.cpp +++ b/modules/onscreengui/src/gui.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include @@ -196,8 +196,11 @@ void GUI::initialize() { } void GUI::initializeGL() { - _program = ghoul::opengl::ProgramObject::Build("GUI", - "${SHADERS}/gui_vs.glsl", "${SHADERS}/gui_fs.glsl"); + _program = ghoul::opengl::ProgramObject::Build( + "GUI", + "${MODULE_ONSCREENGUI}/shaders/gui_vs.glsl", + "${MODULE_ONSCREENGUI}/shaders/gui_fs.glsl" + ); if (!_program) return; diff --git a/src/gui/guicomponent.cpp b/modules/onscreengui/src/guicomponent.cpp similarity index 97% rename from src/gui/guicomponent.cpp rename to modules/onscreengui/src/guicomponent.cpp index 28764ebe82..f88561908a 100644 --- a/src/gui/guicomponent.cpp +++ b/modules/onscreengui/src/guicomponent.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include namespace openspace { namespace gui { diff --git a/src/gui/guihelpcomponent.cpp b/modules/onscreengui/src/guihelpcomponent.cpp similarity index 97% rename from src/gui/guihelpcomponent.cpp rename to modules/onscreengui/src/guihelpcomponent.cpp index 1f0b3fbad6..c266364cd9 100644 --- a/src/gui/guihelpcomponent.cpp +++ b/modules/onscreengui/src/guihelpcomponent.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include "imgui.h" diff --git a/src/gui/guiorigincomponent.cpp b/modules/onscreengui/src/guiorigincomponent.cpp similarity index 99% rename from src/gui/guiorigincomponent.cpp rename to modules/onscreengui/src/guiorigincomponent.cpp index c7839f416d..7322367890 100644 --- a/src/gui/guiorigincomponent.cpp +++ b/modules/onscreengui/src/guiorigincomponent.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include #include diff --git a/src/gui/guiperformancecomponent.cpp b/modules/onscreengui/src/guiperformancecomponent.cpp similarity index 98% rename from src/gui/guiperformancecomponent.cpp rename to modules/onscreengui/src/guiperformancecomponent.cpp index eca3734915..094349193e 100644 --- a/src/gui/guiperformancecomponent.cpp +++ b/modules/onscreengui/src/guiperformancecomponent.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include #include diff --git a/src/gui/guipropertycomponent.cpp b/modules/onscreengui/src/guipropertycomponent.cpp similarity index 99% rename from src/gui/guipropertycomponent.cpp rename to modules/onscreengui/src/guipropertycomponent.cpp index e8b34a2cff..15b3977e2b 100644 --- a/src/gui/guipropertycomponent.cpp +++ b/modules/onscreengui/src/guipropertycomponent.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include #include diff --git a/src/gui/guitimecomponent.cpp b/modules/onscreengui/src/guitimecomponent.cpp similarity index 98% rename from src/gui/guitimecomponent.cpp rename to modules/onscreengui/src/guitimecomponent.cpp index 709713b865..85c0d90d1c 100644 --- a/src/gui/guitimecomponent.cpp +++ b/modules/onscreengui/src/guitimecomponent.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 96a6c83e8b..bddf3e7753 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,13 +33,6 @@ set(OPENSPACE_SOURCE ${OPENSPACE_BASE_DIR}/src/engine/logfactory.cpp ${OPENSPACE_BASE_DIR}/src/engine/moduleengine.cpp ${OPENSPACE_BASE_DIR}/src/engine/openspaceengine.cpp - ${OPENSPACE_BASE_DIR}/src/gui/gui.cpp - ${OPENSPACE_BASE_DIR}/src/gui/guicomponent.cpp - ${OPENSPACE_BASE_DIR}/src/gui/guihelpcomponent.cpp - ${OPENSPACE_BASE_DIR}/src/gui/guiorigincomponent.cpp - ${OPENSPACE_BASE_DIR}/src/gui/guiperformancecomponent.cpp - ${OPENSPACE_BASE_DIR}/src/gui/guipropertycomponent.cpp - ${OPENSPACE_BASE_DIR}/src/gui/guitimecomponent.cpp ${OPENSPACE_BASE_DIR}/src/interaction/controller.cpp ${OPENSPACE_BASE_DIR}/src/interaction/deviceidentifier.cpp ${OPENSPACE_BASE_DIR}/src/interaction/interactionhandler.cpp @@ -106,13 +99,6 @@ set(OPENSPACE_HEADER ${OPENSPACE_BASE_DIR}/include/openspace/engine/logfactory.h ${OPENSPACE_BASE_DIR}/include/openspace/engine/moduleengine.h ${OPENSPACE_BASE_DIR}/include/openspace/engine/openspaceengine.h - ${OPENSPACE_BASE_DIR}/include/openspace/gui/gui.h - ${OPENSPACE_BASE_DIR}/include/openspace/gui/guicomponent.h - ${OPENSPACE_BASE_DIR}/include/openspace/gui/guihelpcomponent.h - ${OPENSPACE_BASE_DIR}/include/openspace/gui/guiorigincomponent.h - ${OPENSPACE_BASE_DIR}/include/openspace/gui/guiperformancecomponent.h - ${OPENSPACE_BASE_DIR}/include/openspace/gui/guipropertycomponent.h - ${OPENSPACE_BASE_DIR}/include/openspace/gui/guitimecomponent.h ${OPENSPACE_BASE_DIR}/include/openspace/interaction/controller.h ${OPENSPACE_BASE_DIR}/include/openspace/interaction/deviceidentifier.h ${OPENSPACE_BASE_DIR}/include/openspace/interaction/interactionhandler.h diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 835e34c7bb..7197d9249d 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -63,6 +62,10 @@ #include #include +#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED +#include +#endif + #ifdef _MSC_VER #ifdef OPENSPACE_ENABLE_VLD #include diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 7d42e35a3c..8e6b0c58bc 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -53,6 +52,10 @@ #include #include +#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED +#include +#endif + #include "scene_lua.inl" namespace { diff --git a/support/cmake/handle_external_library.cmake b/support/cmake/handle_external_library.cmake new file mode 100644 index 0000000000..bd75cce586 --- /dev/null +++ b/support/cmake/handle_external_library.cmake @@ -0,0 +1,45 @@ +######################################################################################### +# # +# OpenSpace # +# # +# Copyright (c) 2014-2015 # +# # +# 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. # +######################################################################################### + +# Includes an external library by adding its subdirectory using 'add_subdirectory' +# target_name: Target to which the library is added +# library_name: The library that is added by including 'path' +# path: The path that will be included +function (include_external_library target_name library_name path) + if (NOT TARGET ${library_name}) + add_subdirectory(${path}) + get_property(INCLUDE_DIR TARGET ${target_name} PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + target_link_libraries(${target_name} ${library_name}) + target_include_directories(${target_name} PUBLIC ${INCLUDE_DIR}) + set_property(TARGET ${library_name} PROPERTY FOLDER "External") + if (OPENSPACE_DISABLE_EXTERNAL_WARNINGS) + if (MSVC) + target_compile_options(${library_name} PUBLIC "/W0" "/MP") + else () + target_compile_options(${library_name} PUBLIC "-w") + endif () + endif () + endif () + +endfunction () \ No newline at end of file diff --git a/support/cmake/module_definition.cmake b/support/cmake/module_definition.cmake index 1cfb40a8f1..c1c6be037e 100644 --- a/support/cmake/module_definition.cmake +++ b/support/cmake/module_definition.cmake @@ -23,6 +23,7 @@ ######################################################################################### include (${OPENSPACE_CMAKE_EXT_DIR}/module_common.cmake) +include (${OPENSPACE_CMAKE_EXT_DIR}/handle_external_library.cmake) # Creates a new project and a library for the module with name . The name of # the library is returned in for outside configuration @@ -53,7 +54,7 @@ function (create_new_module module_name output_library_name) write_module_name(${module_name}) - set(${output_library_name} ${library_name}) + set(${output_library_name} ${library_name} PARENT_SCOPE) endfunction () diff --git a/support/cmake/support_macros.cmake b/support/cmake/support_macros.cmake index 714902e4c4..6a26c38801 100644 --- a/support/cmake/support_macros.cmake +++ b/support/cmake/support_macros.cmake @@ -206,20 +206,6 @@ function (add_external_dependencies) endif () set_property(TARGET cdf PROPERTY FOLDER "External") endif () - - # Imgui - add_subdirectory(${OPENSPACE_EXT_DIR}/imgui) - get_property(IMGUI_INCLUDE_DIR TARGET Imgui PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - target_link_libraries(libOpenSpace Imgui) - target_include_directories(libOpenSpace PUBLIC ${IMGUI_INCLUDE_DIR}) - set_property(TARGET Imgui PROPERTY FOLDER "External") - if (OPENSPACE_DISABLE_EXTERNAL_WARNINGS) - if (MSVC) - target_compile_options(Imgui PUBLIC "/W0" "/MP") - else () - target_compile_options(ccmc PUBLIC "-w") - endif () - endif () endfunction ()