From 59487976f6956eca6943cbc3ea2d710eb612b5b6 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Thu, 27 Jun 2024 00:09:50 +0300 Subject: [PATCH] Isolate misc module Isolate misc module for better dependency handling. --- 2dlib/CMakeLists.txt | 1 + Descent3/lnxmain.cpp | 2 -- Descent3/winmain.cpp | 1 - bitmap/CMakeLists.txt | 1 + cfile/CMakeLists.txt | 1 + czip/CMakeLists.txt | 3 +++ dd_grwin32/CMakeLists.txt | 3 +++ dd_video/CMakeLists.txt | 3 +++ ddebug/CMakeLists.txt | 3 +++ ddebug/windebug.cpp | 3 +-- ddio/CMakeLists.txt | 1 + grtext/CMakeLists.txt | 1 + linux/CMakeLists.txt | 1 + manage/CMakeLists.txt | 1 + mem/CMakeLists.txt | 3 +++ misc/CMakeLists.txt | 20 +++++++++++++++----- misc/error.cpp | 2 +- {lib => misc}/log.h | 0 {lib => misc}/logfile.h | 0 {lib => misc}/pserror.h | 3 +++ {lib => misc}/psglob.h | 0 {lib => misc}/psrand.h | 0 {lib => misc}/pstring.h | 0 model/CMakeLists.txt | 1 + module/CMakeLists.txt | 1 + movie/CMakeLists.txt | 1 + music/CMakeLists.txt | 1 + netcon/lanclient/CMakeLists.txt | 1 + netcon/mtclient/CMakeLists.txt | 1 + netgames/anarchy/CMakeLists.txt | 5 ++++- netgames/coop/CMakeLists.txt | 5 ++++- netgames/ctf/CMakeLists.txt | 5 ++++- netgames/dmfc/CMakeLists.txt | 3 +++ netgames/entropy/CMakeLists.txt | 5 ++++- netgames/hoard/CMakeLists.txt | 5 ++++- netgames/hyperanarchy/CMakeLists.txt | 5 ++++- netgames/monsterball/CMakeLists.txt | 5 ++++- netgames/roboanarchy/CMakeLists.txt | 5 ++++- netgames/tanarchy/CMakeLists.txt | 5 ++++- networking/CMakeLists.txt | 1 + physics/CMakeLists.txt | 1 + renderer/CMakeLists.txt | 1 + scripts/CMakeLists.txt | 5 ++++- sndlib/CMakeLists.txt | 1 + stream_audio/CMakeLists.txt | 1 + ui/CMakeLists.txt | 1 + vecmat/CMakeLists.txt | 5 ++++- win32/CMakeLists.txt | 1 + 48 files changed, 102 insertions(+), 22 deletions(-) rename {lib => misc}/log.h (100%) rename {lib => misc}/logfile.h (100%) rename {lib => misc}/pserror.h (99%) rename {lib => misc}/psglob.h (100%) rename {lib => misc}/psrand.h (100%) rename {lib => misc}/pstring.h (100%) diff --git a/2dlib/CMakeLists.txt b/2dlib/CMakeLists.txt index 5821a3b9..80c6ff10 100644 --- a/2dlib/CMakeLists.txt +++ b/2dlib/CMakeLists.txt @@ -13,4 +13,5 @@ add_library(2dlib STATIC ${HEADERS} ${CPPS}) target_link_libraries(2dlib PRIVATE cfile mem + misc ) diff --git a/Descent3/lnxmain.cpp b/Descent3/lnxmain.cpp index e2e7890c..9d65df78 100644 --- a/Descent3/lnxmain.cpp +++ b/Descent3/lnxmain.cpp @@ -37,14 +37,12 @@ #include "args.h" #include "init.h" -#include "ddio.h" #include "osiris_dll.h" #include "loki_utils.h" #include "log.h" extern bool ddio_mouseGrabbed; -int no_debug_dialog = 0; const char *DMFCGetString(int d); // void *x = (void *) DMFCGetString; // just force a reference to dmfc.so ... diff --git a/Descent3/winmain.cpp b/Descent3/winmain.cpp index af2b4398..a1583750 100644 --- a/Descent3/winmain.cpp +++ b/Descent3/winmain.cpp @@ -109,7 +109,6 @@ static int m_resource_language = 0; #define VENDOR_NEXGEN 5 #define VENDOR_UNKNOWN 6 -int no_debug_dialog = 0; // --------------------------------------------------------------------------- // Define our operating system specific extensions to the gameos system diff --git a/bitmap/CMakeLists.txt b/bitmap/CMakeLists.txt index b646b636..26b48b12 100644 --- a/bitmap/CMakeLists.txt +++ b/bitmap/CMakeLists.txt @@ -16,6 +16,7 @@ target_link_libraries(bitmap PRIVATE ddebug ddio mem + misc stb ) target_include_directories(bitmap PUBLIC diff --git a/cfile/CMakeLists.txt b/cfile/CMakeLists.txt index eea245a6..05252983 100644 --- a/cfile/CMakeLists.txt +++ b/cfile/CMakeLists.txt @@ -8,6 +8,7 @@ add_library(cfile STATIC ${CPPS}) target_link_libraries(cfile PRIVATE ddio mem + misc ) target_include_directories(cfile PUBLIC $: linux > + $<$: + misc + > ) diff --git a/ddebug/CMakeLists.txt b/ddebug/CMakeLists.txt index 1d14a59c..dc241f8c 100644 --- a/ddebug/CMakeLists.txt +++ b/ddebug/CMakeLists.txt @@ -20,4 +20,7 @@ target_include_directories(ddebug PUBLIC ) target_link_libraries(ddebug PRIVATE mem + $<$: + misc + > ) diff --git a/ddebug/windebug.cpp b/ddebug/windebug.cpp index 42adc1a7..e7e53439 100644 --- a/ddebug/windebug.cpp +++ b/ddebug/windebug.cpp @@ -197,6 +197,7 @@ #include "debug.h" #include "mem.h" #include "mono.h" +#include "pserror.h" /////////////////////////////////////////////////////////////////////////////// @@ -1152,8 +1153,6 @@ const int NumCodeBytes = 16; // Number of code bytes to record. const int MaxStackDump = 2048; // Maximum number of DWORDS in stack dumps. const int StackColumns = 8; // Number of columns in stack dump. -extern int no_debug_dialog; - int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message) { static int BeenHere; if (BeenHere) // Going recursive! That must mean this routine crashed! diff --git a/ddio/CMakeLists.txt b/ddio/CMakeLists.txt index b4092d27..5b51ea92 100644 --- a/ddio/CMakeLists.txt +++ b/ddio/CMakeLists.txt @@ -26,6 +26,7 @@ add_library(ddio STATIC ${CPPS}) target_link_libraries(ddio PRIVATE ddebug mem + misc ) target_include_directories(ddio PUBLIC $:MEM_USE_RTL> ) +target_link_libraries(mem PRIVATE + misc +) target_include_directories(mem PUBLIC $: + SDL2::SDL2 + > +) +target_include_directories(misc PUBLIC + $ +) if(BUILD_TESTING) add_subdirectory(tests) diff --git a/misc/error.cpp b/misc/error.cpp index 4f53b6e0..821d0c48 100644 --- a/misc/error.cpp +++ b/misc/error.cpp @@ -114,7 +114,7 @@ bool error_Init(bool debugger, bool mono_debug, const char *app_title) { return true; } -extern int no_debug_dialog; +int no_debug_dialog = 0; // exits the application and prints out a standard error message void Error(const char *fmt, ...) { diff --git a/lib/log.h b/misc/log.h similarity index 100% rename from lib/log.h rename to misc/log.h diff --git a/lib/logfile.h b/misc/logfile.h similarity index 100% rename from lib/logfile.h rename to misc/logfile.h diff --git a/lib/pserror.h b/misc/pserror.h similarity index 99% rename from lib/pserror.h rename to misc/pserror.h index 0bcdd09c..deb655c1 100644 --- a/lib/pserror.h +++ b/misc/pserror.h @@ -151,6 +151,9 @@ #include #include "debug.h" #include "mono.h" + +extern int no_debug_dialog; + // initializes error handler. bool error_Init(bool debugger, bool mono_debug, const char *app_title); // exits the application and prints out a standard error message diff --git a/lib/psglob.h b/misc/psglob.h similarity index 100% rename from lib/psglob.h rename to misc/psglob.h diff --git a/lib/psrand.h b/misc/psrand.h similarity index 100% rename from lib/psrand.h rename to misc/psrand.h diff --git a/lib/pstring.h b/misc/pstring.h similarity index 100% rename from lib/pstring.h rename to misc/pstring.h diff --git a/model/CMakeLists.txt b/model/CMakeLists.txt index b3e73277..bef6c9ce 100644 --- a/model/CMakeLists.txt +++ b/model/CMakeLists.txt @@ -7,4 +7,5 @@ add_library(model STATIC ${HEADERS} ${CPPS}) target_link_libraries(model PRIVATE ddio mem + misc ) diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index a608438a..769fd1e9 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -5,4 +5,5 @@ set(CPPS add_library(module STATIC ${HEADERS} ${CPPS}) target_link_libraries(module PRIVATE ddio + misc ) diff --git a/movie/CMakeLists.txt b/movie/CMakeLists.txt index 334a2071..0863103b 100644 --- a/movie/CMakeLists.txt +++ b/movie/CMakeLists.txt @@ -7,4 +7,5 @@ target_link_libraries(movie PRIVATE ddio libmve mem + misc ) diff --git a/music/CMakeLists.txt b/music/CMakeLists.txt index 875a4a54..29b0aafe 100644 --- a/music/CMakeLists.txt +++ b/music/CMakeLists.txt @@ -10,6 +10,7 @@ target_link_libraries(music cfile ddio mem + misc sndlib stream_audio ) diff --git a/netcon/lanclient/CMakeLists.txt b/netcon/lanclient/CMakeLists.txt index bdd45758..95f928e5 100644 --- a/netcon/lanclient/CMakeLists.txt +++ b/netcon/lanclient/CMakeLists.txt @@ -7,6 +7,7 @@ set_target_properties(Direct_TCP_IP PROPERTIES OUTPUT_NAME "Direct TCP~IP") target_link_libraries(Direct_TCP_IP PRIVATE ddio inetfile + misc $<$:ws2_32> ) diff --git a/netcon/mtclient/CMakeLists.txt b/netcon/mtclient/CMakeLists.txt index 9a459f7a..523fd916 100644 --- a/netcon/mtclient/CMakeLists.txt +++ b/netcon/mtclient/CMakeLists.txt @@ -13,6 +13,7 @@ set_target_properties(Parallax_Online PROPERTIES OUTPUT_NAME "Parallax Online") target_link_libraries(Parallax_Online PRIVATE ddio inetfile + misc $<$:ws2_32> ) diff --git a/netgames/anarchy/CMakeLists.txt b/netgames/anarchy/CMakeLists.txt index 98a3d04e..27662cee 100644 --- a/netgames/anarchy/CMakeLists.txt +++ b/netgames/anarchy/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/netgames/coop/CMakeLists.txt b/netgames/coop/CMakeLists.txt index 651052fa..a4f73fa8 100644 --- a/netgames/coop/CMakeLists.txt +++ b/netgames/coop/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/netgames/ctf/CMakeLists.txt b/netgames/ctf/CMakeLists.txt index f3008f2f..49b3c661 100644 --- a/netgames/ctf/CMakeLists.txt +++ b/netgames/ctf/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/netgames/dmfc/CMakeLists.txt b/netgames/dmfc/CMakeLists.txt index 7c9cca92..b64811cc 100644 --- a/netgames/dmfc/CMakeLists.txt +++ b/netgames/dmfc/CMakeLists.txt @@ -28,3 +28,6 @@ set(CPPS add_definitions(-DOUTRAGE_VERSION) add_library(dmfc STATIC ${HEADERS} ${CPPS}) +target_link_libraries(dmfc PRIVATE + misc +) diff --git a/netgames/entropy/CMakeLists.txt b/netgames/entropy/CMakeLists.txt index 77868a27..60509a94 100644 --- a/netgames/entropy/CMakeLists.txt +++ b/netgames/entropy/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/netgames/hoard/CMakeLists.txt b/netgames/hoard/CMakeLists.txt index 4c8d9d4b..a5938837 100644 --- a/netgames/hoard/CMakeLists.txt +++ b/netgames/hoard/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/netgames/hyperanarchy/CMakeLists.txt b/netgames/hyperanarchy/CMakeLists.txt index c75cfef9..4d773c19 100644 --- a/netgames/hyperanarchy/CMakeLists.txt +++ b/netgames/hyperanarchy/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/netgames/monsterball/CMakeLists.txt b/netgames/monsterball/CMakeLists.txt index 76392a3d..03781e0b 100644 --- a/netgames/monsterball/CMakeLists.txt +++ b/netgames/monsterball/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/netgames/roboanarchy/CMakeLists.txt b/netgames/roboanarchy/CMakeLists.txt index 18268c7e..5a543e72 100644 --- a/netgames/roboanarchy/CMakeLists.txt +++ b/netgames/roboanarchy/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/netgames/tanarchy/CMakeLists.txt b/netgames/tanarchy/CMakeLists.txt index 74c1732d..6b2e4af8 100644 --- a/netgames/tanarchy/CMakeLists.txt +++ b/netgames/tanarchy/CMakeLists.txt @@ -8,5 +8,8 @@ set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden set_target_properties(${NETGAME_MODULE} PROPERTIES PREFIX "") set_target_properties(${NETGAME_MODULE} PROPERTIES SUFFIX ".d3m") -target_link_libraries(${NETGAME_MODULE} dmfc) +target_link_libraries(${NETGAME_MODULE} PRIVATE + dmfc + misc +) install(TARGETS "${NETGAME_MODULE}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/netgames) diff --git a/networking/CMakeLists.txt b/networking/CMakeLists.txt index 89b8bc00..aae00432 100644 --- a/networking/CMakeLists.txt +++ b/networking/CMakeLists.txt @@ -10,4 +10,5 @@ add_library(networking STATIC ${HEADERS} ${CPPS}) target_link_libraries(networking PRIVATE ddio mem + misc ) diff --git a/physics/CMakeLists.txt b/physics/CMakeLists.txt index 0d16f9fe..195c2cee 100644 --- a/physics/CMakeLists.txt +++ b/physics/CMakeLists.txt @@ -9,5 +9,6 @@ add_library(physics STATIC ${HEADERS} ${CPPS}) target_link_libraries(physics PRIVATE ddio mem + misc sndlib ) diff --git a/renderer/CMakeLists.txt b/renderer/CMakeLists.txt index 094d7cca..248f799b 100644 --- a/renderer/CMakeLists.txt +++ b/renderer/CMakeLists.txt @@ -28,4 +28,5 @@ target_link_libraries(renderer PRIVATE bitmap ddio mem + misc ) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 25229309..936115f0 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -70,7 +70,10 @@ set(SCRIPTS foreach(SCRIPT ${SCRIPTS}) add_library(${SCRIPT} MODULE ${CPPS} "${SCRIPT}.cpp") - target_link_libraries(${SCRIPT} fix) + target_link_libraries(${SCRIPT} + fix + misc + ) set_target_properties(${SCRIPT} PROPERTIES PREFIX "") set_target_properties(${SCRIPT} PROPERTIES CXX_VISIBILITY_PRESET "hidden") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") diff --git a/sndlib/CMakeLists.txt b/sndlib/CMakeLists.txt index d9f7d119..a194d455 100644 --- a/sndlib/CMakeLists.txt +++ b/sndlib/CMakeLists.txt @@ -22,6 +22,7 @@ target_link_libraries(sndlib PRIVATE cfile ddio mem + misc stream_audio ) target_include_directories(sndlib PUBLIC diff --git a/stream_audio/CMakeLists.txt b/stream_audio/CMakeLists.txt index b1d9abc3..19e217d2 100644 --- a/stream_audio/CMakeLists.txt +++ b/stream_audio/CMakeLists.txt @@ -8,6 +8,7 @@ target_link_libraries(stream_audio PRIVATE ddio libacm mem + misc sndlib ) target_include_directories(stream_audio PUBLIC diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 6d47e421..404509da 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -20,4 +20,5 @@ add_library(ui STATIC ${HEADERS} ${CPPS}) target_link_libraries(ui PRIVATE ddio mem + misc ) diff --git a/vecmat/CMakeLists.txt b/vecmat/CMakeLists.txt index 6a5269ce..71f7ed40 100644 --- a/vecmat/CMakeLists.txt +++ b/vecmat/CMakeLists.txt @@ -3,4 +3,7 @@ set(CPPS vector.cpp) add_library(vecmat STATIC ${HEADERS} ${CPPS}) -target_link_libraries(vecmat fix) +target_link_libraries(vecmat PRIVATE + fix + misc +) diff --git a/win32/CMakeLists.txt b/win32/CMakeLists.txt index 359aa621..86aa4048 100644 --- a/win32/CMakeLists.txt +++ b/win32/CMakeLists.txt @@ -11,4 +11,5 @@ add_dependencies(win32 get_git_hash) target_include_directories(win32 PRIVATE ${PROJECT_BINARY_DIR}/lib) target_link_libraries(win32 PRIVATE ddio + misc )