Mac OS X "‘MyGUI::helper’ has not been declared"

Calder

12-03-2010 18:43:13

I've been stumped by the following error, so if anyone has any idea what's up that would be quite helpful:

/Users/mayproject/Developer/MyGUI/Common/Base/Ogre/BaseManager.cpp: In constructor ‘base::BaseManager::BaseManager()’:
/Users/mayproject/Developer/MyGUI/Common/Base/Ogre/BaseManager.cpp:35: error: ‘MyGUI::helper’ has not been declared
/Users/mayproject/Developer/MyGUI/Common/Base/Ogre/BaseManager.cpp:35: error: ‘macBundlePath’ was not declared in this scope
/Users/mayproject/Developer/MyGUI/Common/Base/Ogre/BaseManager.cpp: In member function ‘void base::BaseManager::addResourceLocation(const std::string&, const std::string&, const std::string&, bool)’:
/Users/mayproject/Developer/MyGUI/Common/Base/Ogre/BaseManager.cpp:332: error: ‘MyGUI::helper’ has not been declared
/Users/mayproject/Developer/MyGUI/Common/Base/Ogre/BaseManager.cpp:332: error: ‘macBundlePath’ was not declared in this scope
make[2]: *** [Demos/Demo_Colour/CMakeFiles/Demo_Colour.dir/__/__/Common/Base/Ogre/BaseManager.cpp.o] Error 1
make[1]: *** [Demos/Demo_Colour/CMakeFiles/Demo_Colour.dir/all] Error 2
make: *** [all] Error 2


Thanks,
-Calder

Altren

12-03-2010 21:20:02

That was fixed in 3.0.1 . It's hard to do blind programming and write stuff for Mac when you never seen one :)

Calder

13-03-2010 02:28:38

Huh, I thought I'd downloaded that version. Thanks for the speedy response!

And you have no idea how much I (and I think I can speak for the entire Mac community) appreciate your efforts to support the Mac platform! Thank you so much for your extremely successful efforts at "blind programming"! :D

Calder

13-03-2010 04:45:41

Ok, bad news. I do have 3.0.1, as the ChangeLog.txt file confirms. I ran a quick
grep helper -r .
on the MyGUI directory, and the only references it turned up were files using it, nothing defining it. After a quick look in the API on Sourceforge (it looks like from version 2.2.2), the file that used to define the macBundlePath and other functions has since been removed. Has anyone else gotten this release to work on the Mac, and if so, how?

Also, if and when we finally get this working, would youguys be interested in me trying to fix up and maintain the Mac side of things in the future?

Calder

13-03-2010 14:25:53

I seem to have temporarily fixed that by copying the old definition into the BaseManager.cpp file. Here's the code I added:

#if MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
#include <CoreFoundation/CoreFoundation.h>
#endif

namespace MyGUI
{
namespace helper
{
#if MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
// This function will locate the path to our application on OS X,
// unlike windows you can not rely on the curent working directory
// for locating your configuration files and resources.
std::string MYGUI_EXPORT macBundlePath()
{
char path[1024];
CFBundleRef mainBundle = CFBundleGetMainBundle(); assert(mainBundle);
CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); assert(mainBundleURL);
CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle); assert(cfStringRef);
CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
CFRelease(mainBundleURL);
CFRelease(cfStringRef);
return std::string(path);
}
#endif
}
}

Altren

13-03-2010 14:29:19

Oh, I was wrong. It is fixed in trunk only.

Also, if and when we finally get this working, would youguys be interested in me trying to fix up and maintain the Mac side of things in the future?
We will be glad if you'll be doing that. I have Mac on virtual machine, but it works way too slow and also I'm new to this operating system. Also, if you want to maintain that then you should switch to code from svn trunk instead, since I already made few related changes.

Calder

13-03-2010 15:23:16

