Merge pull request #171 from assimp/zip-cmake-fixes
Update CMakeLists.txt for zlib to build on MSVC again, closes #170.pull/175/head
commit
4167a68493
|
@ -110,7 +110,7 @@ if( NOT ZLIB_FOUND )
|
||||||
# compile from sources
|
# compile from sources
|
||||||
add_subdirectory(contrib/zlib)
|
add_subdirectory(contrib/zlib)
|
||||||
set(ZLIB_FOUND 1)
|
set(ZLIB_FOUND 1)
|
||||||
set(ZLIB_LIBRARIES zlib)
|
set(ZLIB_LIBRARIES zlibstatic)
|
||||||
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/zlib)
|
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/zlib)
|
||||||
else(NOT ZLIB_FOUND)
|
else(NOT ZLIB_FOUND)
|
||||||
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
||||||
|
|
|
@ -5,14 +5,14 @@ project(zlib C)
|
||||||
|
|
||||||
set(VERSION "1.2.8")
|
set(VERSION "1.2.8")
|
||||||
|
|
||||||
option(ASM686 "Enable building i686 assembly implementation")
|
option(ASM686 "Enable building i686 assembly implementation for zlib")
|
||||||
option(AMD64 "Enable building amd64 assembly implementation")
|
option(AMD64 "Enable building amd64 assembly implementation for zlib")
|
||||||
|
|
||||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
#set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
||||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
#set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
||||||
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
|
#set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
|
||||||
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
|
#set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
|
||||||
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
|
#set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
|
||||||
|
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
@ -83,6 +83,10 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
|
||||||
${ZLIB_PC} @ONLY)
|
${ZLIB_PC} @ONLY)
|
||||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
|
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
|
||||||
|
|
||||||
|
# (hack) needed for the regular assimp build, which needs to be able to find zconf.h
|
||||||
|
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/zconf.h @ONLY)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,12 +187,12 @@ if(MINGW)
|
||||||
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
||||||
endif(MINGW)
|
endif(MINGW)
|
||||||
|
|
||||||
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
#add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||||
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||||
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
#set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||||
set_target_properties(zlib PROPERTIES SOVERSION 1)
|
#set_target_properties(zlib PROPERTIES SOVERSION 1)
|
||||||
|
|
||||||
if(NOT CYGWIN)
|
#if(NOT CYGWIN)
|
||||||
# This property causes shared libraries on Linux to have the full version
|
# This property causes shared libraries on Linux to have the full version
|
||||||
# encoded into their final filename. We disable this on Cygwin because
|
# encoded into their final filename. We disable this on Cygwin because
|
||||||
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
|
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
|
||||||
|
@ -196,54 +200,33 @@ if(NOT CYGWIN)
|
||||||
#
|
#
|
||||||
# This has no effect with MSVC, on that platform the version info for
|
# This has no effect with MSVC, on that platform the version info for
|
||||||
# the DLL comes from the resource file win32/zlib1.rc
|
# the DLL comes from the resource file win32/zlib1.rc
|
||||||
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
|
#set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
if(UNIX)
|
#if(UNIX)
|
||||||
# On unix-like platforms the library is almost always called libz
|
# On unix-like platforms the library is almost always called libz
|
||||||
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
|
#set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
|
||||||
if(NOT APPLE)
|
#if(NOT APPLE)
|
||||||
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
# set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
||||||
endif()
|
#endif()
|
||||||
elseif(BUILD_SHARED_LIBS AND WIN32)
|
#elseif(BUILD_SHARED_LIBS AND WIN32)
|
||||||
# Creates zlib1.dll when building shared library version
|
# # Creates zlib1.dll when building shared library version
|
||||||
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
|
# set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
#if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||||
install(TARGETS zlib zlibstatic
|
# install(TARGETS zlib zlibstatic
|
||||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
# RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
# ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
|
# LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
|
||||||
endif()
|
#endif()
|
||||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
#if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
||||||
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
|
# install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
|
||||||
endif()
|
#endif()
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
#if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||||
install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
|
# install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
|
||||||
endif()
|
#endif()
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
#if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||||
install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
|
# install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
#============================================================================
|
|
||||||
# Example binaries
|
|
||||||
#============================================================================
|
|
||||||
|
|
||||||
#add_executable(example test/example.c)
|
|
||||||
#target_link_libraries(example zlib)
|
|
||||||
#add_test(example example)
|
|
||||||
|
|
||||||
#add_executable(minigzip test/minigzip.c)
|
|
||||||
#target_link_libraries(minigzip zlib)
|
|
||||||
|
|
||||||
if(HAVE_OFF64_T)
|
|
||||||
add_executable(example64 test/example.c)
|
|
||||||
target_link_libraries(example64 zlib)
|
|
||||||
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
|
||||||
add_test(example64 example64)
|
|
||||||
|
|
||||||
add_executable(minigzip64 test/minigzip.c)
|
|
||||||
target_link_libraries(minigzip64 zlib)
|
|
||||||
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
|
||||||
endif()
|
|
||||||
|
|
Loading…
Reference in New Issue