Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdl_mixer/all: migrate to Conan v2 #18836

Merged
merged 8 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 69 additions & 70 deletions recipes/sdl_mixer/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.15)
project(sdl2_mixer)

include(conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

include(CheckTypeSize)

macro(add_music_option type)
option(${type} "${type} music support" OFF)
message(STATUS "${type} ${${type}}")
if(${${type}})
if(${type})
add_definitions("-DMUSIC_${type}")
if(${${type}_DYNAMIC})
add_definitions("-D${type}_DYNAMIC")
endif()
endif()
endmacro()

Expand All @@ -30,73 +24,78 @@ add_music_option(MID_NATIVE)
add_music_option(MID_FLUIDSYNTH)
add_music_option(MID_TINYMIDI)

if(${MID_NATIVE})

set(NATIVE_MIDI_SOURCES
source_subfolder/native_midi/native_midi_common.c
source_subfolder/native_midi/native_midi_common.h
source_subfolder/native_midi/native_midi_haiku.cpp
source_subfolder/native_midi/native_midi_mac.c
source_subfolder/native_midi/native_midi_macosx.c
source_subfolder/native_midi/native_midi_win32.c
)

set(NATIVE_MIDI_HEADERS
source_subfolder/native_midi/native_midi.h
)

if(MIDI_NATIVE)
set(NATIVE_MIDI_SOURCES
src/native_midi/native_midi_common.c
src/native_midi/native_midi_common.h
src/native_midi/native_midi_haiku.cpp
src/native_midi/native_midi_mac.c
src/native_midi/native_midi_macosx.c
src/native_midi/native_midi_win32.c
)

set(NATIVE_MIDI_HEADERS
src/native_midi/native_midi.h
)
endif()

set(SOURCES
source_subfolder/effect_position.c
source_subfolder/effect_stereoreverse.c
source_subfolder/effects_internal.c
source_subfolder/load_aiff.c
source_subfolder/load_voc.c
source_subfolder/mixer.c
source_subfolder/music.c
source_subfolder/music_cmd.c
source_subfolder/music_flac.c
source_subfolder/music_fluidsynth.c
source_subfolder/music_mad.c
source_subfolder/music_mikmod.c
source_subfolder/music_modplug.c
source_subfolder/music_mpg123.c
source_subfolder/music_nativemidi.c
source_subfolder/music_ogg.c
source_subfolder/music_opus.c
source_subfolder/music_timidity.c
source_subfolder/music_wav.c
${NATIVE_MIDI_SOURCES}
src/effect_position.c
src/effect_stereoreverse.c
src/effects_internal.c
src/load_aiff.c
src/load_voc.c
src/mixer.c
src/music.c
src/music_cmd.c
src/music_flac.c
src/music_fluidsynth.c
src/music_mad.c
src/music_mikmod.c
src/music_modplug.c
src/music_mpg123.c
src/music_nativemidi.c
src/music_ogg.c
src/music_opus.c
src/music_timidity.c
src/music_wav.c
${NATIVE_MIDI_SOURCES}
)

set(HEADERS
source_subfolder/effects_internal.h
source_subfolder/load_aiff.h
source_subfolder/load_voc.h
source_subfolder/mixer.h
source_subfolder/music.h
source_subfolder/music_cmd.h
source_subfolder/music_flac.h
source_subfolder/music_fluidsynth.h
source_subfolder/music_mad.h
source_subfolder/music_mikmod.h
source_subfolder/music_modplug.h
source_subfolder/music_mpg123.h
source_subfolder/music_nativemidi.h
source_subfolder/music_ogg.h
source_subfolder/music_opus.h
source_subfolder/music_timidity.h
source_subfolder/music_wav.h
${NATIVE_MIDI_HEADERS}
src/effects_internal.h
src/load_aiff.h
src/load_voc.h
src/mixer.h
src/music.h
src/music_cmd.h
src/music_flac.h
src/music_fluidsynth.h
src/music_mad.h
src/music_mikmod.h
src/music_modplug.h
src/music_mpg123.h
src/music_nativemidi.h
src/music_ogg.h
src/music_opus.h
src/music_timidity.h
src/music_wav.h
${NATIVE_MIDI_HEADERS}
)

add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})

target_include_directories(${PROJECT_NAME} PRIVATE "source_subfolder")
target_include_directories(${PROJECT_NAME} PRIVATE "src")

if(${MID_NATIVE})
target_include_directories(${PROJECT_NAME} PRIVATE "source_subfolder/native_midi")
if(MIDI_NATIVE)
target_include_directories(${PROJECT_NAME} PRIVATE "src/native_midi")
if(APPLE)
# https://github.com/libsdl-org/SDL_mixer/blob/release-2.0.4/configure.in#L380
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework AudioToolbox" "-framework AudioUnit" "-framework CoreServices")
elseif(WIN32)
# https://github.com/libsdl-org/SDL_mixer/blob/release-2.0.4/configure.in#L376
target_link_libraries(${PROJECT_NAME} PRIVATE winmm)
endif()
endif()

find_package(SDL2 CONFIG REQUIRED)
Expand Down Expand Up @@ -146,9 +145,9 @@ if(MID_TINYMIDI)
target_link_libraries(${PROJECT_NAME} PRIVATE tinymidi::tinymidi)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER source_subfolder/SDL_mixer.h)
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER src/SDL_mixer.h)

if(${BUILD_SHARED_LIBS})
if(BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_NAME} PRIVATE DLL_EXPORT)
endif()

Expand All @@ -160,8 +159,8 @@ if(SSIZE_T STREQUAL "")
endif()

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION "lib"
LIBRARY DESTINATION "lib"
RUNTIME DESTINATION "bin"
PUBLIC_HEADER DESTINATION "include/SDL2"
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include/SDL2
)
Loading
Loading