mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
enforced setting the app name and fixed default-appname bugs
added debug batch file for windows improved project filters for executable: separated into engine and user sources refactored version numbers, added them to the .rc file changed /W2 to /W4 TORQUE_DEBUG,TORQUE_ENABLE_ASSERTS and TORQUE_DEBUG_GFX_MODE now automatically defined in debug mode
This commit is contained in:
parent
f3dbe07b9a
commit
36cc041254
7 changed files with 148 additions and 12 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
cmake_minimum_required (VERSION 2.8)
|
cmake_minimum_required (VERSION 2.8.3)
|
||||||
|
|
||||||
set(TORQUE_APP_NAME "My Project" CACHE STRING "the app name")
|
set(TORQUE_APP_NAME "" 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")
|
if("${TORQUE_APP_NAME}" STREQUAL "")
|
||||||
|
message(FATAL_ERROR "Please set TORQUE_APP_NAME first")
|
||||||
|
endif()
|
||||||
|
|
||||||
project(${TORQUE_APP_NAME})
|
project(${TORQUE_APP_NAME})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
include(basics.cmake)
|
include(basics.cmake)
|
||||||
|
|
||||||
|
setupVersionNumbers()
|
||||||
|
|
||||||
#the libs
|
#the libs
|
||||||
include(lmng.cmake)
|
include(lmng.cmake)
|
||||||
include(lpng.cmake)
|
include(lpng.cmake)
|
||||||
|
|
@ -22,3 +24,5 @@ endif()
|
||||||
|
|
||||||
# the main engine, should come last
|
# the main engine, should come last
|
||||||
include(torque3d.cmake)
|
include(torque3d.cmake)
|
||||||
|
|
||||||
|
#setupPackaging()
|
||||||
15
Tools/CMake/app-debug-win.bat.in
Normal file
15
Tools/CMake/app-debug-win.bat.in
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
:: little debug helper script that helps you starting Torque3D with command line arguments.
|
||||||
|
|
||||||
|
:: possible args:
|
||||||
|
:: -log <Mode: 0,1,2>
|
||||||
|
:: -console
|
||||||
|
:: -level <level.mis>
|
||||||
|
:: -worldeditor
|
||||||
|
:: -guieditor
|
||||||
|
:: -help
|
||||||
|
|
||||||
|
:: as example, we just show the console
|
||||||
|
"@PROJECT_NAME@.exe" -console
|
||||||
|
|
||||||
|
:: or load a level and open the editor:
|
||||||
|
:: "@PROJECT_NAME@.exe" -console -level mylevel.mis -worldeditor
|
||||||
|
|
@ -9,6 +9,11 @@ set(libDir "${CMAKE_SOURCE_DIR}/Engine/lib")
|
||||||
set(srcDir "${CMAKE_SOURCE_DIR}/Engine/source")
|
set(srcDir "${CMAKE_SOURCE_DIR}/Engine/source")
|
||||||
set(cmakeDir "${CMAKE_SOURCE_DIR}/Tools/CMake")
|
set(cmakeDir "${CMAKE_SOURCE_DIR}/Tools/CMake")
|
||||||
|
|
||||||
|
|
||||||
|
# hide some things
|
||||||
|
mark_as_advanced(CMAKE_INSTALL_PREFIX)
|
||||||
|
mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
|
||||||
|
|
||||||
# output folders
|
# output folders
|
||||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${projectOutDir}/game)
|
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${projectOutDir}/game)
|
||||||
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${projectOutDir}/game)
|
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${projectOutDir}/game)
|
||||||
|
|
@ -24,12 +29,14 @@ macro(addPath dir)
|
||||||
${dir}/*.h)
|
${dir}/*.h)
|
||||||
LIST(APPEND ${PROJECT_NAME}_files "${tmpa}")
|
LIST(APPEND ${PROJECT_NAME}_files "${tmpa}")
|
||||||
LIST(APPEND ${PROJECT_NAME}_paths "${dir}")
|
LIST(APPEND ${PROJECT_NAME}_paths "${dir}")
|
||||||
|
#message(STATUS "addPath ${PROJECT_NAME} : ${tmpa}")
|
||||||
#set(t "${${t}};${tmpa}")
|
#set(t "${${t}};${tmpa}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# adds a file to the sources
|
# adds a file to the sources
|
||||||
macro(addFile filename)
|
macro(addFile filename)
|
||||||
LIST(APPEND ${PROJECT_NAME}_files "${filename}")
|
LIST(APPEND ${PROJECT_NAME}_files "${filename}")
|
||||||
|
#message(STATUS "addFile ${PROJECT_NAME} : ${filename}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# finds and adds sources files in a folder recursively
|
# finds and adds sources files in a folder recursively
|
||||||
|
|
@ -42,12 +49,17 @@ macro(addPathRec dir)
|
||||||
${dir}/*.h)
|
${dir}/*.h)
|
||||||
LIST(APPEND ${PROJECT_NAME}_files "${tmpa}")
|
LIST(APPEND ${PROJECT_NAME}_files "${tmpa}")
|
||||||
LIST(APPEND ${PROJECT_NAME}_paths "${dir}")
|
LIST(APPEND ${PROJECT_NAME}_paths "${dir}")
|
||||||
|
#message(STATUS "addPathRec ${PROJECT_NAME} : ${tmpa}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# adds a definition
|
# adds a definition
|
||||||
macro(addDef def)
|
macro(addDef def)
|
||||||
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS "${def}")
|
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS "${def}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
# adds a definition
|
||||||
|
macro(addDebugDef def)
|
||||||
|
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG "${def}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# adds an include path
|
# adds an include path
|
||||||
macro(addInclude incPath)
|
macro(addInclude incPath)
|
||||||
|
|
@ -85,6 +97,30 @@ macro(generateFilters relDir)
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# creates a proper filter for VS
|
||||||
|
macro(generateFiltersSpecial relDir)
|
||||||
|
foreach(f ${${PROJECT_NAME}_files})
|
||||||
|
# Get the path of the file relative to ${DIRECTORY},
|
||||||
|
# then alter it (not compulsory)
|
||||||
|
file(RELATIVE_PATH SRCGR ${relDir} ${f})
|
||||||
|
set(SRCGR "torque3d/${SRCGR}")
|
||||||
|
# Extract the folder, ie remove the filename part
|
||||||
|
string(REGEX REPLACE "(.*)(/[^/]*)$" "\\1" SRCGR ${SRCGR})
|
||||||
|
# do not have any ../ dirs
|
||||||
|
string(REPLACE "../" "" SRCGR ${SRCGR})
|
||||||
|
IF("${SRCGR}" MATCHES "^torque3d/My Projects/.*$")
|
||||||
|
string(REPLACE "torque3d/My Projects/${PROJECT_NAME}/" "" SRCGR ${SRCGR})
|
||||||
|
string(REPLACE "/source" "" SRCGR ${SRCGR})
|
||||||
|
endif()
|
||||||
|
# Source_group expects \\ (double antislash), not / (slash)
|
||||||
|
string(REPLACE / \\ SRCGR ${SRCGR})
|
||||||
|
#STRING(REPLACE "//" "/" SRCGR ${SRCGR})
|
||||||
|
IF(EXISTS "${f}" AND NOT IS_DIRECTORY "${f}")
|
||||||
|
#message(STATUS "FILE: ${f} -> ${SRCGR}")
|
||||||
|
source_group("${SRCGR}" FILES ${f})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
# macro to add a static library
|
# macro to add a static library
|
||||||
macro(addStaticLib)
|
macro(addStaticLib)
|
||||||
# more paths?
|
# more paths?
|
||||||
|
|
@ -121,20 +157,51 @@ macro(addExecutable)
|
||||||
set(firstDir "${dir}")
|
set(firstDir "${dir}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
generateFilters("${firstDir}")
|
generateFiltersSpecial("${firstDir}")
|
||||||
add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files})
|
add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files})
|
||||||
# omg - only use the first folder ... otehrwise we get lots of header name collisions
|
# omg - only use the first folder ... otehrwise we get lots of header name collisions
|
||||||
addInclude("${firstDir}")
|
addInclude("${firstDir}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(setupVersionNumbers)
|
||||||
|
set(TORQUE_APP_VERSION_MAYOR 1 CACHE INTEGER "")
|
||||||
|
set(TORQUE_APP_VERSION_MINOR 0 CACHE INTEGER "")
|
||||||
|
set(TORQUE_APP_VERSION_PATCH 0 CACHE INTEGER "")
|
||||||
|
set(TORQUE_APP_VERSION_TWEAK 0 CACHE INTEGER "")
|
||||||
|
mark_as_advanced(TORQUE_APP_VERSION_TWEAK)
|
||||||
|
MATH(EXPR TORQUE_APP_VERSION "${TORQUE_APP_VERSION_MAYOR} * 1000 + ${TORQUE_APP_VERSION_MINOR} * 100 + ${TORQUE_APP_VERSION_PATCH} * 10 + ${TORQUE_APP_VERSION_TWEAK}")
|
||||||
|
set(TORQUE_APP_VERSION_STRING "${TORQUE_APP_VERSION_MAYOR}.${TORQUE_APP_VERSION_MINOR}.${TORQUE_APP_VERSION_PATCH}.${TORQUE_APP_VERSION_TWEAK}")
|
||||||
|
#message(STATUS "version numbers: ${TORQUE_APP_VERSION} / ${TORQUE_APP_VERSION_STRING}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(setupPackaging)
|
||||||
|
INCLUDE(CPack)
|
||||||
|
# only enable zips for now
|
||||||
|
set(CPACK_BINARY_NSIS OFF CACHE INTERNAL "" FORCE)
|
||||||
|
set(CPACK_BINARY_ZIP ON CACHE INTERNAL "" FORCE)
|
||||||
|
set(CPACK_SOURCE_ZIP OFF CACHE INTERNAL "" FORCE)
|
||||||
|
SET(CPACK_GENERATOR "ZIP")
|
||||||
|
SET(CPACK_PACKAGE_VENDOR "${PROJECT_NAME}")
|
||||||
|
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}")
|
||||||
|
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1)
|
||||||
|
SET(CPACK_OUTPUT_FILE_PREFIX "${projectDir}/packages/${PROJECT_NAME}")
|
||||||
|
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "")
|
||||||
|
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
|
||||||
|
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MAJOR "${TORQUE_APP_VERSION_MAYOR}")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MINOR "${TORQUE_APP_VERSION_MINOR}")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_PATCH "${TORQUE_APP_VERSION_PATCH}")
|
||||||
|
#SET(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}")
|
||||||
|
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${TORQUE_APP_VERSION_STRING}")
|
||||||
|
#SET(CPACK_SOURCE_STRIP_FILES "")
|
||||||
|
endmacro()
|
||||||
# always static for now
|
# always static for now
|
||||||
set(TORQUE_STATIC ON)
|
set(TORQUE_STATIC ON)
|
||||||
#option(TORQUE_STATIC "enables or disable static" OFF)
|
#option(TORQUE_STATIC "enables or disable static" OFF)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# default disabled warnings: 4018;4100;4121;4127;4130;4244;4245;4389;4511;4512;4800;
|
# default disabled warnings: 4018;4100;4121;4127;4130;4244;4245;4389;4511;4512;4800;
|
||||||
set(TORQUE_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-" CACHE TYPE STRING)
|
set(TORQUE_CXX_FLAGS "/MP /O2 /Ob2 /Oi /Ot /Oy /GT /Zi /W4 /nologo /GF /EHsc /GS- /Gy- /Qpar- /arch:SSE2 /fp:fast /fp:except- /GR /Zc:wchar_t-" CACHE TYPE STRING)
|
||||||
mark_as_advanced(TORQUE_CXX_FLAGS)
|
mark_as_advanced(TORQUE_CXX_FLAGS)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORQUE_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORQUE_CXX_FLAGS}")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,48 @@ END
|
||||||
|
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
#endif // English (U.S.) resources
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION @TORQUE_APP_VERSION_MAYOR@,@TORQUE_APP_VERSION_MINOR@,@TORQUE_APP_VERSION_PATCH@,@TORQUE_APP_VERSION_TWEAK@
|
||||||
|
PRODUCTVERSION @TORQUE_APP_VERSION_MAYOR@,@TORQUE_APP_VERSION_MINOR@,@TORQUE_APP_VERSION_PATCH@,@TORQUE_APP_VERSION_TWEAK@
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "@PROJECT_NAME@"
|
||||||
|
VALUE "FileDescription", "@PROJECT_NAME@"
|
||||||
|
VALUE "FileVersion", "@TORQUE_APP_VERSION_STRING@"
|
||||||
|
VALUE "InternalName", "@PROJECT_NAME@"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2014"
|
||||||
|
VALUE "OriginalFilename", "@PROJECT_NAME@"
|
||||||
|
VALUE "ProductName", "@PROJECT_NAME@"
|
||||||
|
VALUE "ProductVersion", "@TORQUE_APP_VERSION_STRING@"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // English (U.S.) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef APSTUDIO_INVOKED
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
|
@ -82,4 +121,3 @@ END
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#endif // not APSTUDIO_INVOKED
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ addPath("${srcDir}/T3D/turret")
|
||||||
addPath("${srcDir}/main/")
|
addPath("${srcDir}/main/")
|
||||||
addPathRec("${srcDir}/ts/collada")
|
addPathRec("${srcDir}/ts/collada")
|
||||||
addPathRec("${srcDir}/ts/loader")
|
addPathRec("${srcDir}/ts/loader")
|
||||||
addFile("${projectSrcDir}")
|
addPathRec("${projectSrcDir}")
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# modular paths
|
# modular paths
|
||||||
|
|
@ -327,6 +327,9 @@ if(WIN32)
|
||||||
if(NOT EXISTS "${projectSrcDir}/torque.rc")
|
if(NOT EXISTS "${projectSrcDir}/torque.rc")
|
||||||
CONFIGURE_FILE("${cmakeDir}/torque-win.rc.in" "${projectSrcDir}/torque.rc")
|
CONFIGURE_FILE("${cmakeDir}/torque-win.rc.in" "${projectSrcDir}/torque.rc")
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT EXISTS "${projectOutDir}/${PROJECT_NAME}-debug.bat")
|
||||||
|
CONFIGURE_FILE("${cmakeDir}/app-debug-win.bat.in" "${projectOutDir}/${PROJECT_NAME}-debug.bat")
|
||||||
|
endif()
|
||||||
if(NOT EXISTS "${projectOutDir}/cleanup.bat")
|
if(NOT EXISTS "${projectOutDir}/cleanup.bat")
|
||||||
CONFIGURE_FILE("${cmakeDir}/cleanup-win.bat.in" "${projectOutDir}/cleanup.bat")
|
CONFIGURE_FILE("${cmakeDir}/cleanup-win.bat.in" "${projectOutDir}/cleanup.bat")
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -357,6 +360,10 @@ endif()
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Always enabled Definitions
|
# Always enabled Definitions
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
addDebugDef(TORQUE_DEBUG)
|
||||||
|
addDebugDef(TORQUE_ENABLE_ASSERTS)
|
||||||
|
addDebugDef(TORQUE_DEBUG_GFX_MODE)
|
||||||
|
|
||||||
addDef(TORQUE_SHADERGEN)
|
addDef(TORQUE_SHADERGEN)
|
||||||
addDef(INITGUID)
|
addDef(INITGUID)
|
||||||
addDef(NTORQUE_SHARED)
|
addDef(NTORQUE_SHARED)
|
||||||
|
|
@ -448,5 +455,3 @@ if(WIN32)
|
||||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteDSOs.bat" DESTINATION "${projectDir}")
|
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteDSOs.bat" DESTINATION "${projectDir}")
|
||||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeletePrefs.bat" DESTINATION "${projectDir}")
|
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeletePrefs.bat" DESTINATION "${projectDir}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
INCLUDE(CPack)
|
|
||||||
|
|
@ -74,7 +74,10 @@
|
||||||
/// Define me to enable debug mode; enables a great number of additional
|
/// Define me to enable debug mode; enables a great number of additional
|
||||||
/// sanity checks, as well as making AssertFatal and AssertWarn do something.
|
/// sanity checks, as well as making AssertFatal and AssertWarn do something.
|
||||||
/// This is usually defined by the build target.
|
/// This is usually defined by the build target.
|
||||||
#cmakedefine TORQUE_DEBUG
|
|
||||||
|
// TORQUE_DEBUG is now set dynamically and not here anymore
|
||||||
|
// #cmakedefine TORQUE_DEBUG
|
||||||
|
|
||||||
#cmakedefine DEBUG_SPEW
|
#cmakedefine DEBUG_SPEW
|
||||||
#cmakedefine TORQUE_DEBUG_GFX_MODE
|
#cmakedefine TORQUE_DEBUG_GFX_MODE
|
||||||
|
|
||||||
|
|
@ -156,7 +159,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enables the C++ assert macros AssertFatal, AssertWarn, etc.
|
// Enables the C++ assert macros AssertFatal, AssertWarn, etc.
|
||||||
|
#ifndef TORQUE_ENABLE_ASSERTS
|
||||||
#define TORQUE_ENABLE_ASSERTS
|
#define TORQUE_ENABLE_ASSERTS
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue