]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
radiant: strip .[ExecutableType] entirely (including preceding dot) outside of Windows
authorThomas Debesse <dev@illwieckz.net>
Sun, 4 Nov 2018 04:02:18 +0000 (05:02 +0100)
committerThomas Debesse <dev@illwieckz.net>
Sat, 18 May 2019 20:47:42 +0000 (22:47 +0200)
keep backward compatibility with existing build menus

CMakeLists.txt
radiant/build.cpp
radiant/map.cpp
radiant/qe3.cpp

index 4e4bafca6857001779a29a28ee44214d1dfb7bdf..05c9092cc21d15446670049cf6dfd78a37c96f89 100644 (file)
@@ -215,13 +215,7 @@ endif ()
 
 if (CMAKE_EXECUTABLE_SUFFIX)
     string(REGEX REPLACE "^[.]" "" RADIANT_EXECUTABLE ${CMAKE_EXECUTABLE_SUFFIX})
-else ()
-    execute_process(
-            COMMAND uname -m
-            OUTPUT_VARIABLE RADIANT_EXECUTABLE
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-    )
-endif ()
+endif()
 
 macro(radiant_tool name)
     add_executable(${name} ${ARGN})
@@ -229,15 +223,6 @@ macro(radiant_tool name)
             TARGETS ${name}
             RUNTIME DESTINATION ${RADIANT_BIN_SUBDIR}/.
     )
-    if (NOT (CMAKE_EXECUTABLE_SUFFIX STREQUAL ".${RADIANT_EXECUTABLE}"))
-        add_custom_command(TARGET ${name} POST_BUILD
-                COMMAND ln -f -s "$<TARGET_FILE_NAME:${name}>" "${PROJECT_BINARY_DIR}/${name}.${RADIANT_EXECUTABLE}"
-                VERBATIM
-                )
-        install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
-                ${name}${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_INSTALL_PREFIX}/${RADIANT_BIN_SUBDIR}/${name}.${RADIANT_EXECUTABLE})
-                ")
-    endif ()
 endmacro()
 
 if (BUILD_RADIANT)
index 6462e382ab66aa3f61ccdadb2cfca67fdcead48d..d9d4e404531404314a941d492454364f9c6abcb5 100644 (file)
@@ -76,6 +76,53 @@ 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
+       {
+               StringBuffer output;
+               StringBuffer variable;
+               bool found_dot = false;
+               bool in_variable = false;
+               for (const char *i = m_string.c_str(); *i != '\0'; ++i) {
+                       if (!found_dot && !in_variable) {
+                               switch (*i) {
+                                       case '.':
+                                               found_dot = true;
+                                               break;
+                                       default:
+                                               output.push_back(*i);
+                                               break;
+                               }
+                       } else if (found_dot && !in_variable) {
+                               switch (*i) {
+                                       case '[':
+                                               in_variable = true;
+                                               break;
+                                       default:
+                                               found_dot = false;
+                                               output.push_back(*i);
+                                               break;
+                               }
+                       } else {
+                               switch (*i) {
+                                       case ']':
+                                               found_dot = false;
+                                               in_variable = false;
+                                               if ( strncmp("ExecutableType", variable.c_str(), sizeof(variable.c_str())) == 0 ) {
+                                                       output.push_string("");
+                                                       variable.clear();
+                                               }
+                                               break;
+                                       default:
+                                               variable.push_back(*i);
+                                               break;
+                               }
+                       }
+               }
+               setString(output.c_str());
+       }
+       #endif // !(GDEF_OS_WINDOWS)
+
        StringBuffer variable;
        bool in_variable = false;
        for ( const char* i = m_string.c_str(); *i != '\0'; ++i )
index 6603279f17112f72e295a502a3aa6b8c99bb0a5c..7e66831ac17a88a58ce4c0293e0e82b9c2bd7f10 100644 (file)
@@ -1580,8 +1580,13 @@ tryDecompile:
        if ( n && ( extension_equal( path_get_extension( filename ), "bsp" ) || extension_equal( path_get_extension( filename ), "map" ) ) ) {
                StringBuffer output;
                output.push_string( AppPath_get() );
-               output.push_string( "q3map2." );
+               output.push_string( "q3map2" );
+
+               #if GDEF_OS_WINDOWS
+               output.push_string( "." );
                output.push_string( RADIANT_EXECUTABLE );
+               #endif // GDEF_OS_WINDOWS
+
                output.push_string( " -v -game " );
                output.push_string( ( type && *type ) ? type : "quake3" );
                output.push_string( " -fs_basepath \"" );
index b073752126670a97ea9707cb5c0115850e0da4ae..230fa1546bb8990172ddfa18fb61118df6bfaaee 100644 (file)
@@ -174,7 +174,11 @@ bool ConfirmModified( const char* title ){
 
 void bsp_init(){
        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" : "" );