From: Thomas Debesse Date: Fri, 27 Mar 2020 18:11:38 +0000 (+0100) Subject: radiant/buildmenu: rename ".[ExecutableType]" as "[ExecutableExt]" X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=96a0d4ae7e1564c618d73ce505ead7035a7fd31c;p=xonotic%2Fnetradiant.git radiant/buildmenu: rename ".[ExecutableType]" as "[ExecutableExt]" - introduce GDEF_OS_EXE_EXT - no need for RADIANT_EXECUTABLE anymore - keep "[ExecutableType]" parsing but it looks useless --- diff --git a/CMakeLists.txt b/CMakeLists.txt index fb00a218..6d82b5cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,10 +282,6 @@ endif () #----------------------------------------------------------------------- if (BUILD_BINARIES) - if (CMAKE_EXECUTABLE_SUFFIX) - string(REGEX REPLACE "^[.]" "" RADIANT_EXECUTABLE ${CMAKE_EXECUTABLE_SUFFIX}) - endif () - macro (radiant_tool name) add_dependencies(binaries ${name}) @@ -305,9 +301,6 @@ if (BUILD_BINARIES) if (BUILD_RADIANT) add_subdirectory(radiant) - set_target_properties(${RADIANT_BASENAME} PROPERTIES - COMPILE_DEFINITIONS RADIANT_EXECUTABLE="${RADIANT_EXECUTABLE}" - ) endif () endif () diff --git a/Makefile b/Makefile index ff8161fb..4f1fc2e8 100644 --- a/Makefile +++ b/Makefile @@ -264,16 +264,13 @@ RADIANT_VERSION_NUMBER = $(RADIANT_MAJOR_VERSION).$(RADIANT_MINOR_VERSION).$(RAD RADIANT_VERSION = $(RADIANT_VERSION_NUMBER)n Q3MAP_VERSION = 2.5.17n -# Executable extension -RADIANT_EXECUTABLE := $(EXE) - GIT_VERSION := $(shell $(GIT) rev-parse --short HEAD $(STDERR_TO_DEVNULL)) ifneq ($(GIT_VERSION),) RADIANT_VERSION := $(RADIANT_VERSION)-git-$(GIT_VERSION) Q3MAP_VERSION := $(Q3MAP_VERSION)-git-$(GIT_VERSION) endif -CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_VERSION_STRING="\"$(RADIANT_VERSION_STRING)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\"" -DRADIANT_NAME="\"${RADIANT_NAME}\"" -DRADIANT_BASENAME="\"${RADIANT_BASENAME}\"" -DQ3MAP_VERSION="\"$(Q3MAP_VERSION)\"" -DRADIANT_EXECUTABLE="\"$(RADIANT_EXECUTABLE)\"" +CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_VERSION_STRING="\"$(RADIANT_VERSION_STRING)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\"" -DRADIANT_NAME="\"${RADIANT_NAME}\"" -DRADIANT_BASENAME="\"${RADIANT_BASENAME}\"" -DQ3MAP_VERSION="\"$(Q3MAP_VERSION)\"" CPPFLAGS += -DGTK_TARGET=2 .PHONY: all diff --git a/libs/globaldefs.h b/libs/globaldefs.h index 5d170523..7f6b3048 100644 --- a/libs/globaldefs.h +++ b/libs/globaldefs.h @@ -107,6 +107,14 @@ #define GDEF_OS_XDG 0 #endif +// EXECUTABLE EXTENSION + +#if GDEF_OS_WINDOWS +#define GDEF_OS_EXE_EXT ".exe" +#else +#define GDEF_OS_EXE_EXT "" +#endif + // COMPILER #if defined(_MSC_VER) diff --git a/radiant/build.cpp b/radiant/build.cpp index c060d08f..7090b98f 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -76,8 +76,7 @@ void setString( const char* string ){ m_string = string; } void evaluate( StringBuffer& output ){ - #if !(GDEF_OS_WINDOWS) - // strip .[ExecutableType] entirely (including preceding dot) on Mac and Linux + // replace ".[ExecutableType]" with "[ExecutableExt]" { StringBuffer output; const char *pattern = ".[ExecutableType]"; @@ -85,7 +84,7 @@ void evaluate( StringBuffer& output ){ { if ( strncmp( pattern, i, sizeof( pattern ) ) == 0 ) { - output.push_string(""); + output.push_string("[ExecutableExt]"); i += strlen( pattern ) - 1; } else @@ -95,7 +94,6 @@ void evaluate( StringBuffer& output ){ } setString(output.c_str()); } - #endif // !(GDEF_OS_WINDOWS) StringBuffer variable; bool in_variable = false; diff --git a/radiant/map.cpp b/radiant/map.cpp index 7e66831a..de6c6d13 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -1581,11 +1581,7 @@ tryDecompile: StringBuffer output; output.push_string( AppPath_get() ); output.push_string( "q3map2" ); - - #if GDEF_OS_WINDOWS - output.push_string( "." ); - output.push_string( RADIANT_EXECUTABLE ); - #endif // GDEF_OS_WINDOWS + output.push_string( GDEF_OS_EXE_EXT ); output.push_string( " -v -game " ); output.push_string( ( type && *type ) ? type : "quake3" ); diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index 38028e7d..bc1b6ed8 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -173,15 +173,18 @@ bool ConfirmModified( const char* title ){ } void bsp_init(){ + // this is expected to not be used since + // ".[ExecutableType]" is replaced by "[ExecutableExt]" + const char *exe_ext = GDEF_OS_EXE_EXT; + build_set_variable( "ExecutableType", exe_ext[0] == '\0' ? exe_ext : exe_ext + 1 ); + + build_set_variable( "ExecutableExt", GDEF_OS_EXE_EXT ); build_set_variable( "RadiantPath", AppPath_get() ); - - #if GDEF_OS_WINDOWS - build_set_variable( "ExecutableType", RADIANT_EXECUTABLE ); - #endif // GDEF_OS_WINDOWS - build_set_variable( "EnginePath", EnginePath_get() ); build_set_variable( "UserEnginePath", g_qeglobals.m_userEnginePath.c_str() ); + build_set_variable( "MonitorAddress", ( g_WatchBSP_Enabled ) ? "127.0.0.1:39000" : "" ); + build_set_variable( "GameName", gamename_get() ); StringBuffer ExtraQ3map2Args;