From 151288e170713da1935877bf9acdb3d35e404a7b Mon Sep 17 00:00:00 2001 From: dhewg Date: Sat, 14 Jan 2012 14:51:37 +0100 Subject: [PATCH] CMake: Use config.h for BUILD_OS and BUILD_CPU This fixes, among others, FreeBSD 64bit builds where the build system used a "amd64" suffix and runtime "x86_64". --- CMakeLists.txt | 2 +- config.h.in | 3 +++ d3xp/gamesys/SysCvar.cpp | 2 +- game/gamesys/SysCvar.cpp | 2 +- sys/platform.h | 24 ------------------------ 5 files changed, 6 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b163c83..03eaead 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,7 +233,7 @@ configure_file( "${CMAKE_BINARY_DIR}/config.h" ) -message(STATUS "Building ${CMAKE_BUILD_TYPE} for ${os}.${cpu}") +message(STATUS "Building ${CMAKE_BUILD_TYPE} for ${os}-${cpu}") set(src_renderer renderer/jpeg_memory_src.cpp diff --git a/config.h.in b/config.h.in index 35b77af..39fcf5b 100644 --- a/config.h.in +++ b/config.h.in @@ -1,6 +1,9 @@ #ifndef __DOOM3_CONFIG_H__ #define __DOOM3_CONFIG_H__ +#define BUILD_OS "@os@" +#define BUILD_CPU "@cpu@" + #cmakedefine HAVE_JPEG_MEM_SRC #cmakedefine ID_ENABLE_CURL diff --git a/d3xp/gamesys/SysCvar.cpp b/d3xp/gamesys/SysCvar.cpp index 1032a8c..49dd7ce 100644 --- a/d3xp/gamesys/SysCvar.cpp +++ b/d3xp/gamesys/SysCvar.cpp @@ -65,7 +65,7 @@ const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/char const char *ui_teamArgs[] = { "Red", "Blue", NULL }; struct gameVersion_s { - gameVersion_s( void ) { sprintf( string, "%s.%d%s %s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); } + gameVersion_s( void ) { sprintf( string, "%s.%d%s %s-%s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_OS, BUILD_CPU, __DATE__, __TIME__ ); } char string[256]; } gameVersion; diff --git a/game/gamesys/SysCvar.cpp b/game/gamesys/SysCvar.cpp index e1467dd..745e14d 100644 --- a/game/gamesys/SysCvar.cpp +++ b/game/gamesys/SysCvar.cpp @@ -55,7 +55,7 @@ const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/char const char *ui_teamArgs[] = { "Red", "Blue", NULL }; struct gameVersion_s { - gameVersion_s( void ) { sprintf( string, "%s.%d%s %s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_STRING, __DATE__, __TIME__ ); } + gameVersion_s( void ) { sprintf( string, "%s.%d%s %s-%s %s %s", ENGINE_VERSION, BUILD_NUMBER, BUILD_DEBUG, BUILD_OS, BUILD_CPU, __DATE__, __TIME__ ); } char string[256]; } gameVersion; diff --git a/sys/platform.h b/sys/platform.h index bcc521f..77515d3 100644 --- a/sys/platform.h +++ b/sys/platform.h @@ -43,9 +43,7 @@ If you have questions concerning this license or the applicable additional terms // Win32 #if defined(WIN32) || defined(_WIN32) -#define BUILD_STRING "win-x86" #define BUILD_OS_ID 0 -#define CPUSTRING "x86" #define CPU_EASYARGS 1 #define _alloca16( x ) ((void *)((((uintptr_t)_alloca( (x)+15 )) + 15) & ~15)) @@ -83,13 +81,10 @@ If you have questions concerning this license or the applicable additional terms // Mac OSX #if defined(MACOS_X) || defined(__APPLE__) -#define BUILD_STRING "MacOSX-universal" #define BUILD_OS_ID 1 #ifdef __ppc__ - #define CPUSTRING "ppc" #define CPU_EASYARGS 0 #elif defined(__i386__) - #define CPUSTRING "x86" #define CPU_EASYARGS 1 #endif @@ -125,35 +120,16 @@ If you have questions concerning this license or the applicable additional terms #define BUILD_OS_ID 2 -#ifdef __linux__ - #define BUILD_OS "linux" -#elif defined(__FreeBSD__) - #define BUILD_OS "FreeBSD" -#elif defined(__DragonFly__) - #define BUILD_OS "DragonFly" -#elif defined(__OpenBSD__) - #define BUILD_OS "OpenBSD" -#elif defined(__NetBSD__) - #define BUILD_OS "NetBSD" -#else - #error unknown operating system! -#endif - #ifdef __i386__ - #define CPUSTRING "x86" #define CPU_EASYARGS 1 #elif defined(__x86_64__) - #define CPUSTRING "x86_64" #define CPU_EASYARGS 0 #elif defined(__ppc__) - #define CPUSTRING "ppc" #define CPU_EASYARGS 0 #else #error unknown cpu architecture! #endif -#define BUILD_STRING (BUILD_OS "-" CPUSTRING) - #define _alloca alloca #define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))