-
Notifications
You must be signed in to change notification settings - Fork 36
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
add sdl2_image/2.0.5 and sdl2_mixer/2.0.4 #1317
Merged
Merged
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f2d0a03
add sdl2_mixer/2.0.4
Croydon d8ae643
add sdl2_image/2.0.5
Croydon cf1077b
sdl2_image: cache CMake
Croydon d787333
sdl2_mixer: nit-picking (triggering CI)
Croydon bc36a9b
sdl2_mixer: nit-picking formatting
Croydon 2cd0b85
sdl2_mixer: update test_package
Croydon 52e3422
sdl2_mixer: add more topics
Croydon f1bbe91
sdl2: test if it compiles without patch
Croydon f95dffe
Revert "sdl2: test if it compiles without patch"
Croydon a4a3a0f
sdl2_image: use find_package in test_package
Croydon 53a6f48
sdl2_image: use find_package and targets for linking deps
Croydon b9272d7
update urls
Croydon 90e1d73
migrate libmikmod to CCI
ericLemanissier 0aec28f
update to sdl 2.0.14
Croydon 91a9536
sdl2_image: fix license packaging
Croydon a200b88
sdl2_image: simplify imageio handling
Croydon 2da3cf3
move to versioned folders to prepare for upstream CMake files
Croydon 2d8f407
Update libmpg123
Croydon e8cd753
Migrate tinymidi to CCI version
Croydon b1541f7
Update recipes/sdl2_mixer/2.0.4/conanfile.py
ericLemanissier 45369ff
add DLL_EXPORT for shared libs
ericLemanissier 8cd9757
Rename confusing CMake definition
Croydon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(SDL2_image) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(SDL2 REQUIRED CONFIG) | ||
|
||
macro(add_image_option type) | ||
option(${type} "${type} images support" ON) | ||
if(${type}) | ||
add_definitions("-DLOAD_${type}") | ||
if(${type}_DYNAMIC) | ||
add_definitions("-DLOAD_${type}_DYNAMIC") | ||
endif() | ||
endif() | ||
endmacro() | ||
|
||
if(APPLE) | ||
option(IMAGEIO "use native Mac OS X frameworks for loading images" ON) | ||
if(IMAGEIO) | ||
set(IMAGEIO_SOURCE "source_subfolder/IMG_ImageIO.m") | ||
else() | ||
add_definitions("-DSDL_IMAGE_USE_COMMON_BACKEND") | ||
endif() | ||
endif() | ||
|
||
add_image_option(BMP) | ||
add_image_option(GIF) | ||
add_image_option(JPG) | ||
add_image_option(LBM) | ||
add_image_option(PCX) | ||
add_image_option(PNG) | ||
add_image_option(PNM) | ||
add_image_option(SVG) | ||
add_image_option(TGA) | ||
add_image_option(TIF) | ||
add_image_option(WEBP) | ||
add_image_option(XCF) | ||
add_image_option(XPM) | ||
add_image_option(XV) | ||
|
||
set(SOURCES | ||
source_subfolder/IMG.c | ||
source_subfolder/IMG_bmp.c | ||
source_subfolder/IMG_gif.c | ||
source_subfolder/IMG_jpg.c | ||
source_subfolder/IMG_lbm.c | ||
source_subfolder/IMG_pcx.c | ||
source_subfolder/IMG_png.c | ||
source_subfolder/IMG_pnm.c | ||
source_subfolder/IMG_svg.c | ||
source_subfolder/IMG_tga.c | ||
source_subfolder/IMG_tif.c | ||
source_subfolder/IMG_xcf.c | ||
source_subfolder/IMG_xpm.c | ||
source_subfolder/IMG_xv.c | ||
source_subfolder/IMG_webp.c | ||
${IMAGEIO_SOURCE} | ||
) | ||
|
||
add_library(${PROJECT_NAME} ${SOURCES}) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE "source_subfolder") | ||
|
||
if(${SDL_DYNAMIC}) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2) | ||
else() | ||
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2-static) | ||
endif() | ||
|
||
if(${TIF}) | ||
find_package(TIFF REQUIRED CONFIG) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE TIFF::TIFF) | ||
endif() | ||
|
||
if(${JPG}) | ||
find_package(JPEG REQUIRED CONFIG) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) | ||
endif() | ||
|
||
if(${PNG}) | ||
find_package(PNG REQUIRED CONFIG) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE PNG::PNG) | ||
endif() | ||
|
||
if(${WEBP}) | ||
find_package(WebP REQUIRED CONFIG) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE WebP::webp) | ||
endif() | ||
|
||
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER source_subfolder/SDL_image.h) | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
ARCHIVE DESTINATION "lib" | ||
LIBRARY DESTINATION "lib" | ||
RUNTIME DESTINATION "bin" | ||
PUBLIC_HEADER DESTINATION "include/SDL2" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"2.0.5": | ||
url: "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz" | ||
sha256: "bdd5f6e026682f7d7e1be0b6051b209da2f402a2dd8bd1c4bd9c25ad263108d0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
from conans import ConanFile, tools, CMake | ||
import os | ||
|
||
|
||
class SDL2ImageConan(ConanFile): | ||
name = "sdl2_image" | ||
description = "SDL_image is an image file loading library" | ||
topics = ("sdl2_image", "sdl_image", "sdl2", "sdl", "images", "opengl") | ||
url = "https://github.com/bincrafters/community" | ||
homepage = "https://www.libsdl.org/projects/SDL_image/" | ||
license = "MIT" | ||
exports_sources = ["CMakeLists.txt"] | ||
generators = ["cmake", "cmake_find_package_multi"] | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"bmp": [True, False], | ||
"gif": [True, False], | ||
"lbm": [True, False], | ||
"pcx": [True, False], | ||
"pnm": [True, False], | ||
"svg": [True, False], | ||
"tga": [True, False], | ||
"xcf": [True, False], | ||
"xpm": [True, False], | ||
"xv": [True, False], | ||
"jpg": [True, False], | ||
"tif": [True, False], | ||
"png": [True, False], | ||
"webp": [True, False], | ||
"imageio": [True, False]} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"bmp": True, | ||
"gif": True, | ||
"lbm": True, | ||
"pcx": True, | ||
"pnm": True, | ||
"svg": True, | ||
"tga": True, | ||
"xcf": True, | ||
"xpm": True, | ||
"xv": True, | ||
"jpg": True, | ||
"tif": True, | ||
"png": True, | ||
"webp": True, | ||
"imageio": False | ||
} | ||
|
||
_cmake = None | ||
_source_subfolder = "source_subfolder" | ||
_build_subfolder = "build_subfolder" | ||
|
||
def config_options(self): | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
if self.settings.os != "Macos": | ||
del self.options.imageio | ||
|
||
def requirements(self): | ||
self.requires("sdl2/2.0.14@bincrafters/stable") | ||
if self.options.tif: | ||
self.requires("libtiff/4.0.9") | ||
if self.options.jpg: | ||
self.requires("libjpeg/9d") | ||
if self.options.png: | ||
self.requires("libpng/1.6.37") | ||
if self.options.webp: | ||
self.requires("libwebp/1.0.3") | ||
self.requires("zlib/1.2.11") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
extracted_dir = "SDL2_image-" + self.version | ||
os.rename(extracted_dir, self._source_subfolder) | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
|
||
self._cmake = CMake(self) | ||
self._cmake.definitions["BMP"] = self.options.bmp | ||
self._cmake.definitions["GIF"] = self.options.gif | ||
self._cmake.definitions["IMAGEIO"] = self.options.get_safe("imageio") | ||
self._cmake.definitions["JPG"] = self.options.jpg | ||
self._cmake.definitions["LBM"] = self.options.lbm | ||
self._cmake.definitions["PCX"] = self.options.pcx | ||
self._cmake.definitions["PNG"] = self.options.png | ||
self._cmake.definitions["PNM"] = self.options.pnm | ||
self._cmake.definitions["SVG"] = self.options.svg | ||
self._cmake.definitions["TGA"] = self.options.tga | ||
self._cmake.definitions["TIF"] = self.options.tif | ||
self._cmake.definitions["WEBP"] = self.options.webp | ||
self._cmake.definitions["XCF"] = self.options.xcf | ||
self._cmake.definitions["XPM"] = self.options.xpm | ||
self._cmake.definitions["XV"] = self.options.xv | ||
self._cmake.definitions["TIF_DYNAMIC"] = self.options["libtiff"].shared if self.options.tif else False | ||
self._cmake.definitions["JPG_DYNAMIC"] = self.options["libjpeg"].shared if self.options.jpg else False | ||
self._cmake.definitions["PNG_DYNAMIC"] = self.options["libpng"].shared if self.options.png else False | ||
self._cmake.definitions["WEBP_DYNAMIC"] = self.options["libwebp"].shared if self.options.webp else False | ||
self._cmake.definitions["SDL2_DYNAMIC"] = self.options["sdl2"].shared | ||
|
||
self._cmake.configure(build_dir="build") | ||
return self._cmake | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy(pattern="COPYING.txt", dst="license", src=self._source_subfolder) | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["SDL2_image"] | ||
self.cpp_info.includedirs.append(os.path.join("include", "SDL2")) | ||
# TODO: Add components in a sane way. SDL2_image might be incorrect, as the current dev version uses SDL2::image | ||
# The current dev version is the first version with official CMake support | ||
self.cpp_info.names["cmake_find_package"] = "SDL2_image" | ||
self.cpp_info.names["cmake_find_package_multi"] = "SDL2_image" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(SDL2_image REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} SDL2_image::SDL2_image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <cstdlib> | ||
#include <iostream> | ||
#include "SDL_image.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
SDL_version compile_version; | ||
const SDL_version * link_version=IMG_Linked_Version(); | ||
SDL_IMAGE_VERSION(&compile_version); | ||
std::cout << "SDL2_image compile version: " << | ||
int(compile_version.major) << "." << | ||
int(compile_version.minor) << "." << | ||
int(compile_version.patch) << std::endl; | ||
std::cout << "SDL2_image link version: " << | ||
int(link_version->major) << "." << | ||
int(link_version->minor) << "." << | ||
int(link_version->patch) << std::endl; | ||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"2.0.5": | ||
folder: "2.0.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(sdl2_mixer) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
macro(add_music_option type) | ||
option(${type} "${type} music support" OFF) | ||
message(STATUS "${type} ${${type}}") | ||
if(${${type}}) | ||
add_definitions("-DMUSIC_${type}") | ||
if(${${type}_DYNAMIC}) | ||
add_definitions("-D${type}_DYNAMIC") | ||
endif() | ||
endif() | ||
endmacro() | ||
|
||
add_music_option(CMD) | ||
add_music_option(WAV) | ||
add_music_option(FLAC) | ||
add_music_option(OGG) | ||
add_music_option(OPUS) | ||
add_music_option(MP3_MPG123) | ||
add_music_option(MP3_MAD) | ||
add_music_option(MOD_MIKMOD) | ||
add_music_option(MOD_MODPLUG) | ||
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 | ||
) | ||
|
||
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} | ||
) | ||
|
||
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} | ||
) | ||
|
||
add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS}) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE "source_subfolder") | ||
|
||
if(${MID_NATIVE}) | ||
target_include_directories(${PROJECT_NAME} PRIVATE "source_subfolder/native_midi") | ||
endif() | ||
|
||
target_link_libraries(${PROJECT_NAME} PRIVATE ${CONAN_LIBS}) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER source_subfolder/SDL_mixer.h) | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
ARCHIVE DESTINATION "lib" | ||
LIBRARY DESTINATION "lib" | ||
RUNTIME DESTINATION "bin" | ||
PUBLIC_HEADER DESTINATION "include/SDL2" | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not because libtiff is shared that consumer wants dynamic load. In upstream
configure.in
, there is a specific option (true by default) for each dependency for which sdl2_image supports dynamic load (libtiff, libjpeg, libpng and libwebp).So, you can link to static, to shared, or dynamically load shared.
Moreover, there is no dynamic load of sdl2 in sdl2_image, it's always linked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch. We are currently using a custom CMake file for sdl2_image, only the next version will have official CMake support.
I will rename the
SDL2_DYNAMIC
option name as it only seems to make a switch between static and shared linking. Not entirely sure how to proceed with the rest.Is dynamic loading just working, despite our custom CMake file?
If yes, we don't necessarily need special handling I guess.
If not, it doesn't work right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I see in this custom CMake file, nothing is done with these definitions (except
SDL2_DYNAMIC
, but it's a different purpose and this CMake option could be avoided), so well let's say that the "dynamic" options in upstreamconfigure.in
is not supported for the moment in this recipe.It can't work with this custom CMakeLists, there is an explicit branching with macros for dynamic load handling at runtime:
https://github.com/SDL-mirror/SDL_image/blob/b4f28c1fc9ab2f91ae594fc3e86622c5c13ffbbb/configure.in#L358-L364
https://github.com/SDL-mirror/SDL_image/blob/f4f5caf21d6f18de85baee945348f56697d1813a/IMG_jpg.c#L70-L77