Rename game libraries to the game name

Never use "game" as library name, use the game name instead. This
allows d3xp/mods to coexist in a single (installation-)directory.

This paves the way for future `make install` or binary installers.

Additionally, the "mods" menu entry works from within the game gui.
This commit is contained in:
dhewg 2012-07-03 19:26:41 +02:00
parent 822f9d30b5
commit be37221024
2 changed files with 15 additions and 12 deletions

View file

@ -6,8 +6,6 @@ cmake_minimum_required(VERSION 2.6)
# osx: place game .dylib's in the bundle (next to the binary) # osx: place game .dylib's in the bundle (next to the binary)
# osx: -weak_framework ? # osx: -weak_framework ?
# how to name the game .so's?
# maybe add these as options: # maybe add these as options:
# BUILD_GAMEPAK # BUILD_GAMEPAK
# TARGET_MONO # TARGET_MONO
@ -27,7 +25,7 @@ include(CheckCXXCompilerFlag)
include(CheckFunctionExists) include(CheckFunctionExists)
option(CORE "Build the core" ON) option(CORE "Build the core" ON)
option(GAME "Build the base game code" ON) option(BASE "Build the base game code" ON)
option(D3XP "Build the d3xp game code" OFF) option(D3XP "Build the d3xp game code" OFF)
option(DEDICATED "Build the dedicated server" OFF) option(DEDICATED "Build the dedicated server" OFF)
option(X86 "Cross compile for x86 (only applicable on x86_64)" OFF) option(X86 "Cross compile for x86 (only applicable on x86_64)" OFF)
@ -765,14 +763,14 @@ if (DEDICATED)
) )
endif() endif()
if (GAME) if (BASE)
add_library(game SHARED ${src_game}) add_library(base SHARED ${src_game})
set_target_properties(game PROPERTIES PREFIX "") set_target_properties(base PROPERTIES PREFIX "")
set_target_properties(game PROPERTIES COMPILE_DEFINITIONS "GAME_DLL") set_target_properties(base PROPERTIES COMPILE_DEFINITIONS "GAME_DLL")
set_target_properties(game PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/game") set_target_properties(base PROPERTIES COMPILE_FLAGS "-I${CMAKE_SOURCE_DIR}/game")
set_target_properties(game PROPERTIES LINK_FLAGS "${ldflags}") set_target_properties(base PROPERTIES LINK_FLAGS "${ldflags}")
set_target_properties(game PROPERTIES INSTALL_NAME_DIR "@executable_path") set_target_properties(base PROPERTIES INSTALL_NAME_DIR "@executable_path")
target_link_libraries(game idlib) target_link_libraries(base idlib)
endif() endif()
if (D3XP) if (D3XP)

View file

@ -2589,6 +2589,7 @@ idCommonLocal::LoadGameDLL
*/ */
void idCommonLocal::LoadGameDLL( void ) { void idCommonLocal::LoadGameDLL( void ) {
#ifdef __DOOM_DLL__ #ifdef __DOOM_DLL__
const char *fs_game;
char dll[MAX_OSPATH]; char dll[MAX_OSPATH];
idStr s; idStr s;
@ -2596,8 +2597,12 @@ void idCommonLocal::LoadGameDLL( void ) {
gameExport_t gameExport; gameExport_t gameExport;
GetGameAPI_t GetGameAPI; GetGameAPI_t GetGameAPI;
fs_game = cvarSystem->GetCVarString("fs_game");
if (!fs_game || !fs_game[0])
fs_game = BASE_GAMEDIR;
gameDLL = 0; gameDLL = 0;
sys->DLL_GetFileName("game", dll, sizeof(dll)); sys->DLL_GetFileName(fs_game, dll, sizeof(dll));
// try next to the binary first (build tree) // try next to the binary first (build tree)
if (Sys_GetPath(PATH_EXE, s)) { if (Sys_GetPath(PATH_EXE, s)) {