Commit 444b12a6 authored by Thomas Fischer's avatar Thomas Fischer

cmake, better isolated :)

parent 29d7fe31
cmake_minimum_required (VERSION 2.8)
project("Torque3D")
add_subdirectory(Tools/CMake)
\ No newline at end of file
include(basics.cmake)
#the libs
include(lmng.cmake)
include(lpng.cmake)
include(lungif.cmake)
include(zlib.cmake)
include(ljpeg.cmake)
include(tinyxml.cmake)
include(opcode.cmake)
include(squish.cmake)
include(collada.cmake)
include(pcre.cmake)
include(convexDecomp.cmake)
if(TORQUE_SFX_VORBIS)
include(libvorbis.cmake)
include(libogg.cmake)
endif()
if(TORQUE_THEORA)
include(libtheora.cmake)
endif()
# the main engine, should come last
include(torque3d.cmake)
project("Torque3DEngine")
set(TORQUE_TEMPLATE "Empty" CACHE STRING "the template to use")
set(projectOutDir "${CMAKE_SOURCE_DIR}/My Projects/${TORQUE_TEMPLATE}")
set(projectSrcDir "${CMAKE_SOURCE_DIR}/My Projects/${TORQUE_TEMPLATE}/source")
set(libDir "${CMAKE_SOURCE_DIR}/Engine/lib")
set(srcDir "${CMAKE_SOURCE_DIR}/Engine/source")
set(cmakeDir "${CMAKE_SOURCE_DIR}/Tools/CMake")
# output folders
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${projectOutDir}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${projectOutDir}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${projectOutDir}/bin)
SET(CMAKE_INSTALL_PREFIX "${projectOutDir}" CACHE INTERNAL "Prefix prepended to install directories" FORCE)
function(addLibPath varname dir mode)
set(tmpa "")
file(${mode} tmpa
${dir}/*.cpp
${dir}/*.c
${dir}/*.cc
${dir}/*.h)
set("${varname}" "${${varname}};${tmpa}" PARENT_SCOPE)
endfunction()
function(addLibraryFinal paths libName relDir)
foreach(f ${paths})
# Get the path of the file relative to ${DIRECTORY},
# then alter it (not compulsory)
file(RELATIVE_PATH SRCGR ${relDir} ${f})
set(SRCGR "${libName}/${SRCGR}")
# Extract the folder, ie remove the filename part
string(REGEX REPLACE "(.*)(/[^/]*)$" "\\1" SRCGR ${SRCGR})
# Source_group expects \\ (double antislash), not / (slash)
string(REPLACE / \\ SRCGR ${SRCGR})
source_group("${SRCGR}" FILES ${f})
endforeach()
add_library("${libName}" STATIC ${paths})
endfunction()
function(addExecutableFinal paths exeName relDir)
foreach(f ${paths})
# Get the path of the file relative to ${DIRECTORY},
# then alter it (not compulsory)
file(RELATIVE_PATH SRCGR ${relDir} ${f})
set(SRCGR "${exeName}/${SRCGR}")
# Extract the folder, ie remove the filename part
string(REGEX REPLACE "(.*)(/[^/]*)$" "\\1" SRCGR ${SRCGR})
# Source_group expects \\ (double antislash), not / (slash)
string(REPLACE / \\ SRCGR ${SRCGR})
source_group("${SRCGR}" FILES ${f})
endforeach()
add_executable("${exeName}" WIN32 ${paths})
endfunction()
function(addLibrary dirs libName mode)
set(tmp "")
set(firstDir "")
#message(STATUS "${libName}")
foreach(dir ${dirs})
if("${firstDir}" STREQUAL "")
set(firstDir "${dir}")
endif()
addLibPath(tmp "${dir}" ${mode})
endforeach()
addLibraryFinal("${tmp}" "${libName}" "${firstDir}")
foreach(dir ${dirs})
set_property(TARGET "${libName}" PROPERTY INCLUDE_DIRECTORIES "${dir}")
endforeach()
endfunction()
if(WIN32)
# default disabled warnings: 4018;4100;4121;4127;4130;4244;4245;4389;4511;4512;4800;
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /O2 /Ob2 /Oi /Ot /Oy /GT /Zi /W2 /nologo /GF /EHsc /GS- /Gy- /Qpar- /arch:SSE2 /fp:fast /fp:except- /GR /Zc:wchar_t-")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
#set(CMAKE_EXE_LINKER_FLAGS "/OPT:NOREF")
#set(STATIC_LIBRARY_FLAGS "/OPT:NOREF")
# Force static runtime libraries
FOREACH(flag
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_DEBUG_INIT)
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
SET("${flag}" "${${flag}} /EHsc")
ENDFOREACH()
endif()
project(collada)
addLibrary("${libDir}/collada/src/1.4/dom;${libDir}/collada/src/dae;${libDir}/collada/src/modules/LIBXMLPlugin;${libDir}/collada/src/modules/stdErrPlugin;${libDir}/collada/src/modules/STLDatabase" collada GLOB)
set_property(TARGET collada PROPERTY COMPILE_DEFINITIONS DOM_INCLUDE_TINYXML PCRE_STATIC)
set_property(TARGET collada PROPERTY INCLUDE_DIRECTORIES ${libDir}/collada/include ${libDir}/collada/include/1.4 ${libDir}/pcre ${libDir}/tinyxml)
project(convexDecomp)
addLibrary("${libDir}/convexDecomp" convexDecomp GLOB)
project(libogg)
addLibrary("${libDir}/libogg" libogg GLOB_RECURSE)
set_property(TARGET libogg PROPERTY INCLUDE_DIRECTORIES ${libDir}/libogg/include )
project(libtheora)
addLibrary("${libDir}/libtheora" libtheora GLOB_RECURSE)
set_property(TARGET libtheora PROPERTY COMPILE_DEFINITIONS TORQUE_OGGTHEORA TORQUE_OGGVORIBS)
set_property(TARGET libtheora PROPERTY INCLUDE_DIRECTORIES ${libDir}/libtheora/include ${libDir}/libogg/include)
project(libvorbis)
addLibrary("${libDir}/libvorbis" libvorbis GLOB_RECURSE)
set_property(TARGET libvorbis PROPERTY COMPILE_DEFINITIONS TORQUE_OGGVORBIS)
set_property(TARGET libvorbis PROPERTY INCLUDE_DIRECTORIES ${libDir}/libvorbis/include ${libDir}/libogg/include )
project(ljpeg)
addLibrary("${libDir}/ljpeg" ljpeg GLOB)
project(lmng)
addLibrary("${libDir}/lmng" lmng GLOB)
set_property(TARGET lmng PROPERTY COMPILE_DEFINITIONS MNG_OPTIMIZE_OBJCLEANUP)
set_property(TARGET lmng PROPERTY INCLUDE_DIRECTORIES ${libDir}/lpng ${libDir}/zlib ${libDir}/ljpeg)
project(lpng)
addLibrary("${libDir}/lpng" lpng GLOB)
#set_property(TARGET lpng PROPERTY COMPILE_DEFINITIONS PNG_NO_ASSEMBLER_CODE)
set_property(TARGET lpng PROPERTY INCLUDE_DIRECTORIES ${libDir}/zlib)
project(lungif)
addLibrary("${libDir}/lungif" lungif GLOB)
set_property(TARGET lungif PROPERTY COMPILE_DEFINITIONS _GBA_NO_FILEIO)
project(opcode)
addLibrary("${libDir}/opcode;${libDir}/opcode/Ice" opcode GLOB)
set_property(TARGET opcode PROPERTY COMPILE_DEFINITIONS TORQUE_OPCODE ICE_NO_DLL)
project(pcre)
addLibrary("${libDir}/pcre" pcre GLOB)
set_property(TARGET pcre PROPERTY COMPILE_DEFINITIONS PCRE_STATIC HAVE_CONFIG_H)
set_property(TARGET pcre PROPERTY COMPILE_FLAGS /TP) #/TP = compile as C++
set_property(TARGET pcre PROPERTY INCLUDE_DIRECTORIES ${libDir}/pcre)
project(squish)
addLibrary("${libDir}/squish" squish GLOB)
project(tinyxml)
addLibrary("${libDir}/tinyxml" tinyxml GLOB)
//Microsoft Developer Studio generated resource script.
//
#define IDI_ICON1 103
#define IDI_ICON2 107
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON DISCARDABLE "torque.ico"
IDI_ICON2 ICON DISCARDABLE "torque.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""windows.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
This diff is collapsed.
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// 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.
//-----------------------------------------------------------------------------
#pragma once
//-----------------------------------------------------------------------------
//Hi, and welcome to the Torque Config file.
//
//This file is a central reference for the various configuration flags that
//you'll be using when controlling what sort of a Torque build you have. In
//general, the information here is global for your entire codebase, applying
//not only to your game proper, but also to all of your tools.
/// What's the name of your application? Used in a variety of places.
#define TORQUE_APP_NAME "Empty"
/// What version of the application specific source code is this?
///
/// Version number is major * 1000 + minor * 100 + revision * 10.
#define TORQUE_APP_VERSION @TORQUE_APP_VERSION@
/// Human readable application version string.
#define TORQUE_APP_VERSION_STRING "@TORQUE_APP_VERSION_STRING@"
/// Define me if you want to enable multithreading support.
#cmakedefine TORQUE_MULTITHREAD
/// Define me if you want to disable Torque memory manager.
#cmakedefine TORQUE_DISABLE_MEMORY_MANAGER
/// Define me if you want to disable the virtual mount system.
#cmakedefine TORQUE_DISABLE_VIRTUAL_MOUNT_SYSTEM
/// Define me if you want to disable looking for the root of a given path
/// within a zip file. This means that the zip file name itself must be
/// the root of the path. Requires the virtual mount system to be active.
#cmakedefine TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
//Uncomment this define if you want to use the alternative zip support where you can
//define your directories and files inside the zip just like you would on disk
//instead of the default zip support that treats the zip as an extra directory.
#cmakedefine TORQUE_ZIP_DISK_LAYOUT
/// Define me if you don't want Torque to compile dso's
#cmakedefine TORQUE_NO_DSO_GENERATION
// Define me if this build is a tools build
#cmakedefine TORQUE_PLAYER
#cmakedefine TORQUE_TOOLS
/// Define me if you want to enable the profiler.
/// See also the TORQUE_SHIPPING block below
#cmakedefine TORQUE_ENABLE_PROFILER
/// Define me to enable debug mode; enables a great number of additional
/// sanity checks, as well as making AssertFatal and AssertWarn do something.
/// This is usually defined by the build target.
#cmakedefine TORQUE_DEBUG
#cmakedefine DEBUG_SPEW
/// Define me if this is a shipping build; if defined I will instruct Torque
/// to batten down some hatches and generally be more "final game" oriented.
/// Notably this disables a liberal resource manager file searching, and
/// console help strings.
#cmakedefine TORQUE_SHIPPING
/// Define me to enable a variety of network debugging aids.
///
/// - NetConnection packet logging.
/// - DebugChecksum guards to detect mismatched pack/unpacks.
/// - Detection of invalid destination ghosts.
///
#cmakedefine TORQUE_DEBUG_NET
/// Define me to enable detailed console logging of net moves.
#cmakedefine TORQUE_DEBUG_NET_MOVES
/// Enable this define to change the default Net::MaxPacketDataSize
/// Do this at your own risk since it has the potential to cause packets
/// to be split up by old routers and Torque does not have a mechanism to
/// stitch split packets back together. Using this define can be very useful
/// in controlled network hardware environments (like a LAN) or for singleplayer
/// games (like BArricade and its large paths)
//#define MAXPACKETSIZE 1500
/// Modify me to enable metric gathering code in the renderers.
///
/// 0 does nothing; higher numbers enable higher levels of metric gathering.
//#define TORQUE_GATHER_METRICS 0
/// Define me if you want to enable debug guards in the memory manager.
///
/// Debug guards are known values placed before and after every block of
/// allocated memory. They are checked periodically by Memory::validate(),
/// and if they are modified (indicating an access to memory the app doesn't
/// "own"), an error is flagged (ie, you'll see a crash in the memory
/// manager's validate code). Using this and a debugger, you can track down
/// memory corruption issues quickly.
//#define TORQUE_DEBUG_GUARD
/// Define me if you want to enable instanced-static behavior
//#define TORQUE_ENABLE_THREAD_STATICS
/// Define me if you want to gather static-usage metrics
//#define TORQUE_ENABLE_THREAD_STATIC_METRICS
/// Define me if you want to enable debug guards on the FrameAllocator.
///
/// This is similar to the above memory manager guards, but applies only to the
/// fast FrameAllocator temporary pool memory allocations. The guards are only
/// checked when the FrameAllocator frees memory (when it's water mark changes).
/// This is most useful for detecting buffer overruns when using FrameTemp<> .
/// A buffer overrun in the FrameAllocator is unlikely to cause a crash, but may
/// still result in unexpected behavior, if other FrameTemp's are stomped.
//#define FRAMEALLOCATOR_DEBUG_GUARD
/// This #define is used by the FrameAllocator to set the size of the frame.
///
/// It was previously set to 3MB but I've increased it to 16MB due to the
/// FrameAllocator being used as temporary storage for bitmaps in the D3D9
/// texture manager.
#define TORQUE_FRAME_SIZE 16 << 20
// Finally, we define some dependent #defines. This enables some subsidiary
// functionality to get automatically turned on in certain configurations.
#ifdef TORQUE_DEBUG
#define TORQUE_GATHER_METRICS 0
#define TORQUE_ENABLE_PROFILE_PATH
#ifndef TORQUE_DEBUG_GUARD
#define TORQUE_DEBUG_GUARD
#endif
#ifndef TORQUE_NET_STATS
#define TORQUE_NET_STATS
#endif
// Enables the C++ assert macros AssertFatal, AssertWarn, etc.
#define TORQUE_ENABLE_ASSERTS
#endif
#ifdef TORQUE_RELEASE
// If it's not DEBUG, it's a RELEASE build, put appropriate things here.
#endif
#ifdef TORQUE_SHIPPING
// TORQUE_SHIPPING flags here.
#else
// Enable the profiler by default, if we're not doing a shipping build.
#define TORQUE_ENABLE_PROFILER
// Enable the TorqueScript assert() instruction if not shipping.
#define TORQUE_ENABLE_SCRIPTASSERTS
// We also enable GFX debug events for use in Pix and other graphics
// debugging tools.
#define TORQUE_ENABLE_GFXDEBUGEVENTS
#endif
#ifdef TORQUE_TOOLS
# define TORQUE_INSTANCE_EXCLUSION "TorqueToolsTest"
#else
# define TORQUE_INSTANCE_EXCLUSION "TorqueTest"
#endif
// Someday, it might make sense to do some pragma magic here so we error
// on inconsistent flags.
// The Xbox360 has it's own profiling tools, the Torque Profiler should not be used
#ifdef TORQUE_OS_XENON
# ifdef TORQUE_ENABLE_PROFILER
# undef TORQUE_ENABLE_PROFILER
# endif
#
# ifdef TORQUE_ENABLE_PROFILE_PATH
# undef TORQUE_ENABLE_PROFILE_PATH
#endif
#endif
project(zlib)
addLibrary("${libDir}/zlib" zlib GLOB)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment