Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed Aug 12, 2022
2 parents 3e63b11 + d18f5fc commit de76af5
Show file tree
Hide file tree
Showing 35 changed files with 372 additions and 65 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/cpp-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- master

jobs:
cpp-linter:
Expand All @@ -26,6 +28,7 @@ jobs:
with:
style: file
lines-changed-only: true
version: 14
tidy-checks: >-
boost-*
,bugprone-*
Expand All @@ -40,4 +43,5 @@ jobs:
- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: exit 1
run: |
echo "Some files failed the linting checks! Fail fast disabled until false posivite issue is fixed"
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,21 @@ else()
"-Wredundant-decls")
endif()

option(ENABLE_SDL2_NET "Enable SDL2_net" On)
option(ENABLE_SDL2_MIXER "Enable SDL2_mixer" On)

find_package(SDL2 2.0.7)
find_package(SDL2_mixer 2.0.2)
find_package(SDL2_net 2.0.0)
if(ENABLE_SDL2_MIXER)
find_package(SDL2_mixer 2.0.2)
else()
add_compile_definitions(DISABLE_SDL2MIXER=1)
endif()

if(ENABLE_SDL2_NET)
find_package(SDL2_net 2.0.0)
else()
add_compile_definitions(DISABLE_SDL2NET=1)
endif()

option(CRISPY_TRUECOLOR "True color rendering" OFF)

Expand Down
19 changes: 17 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,23 @@ then
fi

PKG_CHECK_MODULES(SDL, [sdl2 >= 2.0.7])
PKG_CHECK_MODULES(SDLMIXER, [SDL2_mixer >= 2.0.2])
PKG_CHECK_MODULES(SDLNET, [SDL2_net >= 2.0.0])
# Check for SDL2_mixer
AC_ARG_ENABLE([sdl2mixer],
AS_HELP_STRING([--disable-sdl2mixer], [Disable SDL2_mixer support])
)
AS_IF([test "x$enable_sdl2mixer" != xno], [
PKG_CHECK_MODULES(SDLMIXER, [SDL2_mixer >= 2.0.2])], [
AC_DEFINE([DISABLE_SDL2MIXER], [1], [SDL2_mixer disabled])
])

# Check for networking
AC_ARG_ENABLE([sdl2net],
AS_HELP_STRING([--disable-sdl2net], [Disable SDL2_net support])
)
AS_IF([test "x$enable_sdl2net" != xno], [
PKG_CHECK_MODULES(SDLNET, [SDL2_net >= 2.0.0])], [
AC_DEFINE([DISABLE_SDL2NET], [1], [SDL2_net disabled])
])

