Update submodule layout

This commit is contained in:
mayeut 2016-05-05 00:43:37 +02:00
parent 0813a5eb65
commit b860b39ae6
8 changed files with 199 additions and 192 deletions

11
.gitmodules vendored
View File

@ -1,9 +1,12 @@
[submodule "liblcms2"]
path = thirdparty/liblcms2/liblcms2
url = https://github.com/mm2/Little-CMS.git
[submodule "zlib"]
path = thirdparty/zlib
url = https://github.com/madler/zlib.git
ignore = dirty
[submodule "libpng"]
path = thirdparty/libpng
path = thirdparty/libpng/libpng
url = https://github.com/glennrp/libpng.git
ignore = dirty
[submodule "zlib"]
path = thirdparty/zlib/zlib
url = https://github.com/madler/zlib.git
ignore = dirty

View File

@ -1,17 +1,13 @@
# 3rd party libs
function(include_thirdparty THIRDPARTY_CMAKELISTS)
include(${THIRDPARTY_CMAKELISTS})
endfunction(include_thirdparty)
#------------
# Try to find lib Z
if(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build Z lib from thirdparty")
include_thirdparty(CMakeLists.txt.zlib)
add_subdirectory(zlib)
set(Z_LIBNAME zlibstatic PARENT_SCOPE)
set(Z_INCLUDE_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/zlib-inc PARENT_SCOPE)
set(Z_INCLUDE_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/zlib PARENT_SCOPE)
set(ZLIB_FOUND 1)
else(BUILD_THIRDPARTY)
# Try to find lib Z
@ -32,11 +28,11 @@ endif(BUILD_THIRDPARTY)
if(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build PNG lib from thirdparty")
include_thirdparty(CMakeLists.txt.libpng)
add_subdirectory(libpng)
set(OPJ_HAVE_PNG_H 1 PARENT_SCOPE)
set(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE)
set(PNG_LIBNAME png PARENT_SCOPE)
set(PNG_INCLUDE_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/libpng-inc PARENT_SCOPE)
set(PNG_LIBNAME pngstatic PARENT_SCOPE)
set(PNG_INCLUDE_DIRNAME ${CMAKE_CURRENT_BINARY_DIR}/libpng PARENT_SCOPE)
else(BUILD_THIRDPARTY)
if(ZLIB_FOUND)
find_package(PNG)

View File

@ -1,57 +0,0 @@
project(libpng C)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng/png.h ${CMAKE_CURRENT_BINARY_DIR}/libpng-inc/png.h COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng/pngconf.h ${CMAKE_CURRENT_BINARY_DIR}/libpng-inc/pngconf.h COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng/scripts/pnglibconf.h.prebuilt ${CMAKE_CURRENT_BINARY_DIR}/libpng-inc/pnglibconf.h)
# OUR SOURCES
set(libpng_public_hdrs
${CMAKE_CURRENT_BINARY_DIR}/libpng-inc/png.h
${CMAKE_CURRENT_BINARY_DIR}/libpng-inc/pngconf.h
${CMAKE_CURRENT_BINARY_DIR}/libpng-inc/pnglibconf.h
)
set(libpng_sources
pngdebug.h
pnginfo.h
pngpriv.h
pngstruct.h
png.c
pngerror.c
pngget.c
pngmem.c
pngpread.c
pngread.c
pngrio.c
pngrtran.c
pngrutil.c
pngset.c
pngtrans.c
pngwio.c
pngwrite.c
pngwtran.c
pngwutil.c
)
foreach(SRCFILE IN LISTS libpng_sources)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng/${SRCFILE} ${CMAKE_CURRENT_BINARY_DIR}/libpng-src/${SRCFILE} COPYONLY)
set(PNG_SOURCES ${PNG_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/libpng-src/${SRCFILE})
endforeach()
#
set(LIBTARGET "png")
#
add_library(${LIBTARGET} STATIC ${PNG_SOURCES} ${libpng_public_hdrs})
#
if(MSVC)
set_target_properties(${LIBTARGET} PROPERTIES PREFIX "lib")
endif(MSVC)
#
target_link_libraries(${LIBTARGET} ${Z_LIBNAME} ${M_LIBRARY})
#
set_target_properties(${LIBTARGET}
PROPERTIES
OUTPUT_NAME "${LIBTARGET}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib)
#
get_property(PNG_TARGET_INC TARGET ${LIBTARGET} PROPERTY INCLUDE_DIRECTORIES)
set_property(TARGET ${LIBTARGET} PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/libpng-inc;${CMAKE_CURRENT_SOURCE_DIR}/libpng;${CMAKE_CURRENT_BINARY_DIR}/zlib-inc;${PNG_TARGET_INC})

View File

@ -1,122 +0,0 @@
cmake_minimum_required(VERSION 2.4.4)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
project(zlib C)
set(VERSION "1.2.8")
include(CheckTypeSize)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
#
# Check to see if we have large file support
#
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
# We add these other definitions here because CheckTypeSize.cmake
# in CMake 2.4.x does not automatically do so and we want
# compatibility with CMake 2.4.x.
if(HAVE_SYS_TYPES_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
endif()
if(HAVE_STDINT_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
endif()
if(HAVE_STDDEF_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
endif()
check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1)
endif()
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
#
# Check for fseeko
#
check_function_exists(fseeko HAVE_FSEEKO)
if(NOT HAVE_FSEEKO)
add_definitions(-DNO_FSEEKO)
endif()
#
# Check for unistd.h
#
check_include_file(unistd.h Z_HAVE_UNISTD_H)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
endif()
# The following lines of zlib original CMakeLists.txt modify the submodule git status...
# We will copy source files...
#if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
# # If we're doing an out of source build and the user has a zconf.h
# # in their source tree...
# if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h)
# message(STATUS "Renaming")
# message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h")
# message(STATUS "to 'zconf.h.included' because this file is included with zlib")
# message(STATUS "but CMake generates it automatically in the build directory.")
# file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h.included)
# endif()
#endif()
set(ZLIB_PUBLIC_HDRS
${CMAKE_CURRENT_BINARY_DIR}/zlib-inc/zconf.h
${CMAKE_CURRENT_BINARY_DIR}/zlib-inc/zlib.h
)
set(ZLIB_PRIVATE_HDRS
crc32.h
deflate.h
gzguts.h
inffast.h
inffixed.h
inflate.h
inftrees.h
trees.h
zutil.h
)
set(ZLIB_SRCS
adler32.c
compress.c
crc32.c
deflate.c
gzclose.c
gzlib.c
gzread.c
gzwrite.c
inflate.c
infback.c
inftrees.c
inffast.c
trees.c
uncompr.c
zutil.c
)
foreach(SRCFILE IN LISTS ZLIB_PRIVATE_HDRS ZLIB_SRCS)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib/${SRCFILE} ${CMAKE_CURRENT_BINARY_DIR}/zlib-src/${SRCFILE} COPYONLY)
set(ZLIB_SOURCES ${ZLIB_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/zlib-src/${SRCFILE})
endforeach()
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h.cmakein
${CMAKE_CURRENT_BINARY_DIR}/zlib-inc/zconf.h @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib/zlib.h
${CMAKE_CURRENT_BINARY_DIR}/zlib-inc/zlib.h COPYONLY)
#============================================================================
# zlib
#============================================================================
add_library(zlibstatic STATIC ${ZLIB_SOURCES} ${ZLIB_PUBLIC_HDRS})
get_property(ZLIB_TARGET_INC TARGET zlibstatic PROPERTY INCLUDE_DIRECTORIES)
set_property(TARGET zlibstatic PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/zlib-inc;${CMAKE_CURRENT_BINARY_DIR}/zlib-src;${ZLIB_TARGET_INC})

74
thirdparty/libpng/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,74 @@
# CMakeLists.txt
# Copyright (C) 2007-2015 Glenn Randers-Pehrson
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#cmake_minimum_required(VERSION 2.4.4)
#set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
#set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
project(libpng C)
# Use the prebuilt pnglibconf.h file from the scripts folder
# TODO: fix this by building with awk; without this no cmake build can be
# configured directly (to do so indirectly use your local awk to build a
# pnglibconf.h in the build directory.)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng/png.h ${CMAKE_CURRENT_BINARY_DIR}/png.h COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng/pngconf.h ${CMAKE_CURRENT_BINARY_DIR}/pngconf.h COPYONLY)
# OUR SOURCES
set(libpng_public_hdrs
libpng/png.h
libpng/pngconf.h
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
)
set(libpng_sources
${libpng_public_hdrs}
libpng/pngdebug.h
libpng/pnginfo.h
libpng/pngpriv.h
libpng/pngstruct.h
libpng/png.c
libpng/pngerror.c
libpng/pngget.c
libpng/pngmem.c
libpng/pngpread.c
libpng/pngread.c
libpng/pngrio.c
libpng/pngrtran.c
libpng/pngrutil.c
libpng/pngset.c
libpng/pngtrans.c
libpng/pngwio.c
libpng/pngwrite.c
libpng/pngwtran.c
libpng/pngwutil.c
)
# SOME NEEDED DEFINITIONS
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC)
# NOW BUILD OUR TARGET
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libpng ${CMAKE_CURRENT_BINARY_DIR}/../zlib)
# does not work without changing name
add_library(pngstatic STATIC ${libpng_sources})
target_link_libraries(pngstatic ${Z_LIBNAME} ${M_LIBRARY})
SET_TARGET_PROPERTIES(pngstatic
PROPERTIES
OUTPUT_NAME "pngstatic"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib
)

113
thirdparty/zlib/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,113 @@
project(zlib C)
include(CheckTypeSize)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
#
# Check to see if we have large file support
#
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
# We add these other definitions here because CheckTypeSize.cmake
# in CMake 2.4.x does not automatically do so and we want
# compatibility with CMake 2.4.x.
if(HAVE_SYS_TYPES_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
endif()
if(HAVE_STDINT_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
endif()
if(HAVE_STDDEF_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
endif()
check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1)
endif()
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
#
# Check for fseeko
#
check_function_exists(fseeko HAVE_FSEEKO)
if(NOT HAVE_FSEEKO)
add_definitions(-DNO_FSEEKO)
endif()
#
# Check for unistd.h
#
check_include_file(unistd.h Z_HAVE_UNISTD_H)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
endif()
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
# If we're doing an out of source build and the user has a zconf.h
# in their source tree...
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h)
message(STATUS "Renaming")
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h")
message(STATUS "to 'zconf.h.included' because this file is included with zlib")
message(STATUS "but CMake generates it automatically in the build directory.")
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h.included)
endif()
endif()
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zconf.h.cmakein
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zlib.h ${CMAKE_CURRENT_BINARY_DIR}/zlib.h COPYONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/zlib)
#============================================================================
# zlib
#============================================================================
set(ZLIB_PUBLIC_HDRS
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
zlib/zlib.h
)
set(ZLIB_PRIVATE_HDRS
zlib/crc32.h
zlib/deflate.h
zlib/gzguts.h
zlib/inffast.h
zlib/inffixed.h
zlib/inflate.h
zlib/inftrees.h
zlib/trees.h
zlib/zutil.h
)
set(ZLIB_SRCS
zlib/adler32.c
zlib/compress.c
zlib/crc32.c
zlib/deflate.c
zlib/gzclose.c
zlib/gzlib.c
zlib/gzread.c
zlib/gzwrite.c
zlib/inflate.c
zlib/infback.c
zlib/inftrees.c
zlib/inffast.c
zlib/trees.c
zlib/uncompr.c
zlib/zutil.c
)
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
SET_TARGET_PROPERTIES(zlibstatic
PROPERTIES
OUTPUT_NAME "zlibstatic"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib
)