Support opening JXL images (#24)

* Update SDL_image on linux+windows

Partially reverts "add -O3 to CFLAGS for dependencies"

This partially reverts commit 79bae839de.

* Enable JXL in SDL2_image
This commit is contained in:
Splendide Imaginarius 2023-10-09 03:04:50 +00:00 committed by GitHub
parent 55ce4828bc
commit 4d7a4bff7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 66 deletions

View file

@ -181,20 +181,6 @@ $(DOWNLOADS)/libpng/Makefile: $(DOWNLOADS)/libpng/configure
$(DOWNLOADS)/libpng/configure: $(DOWNLOADS)/libpng/configure:
$(CLONE) $(GITHUB)/mkxp-z/libpng $(DOWNLOADS)/libpng $(CLONE) $(GITHUB)/mkxp-z/libpng $(DOWNLOADS)/libpng
# libjpeg
libjpeg: init_dirs $(LIBDIR)/libjpeg.a
$(LIBDIR)/libjpeg.a: $(DOWNLOADS)/libjpeg/cmakebuild/Makefile
cd $(DOWNLOADS)/libjpeg/cmakebuild; \
make -j$(NPROC); make install
$(DOWNLOADS)/libjpeg/cmakebuild/Makefile: $(DOWNLOADS)/libjpeg/CMakeLists.txt
cd $(DOWNLOADS)/libjpeg; mkdir -p cmakebuild; cd cmakebuild; \
$(CMAKE) -DENABLE_SHARED=no -DENABLE_STATIC=yes
$(DOWNLOADS)/libjpeg/CMakeLists.txt:
$(CLONE) $(GITHUB)/mkxp-z/libjpeg-turbo $(DOWNLOADS)/libjpeg
# SDL2 # SDL2
sdl2: init_dirs $(LIBDIR)/libSDL2.a sdl2: init_dirs $(LIBDIR)/libSDL2.a
@ -212,26 +198,29 @@ $(DOWNLOADS)/sdl2/configure: $(DOWNLOADS)/sdl2/autogen.sh
$(DOWNLOADS)/sdl2/autogen.sh: $(DOWNLOADS)/sdl2/autogen.sh:
$(CLONE) $(GITHUB)/mkxp-z/SDL $(DOWNLOADS)/sdl2 -b mkxp-z $(CLONE) $(GITHUB)/mkxp-z/SDL $(DOWNLOADS)/sdl2 -b mkxp-z
# SDL2 (Image) # SDL_image
sdl2image: init_dirs sdl2 libpng libjpeg $(LIBDIR)/libSDL2_image.a sdl2image: init_dirs sdl2 $(LIBDIR)/libSDL2_image.a
$(LIBDIR)/libSDL2_image.a: $(DOWNLOADS)/sdl2_image/Makefile $(LIBDIR)/libSDL2_image.a: $(DOWNLOADS)/sdl2_image/cmakebuild/Makefile
cd $(DOWNLOADS)/sdl2_image; \ cd $(DOWNLOADS)/sdl2_image/cmakebuild; \
make -j$(NPROC); make install make -j$(NPROC); make install
$(DOWNLOADS)/sdl2_image/Makefile: $(DOWNLOADS)/sdl2_image/configure $(DOWNLOADS)/sdl2_image/cmakebuild/Makefile: $(DOWNLOADS)/sdl2_image/CMakeLists.txt
cd $(DOWNLOADS)/sdl2_image; mkdir -p cmakebuild; cd cmakebuild; \
$(CMAKE) \
-DBUILD_SHARED_LIBS=no \
-DSDL2IMAGE_JPG_SAVE=yes \
-DSDL2IMAGE_PNG_SAVE=yes \
-DSDL2IMAGE_PNG_SHARED=no \
-DSDL2IMAGE_JPG_SHARED=no \
-DSDL2IMAGE_JXL=yes \
-DSDL2IMAGE_JXL_SHARED=no \
-DSDL2IMAGE_VENDORED=yes
$(DOWNLOADS)/sdl2_image/CMakeLists.txt:
$(CLONE) $(GITHUB)/mkxp-z/SDL_image $(DOWNLOADS)/sdl2_image -b mkxp-z; \
cd $(DOWNLOADS)/sdl2_image; \ cd $(DOWNLOADS)/sdl2_image; \
LIBPNG_LIBS="-L$(LIBDIR) -lpng" LIBPNG_CFLAGS="-I$(INCLUDEDIR)" \ ./external/download.sh
$(CONFIGURE) --enable-static=true --enable-shared=false \
--enable-png=yes --enable-png-shared=no \
--enable-jpg=yes --enable-jpg-shared=no \
--enable-webp=no $(SDL2_IMAGE_FLAGS)
$(DOWNLOADS)/sdl2_image/configure: $(DOWNLOADS)/sdl2_image/autogen.sh
cd $(DOWNLOADS)/sdl2_image; ./autogen.sh
$(DOWNLOADS)/sdl2_image/autogen.sh:
$(CLONE) $(GITHUB)/mkxp-z/SDL_image_old $(DOWNLOADS)/sdl2_image -b mkxp-z
# SDL_sound # SDL_sound
sdlsound: init_dirs sdl2 libogg libvorbis $(LIBDIR)/libSDL2_sound.a sdlsound: init_dirs sdl2 libogg libvorbis $(LIBDIR)/libSDL2_sound.a
@ -353,5 +342,5 @@ powerwash: clean-downloads
clean-downloads: clean-downloads:
-rm -rf downloads -rm -rf downloads
deps-core: libtheora libvorbis pixman libpng libjpeg physfs sdl2 sdl2image sdlsound sdl2ttf openal openssl fluidsynth uchardet iconv deps-core: libtheora libvorbis pixman libpng physfs sdl2 sdl2image sdlsound sdl2ttf openal openssl fluidsynth uchardet iconv
everything: deps-core ruby everything: deps-core ruby

View file

@ -208,7 +208,9 @@ $(DOWNLOADS)/sdl2_image/cmakebuild/Makefile: $(DOWNLOADS)/sdl2_image/CMakeLists.
-DSDL2IMAGE_JPG_SAVE=yes \ -DSDL2IMAGE_JPG_SAVE=yes \
-DSDL2IMAGE_PNG_SAVE=yes \ -DSDL2IMAGE_PNG_SAVE=yes \
-DSDL2IMAGE_PNG_SHARED=no \ -DSDL2IMAGE_PNG_SHARED=no \
-DSDL2IMAGE_JPG_SHARED=no \ -DSDL2IMAGE_JPG_SHARED=no \
-DSDL2IMAGE_JXL=yes \
-DSDL2IMAGE_JXL_SHARED=no \
-DSDL2IMAGE_BACKEND_IMAGEIO=no -DSDL2IMAGE_BACKEND_IMAGEIO=no

View file

@ -8,10 +8,9 @@ sdl2 = dependency('SDL2', static: build_static)
sdl_sound = compilers['cpp'].find_library('SDL2_sound') sdl_sound = compilers['cpp'].find_library('SDL2_sound')
sdl2_ttf = dependency('SDL2_ttf', static: build_static) sdl2_ttf = dependency('SDL2_ttf', static: build_static)
freetype = dependency('freetype2', static: build_static) freetype = dependency('freetype2', static: build_static)
sdl2_image = dependency('SDL2_image', static: build_static) sdl2_image = dependency('SDL2_image', modules: ['SDL2_image::SDL2_image-static', 'SDL2_image::brotlidec-static', 'SDL2_image::brotlicommon-static', 'SDL2_image::hwy', 'SDL2_image::jxl_dec-static'])
pixman = dependency('pixman-1', static: build_static) pixman = dependency('pixman-1', static: build_static)
png = dependency('libpng', static: build_static) png = dependency('libpng', static: build_static)
jpeg = dependency('libjpeg', static: build_static)
zlib = dependency('zlib', static: build_static) zlib = dependency('zlib', static: build_static)
uchardet = dependency('uchardet', static: build_static) uchardet = dependency('uchardet', static: build_static)
@ -83,7 +82,7 @@ global_include_dirs += include_directories('.',
'util', 'util/sigslot', 'util/sigslot/adapter' 'util', 'util/sigslot', 'util/sigslot/adapter'
) )
global_dependencies += [openal, zlib, bz2, sdl2, sdl_sound, pixman, physfs, theora, vorbisfile, vorbis, ogg, sdl2_ttf, freetype, sdl2_image, png, jpeg, iconv, uchardet] global_dependencies += [openal, zlib, bz2, sdl2, sdl_sound, pixman, physfs, theora, vorbisfile, vorbis, ogg, sdl2_ttf, freetype, sdl2_image, png, iconv, uchardet]
if host_system == 'windows' if host_system == 'windows'
global_dependencies += compilers['cpp'].find_library('wsock32') global_dependencies += compilers['cpp'].find_library('wsock32')
endif endif

