Use system-installed lodepng if BUNDLE_DEPENDENCIES=OFF (#1250)

This commit is contained in:
Ben Young
2025-10-08 12:15:35 -05:00
committed by GitHub
parent d3197d10f7
commit d9a3158f6a
2 changed files with 14 additions and 11 deletions

View File

@@ -240,6 +240,7 @@ if(APPLE)
set(PFS_SRC ${PFS_SRC} ../third_party/physfs/src/physfs_platform_apple.m)
endif()
set(PNG_SRC src/lodepng_wrapper.c)
set(PNG_DEF -DLODEPNG_NO_COMPILE_ALLOCATORS -DLODEPNG_NO_COMPILE_DISK)
set(CHM_SRC ../third_party/c-hashmap/map.c)
set(SBIDI_SRC ../third_party/SheenBidi/Source/SheenBidi.c)
@@ -341,14 +342,6 @@ else()
set_source_files_properties(${CHM_SRC} PROPERTIES COMPILE_FLAGS -std=c99)
endif()
# Unfortunately, it doesn't seem like distros package LodePNG
add_library(lodepng-static STATIC ${PNG_SRC})
target_compile_definitions(lodepng-static PRIVATE
-DLODEPNG_NO_COMPILE_ALLOCATORS
-DLODEPNG_NO_COMPILE_DISK
)
add_library(c-hashmap-static STATIC ${CHM_SRC})
add_library(sheenbidi-static STATIC ${SBIDI_SRC})
@@ -361,12 +354,14 @@ target_include_directories(sheenbidi-static PRIVATE
)
if(BUNDLE_DEPENDENCIES)
list(APPEND STATIC_LIBRARIES physfs-static tinyxml2-static lodepng-static c-hashmap-static faudio-static sheenbidi-static)
list(APPEND STATIC_LIBRARIES lodepng-static physfs-static tinyxml2-static c-hashmap-static faudio-static sheenbidi-static)
else()
list(APPEND STATIC_LIBRARIES lodepng-static c-hashmap-static sheenbidi-static)
list(APPEND STATIC_LIBRARIES c-hashmap-static sheenbidi-static)
endif()
if(BUNDLE_DEPENDENCIES)
add_library(lodepng-static STATIC ${PNG_SRC})
target_compile_definitions(lodepng-static PRIVATE ${PNG_DEF})
add_library(tinyxml2-static STATIC ${XML2_SRC})
add_library(physfs-static STATIC ${PFS_SRC})
target_compile_definitions(physfs-static PRIVATE
@@ -382,7 +377,11 @@ if(BUNDLE_DEPENDENCIES)
target_link_libraries(VVVVVV ${STATIC_LIBRARIES})
else()
target_link_libraries(VVVVVV ${STATIC_LIBRARIES} physfs tinyxml2 FAudio)
target_compile_definitions(VVVVVV PRIVATE
${PNG_DEF}
-DSYSTEM_LODEPNG
)
target_link_libraries(VVVVVV ${STATIC_LIBRARIES} physfs tinyxml2 FAudio lodepng)
endif()

View File

@@ -1,2 +1,6 @@
#ifdef SYSTEM_LODEPNG
#include <lodepng.h>
#else
/* Workaround for being unable to rename lodepng.cpp to lodepng.c */
#include "../../third_party/lodepng/lodepng.cpp"
#endif