Add an option for CMake to specify when targeting the local system

This commit is contained in:
smallmodel 2024-11-29 20:59:47 +01:00
parent 6eab2ddd57
commit 83a874e4fd
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
4 changed files with 21 additions and 7 deletions

View file

@ -13,12 +13,12 @@ endif()
option(USE_INTERNAL_JPEG "If set, use bundled libjpeg." ${USE_INTERNAL_LIBS})
option(USE_INTERNAL_MAD "If set, use bundled libmad." ${USE_INTERNAL_LIBS})
option(USE_INTERNAL_ZLIB "If set, use bundled zlib." ${USE_INTERNAL_LIBS})
option(TARGET_LOCAL_SYSTEM "Indicate that the project will be compiled and installed for the local system" OFF)
if(TARGET_GAME_TYPE)
message(SEND_ERROR "TARGET_GAME_TYPE is now unsupported, it is now done at runtime.")
endif()
set(TARGET_BASE_GAME "./")
set(CMAKE_DEBUG_POSTFIX "-dbg")
@ -68,9 +68,17 @@ ELSE()
set(TARGET_ARCH_SUFFIX ${TARGET_ARCH})
ENDIF()
set(TARGET_BIN_SUFFIX ".${TARGET_ARCH}")
message(STATUS "Architecture detected: ${TARGET_ARCH}")
message(STATUS "Architecture detected: ${TARGET_ARCH}, suffix set to ${TARGET_ARCH_SUFFIX}.")
if(TARGET_LOCAL_SYSTEM)
add_definitions(-DTARGET_LOCAL_SYSTEM)
# As it targets the local system, no need to know about the architecture used
set(TARGET_BIN_SUFFIX "")
message(STATUS "Suffix will not be used as the local system is the target")
else()
set(TARGET_BIN_SUFFIX ".${TARGET_ARCH}")
message(STATUS "Suffix set to ${TARGET_ARCH_SUFFIX}.")
endif()
IF(WIN32)
set(TARGET_PLATFORM_PREFIX "")

View file

@ -38,9 +38,9 @@ const char* targetGameList[] =
int main(int argc, const char* argv[]) {
std::vector<std::string> argumentList;
#if !defined(DEDICATED) || !DEDICATED
const char* programName = "openmohaa" "." ARCH_STRING DLL_SUFFIX EXE_EXT;
const char* programName = "openmohaa" ARCH_SUFFIX DLL_SUFFIX EXE_EXT;
#else
const char* programName = "omohaaded" "." ARCH_STRING DLL_SUFFIX EXE_EXT;
const char* programName = "omohaaded" ARCH_SUFFIX DLL_SUFFIX EXE_EXT;
#endif
argumentList.push_back("+set");

View file

@ -86,6 +86,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define DLL_SUFFIX
#endif
#if !defined(TARGET_LOCAL_SYSTEM)
# define ARCH_SUFFIX "." ARCH_STRING
#else
# define ARCH_SUFFIX
#endif
// alloca
#ifdef _MSC_VER
# include <malloc.h>

View file

@ -236,7 +236,7 @@ Sys_GetGameAPI
void* Sys_GetGameAPI(void* parms)
{
void* (*GetGameAPI) (void*);
const char* gamename = "game" "." ARCH_STRING DLL_SUFFIX DLL_EXT;
const char* gamename = "game" ARCH_SUFFIX DLL_SUFFIX DLL_EXT;
if (game_library)
Com_Error(ERR_FATAL, "Sys_GetGameAPI without calling Sys_UnloadGame");
@ -285,7 +285,7 @@ Sys_GetCGameAPI
void* Sys_GetCGameAPI(void* parms)
{
void* (*GetCGameAPI) (void*);
const char* gamename = "cgame" "." ARCH_STRING DLL_SUFFIX DLL_EXT;
const char* gamename = "cgame" ARCH_SUFFIX DLL_SUFFIX DLL_EXT;
if (cgame_library)
Com_Error(ERR_FATAL, "Sys_GetCGameAPI without calling Sys_UnloadCGame");