# Check for bash-completion.
AC_ARG_ENABLE([bash-completion],
Expand Down
3 changes: 1 addition & 2 deletions data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
EXTRA_DIST= \
README \
doom.ico \
doom8.ico \
doom.png \
setup.ico \
setup8.ico \
setup.png \
wadfile.png \
convert-icon

iconsdir = $(prefix)/share/icons/hicolor/128x128/apps
Expand Down
Binary file removed data/doom8.ico
Binary file not shown.
Binary file removed data/setup8.ico
Binary file not shown.
Binary file added data/wadfile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion opl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ add_library(opl STATIC
target_include_directories(opl
INTERFACE "."
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries(opl SDL2::mixer)
target_link_libraries(opl SDL2::SDL2)
if(ENABLE_SDL2_mixer)
target_link_libraries(opl SDL2::mixer)
endif()
4 changes: 3 additions & 1 deletion opl/opl.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ static opl_driver_t *drivers[] =
#ifdef _WIN32
&opl_win32_driver,
#endif
#ifndef DISABLE_SDL2MIXER
&opl_sdl_driver,
#endif // DISABLE_SDL2MIXER
NULL
};

Expand Down Expand Up @@ -110,7 +112,7 @@ static opl_init_result_t AutoSelectDriver(unsigned int port_base)
int i;
opl_init_result_t result;

for (i=0; drivers[i] != NULL; ++i)
for (i = 0; drivers[i] != NULL; ++i)
{
result = InitDriver(drivers[i], port_base);
if (result != OPL_INIT_NONE)
Expand Down
6 changes: 6 additions & 0 deletions opl/opl_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

#include "opl_queue.h"


#ifndef DISABLE_SDL2MIXER


#define MAX_SOUND_SLICE_TIME 100 /* ms */

typedef struct
Expand Down Expand Up @@ -511,3 +515,5 @@ opl_driver_t opl_sdl_driver =
OPL_SDL_AdjustCallbacks,
};


#endif // DISABLE_SDL2MIXER
5 changes: 4 additions & 1 deletion pcsound/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ add_library(pcsound STATIC
target_include_directories(pcsound
INTERFACE "."
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries(pcsound SDL2::mixer)
target_link_libraries(pcsound SDL2::SDL2)
if(ENABLE_SDL2_mixer)
target_link_libraries(pcsound SDL2::mixer)
endif()
2 changes: 2 additions & 0 deletions pcsound/pcsound.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ static pcsound_driver_t *drivers[] =
#ifdef _WIN32
&pcsound_win32_driver,
#endif
#ifndef DISABLE_SDL2MIXER
&pcsound_sdl_driver,
#endif // DISABLE_SDL2MIXER
NULL,
};

Expand Down
6 changes: 6 additions & 0 deletions pcsound/pcsound_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#include "pcsound.h"
#include "pcsound_internal.h"


#ifndef DISABLE_SDL2MIXER


#define MAX_SOUND_SLICE_TIME 70 /* ms */
#define SQUARE_WAVE_AMP 0x2000

Expand Down Expand Up @@ -248,3 +252,5 @@ pcsound_driver_t pcsound_sdl_driver =
PCSound_SDL_Shutdown,
};


#endif // DISABLE_SDL2MIXER
4 changes: 0 additions & 4 deletions pkg/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@

OSX_FILES= \
osx/Resources/128x128.png \
osx/Resources/app.icns \
osx/Resources/app.png \
osx/Resources/wadfile.icns \
osx/Resources/wadfile.png \
osx/Resources/launcher.nib/designable.nib \
osx/Resources/launcher.nib/keyedobjects.nib \
osx/disk/dir.DS_Store \
Expand Down
4 changes: 4 additions & 0 deletions pkg/osx/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Info.plist
app.iconset
app.icns
wadfile.iconset
wadfile.icns
launcher
*.o
*.d
Expand Down
15 changes: 14 additions & 1 deletion pkg/osx/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ SRC_INFO_PLIST=Info.plist
APP_DOC_DIR=$(APP_BIN_DIR)/Documentation
APP_DOC_RELDIR=$(patsubst $(STAGING_DIR)/%,%,$(APP_DOC_DIR))

$(STAGING_DIR): launcher $(TOPLEVEL_DOCS)
$(STAGING_DIR): launcher $(TOPLEVEL_DOCS) app.icns wadfile.icns
rm -rf $(STAGING_DIR)
mkdir $(STAGING_DIR)

mkdir -p "$(APP_TOP_DIR)"
cp -R Resources "$(APP_TOP_DIR)"
cp app.icns wadfile.icns "$(APP_TOP_DIR)/Resources"
cp $(TOPLEVEL)/data/doom.png "$(APP_TOP_DIR)/Resources/128x128.png"
cp PkgInfo "$(APP_TOP_DIR)"
cp $(SRC_INFO_PLIST) "$(APP_TOP_DIR)"

Expand Down Expand Up @@ -86,9 +88,20 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS)
cp disk/dir.DS_Store $(STAGING_DIR)/.DS_Store
cp disk/background.png $(STAGING_DIR)/background.png

app.icns: $(TOPLEVEL)/data/doom.png
mkdir -p app.iconset
sips -z 64 64 $< --out app.iconset/icon_32x32@2x.png
iconutil -c icns app.iconset

wadfile.icns: $(TOPLEVEL)/data/wadfile.png
mkdir -p wadfile.iconset
sips -z 64 64 $< --out wadfile.iconset/icon_32x32@2x.png
iconutil -c icns wadfile.iconset

clean : launcher_clean
rm -f $(DMG)
rm -rf $(STAGING_DIR)
rm -rf app.icns app.iconset wadfile.icns wadfile.iconset

# Launcher build:
CFLAGS = -Wall -I$(TOPLEVEL)
Expand Down
Binary file removed pkg/osx/Resources/128x128.png
Binary file not shown.
Binary file removed pkg/osx/Resources/app.icns
Binary file not shown.
Binary file removed pkg/osx/Resources/wadfile.icns
Binary file not shown.
Binary file removed pkg/osx/Resources/wadfile.png
Binary file not shown.
21 changes: 18 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ set(DEDSERV_FILES
add_executable("${PROGRAM_PREFIX}server" WIN32 ${COMMON_SOURCE_FILES} ${DEDSERV_FILES})
target_include_directories("${PROGRAM_PREFIX}server"
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries("${PROGRAM_PREFIX}server" SDL2::SDL2main SDL2::net)
target_link_libraries("${PROGRAM_PREFIX}server" SDL2::SDL2main SDL2::SDL2)
if(ENABLE_SDL2_NET)
target_link_libraries("${PROGRAM_PREFIX}server" SDL2::net)
endif()

# Source files used by the game binaries (chocolate-doom, etc.)

Expand Down Expand Up @@ -124,7 +127,13 @@ set(DEHACKED_SOURCE_FILES
set(SOURCE_FILES ${COMMON_SOURCE_FILES} ${GAME_SOURCE_FILES})
set(SOURCE_FILES_WITH_DEH ${SOURCE_FILES} ${DEHACKED_SOURCE_FILES})

set(EXTRA_LIBS SDL2::SDL2main SDL2::SDL2 SDL2::mixer SDL2::net textscreen pcsound opl)
set(EXTRA_LIBS SDL2::SDL2main SDL2::SDL2 textscreen pcsound opl)
if(ENABLE_SDL2_MIXER)
list(APPEND EXTRA_LIBS SDL2::mixer)
endif()
if(ENABLE_SDL2_NET)
list(APPEND EXTRA_LIBS SDL2::net)
endif()
if(SAMPLERATE_FOUND)
list(APPEND EXTRA_LIBS samplerate::samplerate)
endif()
Expand Down Expand Up @@ -216,7 +225,13 @@ endif()

target_include_directories("${PROGRAM_PREFIX}setup"
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
target_link_libraries("${PROGRAM_PREFIX}setup" SDL2::SDL2main SDL2::SDL2 SDL2::mixer SDL2::net setup textscreen)
target_link_libraries("${PROGRAM_PREFIX}setup" SDL2::SDL2main SDL2::SDL2 setup textscreen)
if(ENABLE_SDL2_mixer)
target_link_libraries("${PROGRAM_PREFIX}setup" SDL2::mixer)
endif()
if(ENABLE_SDL2_NET)
target_link_libraries("${PROGRAM_PREFIX}setup" SDL2::net)
endif()

if(MSVC)
set_target_properties("${PROGRAM_PREFIX}setup" PROPERTIES
Expand Down
8 changes: 7 additions & 1 deletion src/doom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,10 @@ add_library(doom STATIC
wi_stuff.c wi_stuff.h)

target_include_directories(doom PRIVATE "../" "${CMAKE_CURRENT_BINARY_DIR}/../../")
target_link_libraries(doom SDL2::SDL2 SDL2::mixer SDL2::net)
target_link_libraries(doom SDL2::SDL2)
if(ENABLE_SDL2_mixer)
target_link_libraries(doom SDL2::mixer)
endif()
if(ENABLE_SDL2_NET)
target_link_libraries(doom SDL2::net)
endif()
8 changes: 7 additions & 1 deletion src/heretic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ add_library(heretic STATIC
s_sound.c s_sound.h)

target_include_directories(heretic PRIVATE "../" "${CMAKE_CURRENT_BINARY_DIR}/../../")
target_link_libraries(heretic textscreen SDL2::SDL2 SDL2::mixer SDL2::net)
target_link_libraries(heretic textscreen SDL2::SDL2)
if(ENABLE_SDL2_mixer)
target_link_libraries(heretic SDL2::mixer)
endif()
if(ENABLE_SDL2_NET)
target_link_libraries(heretic SDL2::net)
endif()
8 changes: 7 additions & 1 deletion src/hexen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,10 @@ add_library(hexen STATIC
xddefs.h)

target_include_directories(hexen PRIVATE "../" "${CMAKE_CURRENT_BINARY_DIR}/../../")
target_link_libraries(hexen SDL2::SDL2 SDL2::mixer SDL2::net)
target_link_libraries(hexen SDL2::SDL2)
if(ENABLE_SDL2_mixer)
target_link_libraries(hexen SDL2::mixer)
endif()
if(ENABLE_SDL2_NET)
target_link_libraries(hexen SDL2::net)
endif()
1 change: 1 addition & 0 deletions src/i_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// SDL implementation of system-specific input interface.
//

#include <string.h>

#include "SDL.h"
#include "SDL_keycode.h"
Expand Down
Loading

1 comment on commit de76af5

@rfomin
Copy link
Collaborator

@rfomin rfomin commented on de76af5 Aug 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiangreffrath How about chocolate-doom#1481 ? @fragglet seems to have approved but not merged. I also wanted to add M_getenv from Woof, without it the M_TempFile function will often fail on Windows (temp is usually in a user directory with an often non-latin name).

Please sign in to comment.