Fixed another few bugs in the CMake system:
  1. Ogre framework was not being properly located - added manual override to just look for always look for the framework first on OS X[/*:m]
  2. Ogre include directory was not in path - changed ${OGRE_INCLUDE_DIR} to ${OGRE_INCLUDE_DIRS} in Platforms/Ogre/OgrePlatform/CMakeLists.txt and CMake/Utils/MyGUIConfigTargets.cmake[/*:m]
  3. Demos require CoreFoundation on Mac - added

    if (APPLE)
    find_library(CF_LIBRARY CoreFoundation)
    target_link_libraries(${PROJECTNAME} ${CF_LIBRARY})
    endif ()

    to the end of the mygui_app function in CMake/Utils/MyGUIConfigTargets.cmake[/*:m][/list:u]

    ...and IT WORKS!!! I haven't tried running anything yet because I'm doing this over SSH, but I'll post again once I've tested it thoroughly.

    Anyway, I hope this helps someone, and if not I always have it as a reference for later. Now that I know what needs to be done, I could check out a fresh copy of trunk and make more permanent and neat fixes if that would be helpful.

    EDIT: Posted before I saw your message. I'll do a checkout from trunk and start making corrections.

Calder

13-03-2010 16:43:22

One more question: what does the "-fdiagnostics-show-option" option do? It breaks compatibility with Mac OS X but it would be nicer to just remove it than start proliferating platform dependent guards...

Altren

13-03-2010 17:00:47

This option instructs the diagnostic machinery to add text to each diagnostic emitted, which indicates which command line option directly controls that diagnostic, when such an option is known to the diagnostic machinery. So feel free to remove that.

Calder

13-03-2010 18:06:00

Alright, here's a neat version of all my fixes:

Index: CMake/Utils/MyGUIConfigTargets.cmake
===================================================================
--- CMake/Utils/MyGUIConfigTargets.cmake (revision 2930)
+++ CMake/Utils/MyGUIConfigTargets.cmake (working copy)
@@ -96,6 +96,8 @@
)
# define the sources
include(${PROJECTNAME}.list)
+
+ # Set up dependencies
if(MYGUI_RENDERSYSTEM EQUAL 1)
include_directories(../../Common/Base/DirectX)
add_definitions("-DMYGUI_DIRECTX_PLATFORM")
@@ -155,6 +157,10 @@
MyGUIEngine
Common
)
+ if (APPLE)
+ find_library(CF_LIBRARY CoreFoundation)
+ target_link_libraries(${PROJECTNAME} ${CF_LIBRARY})
+ endif ()
endfunction(mygui_app)


Index: CMake/Dependencies.cmake
===================================================================
--- CMake/Dependencies.cmake (revision 2930)
+++ CMake/Dependencies.cmake (working copy)
@@ -52,7 +52,7 @@
endif()
elseif(MYGUI_RENDERSYSTEM EQUAL 2)
# Find OGRE
- find_package(OGRE_Old)
+ find_package(OGRE)
macro_log_feature(OGRE_FOUND "ogre" "Support for the Ogre render system" "" TRUE "" "")
elseif(MYGUI_RENDERSYSTEM EQUAL 3)
#find_package(ZLIB)
Index: CMake/Packages/FindOGRE_Old.cmake
===================================================================
--- CMake/Packages/FindOGRE_Old.cmake (revision 2930)
+++ CMake/Packages/FindOGRE_Old.cmake (working copy)
@@ -1,127 +0,0 @@
-# Find OGRE includes and library
-#
-# This module defines
-# OGRE_INCLUDE_DIR
-# OGRE_LIBRARIES, the libraries to link against to use OGRE.
-# OGRE_LIB_DIR, the location of the libraries
-# OGRE_FOUND, If false, do not try to use OGRE
-
-if (MYGUI_STANDALONE_BUILD)
- CMAKE_POLICY(PUSH)
- SET(OGRE_INCLUDE_DIR "C:\MYGUIHACK OGRE_HOME MYGUIBRACKETHACK/include" "MYGUIHACK OGRE_SRC MYGUIBRACKETHACK/OgreMain/include" CACHE STRING "")
- SET(OGRE_LIBRARIES "debug;OgreMain_d;optimized;OgreMain" CACHE STRING "")
- SET(OGRE_LIB_DIR "C:\MYGUIHACK OGRE_HOME MYGUIBRACKETHACK/lib" "MYGUIHACK OGRE_SRC MYGUIBRACKETHACK/lib" CACHE STRING "")
- SET(OGRE_FOUND TRUE)
- CMAKE_POLICY(POP)
-else()
-
- if(WIN32 OR APPLE)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${OGRE_SOURCE}/CMake ${OGRE_SOURCE}/CMake/Packages)
- else()
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} /usr/local/lib/OGRE/cmake)
- endif()
-
- IF (NOT OGRE_SOURCE)
- set(OGRE_SOURCE "" CACHE PATH "Path to Ogre sources (set it if you don't have OGRE_HOME or OGRE_SRC environment variables)")
- ENDIF ()
-
- if (NOT OGRE_BUILD)
- set(OGRE_BUILD ${OGRE_SOURCE} CACHE PATH "Path to Ogre build directory (same as OGRE_SOURCE by default)")
- endif ()
-
- if (EXISTS ${OGRE_SOURCE}/CMake)
- MESSAGE(STATUS " Original FingOGRE.cmake found, trying to use it")
- FIND_PACKAGE(OGRE)
- endif()
-
- if (OGRE_FOUND)
- MESSAGE(STATUS "Using OGRE built from source (from specified path)")
- MESSAGE(STATUS "Ogre used with it's own CMake script")
-
- FIND_PACKAGE(Boost)
-
- message("Threads!" ${OGRE_CONFIG_THREADS})
- message("Threads!" ${OGRE_INCLUDE_DIR})
- message("Threads!" ${OGRE_INCLUDE_DIRS})
-
- set (OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
- set (OGRE_LIB_DIR ${OGRE_LIB_DIR} ${Boost_LIBRARY_DIRS})
- message("Threads!" ${OGRE_INCLUDE_DIRS})
-
- return()
- endif ()
-
- # now trying to find it by our script
- CMAKE_POLICY(PUSH)
-
- IF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR)
- SET(OGRE_FIND_QUIETLY TRUE) # Already in cache, be silent
- ENDIF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR)
-
- IF (WIN32) #Windows
- MESSAGE(STATUS "Looking for OGRE")
- SET(OGRESDK $ENV{OGRE_HOME})
- SET(OGRESOURCE $ENV{OGRE_SRC})
- IF (OGRE_SOURCE)
- MESSAGE(STATUS "Using OGRE built from source (from specified path)")
- SET(OGRE_INCLUDE_DIR ${OGRE_SOURCE}/OgreMain/include ${OGRE_SOURCE}/include)
- SET(OGRE_LIB_DIR ${OGRE_SOURCE}/lib)
- ELSEIF (OGRESDK)
- MESSAGE(STATUS "Using OGRE SDK")
- STRING(REGEX REPLACE "[\\]" "/" OGRESDK "${OGRESDK}")
- SET(OGRE_INCLUDE_DIR ${OGRESDK}/include/OGRE ${OGRESDK}/include)
- SET(OGRE_LIB_DIR ${OGRESDK}/lib)
- IF (NOT OGRE_SOURCE)
- set(OGRE_SOURCE $ENV{OGRE_HOME} CACHE PATH "Path to Ogre sources (set it if you don't have OGRE_HOME or OGRE_SRC environment variables)")
- ENDIF ()
- ELSEIF (OGRESOURCE)
- MESSAGE(STATUS "Using OGRE built from source")
- SET(OGRE_INCLUDE_DIR $ENV{OGRE_SRC}/OgreMain/include ${OGRE_SOURCE}/include)
- SET(OGRE_LIB_DIR $ENV{OGRE_SRC}/lib)
- IF (NOT OGRE_SOURCE)
- set(OGRE_SOURCE $ENV{OGRE_SRC} CACHE PATH "Path to Ogre sources (set it if you don't have OGRE_HOME or OGRE_SRC environment variables)")
- ENDIF ()
- ENDIF ()
-
- IF (OGRESDK OR OGRESOURCE OR OGRE_SOURCE)
- SET(OGRE_LIBRARIES debug OgreMain_d optimized OgreMain)
-
- SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} CACHE PATH "")
- SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "")
- SET(OGRE_LIB_DIR ${OGRE_LIB_DIR} CACHE PATH "")
- ENDIF ()
- ELSE (WIN32) #Unix
- IF (OGRE_SOURCE)
- MESSAGE(STATUS "Using OGRE built from source (from specified path)")
- SET(OGRE_INCLUDE_DIR ${OGRE_SOURCE}/OgreMain/include)
- SET(OGRE_LIB_DIR ${OGRE_SOURCE}/lib)
- ELSE ()
- CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
- FIND_PACKAGE(PkgConfig)
- PKG_SEARCH_MODULE(OGRE OGRE)
- SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIRS})
- SET(OGRE_LIB_DIR ${OGRE_LIBDIR})
- ENDIF ()
-
- SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} CACHE PATH "")
- SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "")
- SET(OGRE_LIB_DIR ${OGRE_LIB_DIR} CACHE PATH "")
- ENDIF (WIN32)
-
- IF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES)
- SET(OGRE_FOUND TRUE)
- ENDIF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES)
-
- IF (OGRE_FOUND)
- IF (NOT OGRE_FIND_QUIETLY)
- MESSAGE(STATUS " libraries : ${OGRE_LIBRARIES} from ${OGRE_LIB_DIR}")
- MESSAGE(STATUS " includes : ${OGRE_INCLUDE_DIR}")
- ENDIF (NOT OGRE_FIND_QUIETLY)
- ELSE (OGRE_FOUND)
- IF (OGRE_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find OGRE")
- ENDIF (OGRE_FIND_REQUIRED)
- ENDIF (OGRE_FOUND)
- CMAKE_POLICY(POP)
-endif()
-
Index: CMake/Packages/FindOGRE.cmake
===================================================================
--- CMake/Packages/FindOGRE.cmake (revision 0)
+++ CMake/Packages/FindOGRE.cmake (revision 0)
@@ -0,0 +1,560 @@
+#-------------------------------------------------------------------
+# This file is part of the CMake build system for OGRE
+# (Object-oriented Graphics Rendering Engine)
+# For the latest info, see http://www.ogre3d.org/
+#
+# The contents of this file are placed in the public domain. Feel
+# free to make use of it in any way you like.
+#-------------------------------------------------------------------
+
+# - Try to find OGRE
+# If you have multiple versions of Ogre installed, use the CMake or
+# the environment variable OGRE_HOME to point to the path where the
+# desired Ogre version can be found.
+# By default this script will look for a dynamic Ogre build. If you
+# need to link against static Ogre libraries, set the CMake variable
+# OGRE_STATIC to TRUE.
+#
+# Once done, this will define
+#
+# OGRE_FOUND - system has OGRE
+# OGRE_INCLUDE_DIRS - the OGRE include directories
+# OGRE_LIBRARIES - link these to use the OGRE core
+# OGRE_BINARY_REL - location of the main Ogre binary (win32 non-static only, release)
+# OGRE_BINARY_DBG - location of the main Ogre binaries (win32 non-static only, debug)
+#
+# Additionally this script searches for the following optional
+# parts of the Ogre package:
+# Plugin_BSPSceneManager, Plugin_CgProgramManager,
+# Plugin_OctreeSceneManager, Plugin_OctreeZone,
+# Plugin_ParticleFX, Plugin_PCZSceneManager,
+# RenderSystem_GL, RenderSystem_Direct3D9, RenderSystem_Direct3D10,
+# Paging, Terrain
+#
+# For each of these components, the following variables are defined:
+#
+# OGRE_${COMPONENT}_FOUND - ${COMPONENT} is available
+# OGRE_${COMPONENT}_INCLUDE_DIRS - additional include directories for ${COMPONENT}
+# OGRE_${COMPONENT}_LIBRARIES - link these to use ${COMPONENT}
+# OGRE_${COMPONENT}_BINARY_REL - location of the component binary (win32 non-static only, release)
+# OGRE_${COMPONENT}_BINARY_DBG - location of the component binary (win32 non-static only, debug)
+#
+# Finally, the following variables are defined:
+#
+# OGRE_PLUGIN_DIR_REL - The directory where the release versions of
+# the OGRE plugins are located
+# OGRE_PLUGIN_DIR_DBG - The directory where the debug versions of
+# the OGRE plugins are located
+# OGRE_MEDIA_DIR - The directory where the OGRE sample media is
+# located, if available
+
+
+# Try to find framework first on Mac OS X
+if (APPLE)
+ MACRO (find_framework fwk)
+ find_library(${fwk}_LIBRARY ${fwk})
+ if (${fwk}_LIBRARY)
+ set(${fwk}_FOUND TRUE)
+ set(${fwk}_INCLUDE "${${fwk}_LIBRARY}/Headers")
+ endif (${fwk}_LIBRARY)
+ # Compatibility stuff
+ set(${fwk}_INCLUDE_DIRS ${${fwk}_INCLUDE})
+ set(${fwk}_LIBRARIES ${${fwk}_LIBRARY})
+ ENDMACRO (find_framework)
+
+ find_framework(OGRE)
+endif ()
+if (NOT OGRE_FOUND)
+# Then try everything else
+
+
+include(FindPkgMacros)
+include(PreprocessorUtils)
+findpkg_begin(OGRE)
+
+
+# Get path, convert backslashes as ${ENV_${var}}
+getenv_path(OGRE_HOME)
+getenv_path(OGRE_SDK)
+getenv_path(OGRE_SOURCE)
+getenv_path(OGRE_BUILD)
+getenv_path(OGRE_DEPENDENCIES_DIR)
+getenv_path(PROGRAMFILES)
+
+# Determine whether to search for a dynamic or static build
+if (OGRE_STATIC)
+ set(OGRE_LIB_SUFFIX "Static")
+else ()
+ set(OGRE_LIB_SUFFIX "")
+endif ()
+
+
+set(OGRE_LIBRARY_NAMES "OgreMain${OGRE_LIB_SUFFIX}")
+get_debug_names(OGRE_LIBRARY_NAMES)
+
+# construct search paths from environmental hints and
+# OS specific guesses
+if (WIN32)
+ set(OGRE_PREFIX_GUESSES
+ ${ENV_PROGRAMFILES}/OGRE
+ C:/OgreSDK
+ )
+elseif (UNIX)
+ set(OGRE_PREFIX_GUESSES
+ /opt/ogre
+ /opt/OGRE
+ /usr/lib/ogre
+ /usr/lib/OGRE
+ /usr/local/lib/ogre
+ /usr/local/lib/OGRE
+ $ENV{HOME}/ogre
+ $ENV{HOME}/OGRE
+ )
+endif ()
+set(OGRE_PREFIX_PATH
+ ${OGRE_HOME} ${OGRE_SDK} ${ENV_OGRE_HOME} ${ENV_OGRE_SDK}
+ ${OGRE_PREFIX_GUESSES}
+)
+create_search_paths(OGRE)
+# If both OGRE_BUILD and OGRE_SOURCE are set, prepare to find Ogre in a build dir
+set(OGRE_PREFIX_SOURCE ${OGRE_SOURCE} ${ENV_OGRE_SOURCE})
+set(OGRE_PREFIX_BUILD ${OGRE_BUILD} ${ENV_OGRE_BUILD})
+set(OGRE_PREFIX_DEPENDENCIES_DIR ${OGRE_DEPENDENCIES_DIR} ${ENV_OGRE_DEPENDENCIES_DIR})
+if (OGRE_PREFIX_SOURCE AND OGRE_PREFIX_BUILD)
+ foreach(dir ${OGRE_PREFIX_SOURCE})
+ set(OGRE_INC_SEARCH_PATH ${dir}/OgreMain/include ${dir}/Dependencies/include ${dir}/iPhoneDependencies/include ${OGRE_INC_SEARCH_PATH})
+ set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${dir}/Dependencies/lib ${dir}/iPhoneDependencies/lib ${OGRE_LIB_SEARCH_PATH})
+ set(OGRE_BIN_SEARCH_PATH ${dir}/Samples/Common/bin ${OGRE_BIN_SEARCH_PATH})
+ endforeach(dir)
+ foreach(dir ${OGRE_PREFIX_BUILD})
+ set(OGRE_INC_SEARCH_PATH ${dir}/include ${OGRE_INC_SEARCH_PATH})
+ set(OGRE_LIB_SEARCH_PATH ${dir}/lib ${OGRE_LIB_SEARCH_PATH})
+ set(OGRE_BIN_SEARCH_PATH ${dir}/bin ${OGRE_BIN_SEARCH_PATH})
+ set(OGRE_BIN_SEARCH_PATH ${dir}/Samples/Common/bin ${OGRE_BIN_SEARCH_PATH})
+ endforeach(dir)
+
+ if (OGRE_PREFIX_DEPENDENCIES_DIR)
+ set(OGRE_INC_SEARCH_PATH ${OGRE_PREFIX_DEPENDENCIES_DIR}/include ${OGRE_INC_SEARCH_PATH})
+ set(OGRE_LIB_SEARCH_PATH ${OGRE_PREFIX_DEPENDENCIES_DIR}/lib ${OGRE_LIB_SEARCH_PATH})
+ set(OGRE_BIN_SEARCH_PATH ${OGRE_PREFIX_DEPENDENCIES_DIR}/bin ${OGRE_BIN_SEARCH_PATH})
+ endif()
+else()
+ set(OGRE_PREFIX_SOURCE "NOTFOUND")
+ set(OGRE_PREFIX_BUILD "NOTFOUND")
+endif ()
+
+# redo search if any of the environmental hints changed
+set(OGRE_COMPONENTS Paging Terrain
+ Plugin_BSPSceneManager Plugin_CgProgramManager Plugin_OctreeSceneManager
+ Plugin_OctreeZone Plugin_PCZSceneManager Plugin_ParticleFX
+ RenderSystem_Direct3D10 RenderSystem_Direct3D9 RenderSystem_GL RenderSystem_GLES RenderSystem_GLES2)
+set(OGRE_RESET_VARS
+ OGRE_CONFIG_INCLUDE_DIR OGRE_INCLUDE_DIR
+ OGRE_LIBRARY_FWK OGRE_LIBRARY_REL OGRE_LIBRARY_DBG
+ OGRE_PLUGIN_DIR_DBG OGRE_PLUGIN_DIR_REL OGRE_MEDIA_DIR)
+foreach (comp ${OGRE_COMPONENTS})
+ set(OGRE_RESET_VARS ${OGRE_RESET_VARS}
+ OGRE_${comp}_INCLUDE_DIR OGRE_${comp}_LIBRARY_FWK
+ OGRE_${comp}_LIBRARY_DBG OGRE_${comp}_LIBRARY_REL
+ )
+endforeach (comp)
+set(OGRE_PREFIX_WATCH ${OGRE_PREFIX_PATH} ${OGRE_PREFIX_SOURCE} ${OGRE_PREFIX_BUILD})
+clear_if_changed(OGRE_PREFIX_WATCH ${OGRE_RESET_VARS})
+
+# try to locate Ogre via pkg-config
+use_pkgconfig(OGRE_PKGC "OGRE${OGRE_LIB_SUFFIX}")
+
+if(NOT OGRE_BUILD_PLATFORM_IPHONE)
+ # try to find framework on OSX
+ findpkg_framework(OGRE)
+else()
+ set(OGRE_LIBRARY_FWK "")
+endif()
+
+# locate Ogre include files
+find_path(OGRE_CONFIG_INCLUDE_DIR NAMES OgreBuildSettings.h HINTS ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE")
+find_path(OGRE_INCLUDE_DIR NAMES OgreRoot.h HINTS ${OGRE_CONFIG_INCLUDE_DIR} ${OGRE_INC_SEARCH_PATH} ${OGRE_FRAMEWORK_INCLUDES} ${OGRE_PKGC_INCLUDE_DIRS} PATH_SUFFIXES "OGRE")
+set(OGRE_INCOMPATIBLE FALSE)
+
+if (OGRE_INCLUDE_DIR)
+ if (NOT OGRE_CONFIG_INCLUDE_DIR)
+ set(OGRE_CONFIG_INCLUDE_DIR ${OGRE_INCLUDE_DIR})
+ endif ()
+ # determine Ogre version
+ file(READ ${OGRE_INCLUDE_DIR}/OgrePrerequisites.h OGRE_TEMP_VERSION_CONTENT)
+ get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_MAJOR OGRE_VERSION_MAJOR)
+ get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_MINOR OGRE_VERSION_MINOR)
+ get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_PATCH OGRE_VERSION_PATCH)
+ get_preprocessor_entry(OGRE_TEMP_VERSION_CONTENT OGRE_VERSION_NAME OGRE_VERSION_NAME)
+ set(OGRE_VERSION "${OGRE_VERSION_MAJOR}.${OGRE_VERSION_MINOR}.${OGRE_VERSION_PATCH}")
+ pkg_message(OGRE "Found Ogre ${OGRE_VERSION_NAME} (${OGRE_VERSION})")
+
+ # determine configuration settings
+ set(OGRE_CONFIG_HEADERS
+ ${OGRE_CONFIG_INCLUDE_DIR}/OgreBuildSettings.h
+ ${OGRE_CONFIG_INCLUDE_DIR}/OgreConfig.h
+ )
+ foreach(CFG_FILE ${OGRE_CONFIG_HEADERS})
+ if (EXISTS ${CFG_FILE})
+ set(OGRE_CONFIG_HEADER ${CFG_FILE})
+ break()
+ endif()
+ endforeach()
+ if (OGRE_CONFIG_HEADER)
+ file(READ ${OGRE_CONFIG_HEADER} OGRE_TEMP_CONFIG_CONTENT)
+ has_preprocessor_entry(OGRE_TEMP_CONFIG_CONTENT OGRE_STATIC_LIB OGRE_CONFIG_STATIC)
+ get_preprocessor_entry(OGRE_TEMP_CONFIG_CONTENT OGRE_THREAD_SUPPORT OGRE_CONFIG_THREADS)
+ get_preprocessor_entry(OGRE_TEMP_CONFIG_CONTENT OGRE_THREAD_PROVIDER OGRE_CONFIG_THREAD_PROVIDER)
+ get_preprocessor_entry(OGRE_TEMP_CONFIG_CONTENT OGRE_NO_FREEIMAGE OGRE_CONFIG_FREEIMAGE)
+ if (OGRE_CONFIG_STATIC AND OGRE_STATIC)
+ elseif (OGRE_CONFIG_STATIC OR OGRE_STATIC)
+ pkg_message(OGRE "Build type (static, dynamic) does not match the requested one.")
+ set(OGRE_INCOMPATIBLE TRUE)
+ endif ()
+ else ()
+ pkg_message(OGRE "Could not determine Ogre build configuration.")
+ set(OGRE_INCOMPATIBLE TRUE)
+ endif ()
+else ()
+ set(OGRE_INCOMPATIBLE FALSE)
+endif ()
+
+find_library(OGRE_LIBRARY_REL NAMES ${OGRE_LIBRARY_NAMES} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
+find_library(OGRE_LIBRARY_DBG NAMES ${OGRE_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIB_SEARCH_PATH} ${OGRE_PKGC_LIBRARY_DIRS} ${OGRE_FRAMEWORK_SEARCH_PATH} PATH_SUFFIXES "" "debug")
+make_library_set(OGRE_LIBRARY)
+
+if(APPLE)
+ set(OGRE_LIBRARY_DBG ${OGRE_LIB_SEARCH_PATH})
+endif()
+if (OGRE_INCOMPATIBLE)
+ set(OGRE_LIBRARY "NOTFOUND")
+endif ()
+
+set(OGRE_INCLUDE_DIR ${OGRE_CONFIG_INCLUDE_DIR} ${OGRE_INCLUDE_DIR})
+list(REMOVE_DUPLICATES OGRE_INCLUDE_DIR)
+findpkg_finish(OGRE)
+add_parent_dir(OGRE_INCLUDE_DIRS OGRE_INCLUDE_DIR)
+if (OGRE_SOURCE)
+ # If working from source rather than SDK, add samples include
+ set(OGRE_INCLUDE_DIRS ${OGRE_INCLUDE_DIRS} "${OGRE_SOURCE}/Samples/Common/include")
+endif()
+
+mark_as_advanced(OGRE_CONFIG_INCLUDE_DIR OGRE_MEDIA_DIR OGRE_PLUGIN_DIR_REL OGRE_PLUGIN_DIR_DBG)
+
+if (NOT OGRE_FOUND)
+ return()
+endif ()
+
+
+# look for required Ogre dependencies in case of static build and/or threading
+if (OGRE_STATIC)
+ set(OGRE_DEPS_FOUND TRUE)
+ find_package(Cg QUIET)
+ find_package(DirectX QUIET)
+ find_package(FreeImage QUIET)
+ find_package(Freetype QUIET)
+ find_package(OpenGL QUIET)
+ find_package(OpenGLES QUIET)
+ find_package(OpenGLES2 QUIET)
+ find_package(ZLIB QUIET)
+ find_package(ZZip QUIET)
+ if (UNIX AND NOT APPLE)
+ find_package(X11 QUIET)
+ find_library(XAW_LIBRARY NAMES Xaw Xaw7 PATHS ${DEP_LIB_SEARCH_DIR} ${X11_LIB_SEARCH_PATH})
+ if (NOT XAW_LIBRARY OR NOT X11_Xt_FOUND)
+ set(X11_FOUND FALSE)
+ endif ()
+ endif ()
+ if (APPLE AND NOT OGRE_BUILD_PLATFORM_IPHONE)
+ find_package(Cocoa QUIET)
+ find_package(Carbon QUIET)
+ if (NOT Cocoa_FOUND OR NOT Carbon_FOUND)
+ set(OGRE_DEPS_FOUND FALSE)
+ endif ()
+ endif ()
+ if (APPLE AND OGRE_BUILD_PLATFORM_IPHONE)
+ find_package(iPhoneSDK QUIET)
+ if (NOT iPhoneSDK_FOUND)
+ set(OGRE_DEPS_FOUND FALSE)
+ endif ()
+ endif ()
+
+ set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
+ ${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES}
+ ${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB}
+ ${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
+
+ if (NOT ZLIB_FOUND OR NOT ZZip_FOUND)
+ set(OGRE_DEPS_FOUND FALSE)
+ endif ()
+ if (NOT FreeImage_FOUND AND NOT OGRE_CONFIG_FREEIMAGE)
+ set(OGRE_DEPS_FOUND FALSE)
+ endif ()
+ if (NOT FREETYPE_FOUND)
+ set(OGRE_DEPS_FOUND FALSE)
+ endif ()
+ if (UNIX AND NOT APPLE)
+ if (NOT X11_FOUND)
+ set(OGRE_DEPS_FOUND FALSE)
+ endif ()
+ endif ()
+
+ if (OGRE_CONFIG_THREADS)
+ if (OGRE_CONFIG_THREAD_PROVIDER EQUAL 1)
+ find_package(Boost COMPONENTS thread QUIET)
+ if (NOT Boost_THREAD_FOUND)
+ set(OGRE_DEPS_FOUND FALSE)
+ else ()
+ set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${Boost_LIBRARIES})
+ endif ()
+ elseif (OGRE_CONFIG_THREAD_PROVIDER EQUAL 2)
+ find_package(POCO QUIET)
+ if (NOT POCO_FOUND)
+ set(OGRE_DEPS_FOUND FALSE)
+ else ()
+ set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${POCO_LIBRARIES})
+ endif ()
+ elseif (OGRE_CONFIG_THREAD_PROVIDER EQUAL 3)
+ find_package(TBB QUIET)
+ if (NOT TBB_FOUND)
+ set(OGRE_DEPS_FOUND FALSE)
+ else ()
+ set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${TBB_LIBRARIES})
+ endif ()
+ endif ()
+ endif ()
+
+ if (NOT OGRE_DEPS_FOUND)
+ pkg_message(OGRE "Could not find all required dependencies for the Ogre package.")
+ set(OGRE_FOUND FALSE)
+ endif ()
+endif ()
+
+if (NOT OGRE_FOUND)
+ return()
+endif ()
+
+
+get_filename_component(OGRE_LIBRARY_DIR_REL "${OGRE_LIBRARY_REL}" PATH)
+get_filename_component(OGRE_LIBRARY_DIR_DBG "${OGRE_LIBRARY_DBG}" PATH)
+set(OGRE_LIBRARY_DIRS ${OGRE_LIBRARY_DIR_REL} ${OGRE_LIBRARY_DIR_DBG})
+
+# find binaries
+if (NOT OGRE_STATIC)
+ if (WIN32)
+ find_file(OGRE_BINARY_REL NAMES "OgreMain.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
+ PATH_SUFFIXES "" release relwithdebinfo minsizerel)
+ find_file(OGRE_BINARY_DBG NAMES "OgreMain_d.dll" HINTS ${OGRE_BIN_SEARCH_PATH}
+ PATH_SUFFIXES "" debug )
+ endif()
+ mark_as_advanced(OGRE_BINARY_REL OGRE_BINARY_DBG)
+endif()
+
+
+
+# look for Paging component
+findpkg_begin(OGRE_Paging)
+find_path(OGRE_Paging_INCLUDE_DIR NAMES OgrePaging.h HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE} PATH_SUFFIXES Paging OGRE/Paging Components/Paging/include)
+set(OGRE_Paging_LIBRARY_NAMES "OgrePaging${OGRE_LIB_SUFFIX}")
+get_debug_names(OGRE_Paging_LIBRARY_NAMES)
+find_library(OGRE_Paging_LIBRARY_REL NAMES ${OGRE_Paging_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
+find_library(OGRE_Paging_LIBRARY_DBG NAMES ${OGRE_Paging_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} PATH_SUFFIXES "" "debug")
+set(OGRE_Paging_LIBRARY_FWK ${OGRE_LIBRARY_FWK})
+make_library_set(OGRE_Paging_LIBRARY)
+findpkg_finish(OGRE_Paging)
+
+# look for Terrain component
+findpkg_begin(OGRE_Terrain)
+find_path(OGRE_Terrain_INCLUDE_DIR NAMES OgreTerrain.h HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE} PATH_SUFFIXES Terrain OGRE/Terrain Components/Terrain/include)
+set(OGRE_Terrain_LIBRARY_NAMES "OgreTerrain${OGRE_LIB_SUFFIX}")
+get_debug_names(OGRE_Terrain_LIBRARY_NAMES)
+find_library(OGRE_Terrain_LIBRARY_REL NAMES ${OGRE_Terrain_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
+find_library(OGRE_Terrain_LIBRARY_DBG NAMES ${OGRE_Terrain_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} PATH_SUFFIXES "" "debug")
+make_library_set(OGRE_Terrain_LIBRARY)
+findpkg_finish(OGRE_Terrain)
+
+# look for Property component
+findpkg_begin(OGRE_Property)
+find_path(OGRE_Property_INCLUDE_DIR NAMES OgreProperty.h HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE} PATH_SUFFIXES Property OGRE/Property Components/Property/include)
+set(OGRE_Property_LIBRARY_NAMES "OgreProperty${OGRE_LIB_SUFFIX}")
+get_debug_names(OGRE_Property_LIBRARY_NAMES)
+find_library(OGRE_Property_LIBRARY_REL NAMES ${OGRE_Property_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
+find_library(OGRE_Property_LIBRARY_DBG NAMES ${OGRE_Property_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} PATH_SUFFIXES "" "debug")
+make_library_set(OGRE_Property_LIBRARY)
+findpkg_finish(OGRE_Property)
+
+# look for RTShaderSystem component
+findpkg_begin(OGRE_RTShaderSystem)
+find_path(OGRE_RTShaderSystem_INCLUDE_DIR NAMES OgreRTShaderSystem.h HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE} PATH_SUFFIXES RTShaderSystem OGRE/RTShaderSystem Components/RTShaderSystem/include)
+set(OGRE_RTShaderSystem_LIBRARY_NAMES "OgreRTShaderSystem${OGRE_LIB_SUFFIX}")
+get_debug_names(OGRE_RTShaderSystem_LIBRARY_NAMES)
+find_library(OGRE_RTShaderSystem_LIBRARY_REL NAMES ${OGRE_RTShaderSystem_LIBRARY_NAMES} HINTS ${OGRE_LIBRARY_DIR_REL} PATH_SUFFIXES "" "release" "relwithdebinfo" "minsizerel")
+find_library(OGRE_RTShaderSystem_LIBRARY_DBG NAMES ${OGRE_RTShaderSystem_LIBRARY_NAMES_DBG} HINTS ${OGRE_LIBRARY_DIR_DBG} PATH_SUFFIXES "" "debug")
+make_library_set(OGRE_RTShaderSystem_LIBRARY)
+findpkg_finish(OGRE_RTShaderSystem)
+
+#########################################################
+# Find Ogre plugins
+#########################################################
+
+macro(ogre_find_plugin PLUGIN HEADER)
+ # On Unix, the plugins might have no prefix
+ if (CMAKE_FIND_LIBRARY_PREFIXES)
+ set(TMP_CMAKE_LIB_PREFIX ${CMAKE_FIND_LIBRARY_PREFIXES})
+ set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "")
+ endif()
+
+ # strip RenderSystem_ or Plugin_ prefix from plugin name
+ string(REPLACE "RenderSystem_" "" PLUGIN_TEMP ${PLUGIN})
+ string(REPLACE "Plugin_" "" PLUGIN_NAME ${PLUGIN_TEMP})
+
+ # header files for plugins are not usually needed, but find them anyway if they are present
+ set(OGRE_PLUGIN_PATH_SUFFIXES
+ PlugIns PlugIns/${PLUGIN_NAME} Plugins Plugins/${PLUGIN_NAME} ${PLUGIN}
+ RenderSystems RenderSystems/${PLUGIN_NAME} ${ARGN})
+ find_path(OGRE_${PLUGIN}_INCLUDE_DIR NAMES ${HEADER}
+ HINTS ${OGRE_INCLUDE_DIRS} ${OGRE_PREFIX_SOURCE}
+ PATH_SUFFIXES ${OGRE_PLUGIN_PATH_SUFFIXES})
+ # find link libraries for plugins
+ set(OGRE_${PLUGIN}_LIBRARY_NAMES "${PLUGIN}${OGRE_LIB_SUFFIX}")
+ get_debug_names(OGRE_${PLUGIN}_LIBRARY_NAMES)
+ set(OGRE_${PLUGIN}_LIBRARY_FWK ${OGRE_LIBRARY_FWK})
+ find_library(OGRE_${PLUGIN}_LIBRARY_REL NAMES ${OGRE_${PLUGIN}_LIBRARY_NAMES}
+ HINTS ${OGRE_LIBRARY_DIRS} PATH_SUFFIXES "" OGRE opt release release/opt relwithdebinfo relwithdebinfo/opt minsizerel minsizerel/opt)
+ find_library(OGRE_${PLUGIN}_LIBRARY_DBG NAMES ${OGRE_${PLUGIN}_LIBRARY_NAMES_DBG}
+ HINTS ${OGRE_LIBRARY_DIRS} PATH_SUFFIXES "" OGRE opt debug debug/opt)
+ make_library_set(OGRE_${PLUGIN}_LIBRARY)
+
+ if (OGRE_${PLUGIN}_LIBRARY OR OGRE_${PLUGIN}_INCLUDE_DIR)
+ set(OGRE_${PLUGIN}_FOUND TRUE)
+ if (OGRE_${PLUGIN}_INCLUDE_DIR)
+ set(OGRE_${PLUGIN}_INCLUDE_DIRS ${OGRE_${PLUGIN}_INCLUDE_DIR})
+ endif()
+ set(OGRE_${PLUGIN}_LIBRARIES ${OGRE_${PLUGIN}_LIBRARY})
+ endif ()
+
+ mark_as_advanced(OGRE_${PLUGIN}_INCLUDE_DIR OGRE_${PLUGIN}_LIBRARY_REL OGRE_${PLUGIN}_LIBRARY_DBG OGRE_${PLUGIN}_LIBRARY_FWK)
+
+ # look for plugin dirs
+ if (OGRE_${PLUGIN}_FOUND)
+ if (NOT OGRE_PLUGIN_DIR_REL OR NOT OGRE_PLUGIN_DIR_DBG)
+ if (WIN32)
+ set(OGRE_PLUGIN_SEARCH_PATH_REL
+ ${OGRE_LIBRARY_DIR_REL}/..
+ ${OGRE_LIBRARY_DIR_REL}/../..
+ ${OGRE_BIN_SEARCH_PATH}
+ )
+ set(OGRE_PLUGIN_SEARCH_PATH_DBG
+ ${OGRE_LIBRARY_DIR_DBG}/..
+ ${OGRE_LIBRARY_DIR_DBG}/../..
+ ${OGRE_BIN_SEARCH_PATH}
+ )
+ find_path(OGRE_PLUGIN_DIR_REL NAMES "${PLUGIN}.dll" HINTS ${OGRE_PLUGIN_SEARCH_PATH_REL}
+ PATH_SUFFIXES "" bin bin/release bin/relwithdebinfo bin/minsizerel release)
+ find_path(OGRE_PLUGIN_DIR_DBG NAMES "${PLUGIN}_d.dll" HINTS ${OGRE_PLUGIN_SEARCH_PATH_DBG}
+ PATH_SUFFIXES "" bin bin/debug debug)
+ elseif (UNIX)
+ get_filename_component(OGRE_PLUGIN_DIR_TMP ${OGRE_${PLUGIN}_LIBRARY_REL} PATH)
+ set(OGRE_PLUGIN_DIR_REL ${OGRE_PLUGIN_DIR_TMP} CACHE STRING "Ogre plugin dir (release)")
+ get_filename_component(OGRE_PLUGIN_DIR_TMP ${OGRE_${PLUGIN}_LIBRARY_DBG} PATH)
+ set(OGRE_PLUGIN_DIR_DBG ${OGRE_PLUGIN_DIR_TMP} CACHE STRING "Ogre plugin dir (debug)")
+ endif ()
+ endif ()
+
+ # find binaries
+ if (NOT OGRE_STATIC)
+ if (WIN32)
+ find_file(OGRE_${PLUGIN}_REL NAMES "${PLUGIN}.dll" HINTS ${OGRE_PLUGIN_DIR_REL})
+ find_file(OGRE_${PLUGIN}_DBG NAMES "${PLUGIN}_d.dll" HINTS ${OGRE_PLUGIN_DIR_DBG})
+ endif()
+ mark_as_advanced(OGRE_${PLUGIN}_REL OGRE_${PLUGIN}_DBG)
+ endif()
+
+ endif ()
+
+ if (TMP_CMAKE_LIB_PREFIX)
+ set(CMAKE_FIND_LIBRARY_PREFIXES ${TMP_CMAKE_LIB_PREFIX})
+ endif ()
+endmacro(ogre_find_plugin)
+
+ogre_find_plugin(Plugin_PCZSceneManager OgrePCZSceneManager.h PCZ PlugIns/PCZSceneManager/include)
+ogre_find_plugin(Plugin_OctreeZone OgreOctreeZone.h PCZ PlugIns/OctreeZone/include)
+ogre_find_plugin(Plugin_BSPSceneManager OgreBspSceneManager.h PlugIns/BSPSceneManager/include)
+ogre_find_plugin(Plugin_CgProgramManager OgreCgProgram.h PlugIns/CgProgramManager/include)
+ogre_find_plugin(Plugin_OctreeSceneManager OgreOctreeSceneManager.h PlugIns/OctreeSceneManager/include)
+ogre_find_plugin(Plugin_ParticleFX OgreParticleFXPrerequisites.h PlugIns/ParticleFX/include)
+ogre_find_plugin(RenderSystem_GL OgreGLRenderSystem.h RenderSystems/GL/include)
+ogre_find_plugin(RenderSystem_GLES OgreGLESRenderSystem.h RenderSystems/GLES/include)
+ogre_find_plugin(RenderSystem_GLES2 OgreGLES2RenderSystem.h RenderSystems/GLES2/include)
+ogre_find_plugin(RenderSystem_Direct3D9 OgreD3D9RenderSystem.h RenderSystems/Direct3D9/include)
+ogre_find_plugin(RenderSystem_Direct3D10 OgreD3D10RenderSystem.h RenderSystems/Direct3D10/include)
+ogre_find_plugin(RenderSystem_Direct3D11 OgreD3D11RenderSystem.h RenderSystems/Direct3D11/include)
+
+if (OGRE_STATIC)
+ # check if dependencies for plugins are met
+ if (NOT DirectX_FOUND)
+ set(OGRE_RenderSystem_Direct3D9_FOUND FALSE)
+ endif ()
+ if (NOT DirectX_D3D10_FOUND)
+ set(OGRE_RenderSystem_Direct3D10_FOUND FALSE)
+ endif ()
+ if (NOT DirectX_D3D11_FOUND)
+ set(OGRE_RenderSystem_Direct3D11_FOUND FALSE)
+ endif ()
+ if (NOT OPENGL_FOUND)
+ set(OGRE_RenderSystem_GL_FOUND FALSE)
+ endif ()
+ if (NOT OPENGLES_FOUND)
+ set(OGRE_RenderSystem_GLES_FOUND FALSE)
+ endif ()
+ if (NOT OPENGLES2_FOUND)
+ set(OGRE_RenderSystem_GLES2_FOUND FALSE)
+ endif ()
+ if (NOT Cg_FOUND)
+ set(OGRE_Plugin_CgProgramManager_FOUND FALSE)
+ endif ()
+
+ set(OGRE_RenderSystem_Direct3D9_LIBRARIES ${OGRE_RenderSystem_Direct3D9_LIBRARIES}
+ ${DirectX_LIBRARIES}
+ )
+ set(OGRE_RenderSystem_Direct3D10_LIBRARIES ${OGRE_RenderSystem_Direct3D10_LIBRARIES}
+ ${DirectX_D3D10_LIBRARIES}
+ )
+ set(OGRE_RenderSystem_Direct3D11_LIBRARIES ${OGRE_RenderSystem_Direct3D11_LIBRARIES}
+ ${DirectX_D3D11_LIBRARIES}
+ )
+ set(OGRE_RenderSystem_GL_LIBRARIES ${OGRE_RenderSystem_GL_LIBRARIES}
+ ${OPENGL_LIBRARIES}
+ )
+ set(OGRE_RenderSystem_GLES_LIBRARIES ${OGRE_RenderSystem_GLES_LIBRARIES}
+ ${OPENGLES_LIBRARIES}
+ )
+ set(OGRE_RenderSystem_GLES2_LIBRARIES ${OGRE_RenderSystem_GLES2_LIBRARIES}
+ ${OPENGLES2_LIBRARIES}
+ )
+ set(OGRE_Plugin_CgProgramManager_LIBRARIES ${OGRE_Plugin_CgProgramManager_LIBRARIES}
+ ${Cg_LIBRARIES}
+ )
+endif ()
+
+# look for the media directory
+set(OGRE_MEDIA_SEARCH_PATH
+ ${OGRE_SOURCE}
+ ${OGRE_LIBRARY_DIR_REL}/..
+ ${OGRE_LIBRARY_DIR_DBG}/..
+ ${OGRE_LIBRARY_DIR_REL}/../..
+ ${OGRE_LIBRARY_DIR_DBG}/../..
+ ${OGRE_PREFIX_SOURCE}
+)
+set(OGRE_MEDIA_SEARCH_SUFFIX
+ Samples/Media
+ Media
+ media
+ share/OGRE/media
+)
+
+clear_if_changed(OGRE_PREFIX_WATCH OGRE_MEDIA_DIR)
+find_path(OGRE_MEDIA_DIR NAMES packs/cubemapsJS.zip HINTS ${OGRE_MEDIA_SEARCH_PATH}
+ PATHS ${OGRE_PREFIX_PATH} PATH_SUFFIXES ${OGRE_MEDIA_SEARCH_SUFFIX})
+
+endif () # NOT OGRE_FOUND
\ No newline at end of file
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 2930)
+++ CMakeLists.txt (working copy)
@@ -112,6 +112,8 @@
3 - OpenGL"
)

+option(MYGUI_SUPPRESS_WARNINGS "Don't show compiler warnings" TRUE)
+
option(MYGUI_BUILD_SAMPLES "Build MyGUI demos" TRUE)
option(MYGUI_BUILD_PLUGINS "Build MyGUI plugins" TRUE)
option(MYGUI_BUILD_TOOLS "Build the tools" TRUE)
@@ -137,16 +139,21 @@

# Set compiler specific build flags
if (CMAKE_COMPILER_IS_GNUCXX)
- add_definitions(-fdiagnostics-show-option)
+ if (MYGUI_SUPPRESS_WARNINGS)
+ add_definitions(-w)
+ endif ()
+ if (NOT APPLE)
+ add_definitions(-fdiagnostics-show-option)
+ add_definitions(-pedantic)
+ endif ()
add_definitions(-msse)
if (MYGUI_RENDERSYSTEM EQUAL 2)
# to avoid warnings from OGRE sources
- add_definitions(-isystem ${OGRE_INCLUDE_DIR})
+ add_definitions(-isystem ${OGRE_INCLUDE_DIRS})
endif ()
# very interesting option, but way too many warnings
#add_definitions(-Weffc++)
add_definitions(-Wno-deprecated -Wall -Wctor-dtor-privacy -Winit-self -Woverloaded-virtual -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter)
- add_definitions(-pedantic)

# MyGUI_UString.h ignored from warnings because of this
add_definitions(-Wshadow)


Once you apply that, I'll update to trunk and start working on making MyGUIEngine and MyGUI.OgrePlatform compile to Frameworks, and the samples to Applications.

guido

27-08-2010 12:26:14

-fdiagnostics-show-option comes with g++ from the latest version of xcode. But that version requires MacOSX 10.6 Snow Leopard...I'd definitely prefer the 10.5 Leopard solution and just leaving the option out...

guido

27-08-2010 12:32:18

And if you need some help getting MyGUI to compile on mac I'm willing to help out a little as well.

Altren

27-08-2010 14:37:39

It is strongly recommended to use version from SVN if you want to use MyGUI on Mac. I applied several patches from Calder and fixed several compilation issues.
Also -fdiagnostics-show-option is disabled by default in SVN version.

guido

27-08-2010 19:49:23

I retraced all my steps just to be sure that I was indeed using the latest build (Checked out revision 3358)
from svn at svn co https://my-gui.svn.sourceforge.net/svnroot/my-gui/trunk my-gui ...

Still the error I describe at http://www.ogre3d.org/addonforums/viewtopic.php?f=17&t=13312