Skip to content

Commit

Permalink
Use ZLIB headers correctly in minizip and libpng
Browse files Browse the repository at this point in the history
  • Loading branch information
aufau committed Sep 10, 2024
1 parent cef5b67 commit f711907
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 28 deletions.
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,21 +317,41 @@ endif()
if(UseInternalZLIB)
set(GlobalDefines ${GlobalDefines} "INTERNAL_ZLIB")
add_subdirectory(libs/zlib)
else()
find_package(ZLIB)
if(NOT ZLIB_FOUND)
message(FATAL_ERROR "zlib dev files not found! Install it or set UseInternalZLIB ON")
endif()
endif()

if(UseInternalMiniZip)
set(GlobalDefines ${GlobalDefines} "INTERNAL_MINIZIP")
add_subdirectory(libs/minizip)
else()
find_package(MiniZip)
if(NOT MINIZIP_FOUND)
message(FATAL_ERROR "minizip dev files not found! Install it or set UseInternalMiniZip ON")
endif()
endif()

if(UseInternalJPEG)
set(GlobalDefines ${GlobalDefines} "INTERNAL_JPEG")
add_subdirectory(libs/jpeg-9a)
else()
find_package(JPEG)
if(NOT JPEG_FOUND)
message(FATAL_ERROR "libjpeg dev files not found! Install it or set UseInternalJPEG ON")
endif()
endif()

if(UseInternalPNG)
set(GlobalDefines ${GlobalDefines} "INTERNAL_PNG")
add_subdirectory(libs/libpng)
else()
find_package(PNG)
if(NOT PNG_FOUND)
message(FATAL_ERROR "libpng dev files not found! Install it or set UseInternalPNG ON")
endif()
endif()

add_subdirectory(libs/mongoose)
Expand Down
4 changes: 1 addition & 3 deletions libs/libpng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

# This only has effect in this directory (lib/png).
include_directories(include/)
if(UseInternalZLIB)
include_directories(${ZLIB_INCLUDE_DIRS})
endif(UseInternalZLIB)
include_directories(${ZLIB_INCLUDE_DIRS})

if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
Expand Down
2 changes: 1 addition & 1 deletion libs/minizip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# The current bundled copy comes from the zlib 1.2.8 release.

# These settings only apply to this directory.
include_directories(${ZLIB_INCLUDE_DIRS})
include_directories(include/minizip)
include_directories(${ZLIB_INCLUDE_DIRS})

if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
Expand Down
24 changes: 0 additions & 24 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,9 @@ if (BuildMVMP OR BuildMVDED)
endif()

# zlib
if(NOT UseInternalZLIB)
find_package(ZLIB)
if(NOT ZLIB_FOUND)
message(FATAL_ERROR "zlib dev files not found! Install it or set UseInternalZLIB ON")
endif()
endif()
set(MVMPDEDIncludeDirs ${MVMPDEDIncludeDirs} ${ZLIB_INCLUDE_DIRS})

# minizip
if(NOT UseInternalMiniZip)
find_package(MiniZip)
if(NOT MINIZIP_FOUND)
message(FATAL_ERROR "minizip dev files not found! Install it or set UseInternalMiniZip ON")
endif()
endif()
set(MVMPDEDIncludeDirs ${MVMPDEDIncludeDirs} ${MINIZIP_INCLUDE_DIRS})

# Source
Expand Down Expand Up @@ -325,21 +313,9 @@ if (BuildMVMP)
set(MVMPIncludeDirs ${MVMPIncludeDirs} "${LIBDir}/eax")

# JPEG
if(NOT UseInternalJPEG)
find_package(JPEG)
if(NOT JPEG_FOUND)
message(FATAL_ERROR "libjpeg dev files not found! Install it or set UseInternalJPEG ON")
endif()
endif()
set(MVMPIncludeDirs ${MVMPIncludeDirs} ${JPEG_INCLUDE_DIR})

# PNG
if(NOT UseInternalPNG)
find_package(PNG)
if(NOT PNG_FOUND)
message(FATAL_ERROR "libpng dev files not found! Install it or set UseInternalPNG ON")
endif()
endif()
set(MVMPIncludeDirs ${MVMPIncludeDirs} ${PNG_INCLUDE_DIRS})

# Source
Expand Down

0 comments on commit f711907

Please sign in to comment.