Skip to content

Commit

Permalink
music_xmp.cmake: Move static macros into below
Browse files Browse the repository at this point in the history
Do always define `-DBUILDING_STATIC` (for old versions) and `-DLIBXMP_STATIC` (for recent) macros to fix the linking of the static version of the libxmp. The linking is broken because of the `dllimport()` abuse in the public header that breaks the build and confuses users because of linking errors.
  • Loading branch information
Wohlstand committed Nov 19, 2023
1 parent 37a971d commit 5b39283
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/codecs/music_xmp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ if(USE_XMP)
endif()

elseif(NOT USE_XMP_LITE AND NOT USE_XMP_LITE_ENFORCE)
# AudioCodecs package doesn't include lite version at all
if(WIN32)
list(APPEND SDL_MIXER_DEFINITIONS -DBUILDING_STATIC -DLIBXMP_STATIC)
endif()

if(MSVC)
set(xmplib libxmp-static)
else()
Expand Down Expand Up @@ -85,6 +80,10 @@ if(USE_XMP)
list(APPEND SDL_MIXER_DEFINITIONS -DMUSIC_XMP_MEMORY_ONLY)
endif()

if(WIN32) # Workaround to fix the broken linking of static library, caused by abuse of `dllimport()`
list(APPEND SDL_MIXER_DEFINITIONS -DBUILDING_STATIC -DLIBXMP_STATIC)
endif()

if(USE_XMP_LITE OR USE_XMP_LITE_ENFORCE)
appendTrackerFormats("MOD;XM;S3M;IT")
else()
Expand Down

0 comments on commit 5b39283

Please sign in to comment.