Skip to content

Commit

Permalink
make daemonmap buildable as netradiant submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Mar 30, 2020
1 parent fe8bf86 commit f64be32
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 18 deletions.
6 changes: 5 additions & 1 deletion libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory(fastlz)
# Already defined by NetRadiant, when built as submodule
if (NOT TARGET libs)
add_subdirectory(filematch)
add_subdirectory(l_net)
add_subdirectory(mathlib)
Expand All @@ -11,6 +12,9 @@ add_library(libs

target_include_directories(libs PRIVATE ${GLIB_INCLUDE_DIRS})
target_link_libraries(libs PRIVATE ${GLIB_LIBRARIES})
endif()

add_subdirectory(fastlz)

add_library(cm
cm/cm_patch.cpp
Expand Down
13 changes: 10 additions & 3 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")

add_subdirectory(quake3)
if (NOT TARGET tools)
add_custom_target(tools)
endif()

add_custom_target(tools)
add_dependencies(tools quake3)
if (NOT TARGET unvanquished)
add_custom_target(unvanquished)
endif()

add_subdirectory(quake3 unvanquished)

add_dependencies(tools unvanquished)
17 changes: 10 additions & 7 deletions tools/quake3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include_directories(BEFORE common)

set(Q3MAP_VERSION 2.5.17n)
set(DAEMONMAP_VERSION 2.5.17n)
find_package(Git REQUIRED)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
Expand All @@ -9,9 +9,9 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (GIT_VERSION)
set(Q3MAP_VERSION "${Q3MAP_VERSION}-git-${GIT_VERSION}")
set(DAEMONMAP_VERSION "${DAEMONMAP_VERSION}-git-${GIT_VERSION}")
endif ()
add_definitions(-DQ3MAP_VERSION="${Q3MAP_VERSION}")
add_definitions(-DDAEMONMAP_VERSION="${DAEMONMAP_VERSION}")

find_package(GLIB REQUIRED)
include_directories(${GLIB_INCLUDE_DIRS})
Expand All @@ -31,7 +31,7 @@ include_directories(${ZLIB_INCLUDE_DIRS})
find_package(Minizip REQUIRED)
include_directories(${Minizip_INCLUDE_DIRS})

set(q3map2_games
set(daemonmap_games
q3map2/game_quake3.h
q3map2/game_unvanquished.h
q3map2/game_smokinguns.h
Expand All @@ -54,7 +54,7 @@ radiant_tool(daemonmap
q3map2/brush.c
q3map2/bspfile_abstract.c
q3map2/bspfile_ibsp.c
${q3map2_games} q3map2/game__null.h
${daemonlmap_games} q3map2/game__null.h
q3map2/help.c
q3map2/main.c
q3map2/mesh.c
Expand Down Expand Up @@ -88,8 +88,11 @@ target_link_libraries(daemonmap
recast
)

add_custom_target(quake3)
add_dependencies(quake3 daemonmap)
add_dependencies(unvanquished daemonmap)

if (TARGET quake3)
add_dependencies(unvanquished quake3)
endif ()

if (UNIX)
target_link_libraries(daemonmap pthread m)
Expand Down
2 changes: 1 addition & 1 deletion tools/quake3/q3map2/bspfile_abstract.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ void InjectCommandLine( char **argv, int beginArgs, int endArgs ){

*outpos = 0;
SetKeyValue( &entities[0], "_q3map2_cmdline", newCommandLine );
SetKeyValue( &entities[0], "_q3map2_version", Q3MAP_VERSION );
SetKeyValue( &entities[0], "_q3map2_version", DAEMONMAP_VERSION );
}


Expand Down
2 changes: 1 addition & 1 deletion tools/quake3/q3map2/bspfile_ibsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void WriteIBSPFile( const char *filename ){
time( &t );

/* asctime adds an implicit trailing \n */
sprintf( marker, "I LOVE MY Q3MAP2 %s on %s", Q3MAP_VERSION, asctime( localtime( &t ) ) );
sprintf( marker, "I LOVE MY DAEMONMAP %s on %s", DAEMONMAP_VERSION, asctime( localtime( &t ) ) );
AddLump( file, (bspHeader_t*) header, 0, marker, strlen( marker ) + 1 );

/* add lumps */
Expand Down
4 changes: 2 additions & 2 deletions tools/quake3/q3map2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int main( int argc, char **argv ){
start = I_FloatTime();

/* this was changed to emit version number over the network */
printf( Q3MAP_VERSION "\n" );
printf( DAEMONMAP_VERSION "\n" );

/* set exit call */
atexit( ExitQ3Map );
Expand Down Expand Up @@ -208,7 +208,7 @@ int main( int argc, char **argv ){

Sys_Printf( "Q3Map - v1.0r (c) 1999 Id Software Inc.\n" );
Sys_Printf( "Q3Map (ydnar) - v2.5\n" );
Sys_Printf( "DaemonMap - v" Q3MAP_VERSION "\n" );
Sys_Printf( "DaemonMap - v" DAEMONMAP_VERSION "\n" );
Sys_Printf( "%s\n", Q3MAP_MOTD );

/* ydnar: new path initialization */
Expand Down
6 changes: 3 additions & 3 deletions tools/quake3/q3map2/q3map2.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ extern "C"
#endif

/* version */
#ifndef Q3MAP_VERSION
#error no Q3MAP_VERSION defined
#ifndef DAEMONMAP_VERSION
#error no DAEMONMAP_VERSION defined
#endif
#define Q3MAP_MOTD "Your map saw the pretty lights from daemonmap's lucifer cannon"
#define Q3MAP_MOTD "Your map saw the pretty lights from daemonmap's lucifer cannon"


/* -------------------------------------------------------------------------------
Expand Down

0 comments on commit f64be32

Please sign in to comment.