From 40286007687b2e635739a411324d2750c52707dd Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Mon, 7 Mar 2011 05:09:29 +0300 Subject: [PATCH] Builds on OS X now --- CMakeLists.txt | 9 ++------- apps/openmw/CMakeLists.txt | 4 ++++ apps/openmw/path.cpp | 4 ++-- apps/openmw/path.hpp | 4 ++++ components/esm_store/reclists.hpp | 16 ++++++++-------- components/misc/fileops.cpp | 2 +- files/plugins.cfg.mac | 12 ++++++++++++ 7 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 files/plugins.cfg.mac diff --git a/CMakeLists.txt b/CMakeLists.txt index 42c0bcaf3..a11b51516 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -273,7 +273,7 @@ configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg if (APPLE) set(APPLE_BUNDLE_RESOURCES ${CMAKE_SOURCE_DIR}/files/openmw.cfg - ${CMAKE_SOURCE_DIR}/files/mac/plugins.cfg + ${CMAKE_SOURCE_DIR}/files/plugins.cfg.mac ) endif (APPLE) @@ -287,12 +287,7 @@ endif (CMAKE_COMPILER_IS_GNUCC) if (APPLE) set(MISC_FILES ${CMAKE_SOURCE_DIR}/files/openmw.cfg - ${CMAKE_SOURCE_DIR}/files/mac/plugins.cfg - ${CMAKE_SOURCE_DIR}/files/mac/ogre.cfg) -install(TARGETS openmw - BUNDLE DESTINATION . - RUNTIME DESTINATION ../MacOS - COMPONENT Runtime) + ${CMAKE_SOURCE_DIR}/files/plugins.cfg.mac) install(FILES ${MISC_FILES} DESTINATION ../MacOS) set(CPACK_GENERATOR "Bundle") set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist") diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 5d10b4fed..b6b71fc87 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -242,6 +242,10 @@ target_link_libraries(openmw if (APPLE) find_library(CARBON_FRAMEWORK Carbon) target_link_libraries(openmw ${CARBON_FRAMEWORK}) + install(TARGETS openmw + BUNDLE DESTINATION . + RUNTIME DESTINATION ../MacOS + COMPONENT Runtime) endif (APPLE) if(DPKG_PROGRAM) diff --git a/apps/openmw/path.cpp b/apps/openmw/path.cpp index 9de8158af..e7dbc0471 100644 --- a/apps/openmw/path.cpp +++ b/apps/openmw/path.cpp @@ -13,7 +13,7 @@ std::string OMW::Path::getPath(PathTypeEnum parType, const std::string parApp, c if(parType == GLOBAL_CFG_PATH) { #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE - theBasePath = macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX? + theBasePath = Ogre::macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX? #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX theBasePath = "/etc/"+parApp+"/"; #else @@ -24,7 +24,7 @@ std::string OMW::Path::getPath(PathTypeEnum parType, const std::string parApp, c else { #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE - theBasePath = macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX? + theBasePath = Ogre::macBundlePath() + "/Contents/MacOS/"; //FIXME do we have global/local with OSX? #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX const char* theDir; if ((theDir = getenv("OPENMW_HOME")) != NULL) diff --git a/apps/openmw/path.hpp b/apps/openmw/path.hpp index 719e45435..84ff9ecab 100644 --- a/apps/openmw/path.hpp +++ b/apps/openmw/path.hpp @@ -4,6 +4,10 @@ #include #include +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE +#include +#endif + namespace OMW { class Path diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp index a03e325a9..4d67cf73d 100644 --- a/components/esm_store/reclists.hpp +++ b/components/esm_store/reclists.hpp @@ -259,11 +259,11 @@ namespace ESMS int getSize() { return count; } // List of interior cells. Indexed by cell name. - typedef std::map IntCells; + typedef std::map IntCells; IntCells intCells; // List of exterior cells. Indexed as extCells[gridX][gridY]. - typedef std::map ExtCellsCol; + typedef std::map ExtCellsCol; typedef std::map ExtCells; ExtCells extCells; @@ -283,7 +283,7 @@ namespace ESMS } - const Cell* findInt(const std::string &id) const + const ESM::Cell* findInt(const std::string &id) const { IntCells::const_iterator it = intCells.find(id); @@ -293,7 +293,7 @@ namespace ESMS return it->second; } - const Cell *searchExt (int x, int y) const + const ESM::Cell *searchExt (int x, int y) const { ExtCells::const_iterator it = extCells.find (x); @@ -308,7 +308,7 @@ namespace ESMS return it2->second; } - const Cell *searchExtByName (const std::string& id) const + const ESM::Cell *searchExtByName (const std::string& id) const { for (ExtCells::const_iterator iter = extCells.begin(); iter!=extCells.end(); ++iter) { @@ -323,7 +323,7 @@ namespace ESMS return 0; } - const Cell *searchExtByRegion (const std::string& id) const + const ESM::Cell *searchExtByRegion (const std::string& id) const { std::string id2 = toLower (id); @@ -345,13 +345,13 @@ namespace ESMS count++; // All cells have a name record, even nameless exterior cells. - Cell *cell = new Cell; + ESM::Cell *cell = new ESM::Cell; cell->name = id; // The cell itself takes care of all the hairy details cell->load(esm); - if(cell->data.flags & Cell::Interior) + if(cell->data.flags & ESM::Cell::Interior) { // Store interior cell by name intCells[id] = cell; diff --git a/components/misc/fileops.cpp b/components/misc/fileops.cpp index ce514a736..c6a70b338 100644 --- a/components/misc/fileops.cpp +++ b/components/misc/fileops.cpp @@ -8,7 +8,7 @@ bool isFile(const char *name) return boost::filesystem::exists(cfg_file_path); } -#ifdef __MACOSX__ +#ifdef OGRE_PLATFORM == OGRE_PLATFORM_APPLE #include std::string macBundlePath() diff --git a/files/plugins.cfg.mac b/files/plugins.cfg.mac new file mode 100644 index 000000000..b6e104351 --- /dev/null +++ b/files/plugins.cfg.mac @@ -0,0 +1,12 @@ +# Defines plugins to load + +# Define plugin folder +PluginFolder=${OGRE_PLUGIN_DIR} + +# Define plugins +Plugin=RenderSystem_GL +Plugin=Plugin_ParticleFX +Plugin=Plugin_OctreeSceneManager +# Plugin=Plugin_CgProgramManager + +