View file

@ -151,20 +151,6 @@ $(DOWNLOADS)/libpng/Makefile: $(DOWNLOADS)/libpng/configure
$(DOWNLOADS)/libpng/configure: $(DOWNLOADS)/libpng/configure:
$(CLONE) $(GITHUB)/mkxp-z/libpng $(DOWNLOADS)/libpng $(CLONE) $(GITHUB)/mkxp-z/libpng $(DOWNLOADS)/libpng
# libjpeg
libjpeg: init_dirs $(LIBDIR)/libjpeg.a
$(LIBDIR)/libjpeg.a: $(DOWNLOADS)/libjpeg/cmakebuild/Makefile
cd $(DOWNLOADS)/libjpeg/cmakebuild; \
make -j$(NPROC); make install
$(DOWNLOADS)/libjpeg/cmakebuild/Makefile: $(DOWNLOADS)/libjpeg/CMakeLists.txt
cd $(DOWNLOADS)/libjpeg; mkdir -p cmakebuild; cd cmakebuild; \
$(CMAKE) -DENABLE_SHARED=no -DENABLE_STATIC=yes
$(DOWNLOADS)/libjpeg/CMakeLists.txt:
$(CLONE) $(GITHUB)/mkxp-z/libjpeg-turbo $(DOWNLOADS)/libjpeg
# uchardet # uchardet
uchardet: init_dirs $(LIBDIR)/libuchardet.a uchardet: init_dirs $(LIBDIR)/libuchardet.a
@ -197,26 +183,29 @@ $(DOWNLOADS)/sdl2/configure: $(DOWNLOADS)/sdl2/autogen.sh
$(DOWNLOADS)/sdl2/autogen.sh: $(DOWNLOADS)/sdl2/autogen.sh:
$(CLONE) $(GITHUB)/mkxp-z/SDL $(DOWNLOADS)/sdl2 -b mkxp-z $(CLONE) $(GITHUB)/mkxp-z/SDL $(DOWNLOADS)/sdl2 -b mkxp-z
# SDL2 (Image) # SDL_image
sdl2image: init_dirs sdl2 libpng libjpeg $(LIBDIR)/libSDL2_image.a sdl2image: init_dirs sdl2 $(LIBDIR)/libSDL2_image.a
$(LIBDIR)/libSDL2_image.a: $(DOWNLOADS)/sdl2_image/Makefile $(LIBDIR)/libSDL2_image.a: $(DOWNLOADS)/sdl2_image/cmakebuild/Makefile
cd $(DOWNLOADS)/sdl2_image; \ cd $(DOWNLOADS)/sdl2_image/cmakebuild; \
make -j$(NPROC); make install make -j$(NPROC); make install
$(DOWNLOADS)/sdl2_image/Makefile: $(DOWNLOADS)/sdl2_image/configure $(DOWNLOADS)/sdl2_image/cmakebuild/Makefile: $(DOWNLOADS)/sdl2_image/CMakeLists.txt
cd $(DOWNLOADS)/sdl2_image; mkdir -p cmakebuild; cd cmakebuild; \
$(CMAKE) \
-DBUILD_SHARED_LIBS=no \
-DSDL2IMAGE_JPG_SAVE=yes \
-DSDL2IMAGE_PNG_SAVE=yes \
-DSDL2IMAGE_PNG_SHARED=no \
-DSDL2IMAGE_JPG_SHARED=no \
-DSDL2IMAGE_JXL=yes \
-DSDL2IMAGE_JXL_SHARED=no \
-DSDL2IMAGE_VENDORED=yes
$(DOWNLOADS)/sdl2_image/CMakeLists.txt:
$(CLONE) $(GITHUB)/mkxp-z/SDL_image $(DOWNLOADS)/sdl2_image -b mkxp-z; \
cd $(DOWNLOADS)/sdl2_image; \ cd $(DOWNLOADS)/sdl2_image; \
LIBPNG_LIBS="-L$(LIBDIR) -lpng" LIBPNG_CFLAGS="-I$(INCLUDEDIR)" \ ./external/download.sh
$(CONFIGURE) --enable-static=true --enable-shared=false \
--enable-png=yes --enable-png-shared=no \
--enable-jpg=yes --enable-jpg-shared=no \
--enable-webp=no $(SDL2_IMAGE_FLAGS)
$(DOWNLOADS)/sdl2_image/configure: $(DOWNLOADS)/sdl2_image/autogen.sh
cd $(DOWNLOADS)/sdl2_image; ./autogen.sh
$(DOWNLOADS)/sdl2_image/autogen.sh:
$(CLONE) $(GITHUB)/mkxp-z/SDL_image_old $(DOWNLOADS)/sdl2_image -b mkxp-z
# SDL_sound # SDL_sound
sdlsound: init_dirs sdl2 libogg libvorbis $(LIBDIR)/libSDL2_sound.a sdlsound: init_dirs sdl2 libogg libvorbis $(LIBDIR)/libSDL2_sound.a
@ -341,5 +330,5 @@ powerwash: clean-downloads
clean-downloads: clean-downloads:
-rm -rf downloads -rm -rf downloads
deps-core: libtheora libvorbis pixman libpng libjpeg physfs sdl2 sdl2image sdlsound sdl2ttf openal openssl fluidsynth uchardet deps-core: libtheora libvorbis pixman libpng physfs sdl2 sdl2image sdlsound sdl2ttf openal openssl fluidsynth uchardet
everything: deps-core ruby everything: deps-core ruby