Skip to content

Commit

Permalink
Fix mingw build + copy d3drm from wine (#25)
Browse files Browse the repository at this point in the history
* Fix engineConfig declaration crossing jump

This fixes the following error:
```
/src/isle-portable/LEGO1/omni/src/audio/mxsoundmanager.cpp: In member function 'virtual MxResult MxSoundManager::Create(MxU32, MxBool)':
/src/isle-portable/LEGO1/omni/src/audio/mxsoundmanager.cpp:119:1: error: jump to label 'done'
  119 | done:
      | ^~~~
/src/isle-portable/LEGO1/omni/src/audio/mxsoundmanager.cpp:78:22: note:   from here
   78 |                 goto done;
      |                      ^~~~
/src/isle-portable/LEGO1/omni/src/audio/mxsoundmanager.cpp:84:26: note:   crosses initialization of 'ma_engine_config engineConfig'
   84 |         ma_engine_config engineConfig = ma_engine_config_init();
      |                          ^~~~~~~~~~~~
```

* Fix 'invalid conversion from 'SDL_FunctionPointer' {aka 'void (*)()'} to 'void*'

* /SAFESEH:NO is a VC thing

* SDL3 is still instable

* Cannot forward declare and use enum

* Remove MusicManager from public LEGO1.DLL interface

* Copy d3d from wine git 6c5d17af07a318d754c0c21023b2d162a0d3725d

* Build d3drm-wine with 32-bit mingw

* cmake: move 3rd party targets to cmake script in 3rdparty directory

* cmake: bump minimum required CMake version to 3.25 to allow adding a subproject with SYSTEM automatically applied

An alternative would be to use SYSTEM in target_include_directories in the 3rd party cmake script.

* Add a minimal Findiniparser.cmake (not all distributions carry the upstream iniparser-config.cmake files)

* Add wine's d3drm headers

* cmake: merge ISLE_USE_DX5_LIBS into ISLE_USE_DX5

* cmake: Build all shared libraries in the binary output directory (to avoid PATH issues)

* ci: enable msys2 mingw32 build

* Disable clang-tidy on d3drm wine

* Thread functions must have SDLCALL call convention

* cmake: disable clang-tidy for miniaudio and libsmacker as well

* Hopefully fix c++ format and skip ncc naming violation

* clang-format violations keep up popping out of nowhere

* No need for lego/legoomni/include

* ncc: define SDLCALL as empty instead
  • Loading branch information
madebr authored Jun 24, 2024
1 parent 07e65a2 commit e7fb67b
Show file tree
Hide file tree
Showing 38 changed files with 23,460 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
toolchain:
- { name: 'MSVC', shell: 'sh', setup-cmake: true, setup-ninja: true, setup-msvc: true }
# TODO: Add back eventually, but exclude 3rdparty code from warnings as errors
# - { name: 'msys2 mingw32', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true }
- { name: 'msys2 mingw32', shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, clang-tidy: true, werror: true, no-dx5-libs: true }
# - { name: 'msys2 clang32', shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, clang-tidy: true, werror: true, no-dx5-libs: true }

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/naming.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
--recurse \
--style tools/ncc/ncc.style \
--skip tools/ncc/skip.yml \
--definition WINAPI FAR BOOL CALLBACK HWND__=HWND \
--definition WINAPI FAR BOOL CALLBACK HWND__=HWND SDLCALL \
--include \
util \
LEGO1 \
Expand Down
26 changes: 26 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
set(CMAKE_C_CLANG_TIDY)

add_library(miniaudio STATIC
miniaudio/extras/miniaudio_split/miniaudio.c
)
target_include_directories(miniaudio PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/miniaudio/extras/miniaudio_split")
set_property(TARGET miniaudio PROPERTY ARCHIVE_OUTPUT_NAME "miniaudio$<$<CONFIG:Debug>:d>")
# Disable most features since we don't need them.
target_compile_definitions(miniaudio PUBLIC
MA_ENABLE_ONLY_SPECIFIC_BACKENDS
MA_NO_DECODING
MA_NO_ENCODING
MA_NO_WAV
MA_NO_FLAC
MA_NO_MP3
MA_NO_DEVICE_IO
MA_NO_RESOURCE_MANAGER
MA_NO_GENERATION
MA_NO_THREADING
)

add_library(libsmacker STATIC
libsmacker/smacker.c
)
set_property(TARGET libsmacker PROPERTY ARCHIVE_OUTPUT_NAME "libsmacker$<$<CONFIG:Debug>:d>")
target_include_directories(libsmacker PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/libsmacker")
30 changes: 30 additions & 0 deletions 3rdparty/d3drm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
project(wine_d3drm LANGUAGES C)

set(CMAKE_C_CLANG_TIDY)

add_library(d3drm-wine SHARED EXCLUDE_FROM_ALL
d3drm.c
d3drm_main.c
d3drm_private.h
d3drm.spec
device.c
face.c
frame.c
light.c
material.c
math.c
meshbuilder.c
texture.c
version.rc
viewport.c

d3drm.def
)
target_include_directories(d3drm-wine SYSTEM INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include")
target_link_libraries(d3drm-wine PRIVATE d3dxof ddraw)
set_property(TARGET d3drm-wine PROPERTY PREFIX "")
set_property(TARGET d3drm-wine PROPERTY OUTPUT_NAME "d3drm")
target_compile_definitions(d3drm-wine PRIVATE "__WINESRC__")
target_compile_definitions(d3drm-wine PRIVATE "WINE_NO_TRACE_MSGS")
target_compile_definitions(d3drm-wine PRIVATE "WINE_NO_DEBUG_MSGS")
target_compile_definitions(d3drm-wine PRIVATE "DECLSPEC_EXPORT=")
502 changes: 502 additions & 0 deletions 3rdparty/d3drm/COPYING.LIB

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions 3rdparty/d3drm/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
MODULE = d3drm.dll
IMPORTLIB = d3drm
IMPORTS = d3dxof ddraw

EXTRADLLFLAGS = -Wb,--prefer-native

SOURCES = \
d3drm.c \
d3drm_main.c \
device.c \
face.c \
frame.c \
light.c \
material.c \
math.c \
meshbuilder.c \
texture.c \
version.rc \
viewport.c
Loading

0 comments on commit e7fb67b

Please sign in to comment.