Skip to content

Commit

Permalink
Hook up libchdr to CMakeLists.txt, Android.mk fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Sep 29, 2023
1 parent 64d92c9 commit 1f53d8a
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Expand Up @@ -2317,7 +2317,9 @@ else()
include_directories(ext/zstd/lib)
endif()

target_link_libraries(${CoreLibName} Common native kirk cityhash sfmt19937 xbrz xxhash rcheevos ${GlslangLibs}
include_directories(ext/libchdr/include)

target_link_libraries(${CoreLibName} Common native chdr-static kirk cityhash sfmt19937 xbrz xxhash rcheevos ${GlslangLibs}
${CoreExtraLibs} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS})

if(NOT HTTPS_NOT_AVAILABLE)
Expand Down
2 changes: 1 addition & 1 deletion UI/MainScreen.cpp
Expand Up @@ -846,7 +846,7 @@ void GameBrowser::Refresh() {
}
} else if (!listingPending_) {
std::vector<File::FileInfo> fileInfo;
path_.GetListing(fileInfo, "iso:cso:pbp:elf:prx:ppdmp:");
path_.GetListing(fileInfo, "iso:cso:chd:pbp:elf:prx:ppdmp:");
for (size_t i = 0; i < fileInfo.size(); i++) {
bool isGame = !fileInfo[i].isDirectory;
bool isSaveData = false;
Expand Down
32 changes: 29 additions & 3 deletions android/jni/Android.mk
Expand Up @@ -8,7 +8,7 @@ LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../../ext/cpu_features/include \
$(LOCAL_PATH)/../../ext/rcheevos/include

LOCAL_CFLAGS += -DSTACK_LINE_READER_BUFFER_SIZE=1024 -DHAVE_DLFCN_H -DRC_DISABLE_LUA
LOCAL_CFLAGS += -DSTACK_LINE_READER_BUFFER_SIZE=1024 -DHAVE_DLFCN_H -DRC_DISABLE_LUA -D_7ZIP_ST

# http://software.intel.com/en-us/articles/getting-started-on-optimizing-ndk-project-for-multiple-cpu-architectures

Expand Down Expand Up @@ -113,7 +113,33 @@ VR_FILES := \
$(SRC)/Common/VR/VRMath.cpp \
$(SRC)/Common/VR/VRRenderer.cpp

LZMA_FILES := \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Alloc.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Bcj2.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Bcj2Enc.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Bra.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Bra86.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/CpuArch.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Delta.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/LzFind.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/LzFindOpt.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/LzmaDec.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/LzmaEnc.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Lzma86Dec.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Lzma86Enc.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/LzmaLib.c \
$(SRC)/ext/libchdr/deps/lzma-22.01/src/Sort.c

CHDR_FILES := \
$(SRC)/ext/libchdr/src/libchdr_bitstream.c \
$(SRC)/ext/libchdr/src/libchdr_cdrom.c \
$(SRC)/ext/libchdr/src/libchdr_chd.c \
$(SRC)/ext/libchdr/src/libchdr_flac.c \
$(SRC)/ext/libchdr/src/libchdr_huffman.c

EXT_FILES := \
$(LZMA_FILES) \
$(CHDR_FILES) \
$(SRC)/ext/cityhash/city.cpp \
$(SRC)/ext/libpng17/png.c \
$(SRC)/ext/libpng17/pngerror.c \
Expand Down Expand Up @@ -357,7 +383,7 @@ ARCH_FILES := \
Arm64EmitterTest.cpp
endif

VULKAN_FILES := \
GPU_VULKAN_FILES := \
$(SRC)/GPU/Vulkan/DrawEngineVulkan.cpp \
$(SRC)/GPU/Vulkan/FramebufferManagerVulkan.cpp \
$(SRC)/GPU/Vulkan/GPU_Vulkan.cpp \
Expand All @@ -370,7 +396,7 @@ VULKAN_FILES := \

EXEC_AND_LIB_FILES := \
$(ARCH_FILES) \
$(VULKAN_FILES) \
$(GPU_VULKAN_FILES) \
$(SRC)/ext/xxhash.c \
TestRunner.cpp \
$(SRC)/Core/MIPS/MIPS.cpp.arm \
Expand Down
2 changes: 2 additions & 0 deletions android/jni/Locals.mk
Expand Up @@ -20,6 +20,8 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../ext/armips \
$(LOCAL_PATH)/../../ext/armips/ext/filesystem/include \
$(LOCAL_PATH)/../../ext/armips/ext/tinyformat \
$(LOCAL_PATH)/../../ext/libchdr/deps/lzma-22.01/include \
$(LOCAL_PATH)/../../ext/libchdr/include \
$(LOCAL_PATH)

LOCAL_STATIC_LIBRARIES := libzip glslang-build miniupnp-build
Expand Down
3 changes: 3 additions & 0 deletions ext/CMakeLists.txt
Expand Up @@ -37,3 +37,6 @@ endif()
if(USE_DISCORD AND NOT IOS AND NOT LIBRETRO)
add_subdirectory(discord-rpc-build)
endif()

set(BUILD_SHARED_LIBS OFF)
add_subdirectory(libchdr)
29 changes: 29 additions & 0 deletions libretro/Makefile.common
Expand Up @@ -226,6 +226,35 @@ SOURCES_C += \
COREFLAGS += -DSTACK_LINE_READER_BUFFER_SIZE=1024
COREFLAGS += -DHTTPS_NOT_AVAILABLE

COREFLAGS += -D_7ZIP_ST
INCFLAGS += -I$(EXTDIR)/libchdr/deps/lzma-22.01/include

SOURCES_C += \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Alloc.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Bcj2.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Bcj2Enc.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Bra.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Bra86.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/CpuArch.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Delta.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/LzFind.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/LzFindOpt.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/LzmaDec.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/LzmaEnc.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Lzma86Dec.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Lzma86Enc.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/LzmaLib.c \
$(EXTDIR)/libchdr/deps/lzma-22.01/src/Sort.c

INCFLAGS += -I$(EXTDIR)/libchdr/include

SOURCES_C += \
$(EXTDIR)/libchdr/src/libchdr_bitstream.c \
$(EXTDIR)/libchdr/src/libchdr_cdrom.c \
$(EXTDIR)/libchdr/src/libchdr_chd.c \
$(EXTDIR)/libchdr/src/libchdr_flac.c \
$(EXTDIR)/libchdr/src/libchdr_huffman.c

ifeq ($(PLATFORM_EXT), android)
COREFLAGS += -DHAVE_DLFCN_H
else ifneq ($(PLATFORM_EXT), win32)
Expand Down

0 comments on commit 1f53d8a

Please sign in to comment.