Skip to content

Commit 47ae272

Browse files
authored
Merge pull request #690 from Kalamatee/ADoom3
AROS build fixes and code cleanup.
2 parents f45f525 + d36e470 commit 47ae272

24 files changed

+709
-1611
lines changed

neo/CMakeLists.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ if(IMGUI)
237237
# we need C++11 for ImGui
238238
set (CMAKE_CXX_STANDARD 11)
239239
message(STATUS "Dear ImGui integration enabled")
240+
if(AROS)
241+
add_definitions(-DIMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS)
242+
endif()
240243
else()
241244
message(WARNING "Disabling IMGUI because SDL1.2 is used - it needs SDL2 or SDL3!")
242245
set(IMGUI OFF)
@@ -1154,13 +1157,7 @@ endif()
11541157

11551158
if(AROS)
11561159
set(DHEWM3BINARY "ADoom3")
1157-
set(sys_libs ${sys_libs} dll)
1158-
1159-
set(src_arosdll
1160-
sys/aros/dll/dllstartup.c
1161-
sys/aros/dll/dll.c
1162-
sys/aros/dll/dllimport.c
1163-
)
1160+
set(sys_libs ${sys_libs} dynmod)
11641161

11651162
set(src_sys_base
11661163
sys/cpu.cpp
@@ -1170,6 +1167,8 @@ if(AROS)
11701167
sys/aros/aros_net.cpp
11711168
sys/aros/aros_signal.cpp
11721169
sys/aros/aros_main.cpp
1170+
sys/aros/aros_dynmodcommon.cpp
1171+
sys/aros/aros_support.cpp
11731172
sys/aros/aros_dos.cpp
11741173
)
11751174

@@ -1263,10 +1262,9 @@ if(SDL3)
12631262
target_link_libraries(idlib SDL3::Headers) # so it can use SDL_Endian.h
12641263
endif()
12651264
if (AROS)
1266-
add_library(dll STATIC ${src_arosdll})
1267-
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
1265+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
12681266
set(AROS_ARCH "x86")
1269-
else()
1267+
else()
12701268
set(AROS_ARCH ${CMAKE_SYSTEM_PROCESSOR})
12711269
endif()
12721270
else()
@@ -1371,7 +1369,8 @@ endif()
13711369

13721370
if(BASE AND NOT HARDLINK_GAME)
13731371
if (AROS)
1374-
add_executable(base sys/aros/dll/dllglue.c ${src_game})
1372+
add_executable(base ${src_game} sys/aros/aros_dynmodule.cpp sys/aros/aros_dynmodcommon.cpp)
1373+
target_link_libraries(base idlib dynmodglue)
13751374
set_target_properties(base PROPERTIES OUTPUT_NAME "base.aros-${AROS_ARCH}")
13761375
else()
13771376
add_library(base SHARED ${src_game})
@@ -1385,7 +1384,7 @@ if(BASE AND NOT HARDLINK_GAME)
13851384
set_target_properties(base PROPERTIES LINK_FLAGS "${ldflags}")
13861385
set_target_properties(base PROPERTIES INSTALL_NAME_DIR "@executable_path")
13871386
if (AROS)
1388-
target_link_libraries(base idlib dll)
1387+
target_link_libraries(base idlib dynmod)
13891388
else()
13901389
target_link_libraries(base idlib)
13911390
endif()
@@ -1401,7 +1400,8 @@ endif()
14011400

14021401
if(D3XP AND NOT HARDLINK_GAME)
14031402
if (AROS)
1404-
add_executable(d3xp sys/aros/dll/dllglue.c ${src_d3xp})
1403+
add_executable(d3xp ${src_d3xp} sys/aros/aros_dynmodule.cpp sys/aros/aros_dynmodcommon.cpp)
1404+
target_link_libraries(d3xp dynmodglue)
14051405
set_target_properties(d3xp PROPERTIES OUTPUT_NAME "d3xp.aros-${AROS_ARCH}")
14061406
else()
14071407
add_library(d3xp SHARED ${src_d3xp})
@@ -1413,7 +1413,7 @@ if(D3XP AND NOT HARDLINK_GAME)
14131413
set_target_properties(d3xp PROPERTIES LINK_FLAGS "${ldflags}")
14141414
set_target_properties(d3xp PROPERTIES INSTALL_NAME_DIR "@executable_path")
14151415
if (AROS)
1416-
target_link_libraries(d3xp idlib dll)
1416+
target_link_libraries(d3xp idlib dynmod)
14171417
else()
14181418
target_link_libraries(d3xp idlib)
14191419
endif()

