Index: code/branches/buildsystem3/src/core/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/buildsystem3/src/core/ArgumentCompletionFunctions.cc	(revision 2663)
+++ code/branches/buildsystem3/src/core/ArgumentCompletionFunctions.cc	(revision 2664)
@@ -63,5 +63,5 @@
                     startdirectory = ".";
                 }
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_WINDOWS
                 else
                 {
Index: code/branches/buildsystem3/src/core/BaseObject.cc
===================================================================
--- code/branches/buildsystem3/src/core/BaseObject.cc	(revision 2663)
+++ code/branches/buildsystem3/src/core/BaseObject.cc	(revision 2664)
@@ -33,5 +33,7 @@
 
 #include "BaseObject.h"
-#include "tinyxml/tinyxml.h"
+
+#include <tinyxml/tinyxml.h>
+
 #include "CoreIncludes.h"
 #include "EventIncludes.h"
Index: code/branches/buildsystem3/src/core/CMakeLists.txt
===================================================================
--- code/branches/buildsystem3/src/core/CMakeLists.txt	(revision 2663)
+++ code/branches/buildsystem3/src/core/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,22 @@
-SET(CORE_SRC_FILES
+ #
+ #             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.
+ #
+
+SET_SOURCE_FILES(CORE_SRC_FILES
   Clock.cc
   ConfigFileManager.cc
@@ -41,33 +60,33 @@
   TclBind.cc
   TclThreadManager.cc
+)
+ADD_SUBDIRECTORY(input)
+GET_ALL_HEADER_FILES(CORE_HDR_FILES)
+SET(CORE_FILES ${CORE_SRC_FILES} ${CORE_HDR_FILES})
 
-  tolua/tolua_bind.cc
+GENERATE_SOURCE_GROUPS(${CORE_FILES})
+GENERATE_TOLUA_BINDINGS(Core CORE_FILES INPUTFILES LuaBind.h CommandExecutor.h)
+
+IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
+  # Get around displaying a few hundred lines of warning code
+  SET_SOURCE_FILES_PROPERTIES(ArgumentCompletionFunctions.cc PROPERTIES COMPILE_FLAGS "-w")
+ENDIF()
+
+ADD_LIBRARY(core SHARED ${CORE_FILES})
+
+SET_TARGET_PROPERTIES(core PROPERTIES DEFINE_SYMBOL "CORE_SHARED_BUILD")
+TARGET_LINK_LIBRARIES(core
+  ${OGRE_LIBRARY}
+  ${Boost_THREAD_LIBRARY}
+  ${Boost_FILESYSTEM_LIBRARY}
+  ${Boost_SYSTEM_LIBRARY}
+  ${Boost_DATE_TIME_LIBRARY} # MSVC only
+  ${LUA_LIBRARIES}
+  cpptcl_orxonox
+  ois_orxonox
+  tinyxml++_orxonox
+  tolua++_orxonox
+  util
 )
 
-ADD_SOURCE_DIRECTORY(CORE_SRC_FILES input)
-
-GET_TARGET_PROPERTY(TOLUA_EXE tolua_orxonox LOCATION)
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/tolua/tolua_bind.cc ${CMAKE_CURRENT_SOURCE_DIR}/tolua/tolua_bind.h
-  COMMAND ${TOLUA_EXE} -n Core -o ../../src/core/tolua/tolua_bind.cc -H ../../src/core/tolua/tolua_bind.h ../../src/core/tolua/tolua.pkg
-  DEPENDS
-    tolua_orxonox
-    tolua/tolua.pkg
-    LuaBind.h
-    CommandExecutor.h
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
-)
-
-ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
-
-TARGET_LINK_LIBRARIES(core
-  ${OGRE_LIBRARIES}
-  ${Boost_thread_LIBRARIES}
-  ${Boost_filesystem_LIBRARIES}
-  lua_orxonox
-  cpptcl_orxonox
-  ois_orxonox
-  tinyxml_orxonox
-  tolualib_orxonox
-  util
-)
+ORXONOX_INSTALL(core)
Index: code/branches/buildsystem3/src/core/CommandExecutor.h
===================================================================
--- code/branches/buildsystem3/src/core/CommandExecutor.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/CommandExecutor.h	(revision 2664)
@@ -36,11 +36,10 @@
 #include "CommandEvaluation.h"
 
-namespace orxonox // tolua_export
-{ // tolua_export
+// tolua_begin
+namespace orxonox
+{
     class _CoreExport CommandExecutor
-    /*
-    class CommandExecutor { // tolua_export
-    */
     {
+// tolua_end
         public:
             static bool execute(const std::string& command, bool useTcl = true); // tolua_export
Index: code/branches/buildsystem3/src/core/CorePrereqs.h
===================================================================
--- code/branches/buildsystem3/src/core/CorePrereqs.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/CorePrereqs.h	(revision 2664)
@@ -35,5 +35,5 @@
 #define _CorePrereqs_H__
 
-#include "util/OrxonoxPlatform.h"
+#include "OrxonoxConfig.h"
 
 #include <string>
@@ -42,5 +42,5 @@
 // Shared library settings
 //-----------------------------------------------------------------------
-#if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !defined( CORE_STATIC_BUILD )
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( CORE_STATIC_BUILD )
 #  ifdef CORE_SHARED_BUILD
 #    define _CoreExport __declspec(dllexport)
Index: code/branches/buildsystem3/src/core/Functor.h
===================================================================
--- code/branches/buildsystem3/src/core/Functor.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/Functor.h	(revision 2664)
@@ -436,5 +436,5 @@
 
 // disable annoying warning about forcing value to boolean
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
+#ifdef ORXONOX_COMPILER_MSVC
 #pragma warning(push)
 #pragma warning(disable:4100 4800)
@@ -475,5 +475,5 @@
 }
 
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
+#ifdef ORXONOX_COMPILER_MSVC
 #pragma warning(pop)
 #endif
Index: code/branches/buildsystem3/src/core/IRC.h
===================================================================
--- code/branches/buildsystem3/src/core/IRC.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/IRC.h	(revision 2664)
@@ -32,6 +32,6 @@
 #include "CorePrereqs.h"
 
+#include <cpptcl/cpptcl.h>
 #include "OrxonoxClass.h"
-#include "cpptcl/CppTcl.h"
 
 namespace orxonox
Index: code/branches/buildsystem3/src/core/Loader.cc
===================================================================
--- code/branches/buildsystem3/src/core/Loader.cc	(revision 2663)
+++ code/branches/buildsystem3/src/core/Loader.cc	(revision 2664)
@@ -28,4 +28,7 @@
 
 #include "Loader.h"
+
+#include <tinyxml/ticpp.h>
+
 #include "XMLFile.h"
 #include "BaseObject.h"
@@ -39,6 +42,4 @@
 #include "util/Exception.h"
 
-#include "tinyxml/ticpp.h"
-
 namespace orxonox
 {
Index: code/branches/buildsystem3/src/core/LuaBind.cc
===================================================================
--- code/branches/buildsystem3/src/core/LuaBind.cc	(revision 2663)
+++ code/branches/buildsystem3/src/core/LuaBind.cc	(revision 2664)
@@ -32,7 +32,11 @@
 #include <map>
 
-#include "lua/lua.hpp"
-#include "tolua/tolua++.h"
-#include "tolua/tolua_bind.h"
+extern "C" {
+#include <lua.h>
+#include <lualib.h>
+}
+#include <tolua/tolua++.h>
+
+#include "ToluaBindCore.h"
 #include "util/String.h"
 #include "CoreIncludes.h"
Index: code/branches/buildsystem3/src/core/LuaBind.h
===================================================================
--- code/branches/buildsystem3/src/core/LuaBind.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/LuaBind.h	(revision 2664)
@@ -39,5 +39,5 @@
 
 extern "C" {
-#include <lua/lua.h>
+#include <lua.h>
 }
 
@@ -46,11 +46,11 @@
 #include <string>
 
-namespace orxonox // tolua_export
-{ // tolua_export
+// tolua_begin
+namespace orxonox
+{
   class _CoreExport LuaBind
   {
-  /*
-  class LuaBind { // tolua_export
-  */
+
+// tolua_end
     struct LoadS {
       const char *s;
Index: code/branches/buildsystem3/src/core/TclBind.h
===================================================================
--- code/branches/buildsystem3/src/core/TclBind.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/TclBind.h	(revision 2664)
@@ -32,5 +32,5 @@
 #include "CorePrereqs.h"
 
-#include "cpptcl/CppTcl.h"
+#include <cpptcl/cpptcl.h>
 
 namespace orxonox
Index: code/branches/buildsystem3/src/core/TclThreadManager.h
===================================================================
--- code/branches/buildsystem3/src/core/TclThreadManager.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/TclThreadManager.h	(revision 2664)
@@ -40,5 +40,5 @@
 #include <boost/thread/thread.hpp>
 
-#include "cpptcl/CppTcl.h"
+#include <cpptcl/cpptcl.h>
 #include "core/OrxonoxClass.h"
 
Index: code/branches/buildsystem3/src/core/Template.cc
===================================================================
--- code/branches/buildsystem3/src/core/Template.cc	(revision 2663)
+++ code/branches/buildsystem3/src/core/Template.cc	(revision 2664)
@@ -29,8 +29,9 @@
 #include "Template.h"
 
+#include <tinyxml/ticpp.h>
+
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
 #include "util/Debug.h"
-#include "tinyxml/ticpp.h"
 
 namespace orxonox
Index: code/branches/buildsystem3/src/core/Template.h
===================================================================
--- code/branches/buildsystem3/src/core/Template.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/Template.h	(revision 2664)
@@ -34,6 +34,6 @@
 #include "CorePrereqs.h"
 
+#include <tinyxml/tinyxml.h>
 #include "BaseObject.h"
-#include "tinyxml/tinyxml.h"
 
 namespace orxonox
Index: code/branches/buildsystem3/src/core/XMLPort.h
===================================================================
--- code/branches/buildsystem3/src/core/XMLPort.h	(revision 2663)
+++ code/branches/buildsystem3/src/core/XMLPort.h	(revision 2664)
@@ -44,8 +44,8 @@
 
 #include <cassert>
+#include <tinyxml/ticpp.h>
 #include "util/Debug.h"
 #include "util/Exception.h"
 #include "util/MultiType.h"
-#include "tinyxml/ticpp.h"
 #include "XMLIncludes.h"
 #include "Executor.h"
Index: code/branches/buildsystem3/src/core/input/CMakeLists.txt
===================================================================
--- code/branches/buildsystem3/src/core/input/CMakeLists.txt	(revision 2663)
+++ code/branches/buildsystem3/src/core/input/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(CORE_SRC_FILES
   Button.cc
   CalibratorCallback.cc
@@ -12,4 +12,2 @@
   SimpleInputState.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
