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})
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)
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 )
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 \"" );
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" : "" );