Make in-tree zlib more robust.

pull/4/head
whitequark 2015-12-26 14:30:56 +08:00
parent 4d5a92e9b2
commit 1b6cd0d632
3 changed files with 18 additions and 14 deletions

1
.gitmodules vendored
View File

@ -1,6 +1,7 @@
[submodule "extlib/zlib"] [submodule "extlib/zlib"]
path = extlib/zlib path = extlib/zlib
url = https://github.com/madler/zlib url = https://github.com/madler/zlib
ignore = dirty
[submodule "extlib/libpng"] [submodule "extlib/libpng"]
path = extlib/libpng path = extlib/libpng
url = https://github.com/glennrp/libpng url = https://github.com/glennrp/libpng

View File

@ -63,33 +63,36 @@ if(NOT (PERL_FOUND AND PERLMODULES_FOUND))
endif() endif()
if(WIN32) if(WIN32)
find_package(PNG) find_package(ZLIB)
if(NOT PNG_FOUND) if(NOT ZLIB_FOUND)
message(STATUS "Using in-tree libpng") message(STATUS "Using in-tree zlib")
add_subdirectory(extlib/zlib) add_subdirectory(extlib/zlib)
message(STATUS "Using in-tree libpng")
set(ZLIB_LIBRARY set(ZLIB_LIBRARY
zlibstatic) zlibstatic)
set(ZLIB_INCLUDE_DIR set(ZLIB_INCLUDE_DIR
"${CMAKE_SOURCE_DIR}/extlib/zlib" "${CMAKE_SOURCE_DIR}/extlib/zlib"
"${CMAKE_BINARY_DIR}/extlib/zlib") "${CMAKE_BINARY_DIR}/extlib/zlib")
find_package(ZLIB REQUIRED)
endif()
find_package(PNG)
if(NOT PNG_FOUND)
message(STATUS "Using in-tree libpng")
set(SKIP_INSTALL_ALL set(SKIP_INSTALL_ALL
ON) ON)
add_subdirectory(extlib/libpng) add_subdirectory(extlib/libpng)
set(PNG_FOUND TRUE) set(PNG_LIBRARY
set(PNG_LIBRARIES png16_static)
png16_static set(PNG_PNG_INCLUDE_DIR
zlibstatic)
set(PNG_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/extlib/libpng" "${CMAKE_SOURCE_DIR}/extlib/libpng"
"${CMAKE_BINARY_DIR}/extlib/libpng" "${CMAKE_BINARY_DIR}/extlib/libpng")
"${CMAKE_SOURCE_DIR}/extlib/zlib" find_package(PNG REQUIRED)
"${CMAKE_BINARY_DIR}/extlib/zlib")
endif() endif()
if(NOT MINGW) if(NOT MINGW)

View File

@ -149,7 +149,7 @@ elseif(APPLE)
unix/solvespace-48x48.png) unix/solvespace-48x48.png)
set(platform_BUNDLED_LIBS set(platform_BUNDLED_LIBS
${PNG_LIBRARY}) ${PNG_LIBRARIES})
set(platform_LIBRARIES set(platform_LIBRARIES
${APPKIT_LIBRARY}) ${APPKIT_LIBRARY})