From: Mattia Basaglia Date: Thu, 30 Jul 2015 08:13:59 +0000 (+0200) Subject: Ensure radiant is able to run q3map2 and other tools X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e6eadbf20b770b5d2f758e1edae828ae688369e0;p=xonotic%2Fnetradiant.git Ensure radiant is able to run q3map2 and other tools --- diff --git a/CMakeLists.txt b/CMakeLists.txt index aed33ce6..aa31feb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,14 +23,14 @@ if(GIT_VERSION) ) endif() -if(WIN32) - set(RADIANT_EXECUTABLE "exe") +if(CMAKE_EXECUTABLE_SUFFIX) + set(RADIANT_EXECUTABLE ${CMAKE_EXECUTABLE_SUFFIX}) else() execute_process(COMMAND uname -m OUTPUT_VARIABLE RADIANT_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE) endif() -set(RADIANT_ABOUTMSG "Custom build" CACHE STRING "About message") +set(RADIANT_ABOUTMSG "Custom build" CACHE STRING "About message") message(STATUS "Building ${PROJECT_NAME} ${RADIANT_VERSION_STRING} ${RADIANT_ABOUTMSG}") diff --git a/libs/stream/stringstream.h b/libs/stream/stringstream.h index 386093fe..63823b4c 100644 --- a/libs/stream/stringstream.h +++ b/libs/stream/stringstream.h @@ -30,6 +30,7 @@ /// \brief A wrapper around a STL vector of char. /// Maintains a null-terminated array of char. /// Provides a limited STL-style interface to push and pop characters at the end of the string. +/// \todo That vector must become a std::string, and not NUL terminated. Maybe the whole class can be replaced by std::string class StringBuffer { std::vector m_string; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 22033f12..e16c7ac6 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -2,6 +2,16 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") +macro(radiant_tool name) + add_executable(${name} ${ARGN}) + if(NOT (CMAKE_EXECUTABLE_SUFFIX STREQUAL RADIANT_EXECUTABLE)) + add_custom_command(TARGET ${name} POST_BUILD + COMMAND ln -f -s -T "$" "${CMAKE_BINARY_DIR}/${name}.${RADIANT_EXECUTABLE}" + VERBATIM + ) + endif() +endmacro() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.c.in" "${CMAKE_BINARY_DIR}/version.c") include_directories("${CMAKE_CURRENT_SOURCE_DIR}") add_subdirectory(quake3) diff --git a/tools/quake2/CMakeLists.txt b/tools/quake2/CMakeLists.txt index 8dc03830..82867102 100644 --- a/tools/quake2/CMakeLists.txt +++ b/tools/quake2/CMakeLists.txt @@ -6,7 +6,7 @@ include_directories("${CMAKE_SOURCE_DIR}/include") find_package(LibXml2 REQUIRED) include_directories(${LIBXML2_INCLUDE_DIR}) -add_executable(q2map EXCLUDE_FROM_ALL +radiant_tool(q2map EXCLUDE_FROM_ALL common/bspfile.c common/bspfile.h common/cmdlib.c @@ -61,7 +61,7 @@ target_link_libraries(q2map l_net ) -add_executable(qdata3 EXCLUDE_FROM_ALL +radiant_tool(qdata3 EXCLUDE_FROM_ALL common/bspfile.c common/bspfile.h common/cmdlib.c @@ -101,7 +101,7 @@ target_link_libraries(qdata3 ) # Why is the /common stuff duplicated for qdata_heretic2? -add_executable(h2data EXCLUDE_FROM_ALL +radiant_tool(h2data EXCLUDE_FROM_ALL qdata_heretic2/common/bspfile.c qdata_heretic2/common/bspfile.h qdata_heretic2/common/cmdlib.c diff --git a/tools/quake3/CMakeLists.txt b/tools/quake3/CMakeLists.txt index 29e119ad..dfd11469 100644 --- a/tools/quake3/CMakeLists.txt +++ b/tools/quake3/CMakeLists.txt @@ -16,7 +16,7 @@ include_directories(${LIBXML2_INCLUDE_DIR}) find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIRS}) -add_executable(q3map2 +radiant_tool(q3map2 common/cmdlib.c common/cmdlib.h common/imagelib.c @@ -119,7 +119,7 @@ target_link_libraries(q3map2 picomodel ) -add_executable(q3data +radiant_tool(q3data common/aselib.c common/aselib.h common/bspfile.c