]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
radiant/buildmenu: rename ".[ExecutableType]" as "[ExecutableExt]"
authorThomas Debesse <dev@illwieckz.net>
Fri, 27 Mar 2020 18:11:38 +0000 (19:11 +0100)
committerThomas Debesse <dev@illwieckz.net>
Sat, 28 Mar 2020 02:09:03 +0000 (03:09 +0100)
- introduce GDEF_OS_EXE_EXT
- no need for RADIANT_EXECUTABLE anymore
- keep "[ExecutableType]" parsing but it looks useless

CMakeLists.txt
Makefile
libs/globaldefs.h
radiant/build.cpp
radiant/map.cpp
radiant/qe3.cpp

index fb00a218a1bdb94d8ad3dcdd981b5fbfaefcb621..6d82b5cbfa800c3cae6e5e4e62cfe20629bbecd8 100644 (file)
@@ -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 ()
 
index ff8161fbad379d4ea70c667d115a96b5974d5d90..4f1fc2e8a270332a039e76ce816e2956381dfd69 100644 (file)
--- 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
index 5d170523e6eb2b717e54e6066eec0d760cb22dc2..7f6b30483be2374a37453fe653208ae0d3ac038a 100644 (file)
 #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)
index c060d08ffdf083ebdb0420ad55db467ad1886ccc..7090b98fb82c047f35dc1c8c36b1fce3ece325cb 100644 (file)
@@ -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;
index 7e66831ac17a88a58ce4c0293e0e82b9c2bd7f10..de6c6d135400a5ace17060c17ba1428e4599b7f6 100644 (file)
@@ -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" );
index 38028e7dd5918d087aea2d0b8ea2dc44dc26df00..bc1b6ed8a63f2363cbfe9604ca4b9bb488fb139b 100644 (file)
@@ -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;