Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions CMake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ find_package(Freetype)
macro_log_feature(FREETYPE_FOUND "freetype" "Portable font engine" "http://www.freetype.org" TRUE "" "")

# Find X11
if (UNIX AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
if (UNIX AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS AND NOT OGRE_BUILD_PLATFORM_EMSCRIPTEN)
find_package(X11)
macro_log_feature(X11_FOUND "X11" "X Window system" "http://www.x.org" TRUE "" "")
macro_log_feature(X11_Xt_FOUND "Xt" "X Toolkit" "http://www.x.org" TRUE "" "")
Expand Down Expand Up @@ -116,33 +116,35 @@ endif (NOT OGRE_BUILD_PLATFORM_APPLE_IOS)

# Find Boost
# Prefer static linking in all cases
if (WIN32 OR APPLE)
set(Boost_USE_STATIC_LIBS TRUE)
else ()
# Statically linking boost to a dynamic Ogre build doesn't work on Linux 64bit
set(Boost_USE_STATIC_LIBS ${OGRE_STATIC})
endif ()
if (APPLE AND OGRE_BUILD_PLATFORM_APPLE_IOS)
set(Boost_COMPILER "-xgcc42")
endif()
set(Boost_ADDITIONAL_VERSIONS "1.48" "1.48.0" "1.47" "1.47.0" "1.46" "1.46.0" "1.45" "1.45.0" "1.44" "1.44.0" "1.42" "1.42.0" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" )
# Components that need linking (NB does not include header-only components like bind)
set(OGRE_BOOST_COMPONENTS thread date_time)
find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
if (NOT Boost_FOUND)
# Try again with the other type of libs
if(Boost_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS)
else()
set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
if (NOT OGRE_BUILD_PLATFORM_EMSCRIPTEN)
if (WIN32 OR APPLE)
set(Boost_USE_STATIC_LIBS TRUE)
else ()
# Statically linking boost to a dynamic Ogre build doesn't work on Linux 64bit
set(Boost_USE_STATIC_LIBS ${OGRE_STATIC})
endif ()
if (APPLE AND OGRE_BUILD_PLATFORM_APPLE_IOS)
set(Boost_COMPILER "-xgcc42")
endif()
set(Boost_ADDITIONAL_VERSIONS "1.48" "1.48.0" "1.47" "1.47.0" "1.46" "1.46.0" "1.45" "1.45.0" "1.44" "1.44.0" "1.42" "1.42.0" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" )
# Components that need linking (NB does not include header-only components like bind)
set(OGRE_BOOST_COMPONENTS thread date_time)
find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
if (NOT Boost_FOUND)
# Try again with the other type of libs
if(Boost_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS)
else()
set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
endif()
find_package(Boost QUIET)
# Optional Boost libs (Boost_${COMPONENT}_FOUND
macro_log_feature(Boost_FOUND "boost" "Boost (general)" "http://boost.org" FALSE "" "")
macro_log_feature(Boost_THREAD_FOUND "boost-thread" "Used for threading support" "http://boost.org" FALSE "" "")
macro_log_feature(Boost_DATE_TIME_FOUND "boost-date_time" "Used for threading support" "http://boost.org" FALSE "" "")
endif()
find_package(Boost QUIET)
# Optional Boost libs (Boost_${COMPONENT}_FOUND
macro_log_feature(Boost_FOUND "boost" "Boost (general)" "http://boost.org" FALSE "" "")
macro_log_feature(Boost_THREAD_FOUND "boost-thread" "Used for threading support" "http://boost.org" FALSE "" "")
macro_log_feature(Boost_DATE_TIME_FOUND "boost-date_time" "Used for threading support" "http://boost.org" FALSE "" "")

# POCO
find_package(POCO)
Expand Down
4 changes: 4 additions & 0 deletions CMake/Packages/FindOIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ message(STATUS "Lib will be searched in Symbian out dir: ${CMAKE_SYSYEM_OUT_DIR}
endif (SYMBIAN)
find_library(OIS_LIBRARY_REL NAMES ${OIS_LIBRARY_NAMES} HINTS ${OIS_LIB_SEARCH_PATH} ${OIS_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel)
find_library(OIS_LIBRARY_DBG NAMES ${OIS_LIBRARY_NAMES_DBG} HINTS ${OIS_LIB_SEARCH_PATH} ${OIS_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug)
if (OGRE_BUILD_PLATFORM_EMSCRIPTEN)
set(OIS_LIBRARY_REL "libOIS.so")
set(OIS_LIBRARY_DBG "libOIS.so")
endif()
if (SYMBIAN)
set(OIS_LIBRARY_REL "${FreeImage_LIBRARY_REL} ois.lib touchfeedback.lib")
set(CMAKE_PREFIX_PATH ${ORIGINAL_CMAKE_PREFIX_PATH})
Expand Down
39 changes: 24 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ if(WIN32)
set(CMAKE_SUPPRESS_REGENERATION true)
endif()

if (APPLE)
include(CMakeForceCompiler)
if (OGRE_BUILD_PLATFORM_APPLE_IOS)
CMAKE_FORCE_C_COMPILER(clang GNU)
CMAKE_FORCE_CXX_COMPILER(clang++ GNU)
SET(CMAKE_SIZEOF_VOID_P 4)
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0")
elseif (NOT OGRE_BUILD_PLATFORM_EMSCRIPTEN)
CMAKE_FORCE_C_COMPILER(llvm-gcc-4.2 GNU)
CMAKE_FORCE_CXX_COMPILER(llvm-g++-4.2 GNU)
SET(CMAKE_SIZEOF_VOID_P 4)
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
endif ()
endif ()

project(OGRE)

# Include necessary submodules
Expand All @@ -41,6 +56,7 @@ set(CMAKE_MODULE_PATH
"${OGRE_SOURCE_DIR}/CMake/Packages"
)

include(CMakeDetermineSystem)
include(CMakeDependentOption)
include(CheckCXXCompilerFlag)
include(MacroLogFeature)
Expand All @@ -51,21 +67,6 @@ set(OGRE_TEMPLATES_DIR "${OGRE_SOURCE_DIR}/CMake/Templates")
set(OGRE_WORK_DIR ${OGRE_BINARY_DIR})


if (APPLE)
include(CMakeForceCompiler)
if (OGRE_BUILD_PLATFORM_APPLE_IOS)
CMAKE_FORCE_C_COMPILER(clang GNU)
CMAKE_FORCE_CXX_COMPILER(clang++ GNU)
SET(CMAKE_SIZEOF_VOID_P 4)
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0")
else ()
CMAKE_FORCE_C_COMPILER(llvm-gcc-4.2 GNU)
CMAKE_FORCE_CXX_COMPILER(llvm-g++-4.2 GNU)
SET(CMAKE_SIZEOF_VOID_P 4)
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
endif ()
endif ()

#####################################################################
# Set up the basic build environment
#####################################################################
Expand Down Expand Up @@ -236,6 +237,13 @@ elseif (APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
set(OGRE_BUILD_RENDERSYSTEM_GL TRUE)
set(OGRE_BUILD_RENDERSYSTEM_GLES FALSE)
set(OGRE_BUILD_RENDERSYSTEM_GLES2 FALSE)
elseif (OGRE_BUILD_PLATFORM_EMSCRIPTEN)
# Set build variables
set(OGRE_BUILD_RENDERSYSTEM_GLES2 TRUE CACHE BOOL "Forcing OpenGL ES 2 RenderSystem for Emscripten" FORCE)
set(OGRE_STATIC TRUE CACHE BOOL "Forcing static build for Emscripten" FORCE)
set(OGRE_CONFIG_ALLOCATOR 1 CACHE BOOL "Forcing internal allocator" FORCE)

remove_definitions(-msse)
elseif (SYMBIAN)
set(OGRE_BUILD_RENDERSYSTEM_GLES TRUE CACHE BOOL "Forcing OpenGL ES 1.x RenderSystem for Symbian" FORCE)
endif ()
Expand All @@ -258,6 +266,7 @@ cmake_dependent_option(OGRE_BUILD_RENDERSYSTEM_GLES "Build OpenGL ES 1.x RenderS
cmake_dependent_option(OGRE_BUILD_RENDERSYSTEM_GLES2 "Build OpenGL ES 2.x RenderSystem" FALSE "OPENGLES2_FOUND" FALSE)
cmake_dependent_option(OGRE_BUILD_PLATFORM_APPLE_IOS "Build Ogre for iOS" FALSE "iPhoneSDK_FOUND;OPENGLES_FOUND;OPENGLES2_FOUND" FALSE)
cmake_dependent_option(OGRE_BUILD_PLATFORM_NACL "Build Ogre for Google's Native Client (NaCl)" FALSE "OPENGLES2_FOUND" FALSE)
cmake_dependent_option(OGRE_BUILD_PLATFORM_EMSCRIPTEN "Build Ogre for Emscripten" FALSE "OPENGLES2_FOUND" FALSE)
option(OGRE_BUILD_PLUGIN_BSP "Build BSP SceneManager plugin" TRUE)
option(OGRE_BUILD_PLUGIN_OCTREE "Build Octree SceneManager plugin" TRUE)
option(OGRE_BUILD_PLUGIN_PFX "Build ParticleFX plugin" TRUE)
Expand Down
15 changes: 15 additions & 0 deletions OgreMain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,21 @@ if (OGRE_BUILD_PLATFORM_NACL)
)
set(PLATFORM_LIBS nosys)
set(PLATFORM_HEADER_INSTALL "NaCl")
elseif (OGRE_BUILD_PLATFORM_EMSCRIPTEN)
include_directories("include/Emscripten")
set(PLATFORM_HEADER_FILES
include/Emscripten/OgreConfigDialogImp.h
include/Emscripten/OgreErrorDialogImp.h
include/Emscripten/OgreTimerImp.h
)
set(PLATFORM_SOURCE_FILES
src/Emscripten/OgreConfigDialog.cpp
src/Emscripten/OgreErrorDialog.cpp
src/Emscripten/OgreTimer.cpp
src/OgreSearchOps.cpp
)
set(PLATFORM_LIBS nosys)
set(PLATFORM_HEADER_INSTALL "Emscripten")
elseif (WIN32)
include_directories("include/WIN32")
set(PLATFORM_HEADER_FILES
Expand Down
75 changes: 75 additions & 0 deletions OgreMain/include/Emscripten/OgreConfigDialogImp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2009 Torus Knot Software Ltd

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 __OGRE_EMSCRIPTEN_CONFIG_DIALOG_H__
#define __OGRE_EMSCRIPTEN_CONFIG_DIALOG_H__

#include "../OgrePrerequisites.h"
#include "../OgreRoot.h"
#include "../OgreRenderSystem.h"

namespace Ogre
{
/** Defines the behaviour of an automatic renderer configuration dialog.
@remarks
OGRE comes with it's own renderer configuration dialog, which
applications can use to easily allow the user to configure the
settings appropriate to their machine. This class defines the
interface to this standard dialog. Because dialogs are inherently
tied to a particular platform's windowing system, there will be a
different subclass for each platform.
@author
Steven J. Streeting
*/
class _OgreExport ConfigDialog : public UtilityAlloc
{
public:
ConfigDialog();

/** Displays the dialog.
@remarks
This method displays the dialog and from then on the dialog
interacts with the user independently. The dialog will be
calling the relevant OGRE rendering systems to query them for
options and to set the options the user selects. The method
returns when the user closes the dialog.
@returns
If the user accepted the dialog, <b>true</b> is returned.
@par
If the user cancelled the dialog (indicating the application
should probably terminate), <b>false</b> is returned.
@see
RenderSystem
*/
bool display();

protected:
RenderSystem* mSelectedRenderSystem;
};
}
#endif
52 changes: 52 additions & 0 deletions OgreMain/include/Emscripten/OgreErrorDialogImp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2009 Torus Knot Software Ltd

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 __OGRE_EMSCRIPTEN_ERROR_DIALOG_H__
#define __OGRE_EMSCRIPTEN_ERROR_DIALOG_H__

#include "../OgrePrerequisites.h"

namespace Ogre
{
/** Class for displaying the error dialog if Ogre fails badly. */
class _OgreExport ErrorDialog
{
public:
ErrorDialog();

/**
@remarks
Displays the error dialog.
@param
errorMessage The error message which has caused the failure.
@param
logName Optional name of the log to display in the detail pane.
*/
void display(const String& errorMessage, String logName = "");
};
}
#endif
83 changes: 83 additions & 0 deletions OgreMain/include/Emscripten/OgreTimerImp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/

Copyright (c) 2000-2009 Torus Knot Software Ltd

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 __OGRE_EMSCRIPTEN_TIMER_H__
#define __OGRE_EMSCRIPTEN_TIMER_H__

#include "../OgrePrerequisites.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_EMSCRIPTEN
#include <sys/time.h>
#endif

namespace Ogre
{
/** Timer class */
class _OgreExport Timer : public TimerAlloc
{
private:
struct timeval start;
clock_t zeroClock;
public:
Timer();
~Timer();

/** Method for setting a specific option of the Timer. These options are usually
specific for a certain implementation of the Timer class, and may (and probably
will) not exist across different implementations. reset() must be called after
all setOption() calls.
@param
strKey The name of the option to set
@param
pValue A pointer to the value - the size should be calculated by the timer
based on the key
@return
On success, true is returned.
@par
On failure, false is returned.
*/
bool setOption( const String& strKey, const void* pValue )
{ (void)strKey; (void)pValue; return false; }

/** Resets timer */
void reset();

/** Returns milliseconds since initialisation or last reset */
unsigned long getMilliseconds();

/** Returns microseconds since initialisation or last reset */
unsigned long getMicroseconds();

/** Returns milliseconds since initialisation or last reset, only CPU time measured */
unsigned long getMillisecondsCPU();

/** Returns microseconds since initialisation or last reset, only CPU time measured */
unsigned long getMicrosecondsCPU();
};
}
#endif
2 changes: 2 additions & 0 deletions OgreMain/include/GLX/OgreTimerImp.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ THE SOFTWARE.

#include "../OgrePrerequisites.h"

#include <sys/time.h>

namespace Ogre
{
/** Timer class */
Expand Down
Loading