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".
This commit is contained in:
dhewg 2012-01-14 14:51:37 +01:00 committed by Daniel Gibson
parent a6796cb444
commit 151288e170
5 changed files with 6 additions and 27 deletions

View file

@ -233,7 +233,7 @@ configure_file(
"${CMAKE_BINARY_DIR}/config.h" "${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 set(src_renderer
renderer/jpeg_memory_src.cpp renderer/jpeg_memory_src.cpp

View file

@ -1,6 +1,9 @@
#ifndef __DOOM3_CONFIG_H__ #ifndef __DOOM3_CONFIG_H__
#define __DOOM3_CONFIG_H__ #define __DOOM3_CONFIG_H__
#define BUILD_OS "@os@"
#define BUILD_CPU "@cpu@"
#cmakedefine HAVE_JPEG_MEM_SRC #cmakedefine HAVE_JPEG_MEM_SRC
#cmakedefine ID_ENABLE_CURL #cmakedefine ID_ENABLE_CURL

View file

@ -65,7 +65,7 @@ const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/char
const char *ui_teamArgs[] = { "Red", "Blue", NULL }; const char *ui_teamArgs[] = { "Red", "Blue", NULL };
struct gameVersion_s { 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]; char string[256];
} gameVersion; } gameVersion;

View file

@ -55,7 +55,7 @@ const char *ui_skinArgs[] = { "skins/characters/player/marine_mp", "skins/char
const char *ui_teamArgs[] = { "Red", "Blue", NULL }; const char *ui_teamArgs[] = { "Red", "Blue", NULL };
struct gameVersion_s { 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]; char string[256];
} gameVersion; } gameVersion;

View file

@ -43,9 +43,7 @@ If you have questions concerning this license or the applicable additional terms
// Win32 // Win32
#if defined(WIN32) || defined(_WIN32) #if defined(WIN32) || defined(_WIN32)
#define BUILD_STRING "win-x86"
#define BUILD_OS_ID 0 #define BUILD_OS_ID 0
#define CPUSTRING "x86"
#define CPU_EASYARGS 1 #define CPU_EASYARGS 1
#define _alloca16( x ) ((void *)((((uintptr_t)_alloca( (x)+15 )) + 15) & ~15)) #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 // Mac OSX
#if defined(MACOS_X) || defined(__APPLE__) #if defined(MACOS_X) || defined(__APPLE__)
#define BUILD_STRING "MacOSX-universal"
#define BUILD_OS_ID 1 #define BUILD_OS_ID 1
#ifdef __ppc__ #ifdef __ppc__
#define CPUSTRING "ppc"
#define CPU_EASYARGS 0 #define CPU_EASYARGS 0
#elif defined(__i386__) #elif defined(__i386__)
#define CPUSTRING "x86"
#define CPU_EASYARGS 1 #define CPU_EASYARGS 1
#endif #endif
@ -125,35 +120,16 @@ If you have questions concerning this license or the applicable additional terms
#define BUILD_OS_ID 2 #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__ #ifdef __i386__
#define CPUSTRING "x86"
#define CPU_EASYARGS 1 #define CPU_EASYARGS 1
#elif defined(__x86_64__) #elif defined(__x86_64__)
#define CPUSTRING "x86_64"
#define CPU_EASYARGS 0 #define CPU_EASYARGS 0
#elif defined(__ppc__) #elif defined(__ppc__)
#define CPUSTRING "ppc"
#define CPU_EASYARGS 0 #define CPU_EASYARGS 0
#else #else
#error unknown cpu architecture! #error unknown cpu architecture!
#endif #endif
#define BUILD_STRING (BUILD_OS "-" CPUSTRING)
#define _alloca alloca #define _alloca alloca
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15)) #define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))