From c1edc30ad718a631259ff69844232bd47fe0f294 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 4 May 2015 03:29:12 +0200 Subject: [PATCH] Dead code removal --- CMakeLists.txt | 171 +--------------------- apps/launcher/CMakeLists.txt | 1 - apps/opencs/CMakeLists.txt | 2 - apps/openmw/CMakeLists.txt | 3 - apps/openmw/engine.cpp | 10 -- apps/openmw/mwgui/settingswindow.cpp | 20 --- apps/openmw/mwgui/settingswindow.hpp | 2 - files/mygui/openmw_settings_window.layout | 6 - files/settings-default.cfg | 2 - 9 files changed, 1 insertion(+), 216 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1008d313..92023da2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,12 +54,9 @@ endif (ANDROID) configure_file ("${OpenMW_SOURCE_DIR}/docs/mainpage.hpp.cmake" "${OpenMW_BINARY_DIR}/docs/mainpage.hpp") option(MYGUI_STATIC "Link static build of Mygui into the binaries" FALSE) -option(OGRE_STATIC "Link static build of Ogre and Ogre Plugins into the binaries" FALSE) option(BOOST_STATIC "Link static build of Boost into the binaries" FALSE) option(SDL2_STATIC "Link static build of SDL into the binaries" FALSE) -set(CUSTOM_OGRE_PLUGIN_DIR "" CACHE PATH "Specify a custom directory for Ogre plugins (autodetected by default)") - option(OPENMW_UNITY_BUILD "Use fewer compilation units to speed up compile time" FALSE) # Apps and tools @@ -197,46 +194,9 @@ find_package(SDL2 REQUIRED) find_package(OpenAL REQUIRED) find_package(Bullet REQUIRED) -set(OGRE_PLUGIN_INCLUDE_DIRS "") -set(OGRE_STATIC_PLUGINS "") - -macro(add_static_ogre_plugin PLUGIN) - if(OGRE_${PLUGIN}_FOUND) - # strip RenderSystem_ or Plugin_ prefix from plugin name - string(REPLACE "RenderSystem_" "" PLUGIN_TEMP ${PLUGIN}) - string(REPLACE "Plugin_" "" PLUGIN_NAME ${PLUGIN_TEMP}) - add_definitions(-DENABLE_PLUGIN_${PLUGIN_NAME}) - - list(APPEND OGRE_PLUGIN_INCLUDE_DIRS ${OGRE_${PLUGIN}_INCLUDE_DIRS}) - list(APPEND OGRE_STATIC_PLUGINS ${OGRE_${PLUGIN}_LIBRARIES}) - endif(OGRE_${PLUGIN}_FOUND) -endmacro(add_static_ogre_plugin) - -if(OGRE_STATIC) - # set up OGRE_PLUGIN_INCLUDE_DIRS and OGRE_STATIC_PLUGINS - add_static_ogre_plugin(Plugin_OctreeSceneManager) - add_static_ogre_plugin(Plugin_ParticleFX) - find_package(Cg) - if(Cg_FOUND) - add_static_ogre_plugin(Plugin_CgProgramManager) - list(APPEND OGRE_STATIC_PLUGINS ${Cg_LIBRARIES}) - endif(Cg_FOUND) - -if (ANDROID) - add_static_ogre_plugin(RenderSystem_GLES2) -else () - add_static_ogre_plugin(RenderSystem_GL) -endif () - - if(WIN32) - add_static_ogre_plugin(RenderSystem_Direct3D9) - endif(WIN32) -endif(OGRE_STATIC) - include_directories("." ${LIBS_DIR} SYSTEM - ${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE ${OGRE_INCLUDE_DIRS} ${OGRE_PLUGIN_INCLUDE_DIRS} - ${OGRE_INCLUDE_DIR}/Overlay ${OGRE_Overlay_INCLUDE_DIR} + ${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE ${OGRE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${PLATFORM_INCLUDE_DIR} @@ -252,31 +212,6 @@ if(MYGUI_STATIC) endif (MYGUI_STATIC) if (APPLE) - # List used Ogre plugins - SET(USED_OGRE_PLUGINS ${OGRE_RenderSystem_GL_LIBRARY_REL} - ${OGRE_Plugin_ParticleFX_LIBRARY_REL}) - - # Actually we must use OGRE_Plugin_CgProgramManager_FOUND but it's - # not reliable and equals TRUE even if there's no Ogre Cg plugin - if (Cg_FOUND) - set(USED_OGRE_PLUGINS ${USED_OGRE_PLUGINS} - ${OGRE_Plugin_CgProgramManager_LIBRARY_REL}) - endif () - - if (${OGRE_PLUGIN_DIR_REL}}) - set(OGRE_PLUGINS_REL_FOUND TRUE) - endif () - - if (${OGRE_PLUGIN_DIR_DBG}) - set(OGRE_PLUGINS_DBG_FOUND TRUE) - endif () - - if (${OGRE_PLUGINS_REL_FOUND}) - set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL}) - else () - set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG}) - endif () - configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist "${APP_BUNDLE_DIR}/Contents/Info.plist") @@ -287,28 +222,6 @@ endif (APPLE) # Set up DEBUG define set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_DEBUG DEBUG=1) -# Set up Ogre plugin folder & debug suffix -if (APPLE) - # Ogre on OS X doesn't use "_d" suffix (see Ogre's CMakeLists.txt) - add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="") -else () - add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d") -endif() - -if (APPLE AND OPENMW_OSX_DEPLOYMENT) - # make it empty so plugin loading code can check this and try to find plugins inside app bundle - add_definitions(-DOGRE_PLUGIN_DIR="") -else() - if (CUSTOM_OGRE_PLUGIN_DIR STREQUAL "") - set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL}) - else() - set(OGRE_PLUGIN_DIR ${CUSTOM_OGRE_PLUGIN_DIR}) - endif() - - add_definitions(-DOGRE_PLUGIN_DIR="${OGRE_PLUGIN_DIR}") -endif() - - add_subdirectory(files/) # Specify build paths @@ -651,12 +564,6 @@ if (WIN32) 4987 # nonstandard extension used (triggered by setjmp.h) 4996 # Function was declared deprecated - # cause by ogre extensivly - 4193 # #pragma warning(pop) : no matching '#pragma warning(push)' - 4251 # class 'XXXX' needs to have dll-interface to be used by clients of class 'YYYY' - 4275 # non dll-interface struct 'XXXX' used as base for dll-interface class 'YYYY' - 4315 # undocumented, 'this' pointer for member might not be aligned (OgreMemoryStlAllocator.h) - # caused by boost 4191 # 'type cast' : unsafe conversion (1.56, thread_primitives.hpp, normally off) @@ -722,90 +629,14 @@ if (APPLE) set(OPENCS_BUNDLE_NAME "OpenMW-CS.app") set(OPENCS_APP "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${OPENCS_BUNDLE_NAME}") - set(ABSOLUTE_PLUGINS "") - - foreach (PLUGIN ${USED_OGRE_PLUGINS}) - get_filename_component(PLUGIN_ABS ${PLUGIN} REALPATH) - set(ABSOLUTE_PLUGINS ${PLUGIN_ABS} ${ABSOLUTE_PLUGINS}) - endforeach () - install(CODE " set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) " COMPONENT Runtime) - # installs used plugins in bundle at given path (bundle_path must be relative to ${CMAKE_INSTALL_PREFIX}) - # and returns list of install paths for all installed plugins - function (install_plugins_for_bundle bundle_path plugins_var) - set(RELATIVE_PLUGIN_INSTALL_BASE "${bundle_path}/Contents/Frameworks") - - set(PLUGINS "") - set(PLUGIN_INSTALL_BASE "\${CMAKE_INSTALL_PREFIX}/${RELATIVE_PLUGIN_INSTALL_BASE}") - - foreach (PLUGIN ${ABSOLUTE_PLUGINS}) - get_filename_component(PLUGIN_RELATIVE ${PLUGIN} NAME) - get_filename_component(PLUGIN_RELATIVE_WE ${PLUGIN} NAME_WE) - - set(PLUGIN_DYLIB_IN_BUNDLE "${PLUGIN_INSTALL_BASE}/${PLUGIN_RELATIVE}/${PLUGIN_RELATIVE_WE}") - set(PLUGINS ${PLUGINS} "${PLUGIN_DYLIB_IN_BUNDLE}") - - install(CODE " - copy_resolved_framework_into_bundle(\"${PLUGIN}/${PLUGIN_RELATIVE_WE}\" \"${PLUGIN_DYLIB_IN_BUNDLE}\") - " COMPONENT Runtime) - endforeach () - - set(${plugins_var} ${PLUGINS} PARENT_SCOPE) - endfunction (install_plugins_for_bundle) - - install_plugins_for_bundle("${INSTALL_SUBDIR}/${APP_BUNDLE_NAME}" PLUGINS) - install_plugins_for_bundle("${INSTALL_SUBDIR}/${OPENCS_BUNDLE_NAME}" OPENCS_PLUGINS) - #For now, search unresolved dependencies only in default system paths, so if you put unresolveable (i.e. with @executable_path in id name) lib or framework somewhere else, it would fail set(DIRS "") - # Overriding item resolving during installation, it needed if - # some library already has been "fixed up", i.e. its id name contains @executable_path, - # but library is not embedded in bundle. For example, it's Ogre.framework from Ogre SDK. - # Current implementation of GetPrerequsities/BundleUtilities doesn't handle that case. - # - # Current limitations: - # 1. Handles only frameworks, not simple libs - INSTALL(CODE " - cmake_policy(SET CMP0009 OLD) - set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_SYSTEM_FRAMEWORK_PATH ${CMAKE_SYSTEM_FRAMEWORK_PATH}) - - set(OPENMW_RESOLVED_ITEMS \"\") - - function(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) - if(item MATCHES \"@executable_path\" AND NOT \${\${resolved_var}}) - if (item MATCHES \"Frameworks\") # if it is a framework - # get last segment of path - get_filename_component(fname \"\${item}\" NAME_WE) - find_library(ri NAMES \${fname} PATHS \${exepath} \${dirs} \${CMAKE_SYSTEM_FRAMEWORK_PATH}) - if (ri) - string(REGEX REPLACE \"^.*/Frameworks/.*\\\\.framework\" \"\" item_part \${item}) - set(ri \"\${ri}\${item_part}\") - set(\${resolved_item_var} \${ri} PARENT_SCOPE) - set(\${resolved_var} 1 PARENT_SCOPE) - endif() - else() - # code path for standard (non-framework) libs (ogre & qt pugins) - get_filename_component(fname \"\${item}\" NAME_WE) - string(REGEX REPLACE \"^lib\" \"\" fname \${fname}) - find_library(ri NAMES \${fname} PATHS \${exepath} \${dirs} /usr/lib /usr/local/lib) - if (ri) - set(\${resolved_item_var} \${ri} PARENT_SCOPE) - set(\${resolved_var} 1 PARENT_SCOPE) - endif () - endif() - endif() - endfunction(gp_resolve_item_override) - - fixup_bundle(\"${OPENMW_APP}\" \"${PLUGINS}\" \"${DIRS}\") - fixup_bundle(\"${OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"${DIRS}\") - " COMPONENT Runtime) include(CPack) endif (APPLE) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 0de79f8f6..76b6e46bd 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -90,7 +90,6 @@ add_executable(openmw-launcher target_link_libraries(openmw-launcher ${Boost_LIBRARIES} ${OGRE_LIBRARIES} - ${OGRE_STATIC_PLUGINS} ${SDL2_LIBRARY_ONLY} ${QT_LIBRARIES} components diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 8347af6ee..d7aafcf30 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -201,8 +201,6 @@ endif(APPLE) target_link_libraries(openmw-cs ${OENGINE_LIBRARY} ${OGRE_LIBRARIES} - ${OGRE_Overlay_LIBRARIES} - ${OGRE_STATIC_PLUGINS} ${OPENSCENEGRAPH_LIBRARIES} ${Boost_LIBRARIES} ${BULLET_LIBRARIES} diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 4a93daec7..d680f49d6 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -129,7 +129,6 @@ include_directories(${SOUND_INPUT_INCLUDES}) target_link_libraries(openmw ${OENGINE_LIBRARY} ${OGRE_LIBRARIES} - ${OGRE_STATIC_PLUGINS} ${OPENSCENEGRAPH_LIBRARIES} ${Boost_LIBRARIES} ${OPENAL_LIBRARY} @@ -144,13 +143,11 @@ target_link_libraries(openmw if (ANDROID) target_link_libraries(openmw - ${OGRE_STATIC_PLUGINS} EGL android log dl MyGUIEngineStatic - Plugin_StrangeButtonStatic cpufeatures BulletCollision BulletDynamics diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index ac51eace8..d91d32a28 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -277,16 +277,6 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) mEnvironment.setStateManager ( new MWState::StateManager (mCfgMgr.getUserDataPath() / "saves", mContentFiles.at (0))); - std::string renderSystem = settings.getString("render system", "Video"); - if (renderSystem == "") - { -#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - renderSystem = "Direct3D9 Rendering Subsystem"; -#else - renderSystem = "OpenGL Rendering Subsystem"; -#endif - } - //OEngine::Render::WindowSettings windowSettings; //windowSettings.fullscreen = settings.getBool("fullscreen", "Video"); //windowSettings.window_border = settings.getBool("window border", "Video"); diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index 23cf2c62e..c23e2bb94 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -75,11 +75,6 @@ namespace return MyGUI::utility::toString(xaspect) + " : " + MyGUI::utility::toString(yaspect); } - std::string hlslGlsl () - { - return (Ogre::Root::getSingleton ().getRenderSystem ()->getName ().find("OpenGL") != std::string::npos) ? "glsl" : "hlsl"; - } - const char* checkButtonType = "CheckButton"; const char* sliderType = "Slider"; @@ -180,7 +175,6 @@ namespace MWGui getWidget(mAnisotropyLabel, "AnisotropyLabel"); getWidget(mAnisotropyBox, "AnisotropyBox"); getWidget(mShadersButton, "ShadersButton"); - getWidget(mShaderModeButton, "ShaderModeButton"); getWidget(mShadowsEnabledButton, "ShadowsEnabledButton"); getWidget(mShadowsTextureSize, "ShadowsTextureSize"); getWidget(mControlsBox, "ControlsBox"); @@ -207,7 +201,6 @@ namespace MWGui mMainWidget->castType()->eventWindowChangeCoord += MyGUI::newDelegate(this, &SettingsWindow::onWindowResize); mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onOkButtonClicked); - mShaderModeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onShaderModeToggled); mTextureFilteringButton->eventComboChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onTextureFilteringChanged); mFPSButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onFpsToggled); mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected); @@ -248,8 +241,6 @@ namespace MWGui mShadowsTextureSize->setCaption (Settings::Manager::getString ("texture size", "Shadows")); - mShaderModeButton->setCaption (Settings::Manager::getString("shader mode", "General")); - if (!Settings::Manager::getBool("shaders", "Objects")) { mRefractionButton->setEnabled(false); @@ -398,17 +389,6 @@ namespace MWGui } } - void SettingsWindow::onShaderModeToggled(MyGUI::Widget* _sender) - { - std::string val = hlslGlsl(); - - _sender->castType()->setCaption(val); - - Settings::Manager::setString("shader mode", "General", val); - - apply(); - } - void SettingsWindow::onFpsToggled(MyGUI::Widget* _sender) { int newLevel = (Settings::Manager::getInt("fps", "HUD") + 1) % 2; diff --git a/apps/openmw/mwgui/settingswindow.hpp b/apps/openmw/mwgui/settingswindow.hpp index 1b970b8de..7cebb10d1 100644 --- a/apps/openmw/mwgui/settingswindow.hpp +++ b/apps/openmw/mwgui/settingswindow.hpp @@ -37,7 +37,6 @@ namespace MWGui MyGUI::TextBox* mAnisotropyLabel; MyGUI::Widget* mAnisotropyBox; MyGUI::Button* mShadersButton; - MyGUI::Button* mShaderModeButton; MyGUI::Button* mRefractionButton; MyGUI::Button* mShadowsEnabledButton; @@ -59,7 +58,6 @@ namespace MWGui void onResolutionAccept(); void onResolutionCancel(); - void onShaderModeToggled(MyGUI::Widget* _sender); void onShadowTextureSizeChanged(MyGUI::ComboBox* _sender, size_t pos); void onRebindAction(MyGUI::Widget* _sender); diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index 2efd5841e..cc9c3d1dc 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -271,12 +271,6 @@ - - - - - - diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 862f9495a..7f2185b62 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -59,8 +59,6 @@ anisotropy = 4 # Number of texture mipmaps to generate num mipmaps = 8 -shader mode = - screenshot format = png [Shadows]