neo/d3xp/MultiplayerGame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ const char *idMultiplayerGame::GameTime() {
861861
t = s / 10;
862862
s -= t * 10;
863863

864-
sprintf( buff, "%i:%i%i", m, t, s );
864+
idStr::snPrintf( buff, sizeof( buff ), "%i:%i%i", m, t, s );
865865
}
866866
return &buff[0];
867867
}

neo/framework/Common.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,7 +2626,16 @@ Helper for LoadGameDLL() to make it less painful to try different dll names.
26262626
*/
26272627
void idCommonLocal::LoadGameDLLbyName( const char *dll, idStr& s ) {
26282628
s.CapLength(0);
2629-
// try next to the binary first (build tree)
2629+
#if defined(__AROS__)
2630+
// check in the launch (mod) directory first on AROS
2631+
if (Sys_GetPath(PATH_LAUNCH, s)) {
2632+
s.AppendPath(dll);
2633+
gameDLL = sys->DLL_Load(s);
2634+
if (gameDLL)
2635+
return;
2636+
}
2637+
#endif
2638+
// try next to the binary
26302639
if (Sys_GetPath(PATH_EXE, s)) {
26312640
// "s = " seems superfluous, but works around g++ 4.7 bug else StripFilename()
26322641
// (and possibly even CapLength()) seems to be "optimized" away and the string contains garbage
@@ -2657,7 +2666,7 @@ void idCommonLocal::LoadGameDLLbyName( const char *dll, idStr& s ) {
26572666
s.AppendPath(dll);
26582667
gameDLL = sys->DLL_Load(s);
26592668
}
2660-
#else
2669+
#elif !defined(__AROS__)
26612670
// then the install folder on *nix
26622671
if (!gameDLL) {
26632672
s = BUILD_LIBDIR;

neo/game/MultiplayerGame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ const char *idMultiplayerGame::GameTime() {
561561
s -= t * 10; // => s < 10
562562
// writing <= 5 for m + 3 bytes for ":ts" + 1 byte for \0 => 16 bytes is enough
563563

564-
sprintf( buff, "%i:%i%i", m, t, s );
564+
idStr::snPrintf( buff, sizeof( buff ), "%i:%i%i", m, t, s );
565565
}
566566
return &buff[0];
567567
}

neo/mmakefile.src

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright � 2012-2017, Nick "Kalamatee" Andrews.
1+
# Copyright � 2012-2025, Nick "Kalamatee" Andrews.
22
# $Id$
33

44
#
@@ -16,39 +16,50 @@ GRAPHITE_CFLAGS := \
1616
-ftree-loop-linear $(CFLAGS_LOOP_STRIP_MINE) $(CFLAGS_LOOP_BLOCK)
1717

1818
NOWARN_FLAGS := $(NOWARN_ERROR) $(NOWARN_MISLEADING_INDENTATION) $(NOWARN_MAYBE_UNINITIALIZED) $(NOWARN_NONNULL_COMPARE) $(NOWARN_ENUM_COMPARE)
19+
NOWARN_CXXFLAGS := $(NOWARN_CLASS_MEMACCESS)
1920

20-
USER_CFLAGS := $(NOWARN_FLAGS)
21+
USER_INCLUDES := -I$(AROS_CONTRIB_INCLUDES)
22+
USER_CFLAGS := $(NOWARN_FLAGS) $(CPPFLAGS)
2123
USER_CXXFLAGS := \
22-
$(CFLAGS_FAST_MATH) -fomit-frame-pointer -fexceptions $(NOWARN_FLAGS)
23-
USER_LDFLAGS := -static-libstdc++
24+
$(CXXFLAGS_GNU11) $(CFLAGS_FAST_MATH) -fomit-frame-pointer $(CFLAG_EXCEPTIONS) $(NOWARN_FLAGS) $(NOWARN_CXXFLAGS) $(CPPFLAGS)
25+
USER_LDFLAGS := -L$(AROS_CONTRIB_LIB) -static-libstdc++
2426

25-
#MM- aros-doom3-libs : workbench-libs-jpeg-linklib contrib-openal-linklib development-libogg development-libvorbis
26-
#MM- aros-doom3-libs : contrib-curl contrib-sdl development-SDL_gfx-quick
27+
#MM- aros-doom3-libs : workbench-libs-jpeg-linklib contrib-openal development-libogg development-libvorbis
28+
#MM- aros-doom3-libs : contrib-curl contrib-sdl2 development-SDL2_gfx-quick
2729

2830
#MM aros-doom3 : aros-doom3-libs iconset-Gorilla-contrib-icons-extras-games-adoom3 iconset-Gorilla-contrib-games-doom3game
2931

30-
DOOM3_OPTIONS := -DCORE=ON -DDEDICATED=ON -DBASE=ON -DSDL2=OFF \
32+
DOOM3_OPTIONS := \
33+
-DCORE=ON \
34+
-DDEDICATED=ON \
35+
-DBASE=ON \
36+
-DCMAKE_CXX_STANDARD=11 \
3137
-DCMAKE_INSTALL_BINDIR= \
3238
-DCMAKE_INSTALL_LIBDIR= \
33-
-DZLIB_LIBRARY=$(AROS_DEVELOPER)/lib/libz.a \
34-
-DZLIB_INCLUDE_DIR=$(AROS_DEVELOPER)/include \
35-
-DJPEG_LIBRARY=$(AROS_DEVELOPER)/lib/libjpeg.a \
36-
-DJPEG_INCLUDE_DIR=$(AROS_DEVELOPER)/include \
37-
-DOPENAL_INCLUDE_DIR=$(AROS_DEVELOPER)/include \
38-
-DOPENAL_LIBRARY="$(AROS_DEVELOPER)/lib/libopenal.a;$(AROS_DEVELOPER)/lib/libpthread.a;" \
39-
-DOGG_LIBRARY=$(AROS_DEVELOPER)/lib/libogg.a \
40-
-DOGG_INCLUDE_DIR=$(AROS_DEVELOPER)/include \
41-
-DVORBIS_LIBRARY=$(AROS_DEVELOPER)/lib/libvorbis.a \
42-
-DVORBIS_INCLUDE_DIR=$(AROS_DEVELOPER)/include \
43-
-DVORBISFILE_LIBRARY=$(AROS_DEVELOPER)/lib/libvorbisfile.a \
44-
-DVORBISFILE_INCLUDE_DIR=$(AROS_DEVELOPER)/include \
45-
-DCURL_LIBRARY="$(AROS_DEVELOPER)/lib/libcurl.a;$(AROS_DEVELOPER)/lib/libiconv.a;$(AROS_DEVELOPER)/lib/libz.a;$(AROS_DEVELOPER)/lib/libssl.a;$(AROS_DEVELOPER)/lib/libcrypto.a;" \
46-
-DCURL_INCLUDE_DIR=$(AROS_DEVELOPER)/include \
47-
-DSDL_LIBRARY=$(AROS_DEVELOPER)/lib/libSDL.a \
48-
-DSDL_INCLUDE_DIR=$(AROS_DEVELOPER)/include/SDL
49-
50-
%build_with_cmake mmake=aros-doom3 \
51-
prefix="$(DOOM3_EXEDIR)" \
52-
extraoptions="$(DOOM3_OPTIONS)"
39+
-DOPENAL_INCLUDE_DIR=$(AROS_INCLUDES) \
40+
-DOPENAL_LIBRARY="$(AROS_LIB)/libopenal.a" \
41+
-DCURL_LIBRARY="$(AROS_LIB)/libcurl.a;$(AROS_CONTRIB_LIB)/libiconv.a;$(AROS_LIB)/libz.a;$(AROS_LIB)/libssl.a;$(AROS_LIB)/libcrypto.a;$(AROS_LIB)/libzstd.a" \
42+
-DCURL_INCLUDE_DIR=$(AROS_INCLUDES) \
43+
-DSDL2_LIBRARY=$(AROS_LIB)/libSDL2.a \
44+
-DSDL2_INCLUDE_DIR=$(AROS_INCLUDES)/SDL2
45+
46+
#DOOM3_OPTIONS += \
47+
# -DCMAKE_VERBOSE_MAKEFILE=ON
48+
49+
# CMAKE_CPP_FLAGS
50+
# JPEG_INCLUDE_DIR
51+
# JPEG_LIBRARY
52+
# OGG_INCLUDE_DIR
53+
# OGG_LIBRARY
54+
# VORBISFILE_INCLUDE_DIR
55+
# VORBISFILE_LIBRARY
56+
# VORBIS_INCLUDE_DIR
57+
# VORBIS_LIBRARY
58+
# ZLIB_INCLUDE_DIR
59+
# ZLIB_LIBRARY
60+
61+
%build_with_cmake mmake=aros-doom3 \
62+
prefix="$(DOOM3_EXEDIR)" \
63+
extraoptions="$(DOOM3_OPTIONS)" usecppflags=no
5364

5465
%common

neo/sys/aros/ADoom3.info.src

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
TYPE = TOOL
2-
STACK = 10000000

neo/sys/aros/ROE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ADoom3 +set fs_game d3xp
2+
If NOT ERROR
3+
EndCLI
4+
EndIf

0 commit comments

Comments
 (0)