Index: code/branches/buildsystem3/src/CMakeLists.txt
===================================================================
--- code/branches/buildsystem3/src/CMakeLists.txt	(revision 2663)
+++ code/branches/buildsystem3/src/CMakeLists.txt	(revision 2664)
@@ -1,39 +1,134 @@
-INCLUDE_DIRECTORIES(.)
-INCLUDE_DIRECTORIES(..)
-INCLUDE_DIRECTORIES(orxonox)
-INCLUDE_DIRECTORIES(bullet)
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        This program is free software; you can redistribute it and/or
+ #         modify it under the terms of the GNU General Public License
+ #        as published by the Free Software Foundation; either version 2
+ #            of the License, or (at your option) any later version.
+ #
+ #       This program is distributed in the hope that it will be useful,
+ #        but WITHOUT ANY WARRANTY; without even the implied warranty of
+ #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ #                 GNU General Public License for more details.
+ #
+ #   You should have received a copy of the GNU General Public License along
+ #      with this program; if not, write to the Free Software Foundation,
+ #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ #
 
+################ Various Options ################
+
+# various macro includes
+INCLUDE(FlagUtilities)
+INCLUDE(GenerateToluaBindings)
+INCLUDE(InstallUtilities)
+INCLUDE(SourceFileUtilities)
+
+# Use TinyXML++
+ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
+# OIS dynamic linking requires macro definition, at least for Windows
+ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
+# Tolua binding speedup if required
+ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" Release MinSizeRel TOLUA_PARSER_RELEASE)
+
+################ OrxonoxConfig.h ################
+
+# Check endianness
+INCLUDE(TestBigEndian)
+TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN)
+IF(NOT ORXONOX_BIG_ENDIAN)
+  SET(ORXONOX_LITTLE_ENDIAN TRUE)
+ENDIF()
+
+# 32/64 bit system check
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  SET(ORXONOX_ARCH_64 TRUE)
+ELSE()
+  SET(ORXONOX_ARCH_32 TRUE)
+ENDIF()
+
+# Platforms
+SET(ORXONOX_PLATFORM_WINDOWS ${WIN32})
+SET(ORXONOX_PLATFORM_APPLE ${APPLE})
+SET(ORXONOX_PLATFORM_UNIX ${UNIX})
+IF(UNIX AND NOT APPLE)
+  SET(ORXONOX_PLATFORM_LINUX TRUE)
+ENDIF()
+
+# Check __forceinline
+INCLUDE(CheckCXXSourceCompiles)
+SET(_source "int main() { return 0; } __forceinline void test() { return; }")
+CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE)
+
+# Check ciso646 include (operators in words)
+INCLUDE(CheckIncludeFileCXX)
+CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H)
+
+SET(GENERATED_FILE_COMMENT
+   "DO NOT EDIT THIS FILE!
+    It has been automatically generated by CMake from OrxonoxConfig.h.in")
+# Copy and configure OrxonoxConfig which gets included in every file
+CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h)
+
+
+############## Include Directories ##############
+
+# Set the search paths for include files
+INCLUDE_DIRECTORIES(
+  # External
+  ${OGRE_INCLUDE_DIR}
+  ${CEGUI_INCLUDE_DIR}
+  ${ENET_INCLUDE_DIR}
+  ${Boost_INCLUDE_DIRS}
+  ${OPENAL_INCLUDE_DIRS}
+  ${ALUT_INCLUDE_DIR}
+  ${VORBIS_INCLUDE_DIR}
+  ${OGG_INCLUDE_DIR}
+  ${LUA_INCLUDE_DIR}
+  ${TCL_INCLUDE_PATH}
+  ${DIRECTX_INCLUDE_DIR}
+  ${ZLIB_INCLUDE_DIR}
+
+  # All library includes are prefixed with the path to avoid conflicts
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  # Bullet headers really need the include directory
+  ${CMAKE_CURRENT_SOURCE_DIR}/bullet
+  # Convenience directory
+  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
+  # OrxonoxConfig.h
+  ${CMAKE_CURRENT_BINARY_DIR}
+  # Tolua bind files for Core
+  ${CMAKE_CURRENT_BINARY_DIR}/core/${CMAKE_CFG_INTDIR}
+  # Tolua bind files for Orxonox
+  ${CMAKE_CURRENT_BINARY_DIR}/orxonox/${CMAKE_CFG_INTDIR}
+)
+
+
+################ Sub Directories ################
+
+# Third party libraries
+ADD_SUBDIRECTORY(tolua)
+
+# Include CEGUILua if not requested otherwise
+IF(CEGUILUA_USE_INTERNAL_LIBRARY)
+  IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})
+    MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")
+  ENDIF()
+
+  INCLUDE_DIRECTORIES(ceguilua/ceguilua-${CEGUI_VERSION})
+  ADD_SUBDIRECTORY(ceguilua)
+ENDIF()
+
+ADD_SUBDIRECTORY(bullet)
 ADD_SUBDIRECTORY(cpptcl)
+ADD_SUBDIRECTORY(ogreceguirenderer)
 ADD_SUBDIRECTORY(ois)
 ADD_SUBDIRECTORY(tinyxml)
-ADD_SUBDIRECTORY(bullet)
-ADD_SUBDIRECTORY(lua)
-ADD_SUBDIRECTORY(tolua)
 
-# Some people may not have CEGUILua installed, espc. with version 0.5
-# And we don't know what lua version it was linked against, so we compile
-# it ourselves.
-# So first, find out what CEGUI version we have.
-
-IF (WIN32)
-    ADD_SUBDIRECTORY(ceguilua-0.6.1/ceguilua)
-    INCLUDE_DIRECTORIES(ceguilua-0.6.1)
-ELSE (WIN32)
-    IF (${CEGUI_VERSION} LESS 0.6.0)
-        ADD_SUBDIRECTORY(ceguilua-0.5.0b/ceguilua)
-        INCLUDE_DIRECTORIES(ceguilua-0.5.0b)
-    ELSE (${CEGUI_VERSION} LESS 0.6.0)
-        ADD_SUBDIRECTORY(ceguilua-0.6.1/ceguilua)
-        INCLUDE_DIRECTORIES(ceguilua-0.6.1)
-    ENDIF (${CEGUI_VERSION} LESS 0.6.0)
-ENDIF (WIN32)
-
-# Include macro to easily add source files in subdirectories
-INCLUDE(AddSourceFiles)
-
-# Our own libraries
+# Orxonox code
 ADD_SUBDIRECTORY(util)
 ADD_SUBDIRECTORY(core)
-ADD_SUBDIRECTORY(audio)
+#ADD_SUBDIRECTORY(audio)
 ADD_SUBDIRECTORY(network)
 ADD_SUBDIRECTORY(orxonox)
