cmake, better isolated :)

This commit is contained in:
Thomas Fischer 2014-03-18 13:27:25 +01:00
parent 29d7fe310d
commit 444b12a670
21 changed files with 957 additions and 0 deletions

5
CMakeLists.txt Normal file
View file

@ -0,0 +1,5 @@
cmake_minimum_required (VERSION 2.8)
project("Torque3D")
add_subdirectory(Tools/CMake)

View file

@ -0,0 +1,24 @@
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)

98
Tools/CMake/basics.cmake Normal file
View file

@ -0,0 +1,98 @@
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()

View file

@ -0,0 +1,6 @@
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)

View file

@ -0,0 +1,3 @@
project(convexDecomp)
addLibrary("${libDir}/convexDecomp" convexDecomp GLOB)

5
Tools/CMake/libogg.cmake Normal file
View file

@ -0,0 +1,5 @@
project(libogg)
addLibrary("${libDir}/libogg" libogg GLOB_RECURSE)
set_property(TARGET libogg PROPERTY INCLUDE_DIRECTORIES ${libDir}/libogg/include )

View file

@ -0,0 +1,6 @@
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)

View file

@ -0,0 +1,6 @@
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 )

3
Tools/CMake/ljpeg.cmake Normal file
View file

@ -0,0 +1,3 @@
project(ljpeg)
addLibrary("${libDir}/ljpeg" ljpeg GLOB)

6
Tools/CMake/lmng.cmake Normal file
View file

@ -0,0 +1,6 @@
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)

6
Tools/CMake/lpng.cmake Normal file
View file

@ -0,0 +1,6 @@
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)

5
Tools/CMake/lungif.cmake Normal file
View file

@ -0,0 +1,5 @@
project(lungif)
addLibrary("${libDir}/lungif" lungif GLOB)
set_property(TARGET lungif PROPERTY COMPILE_DEFINITIONS _GBA_NO_FILEIO)

5
Tools/CMake/opcode.cmake Normal file
View file

@ -0,0 +1,5 @@
project(opcode)
addLibrary("${libDir}/opcode;${libDir}/opcode/Ice" opcode GLOB)
set_property(TARGET opcode PROPERTY COMPILE_DEFINITIONS TORQUE_OPCODE ICE_NO_DLL)

7
Tools/CMake/pcre.cmake Normal file
View file

@ -0,0 +1,7 @@
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)

3
Tools/CMake/squish.cmake Normal file
View file

@ -0,0 +1,3 @@
project(squish)
addLibrary("${libDir}/squish" squish GLOB)

View file

@ -0,0 +1,3 @@
project(tinyxml)
addLibrary("${libDir}/tinyxml" tinyxml GLOB)

View file

@ -0,0 +1,85 @@
//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

BIN
Tools/CMake/torque.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

476
Tools/CMake/torque3d.cmake Normal file
View file

