mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-20 18:02:12 +00:00
(RPNG) Make imlib2 optional
This commit is contained in:
parent
1f2db14c2d
commit
33c818cf81
@ -1,4 +1,12 @@
|
||||
TARGET := rpng
|
||||
HAVE_IMLIB2=1
|
||||
|
||||
LDFLAGS += -lz
|
||||
|
||||
ifeq ($(HAVE_IMLIB2),1)
|
||||
CFLAGS += -DHAVE_IMLIB2
|
||||
LDFLAGS += -lImlib2
|
||||
endif
|
||||
|
||||
SOURCES := rpng.c rpng_test.c ../../file/nbio/nbio_stdio.c
|
||||
OBJS := $(SOURCES:.c=.o)
|
||||
@ -11,7 +19,7 @@ all: $(TARGET)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(CC) -o $@ $^ $(LDFLAGS) -lz -lImlib2
|
||||
$(CC) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) $(OBJS)
|
||||
|
@ -25,11 +25,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_IMLIB2
|
||||
#include <Imlib2.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef HAVE_IMLIB2
|
||||
Imlib_Image img;
|
||||
const uint32_t *imlib_data = NULL;
|
||||
#endif
|
||||
const uint32_t test_data[] = {
|
||||
0xff000000 | 0x50, 0xff000000 | 0x80,
|
||||
0xff000000 | 0x40, 0xff000000 | 0x88,
|
||||
@ -43,7 +48,6 @@ int main(int argc, char *argv[])
|
||||
uint32_t *data = NULL;
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
const uint32_t *imlib_data = NULL;
|
||||
const char *in_path = "/tmp/test.png";
|
||||
|
||||
if (argc > 2)
|
||||
@ -76,6 +80,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IMLIB2
|
||||
/* Validate with imlib2 as well. */
|
||||
img = imlib_load_image(in_path);
|
||||
if (!img)
|
||||
@ -106,6 +111,7 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "Imlib and RPNG are equivalent!\n");
|
||||
|
||||
imlib_free_image();
|
||||
#endif
|
||||
free(data);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user