@ -0,0 +1,476 @@
# TODO: fmod support
# Prefs
add_definitions(-DTORQUE_SHADERGEN)
add_definitions(-DINITGUID)
add_definitions(-DNTORQUE_SHARED)
# flags found in the code:
# TORQUE_TGB_ONLY
# TORQUE_PLAYER
# TORQUE_DEMO_PURCHASE
# TORQUE_ENABLE_VFS
# TORQUE_DEBUG
# TORQUE_MINIDUMP
# TORQUE_RELEASE
# TORQUE_DEBUG_GUARD
# _XBOX
# TORQUE_OS_MAC
# TORQUE_TOOLS
# TORQUE_SHIPPING
# TORQUE_DEBUG_NET
# TORQUE_OS_LINUX
# TORQUE_OS_OPENBSD
# TORQUE_OS_XENON
# TORQUE_OS_PS3
# TORQUE_OS_MAC
# TORQUE_OS_WIN32
# TORQUE_ENGINE_PRODUCT
# DEBUG_AST_NODES
# TORQUE_ENABLE_SCRIPTASSERTS
# TORQUE_NO_DSO_GENERATION
# DOXYGENIZING
# TORQUE2D_TOOLS_FIXME
# DEBUG_SPEW
# DISABLE_DEBUG_SPEW
# TORQUE_NET_STATS
# TORQUE_DEBUG_NET
# TORQUE_LOCBUILD
# USE_UNDOCUMENTED_GROUP
# _PACK_BUG_WORKAROUNDS
# PLATFORM_LITTLE_ENDIAN
# TORQUE_BIG_ENDIAN
# NO_BLUR
# FRAMEALLOCATOR_DEBUG_GUARD
# TORQUE_DEBUG_RES_MANAGER
# TORQUE_ENABLE_UTF16_CACHE
# TORQUE_ENABLE_THREAD_STATIC_METRICS
# TORQUE_ENABLE_THREAD_STATICS
# WANT_TO_SIMULATE_UI_ON_360
# TORQUE_GATHER_METRICS
# D3DXSHADER_USE_LEGACY_D3DX9_31_DLL
# TORQUE_ENABLE_CSF_GENERATION
# TORQUE_DEBUG_RENDER
# TORQUE_ENABLE_PROFILER
# TORQUE_ENABLE_PROFILE_PATH
# DOXYGEN
# TORQUE_COLLADA
# TORQUE_COMPILER_GCC
# LOG_INPUT
# TORQUE_SUPPORTS_GCC_INLINE_X86_ASM
# TORQUE_ENABLE_ASSERTS
# DLL_CODE
# TORQUE_USE_WINSOCK
# TORQUE_DISABLE_PC_CONNECTIVITY
# TORQUE_SUPPORTS_VC_INLINE_X86_ASM
# TORQUE_64BITS
# APSTUDIO_INVOKED
# APSTUDIO_READONLY_SYMBOLS
# INITGUID
# LOG_MOUSEMOVE
# TORQUE_COMPILER_MINGW
# TORQUE_LIB
# TORQUE_SHARED
# TORQUE_DEDICATED
# TORQUE_ENGINE
# TORQUE_OGGVORBIS
# TORQUE_EXTENDED_MOVE
# DECALMANAGER_DEBUG
# TORQUE_DEBUG_NET_MOVES
# TORQUE_DEMO_WATERMARK
# TORQUE_CPU_X86
# USE_MEM_VERTEX_BUFFERS
# TORQUE_MAX_LIB
# TORQUE_ENABLE_SAMPLING
#TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
option(TORQUE_MULTITHREAD "Multi Threading" ON)
option(TORQUE_DISABLE_MEMORY_MANAGER "Disable memory manager" OFF)
option(TORQUE_DISABLE_VIRTUAL_MOUNT_SYSTEM "Disable virtual mount system" OFF)
option(TORQUE_PLAYER "Playback only?" OFF)
option(TORQUE_TOOLS "Enable or disable the tools" ON)
option(TORQUE_ENABLE_PROFILER "Enable or disable the profiler" OFF)
option(TORQUE_DEBUG "T3D Debug mode" OFF)
option(TORQUE_SHIPPING "T3D Shipping build?" OFF)
option(TORQUE_DEBUG_NET "debug network" OFF)
option(TORQUE_DEBUG_NET_MOVES "debug network moves" OFF)
#option(DEBUG_SPEW "more debug" OFF)
set(TORQUE_APP_NAME "Default" CACHE STRING "the app name")
set(TORQUE_APP_VERSION "1000" CACHE STRING "the app version: major * 1000 + minor * 100 + revision * 10.")
set(TORQUE_APP_VERSION_STRING "1.0" CACHE STRING "the app version string")
# MAXPACKETSIZE
# TORQUE_GATHER_METRICS
# TORQUE_DEBUG_GUARD
# TORQUE_ENABLE_THREAD_STATICS
# TORQUE_ENABLE_THREAD_STATIC_METRICS
# FRAMEALLOCATOR_DEBUG_GUARD
set(TORQUE_NO_DSO_GENERATION ON)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE) # for VS
add_definitions(-DTORQUE_UNICODE)
#add_definitions(-DTORQUE_SHARED)
# for libTomCrypt
add_definitions(-DLTC_NO_PROTOTYPES)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
# warning C4800: 'XXX' : forcing value to bool 'true' or 'false' (performance warning)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4800")
# warning C4018: '<' : signed/unsigned mismatch
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4018")
# warning C4244: 'initializing' : conversion from 'XXX' to 'XXX', possible loss of data
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4244")
include_directories(${projectSrcDir})
include_directories(${srcDir}/)
include_directories(${libDir}/lmpg)
include_directories(${libDir}/lpng)
include_directories(${libDir}/ljpeg)
include_directories(${libDir}/lungif)
include_directories(${libDir}/zlib)
include_directories(${libDir}/) # for tinyxml
include_directories(${libDir}/tinyxml)
include_directories(${libDir}/squish)
include_directories(${libDir}/convexDecomp)
include_directories(${libDir}/libogg/include)
set(t3dLibs "")
set(t3dLibDirs "")
# external things
include_directories($ENV{DXSDK_DIR}/Include)
set(t3dLibDirs "${t3dLibs};$ENV{DXSDK_DIR}/Lib/x86")
# module helper
set(t "")
addLibPath(t "${srcDir}/app" GLOB_RECURSE)
# lighting
option(TORQUE_ADVANCED_LIGHTING "Advanced Lighting" ON)
if(TORQUE_ADVANCED_LIGHTING)
add_definitions(-DTORQUE_ADVANCED_LIGHTING)
addLibPath(t "${srcDir}/lighting/advanced" GLOB)
addLibPath(t "${srcDir}/lighting/shadowMap" GLOB_RECURSE)
addLibPath(t "${srcDir}/lighting/advanced/hlsl" GLOB_RECURSE)
#addLibPath(t "${srcDir}/lighting/advanced/glsl" GLOB_RECURSE)
endif()
option(TORQUE_BASIC_LIGHTING "Basic Lighting" ON)
if(TORQUE_BASIC_LIGHTING)
add_definitions(-DTORQUE_BASIC_LIGHTING)
addLibPath(t "${srcDir}/lighting/basic" GLOB_RECURSE)
addLibPath(t "${srcDir}/lighting/shadowMap" GLOB_RECURSE)
endif()
# opcode
include_directories(${libDir}/opcode)
add_definitions(-DBAN_OPCODE_AUTOLINK)
add_definitions(-DICE_NO_DLL)
add_definitions(-DTORQUE_OPCODE)
# collada
add_definitions(-DTORQUE_COLLADA)
add_definitions(-DDOM_INCLUDE_TINYXML)
add_definitions(-DPCRE_STATIC)
addLibPath(t "${srcDir}/ts/collada" GLOB_RECURSE)
addLibPath(t "${srcDir}/ts/loader" GLOB_RECURSE)
include_directories(${libDir}/collada/include)
include_directories(${libDir}/collada/include/1.4)
# DirectX Sound
option(TORQUE_SFX_DirectX "DirectX Sound" ON)
if(TORQUE_SFX_DirectX)
addLibPath(t "${srcDir}/sfx/dsound" GLOB_RECURSE)
addLibPath(t "${srcDir}/sfx/xaudio" GLOB_RECURSE)
set(t3dLibs "${t3dLibs};x3daudio.lib")
endif()
# OpenAL
option(TORQUE_SFX_OPENAL "OpenAL Sound" ON)
if(TORQUE_SFX_OPENAL)
addLibPath(t "${srcDir}/sfx/openal" GLOB)
#addLibPath(t "${srcDir}/sfx/openal/mac" GLOB)
addLibPath(t "${srcDir}/sfx/openal/win32" GLOB)
include_directories(${libDir}/openal/win32)
endif()
# vorbis
option(TORQUE_SFX_VORBIS "Vorbis Sound" ON)
if(TORQUE_SFX_VORBIS)
add_definitions(-DTORQUE_OGGVORBIS)
include_directories(${libDir}/libvorbis/include)
set(t3dLibs "${t3dLibs};libvorbis;libogg")
endif()
# Theora
option(TORQUE_THEORA "Theora Video Support" ON)
if(TORQUE_THEORA)
add_definitions(-DTORQUE_OGGTHEORA)
add_definitions(-DTORQUE_OGGVORIBS)
addLibPath(t "${srcDir}/core/ogg" GLOB)
addLibPath(t "${srcDir}/gfx/video" GLOB)
addLibPath(t "${srcDir}/gui/theora" GLOB)
include_directories(${libDir}/libtheora/include)
set(t3dLibs "${t3dLibs};libtheora")
endif()
# Always on things
addLibPath(t "${srcDir}/sfx/media" GLOB)
addLibPath(t "${srcDir}/sfx/null" GLOB)
addLibPath(t "${srcDir}/sfx" GLOB)
# Components
addLibPath(t "${srcDir}/component" GLOB)
addLibPath(t "${srcDir}/component/interfaces" GLOB)
addLibPath(t "${srcDir}/console" GLOB)
addLibPath(t "${srcDir}/core" GLOB)
addLibPath(t "${srcDir}/core/stream" GLOB)
addLibPath(t "${srcDir}/core/strings" GLOB)
addLibPath(t "${srcDir}/core/util" GLOB)
addLibPath(t "${srcDir}/core/util/test" GLOB)
addLibPath(t "${srcDir}/core/util/journal" GLOB)
addLibPath(t "${srcDir}/core/util/journal/test" GLOB)
addLibPath(t "${srcDir}/core/util/zip" GLOB)
addLibPath(t "${srcDir}/core/util/zip/unitTests" GLOB)
addLibPath(t "${srcDir}/core/util/zip/compressors" GLOB)
addLibPath(t "${srcDir}/i18n" GLOB)
addLibPath(t "${srcDir}/sim" GLOB)
#addLibPath(t "${srcDir}/unit/tests" GLOB)
addLibPath(t "${srcDir}/unit" GLOB)
addLibPath(t "${srcDir}/util" GLOB)
addLibPath(t "${srcDir}/windowManager" GLOB)
addLibPath(t "${srcDir}/windowManager/torque" GLOB)
addLibPath(t "${srcDir}/windowManager/test" GLOB)
addLibPath(t "${srcDir}/math" GLOB)
addLibPath(t "${srcDir}/math/util" GLOB)
addLibPath(t "${srcDir}/math/test" GLOB)
addLibPath(t "${srcDir}/platform" GLOB)
addLibPath(t "${srcDir}/cinterface" GLOB)
addLibPath(t "${srcDir}/platform/nativeDialogs" GLOB)
addLibPath(t "${srcDir}/platform/menus" GLOB)
addLibPath(t "${srcDir}/platform/test" GLOB)
addLibPath(t "${srcDir}/platform/threads" GLOB)
addLibPath(t "${srcDir}/platform/async" GLOB)
addLibPath(t "${srcDir}/platform/input" GLOB)
addLibPath(t "${srcDir}/platform/output" GLOB)
addLibPath(t "${srcDir}/app" GLOB)
addLibPath(t "${srcDir}/app/net" GLOB)
addLibPath(t "${srcDir}/util/messaging" GLOB)
# win32
if(WIN32)
#add_definitions(-DTORQUE_OS_WIN32)
addLibPath(t "${srcDir}/platformWin32" GLOB)
addLibPath(t "${srcDir}/platformWin32/nativeDialogs" GLOB)
addLibPath(t "${srcDir}/platformWin32/menus" GLOB)
addLibPath(t "${srcDir}/platformWin32/threads" GLOB)
addLibPath(t "${srcDir}/platformWin32/videoInfo" GLOB)
addLibPath(t "${srcDir}/platformWin32/minidump" GLOB)
addLibPath(t "${srcDir}/windowManager/win32" GLOB)
#addLibPath(t "${srcDir}/gfx/D3D8" GLOB)
addLibPath(t "${srcDir}/gfx/D3D" GLOB)
addLibPath(t "${srcDir}/gfx/D3D9" GLOB)
addLibPath(t "${srcDir}/gfx/D3D9/pc" GLOB)
addLibPath(t "${srcDir}/shaderGen/HLSL" GLOB)
addLibPath(t "${srcDir}/terrain/hlsl" GLOB)
addLibPath(t "${srcDir}/forest/hlsl" GLOB)
endif()
# mac
if(APPLE)
#add_definitions(-DTORQUE_OS_MAC)
addLibPath(t "${srcDir}/platformMac" GLOB)
addLibPath(t "${srcDir}/platformMac/menus" GLOB)
addLibPath(t "${srcDir}/platformPOSIX" GLOB)
addLibPath(t "${srcDir}/windowManager/mac" GLOB)
addLibPath(t "${srcDir}/gfx/gl" GLOB)
addLibPath(t "${srcDir}/gfx/gl/ggl" GLOB)
addLibPath(t "${srcDir}/gfx/gl/ggl/mac" GLOB)
addLibPath(t "${srcDir}/gfx/gl/ggl/generated" GLOB)
addLibPath(t "${srcDir}/shaderGen/GLSL" GLOB)
addLibPath(t "${srcDir}/terrain/glsl" GLOB)
addLibPath(t "${srcDir}/forest/glsl" GLOB)
endif()
# xbox360
if(XBOX360)
#add_definitions(-D_XBOX)
#add_definitions(-DTORQUE_OS_XENON)
addLibPath(t "${srcDir}/platformXbox" GLOB)
addLibPath(t "${srcDir}/platformXbox/threads" GLOB)
addLibPath(t "${srcDir}/windowManager/360" GLOB)
addLibPath(t "${srcDir}/gfx/D3D9" GLOB)
addLibPath(t "${srcDir}/gfx/D3D9/360" GLOB)
addLibPath(t "${srcDir}/shaderGen/HLSL" GLOB)
addLibPath(t "${srcDir}/shaderGen/360" GLOB)
addLibPath(t "${srcDir}/ts/arch/360" GLOB)
addLibPath(t "${srcDir}/terrain/hlsl" GLOB)
addLibPath(t "${srcDir}/forest/hlsl" GLOB)
endif()
# ps3
if(PS3)
#add_definitions(-DTORQUE_OS_PS3)
addLibPath(t "${srcDir}/platformPS3" GLOB)
addLibPath(t "${srcDir}/platformPS3/threads" GLOB)
addLibPath(t "${srcDir}/windowManager/ps3" GLOB)
# GFX - GGL
addLibPath(t "${srcDir}/gfx/gl" GLOB)
addLibPath(t "${srcDir}/gfx/gl/ggl" GLOB)
addLibPath(t "${srcDir}/gfx/gl/ggl/ps3" GLOB)
addLibPath(t "${srcDir}/gfx/gl/ggl/generated" GLOB)
addLibPath(t "${srcDir}/shaderGen/GLSL" GLOB)
addLibPath(t "${srcDir}/ts/arch/ps3" GLOB)
addLibPath(t "${srcDir}/terrain/glsl" GLOB)
addLibPath(t "${srcDir}/forest/glsl" GLOB)
endif()
if(UNIX)
#add_definitions(-DTORQUE_OS_LINUX)
# linux_dedicated
addLibPath(t "${srcDir}/windowManager/dedicated" GLOB)
# linux
addLibPath(t "${srcDir}/platformX86UNIX" GLOB)
addLibPath(t "${srcDir}/platformX86UNIX/threads" GLOB)
addLibPath(t "${srcDir}/platformPOSIX" GLOB)
# GFX - GGL
addLibPath(t "${srcDir}/gfx/gl" GLOB)
addLibPath(t "${srcDir}/gfx/gl/ggl" GLOB)
addLibPath(t "${srcDir}/gfx/gl/ggl/x11" GLOB) # This one is not yet implemented!
addLibPath(t "${srcDir}/gfx/gl/ggl/generated" GLOB)
addLibPath(t "${srcDir}/shaderGen/GLSL" GLOB)
addLibPath(t "${srcDir}/terrain/glsl" GLOB)
addLibPath(t "${srcDir}/forest/glsl" GLOB)
endif()
# GFX
addLibPath(t "${srcDir}/gfx/Null" GLOB)
addLibPath(t "${srcDir}/gfx/test" GLOB)
addLibPath(t "${srcDir}/gfx/bitmap" GLOB)
addLibPath(t "${srcDir}/gfx/bitmap/loaders" GLOB)
addLibPath(t "${srcDir}/gfx/util" GLOB)
addLibPath(t "${srcDir}/gfx/video" GLOB)
addLibPath(t "${srcDir}/gfx" GLOB)
addLibPath(t "${srcDir}/shaderGen" GLOB)
# GFX - Sim dependent
addLibPath(t "${srcDir}/gfx/sim" GLOB)
# GUI
addLibPath(t "${srcDir}/gui/buttons" GLOB)
addLibPath(t "${srcDir}/gui/containers" GLOB)
addLibPath(t "${srcDir}/gui/controls" GLOB)
addLibPath(t "${srcDir}/gui/core" GLOB)
addLibPath(t "${srcDir}/gui/game" GLOB)
addLibPath(t "${srcDir}/gui/shiny" GLOB)
addLibPath(t "${srcDir}/gui/utility" GLOB)
addLibPath(t "${srcDir}/gui" GLOB)
# Include tools for non-tool builds (or define player if a tool build)
addLibPath(t "${srcDir}/gui/worldEditor" GLOB)
addLibPath(t "${srcDir}/environment/editors" GLOB)
addLibPath(t "${srcDir}/forest/editor" GLOB)
addLibPath(t "${srcDir}/gui/editor" GLOB)
addLibPath(t "${srcDir}/gui/editor/inspector" GLOB)
# T3D
# 3D
addLibPath(t "${srcDir}/collision" GLOB)
addLibPath(t "${srcDir}/materials" GLOB)
addLibPath(t "${srcDir}/lighting" GLOB)
addLibPath(t "${srcDir}/lighting/common" GLOB)
addLibPath(t "${srcDir}/renderInstance" GLOB)
addLibPath(t "${srcDir}/scene" GLOB)
addLibPath(t "${srcDir}/scene/culling" GLOB)
addLibPath(t "${srcDir}/scene/zones" GLOB)
addLibPath(t "${srcDir}/scene/mixin" GLOB)
addLibPath(t "${srcDir}/shaderGen" GLOB)
addLibPath(t "${srcDir}/terrain" GLOB)
addLibPath(t "${srcDir}/environment" GLOB)
addLibPath(t "${srcDir}/forest" GLOB)
addLibPath(t "${srcDir}/forest/ts" GLOB)
addLibPath(t "${srcDir}/ts" GLOB)
addLibPath(t "${srcDir}/ts/arch" GLOB)
addLibPath(t "${srcDir}/physics" GLOB)
addLibPath(t "${srcDir}/gui/3d" GLOB)
addLibPath(t "${srcDir}/postFx" GLOB)
# 3D game
addLibPath(t "${srcDir}/T3D" GLOB)
addLibPath(t "${srcDir}/T3D/examples" GLOB)
addLibPath(t "${srcDir}/T3D/fps" GLOB)
addLibPath(t "${srcDir}/T3D/fx" GLOB)
addLibPath(t "${srcDir}/T3D/vehicles" GLOB)
addLibPath(t "${srcDir}/T3D/physics" GLOB)
addLibPath(t "${srcDir}/T3D/decal" GLOB)
addLibPath(t "${srcDir}/T3D/sfx" GLOB)
addLibPath(t "${srcDir}/T3D/gameBase" GLOB)
addLibPath(t "${srcDir}/T3D/turret" GLOB)
# HIFI NET
option(TORQUE_HIFI "HIFI? support" OFF)
if(TORQUE_HIFI)
add_definitions(-DTORQUE_HIFI_NET)
addLibPath(t "${srcDir}/T3D/gameBase/hifi" GLOB)
endif()
# extended move
option(TORQUE_EXTENDED_MOVE "Extended move support" OFF)
if(TORQUE_EXTENDED_MOVE)
add_definitions(-DTORQUE_EXTENDED_MOVE)
addLibPath(t "${srcDir}/T3D/gameBase/extended" GLOB)
else()
addLibPath(t "${srcDir}/T3D/gameBase/std" GLOB)
endif()
if(WIN32)
# copy pasted from T3D build system, some might not be needed
set(t3dLibs "${t3dLibs};COMCTL32.LIB;COMDLG32.LIB;USER32.LIB;ADVAPI32.LIB;GDI32.LIB;WINMM.LIB;WSOCK32.LIB;vfw32.lib;Imm32.lib;d3d9.lib;d3dx9.lib;DxErr.lib;ole32.lib;shell32.lib;oleaut32.lib;version.lib")
# add windows rc file for the icon
set(t "${t};${projectSrcDir}/torque-win.rc")
endif()
# add main/main.cpp
set(t "${t};${srcDir}/main/main.cpp;")
# configure only once
if(NOT EXISTS ${projectSrcDir}/torqueConfig.h)
message(STATUS "writing ${projectSrcDir}/torqueConfig.h")
CONFIGURE_FILE(${cmakeDir}/torqueConfig.h.in ${projectSrcDir}/torqueConfig.h)
CONFIGURE_FILE(${cmakeDir}/torque-win.rc.in ${projectSrcDir}/torque-win.rc)
CONFIGURE_FILE(${cmakeDir}/torque.ico ${projectSrcDir}/torque.ico COPYONLY)
endif()
# internal libs
set(t3dLibs "${t3dLibs};lmng;lpng;lungif;ljpeg;zlib;tinyxml;opcode;squish;collada;pcre;convexDecomp")
#set(t3dLibs "${t3dLibs};libtorque3d")
link_directories(${t3dLibDirs})
#addLibraryFinal("${t}" "libtorque3d")
addExecutableFinal("${t}" "torque3d" "${srcDir}")
target_link_libraries(torque3d ${t3dLibs})
INSTALL_TARGETS(/ torque3d)
INSTALL_FILES(/ FILES ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/)

View file

@ -0,0 +1,202 @@
//-----------------------------------------------------------------------------
// 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

3
Tools/CMake/zlib.cmake Normal file
View file

@ -0,0 +1,3 @@
project(zlib)
addLibrary("${libDir}/zlib" zlib GLOB)