Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cmake: simplify build, update dist.cmake, update dist.info version

  • Loading branch information...
commit 66f7f4580c3ada033a47a6397e6d175236d285c0 1 parent ad13fa1
David Manura davidm authored
Showing with 298 additions and 376 deletions.
  1. +31 −245 CMakeLists.txt
  2. +266 −0 cmake/dist.cmake
  3. +0 −130 dist.cmake
  4. +1 −1  dist.info
276 CMakeLists.txt
View
@@ -1,37 +1,18 @@
-# CMakeLists.txt
-
+# Copyright (C) 2007-2011 LuaDist.
+# Modified by David Manura.
+# Redistribution and use of this file is allowed according to the terms of the MIT license.
+# For details see the COPYRIGHT file distributed with LuaDist.
+# Please note that the package source code is licensed under its own license.
+#
+# Note: code is based on the original CMakeLists.txt in libpng, having its own copyright:
# Copyright (C) 2007-2011 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)
-
-if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
- if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)
- # workaround CMake 2.4.x bug
- set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
- "Choose the type of build, options are:
- None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
- Debug
- Release
- RelWithDebInfo
- MinSizeRel.")
- else()
- set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
- "Choose the type of build, options are:
- None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
- Debug
- Release
- RelWithDebInfo
- MinSizeRel.")
- endif()
-endif()
-
project(libpng C)
-enable_testing()
+cmake_minimum_required(VERSION 2.6)
+include(cmake/dist.cmake)
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 5)
@@ -53,38 +34,22 @@ if(NOT WIN32)
"math library 'libm' not found - floating point support disabled")
endif()
else()
- # not needed on windows
- set(M_LIBRARY "")
+ set(M_LIBRARY "") # not needed on windows
endif()
# COMMAND LINE OPTIONS
-if(DEFINED PNG_SHARED)
- option(PNG_SHARED "Build shared lib" ${PNG_SHARED})
-else()
- option(PNG_SHARED "Build shared lib" ON)
-endif()
-if(DEFINED PNG_STATIC)
- option(PNG_STATIC "Build static lib" ${PNG_STATIC})
-else()
- option(PNG_STATIC "Build static lib" ON)
-endif()
-
+option(PNG_SHARED "Build shared lib" ${BUILD_SHARED_LIB})
option(PNG_TESTS "Build libpng tests" YES)
-
-# Many more configuration options could be added here
-option(PNG_DEBUG "Build with debug output" NO)
-option(PNGARG "Disable ANSI-C prototypes" NO)
+option(PNG_DEBUG "Build with debug output" NO)
+option(PNGARG "Disable ANSI-C prototypes" NO)
# SET LIBNAME
-set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
-
-# to distinguish between debug and release lib
-set(CMAKE_DEBUG_POSTFIX "d")
+set(PNG_LIB_NAME png) #removed: ${PNGLIB_MAJOR}${PNGLIB_MINOR}
# 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.)
+#~# 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}/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
@@ -123,47 +88,22 @@ set(pngtest_sources
set(pngvalid_sources
contrib/libtests/pngvalid.c
)
-# SOME NEEDED DEFINITIONS
add_definitions(-DPNG_CONFIGURE_LIBPNG)
-
-if(MSVC)
- add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
-endif(MSVC)
-
if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG)
endif()
-
-# NOW BUILD OUR TARGET
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
-if(PNG_SHARED)
- add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
- if(MSVC)
- # msvc does not append 'lib' - do it here to have consistent name
- set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
- set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
- endif()
- target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
-endif()
-
-if(PNG_STATIC)
-# does not work without changing name
- set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
- add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
- if(MSVC)
- # msvc does not append 'lib' - do it here to have consistent name
- set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
- endif()
- target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
-endif()
+add_library(${PNG_LIB_NAME} ${libpng_sources})
+target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
if(PNG_SHARED AND WIN32)
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif()
-if(PNG_TESTS AND PNG_SHARED)
+enable_testing()
+if(PNG_TESTS) # removed: AND PNG_SHARED
# does not work with msvc due to png_lib_ver issue
add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME})
@@ -174,171 +114,17 @@ if(PNG_TESTS AND PNG_SHARED)
add_test(pngvalid ./pngvalid)
endif()
-# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
-IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
- SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
-ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
-
-# Set a variable with CMake code which:
-# Creates a symlink from src to dest (if possible) or alternatively
-# copies if different.
-macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
- FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
- if(WIN32 AND NOT CYGWIN AND NOT MINGW)
- ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
- DEPENDS ${PNG_LIB_NAME} ${PNG_LIB_NAME_STATIC}
- )
- ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
- else(WIN32 AND NOT CYGWIN AND NOT MINGW)
- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${SRC_FILE} ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- endif(WIN32 AND NOT CYGWIN AND NOT MINGW)
-endmacro()
-
-# libpng is a library so default to 'lib'
-if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
- set(CMAKE_INSTALL_LIBDIR lib)
-endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
-
-# CREATE PKGCONFIG FILES
-# we use the same files like ./configure, so we have to set its vars
-# Only do this on Windows for Cygwin - the files don't make much sense outside
-# a UNIX look alike
-if(NOT WIN32 OR CYGWIN OR MINGW)
- set(prefix ${CMAKE_INSTALL_PREFIX})
- set(exec_prefix ${CMAKE_INSTALL_PREFIX})
- set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
- set(includedir ${CMAKE_INSTALL_PREFIX}/include)
- set(LIBS "-lz -lm")
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
- ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
- CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
-
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
- ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
- CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
-endif(NOT WIN32 OR CYGWIN OR MINGW)
-
-# SET UP LINKS
-if(PNG_SHARED)
- set_target_properties(${PNG_LIB_NAME} PROPERTIES
-# VERSION 15.${PNGLIB_RELEASE}.1.5.10
- VERSION 15.${PNGLIB_RELEASE}.0
- SOVERSION 15
- CLEAN_DIRECT_OUTPUT 1)
-endif()
-if(PNG_STATIC)
- # MSVC doesn't use a different file extension for shared vs. static
- # libs. We are able to change OUTPUT_NAME to remove the _static
- # for all other platforms.
- if(NOT MSVC)
- set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
- OUTPUT_NAME ${PNG_LIB_NAME}
- CLEAN_DIRECT_OUTPUT 1)
- endif()
-endif()
-
-# If CMake > 2.4.x, we set a variable used below to export
-# targets to an export file.
-# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
-if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
- set(PNG_EXPORT_RULE EXPORT libpng)
-elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
- set(PNG_EXPORT_RULE EXPORT libpng)
-endif()
-
-# INSTALL
-if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
- if(PNG_SHARED)
- install(TARGETS ${PNG_LIB_NAME}
- ${PNG_EXPORT_RULE}
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
- # Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin
- if(CYGWIN OR MINGW)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
- get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
- CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
- DESTINATION ${CMAKE_INSTALL_LIBDIR})
- endif(CYGWIN OR MINGW)
-
- if(NOT WIN32)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
- get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
- CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
- DESTINATION ${CMAKE_INSTALL_LIBDIR})
- endif(NOT WIN32)
- endif(PNG_SHARED)
-
- if(PNG_STATIC)
- install(TARGETS ${PNG_LIB_NAME_STATIC}
- ${PNG_EXPORT_RULE}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
- if(NOT WIN32 OR CYGWIN OR MINGW)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
- get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)
- CREATE_SYMLINK(${BUILD_TARGET_FILE} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
- DESTINATION ${CMAKE_INSTALL_LIBDIR})
- endif(NOT WIN32 OR CYGWIN OR MINGW)
- endif()
-endif()
-
-if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
- install(FILES ${libpng_public_hdrs} DESTINATION include)
- install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
-endif()
-if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
- if(NOT WIN32 OR CYGWIN OR MINGW)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
- DESTINATION bin)
- endif(NOT WIN32 OR CYGWIN OR MINGW)
-endif()
-
-if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
- # Install man pages
- if(NOT PNG_MAN_DIR)
- set(PNG_MAN_DIR "share/man")
- endif()
- install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
- install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
- # Install pkg-config files
- if(NOT WIN32 OR CYGWIN OR MINGW)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
- DESTINATION bin)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
- DESTINATION bin)
- endif(NOT WIN32 OR CYGWIN OR MINGW)
-endif()
-
-# On versions of CMake that support it, create an export file CMake
-# users can include() to import our targets
-if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
- install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
-endif()
-
-# what's with libpng-$VER%.txt and all the extra files?
-# UNINSTALL
-# do we need this?
+install_library(${PNG_LIB_NAME})
+install_header(${libpng_public_hdrs})
+#removed: install_header(${libpng_public_hdrs} INTO ${PNGLIB_NAME})
-# DIST
-# do we need this?
-# to create msvc import lib for mingw compiled shared lib
-# pexports libpng.dll > libpng.def
-# lib /def:libpng.def /machine:x86
+install_doc(libpng.3 libpng.3 png.5)
+#~ removed from original: pkgconfig
+#~ removed from original: create_symlink
+#~ removed from original: libpng-config
+#~ removed from original: man pages
+#~ removed from original: install(EXPORT)
+#~ removed from original: version sovesion
266 cmake/dist.cmake
View
@@ -0,0 +1,266 @@
+# LuaDist CMake utility library.
+# Provides sane project defaults and macros common to LuaDist CMake builds.
+#
+# Copyright (C) 2007-2012 LuaDist.
+# by David Manura, Peter Drahoš
+# Redistribution and use of this file is allowed according to the terms of the MIT license.
+# For details see the COPYRIGHT file distributed with LuaDist.
+# Please note that the package source code is licensed under its own license.
+
+## Extract information from dist.info
+file ( READ ${CMAKE_CURRENT_SOURCE_DIR}/dist.info DIST_INFO )
+if ( ${DIST_INFO} STREQUAL "" )
+ message ( FATAL_ERROR "Failed to load dist.info" )
+endif ()
+# Reads field `name` from dist.info string `DIST_INFO` into variable `var`.
+macro ( _parse_dist_field name var )
+ string ( REGEX REPLACE ".*${name}[ \t]?=[ \t]?[\"']([^\"']+)[\"'].*" "\\1" ${var} "${DIST_INFO}" )
+ if ( ${var} STREQUAL DIST_INFO )
+ message ( FATAL_ERROR "Failed to extract \"${var}\" from dist.info" )
+ endif ()
+endmacro ()
+#
+_parse_dist_field ( name DIST_NAME )
+_parse_dist_field ( version DIST_VERSION )
+_parse_dist_field ( license DIST_LICENSE )
+_parse_dist_field ( author DIST_AUTHOR )
+_parse_dist_field ( maintainer DIST_MAINTAINER )
+_parse_dist_field ( url DIST_URL )
+_parse_dist_field ( desc DIST_DESC )
+message ( "DIST_NAME: ${DIST_NAME}")
+message ( "DIST_VERSION: ${DIST_VERSION}")
+message ( "DIST_AUTHOR: ${DIST_LICENSE}")
+message ( "DIST_AUTHOR: ${DIST_AUTHOR}")
+message ( "DIST_MAINTAINER: ${DIST_MAINTAINER}")
+message ( "DIST_URL: ${DIST_URL}")
+message ( "DIST_DESC: ${DIST_DESC}")
+string ( REGEX REPLACE ".*depends[ \t]?=[ \t]?[\"']([^\"']+)[\"'].*" "\\1" DIST_DEPENDS ${DIST_INFO} )
+if ( DIST_DEPENDS STREQUAL DIST_INFO )
+ set ( DIST_DEPENDS "" )
+endif ()
+message ( "DIST_DEPENDS: ${DIST_DEPENDS}")
+## 2DO: Parse DIST_DEPENDS and try to install Dependencies with automatically using externalproject_add
+
+
+## INSTALL DEFAULTS (Relative to CMAKE_INSTALL_PREFIX)
+# Primary paths
+set ( INSTALL_BIN bin CACHE PATH "Where to install binaries to." )
+set ( INSTALL_LIB lib CACHE PATH "Where to install libraries to." )
+set ( INSTALL_INC include CACHE PATH "Where to install headers to." )
+set ( INSTALL_ETC etc CACHE PATH "Where to store configuration files" )
+set ( INSTALL_SHARE share CACHE PATH "Directory for shared data." )
+
+# Secondary paths
+option ( INSTALL_VERSION "Install runtime libraries and executables with version information." OFF)
+set ( INSTALL_DATA ${INSTALL_SHARE}/${DIST_NAME} CACHE PATH
+ "Directory the package can store documentation, tests or other data in.")
+set ( INSTALL_DOC ${INSTALL_DATA}/doc CACHE PATH
+ "Recommended directory to install documentation into.")
+set ( INSTALL_EXAMPLE ${INSTALL_DATA}/example CACHE PATH
+ "Recommended directory to install examples into.")
+set ( INSTALL_TEST ${INSTALL_DATA}/test CACHE PATH
+ "Recommended directory to install tests into.")
+set ( INSTALL_FOO ${INSTALL_DATA}/etc CACHE PATH
+ "Where to install additional files")
+
+# Tweaks and other defaults
+# Setting CMAKE to use loose block and search for find modules in source directory
+set ( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
+set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} )
+option ( BUILD_SHARED_LIBS "Build shared libraries" ON )
+
+# In MSVC, prevent warnings that can occur when using standard libraries.
+if ( MSVC )
+ add_definitions ( -D_CRT_SECURE_NO_WARNINGS )
+endif ()
+
+# RPath and relative linking
+option ( USE_RPATH "Use relative linking." ON)
+if ( USE_RPATH )
+ string ( REGEX REPLACE "[^!/]+" ".." UP_DIR ${INSTALL_BIN} )
+ set ( CMAKE_SKIP_BUILD_RPATH FALSE CACHE STRING "" FORCE )
+ set ( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE CACHE STRING "" FORCE )
+ set ( CMAKE_INSTALL_RPATH $ORIGIN/${UP_DIR}/${INSTALL_LIB} CACHE STRING "" FORCE )
+ set ( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE STRING "" FORCE )
+ set ( CMAKE_INSTALL_NAME_DIR @executable_path/${UP_DIR}/${INSTALL_LIB} CACHE STRING "" FORCE )
+endif ()
+
+## MACROS
+# Parser macro
+macro ( parse_arguments prefix arg_names option_names)
+ set ( DEFAULT_ARGS )
+ foreach ( arg_name ${arg_names} )
+ set ( ${prefix}_${arg_name} )
+ endforeach ()
+ foreach ( option ${option_names} )
+ set ( ${prefix}_${option} FALSE )
+ endforeach ()
+
+ set ( current_arg_name DEFAULT_ARGS )
+ set ( current_arg_list )
+ foreach ( arg ${ARGN} )
+ set ( larg_names ${arg_names} )
+ list ( FIND larg_names "${arg}" is_arg_name )
+ if ( is_arg_name GREATER -1 )
+ set ( ${prefix}_${current_arg_name} ${current_arg_list} )
+ set ( current_arg_name ${arg} )
+ set ( current_arg_list )
+ else ()
+ set ( loption_names ${option_names} )
+ list ( FIND loption_names "${arg}" is_option )
+ if ( is_option GREATER -1 )
+ set ( ${prefix}_${arg} TRUE )
+ else ()
+ set ( current_arg_list ${current_arg_list} ${arg} )
+ endif ()
+ endif ()
+ endforeach ()
+ set ( ${prefix}_${current_arg_name} ${current_arg_list} )
+endmacro ()
+
+
+# install_executable ( executable_targets )
+# Installs any executables generated using "add_executable".
+# USE: install_executable ( lua )
+# NOTE: subdirectories are NOT supported
+set ( CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "${DIST_NAME} Runtime" )
+set ( CPACK_COMPONENT_RUNTIME_DESCRIPTION "Executables and runtime libraries. Installed into ${INSTALL_BIN}." )
+macro ( install_executable )
+ foreach ( _file ${ARGN} )
+ if ( INSTALL_VERSION )
+ set_target_properties ( ${_file} PROPERTIES VERSION ${DIST_VERSION} SOVERSION ${DIST_VERSION} )
+ endif ()
+ install ( TARGETS ${_file} RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT Runtime )
+ endforeach()
+endmacro ()
+
+# install_library ( library_targets )
+# Installs any libraries generated using "add_library" into apropriate places.
+# USE: install_library ( libexpat )
+# NOTE: subdirectories are NOT supported
+set ( CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "${DIST_NAME} Development Libraries" )
+set ( CPACK_COMPONENT_LIBRARY_DESCRIPTION "Static and import libraries needed for development. Installed into ${INSTALL_LIB} or ${INSTALL_BIN}." )
+macro ( install_library )
+ foreach ( _file ${ARGN} )
+ if ( INSTALL_VERSION )
+ set_target_properties ( ${_file} PROPERTIES VERSION ${DIST_VERSION} SOVERSION ${DIST_VERSION} )
+ endif ()
+ install ( TARGETS ${_file}
+ RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT Runtime
+ LIBRARY DESTINATION ${INSTALL_LIB} COMPONENT Runtime
+ ARCHIVE DESTINATION ${INSTALL_LIB} COMPONENT Library )
+ endforeach()
+endmacro ()
+
+# install_header ( files/directories [INTO destination] )
+# Install a directories or files into header destination.
+# USE: install_header ( lua.h luaconf.h ) or install_header ( GL )
+# USE: install_header ( mylib.h INTO mylib )
+set ( CPACK_COMPONENT_HEADER_DISPLAY_NAME "${DIST_NAME} Development Headers" )
+set ( CPACK_COMPONENT_HEADER_DESCRIPTION "Headers needed for development. Installed into ${INSTALL_INC}." )
+macro ( install_header )
+ parse_arguments ( _ARG "INTO" "" ${ARGN} )
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_INC}/${_ARG_INTO} COMPONENT Header )
+ else ()
+ install ( FILES ${_file} DESTINATION ${INSTALL_INC}/${_ARG_INTO} COMPONENT Header )
+ endif ()
+ endforeach()
+endmacro ()
+
+# install_data ( files/directories [INTO destination] )
+# This installs additional data files or directories.
+# USE: install_data ( extra data.dat )
+# USE: install_data ( image1.png image2.png INTO images )
+set ( CPACK_COMPONENT_DATA_DISPLAY_NAME "${DIST_NAME} Data" )
+set ( CPACK_COMPONENT_DATA_DESCRIPTION "Application data. Installed into ${INSTALL_DATA}." )
+macro ( install_data )
+ parse_arguments ( _ARG "INTO" "" ${ARGN} )
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_DATA}/${_ARG_INTO} COMPONENT Data)
+ else ()
+ install ( FILES ${_file} DESTINATION ${INSTALL_DATA}/${_ARG_INTO} COMPONENT Data )
+ endif ()
+ endforeach()
+endmacro ()
+
+# INSTALL_DOC ( files/directories [INTO destination] )
+# This installs documentation content
+# USE: install_doc ( doc/ doc.pdf )
+# USE: install_doc ( index.html INTO html )
+set ( CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "${DIST_NAME} Documentation" )
+set ( CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Application documentation. Installed into ${INSTALL_DOC}." )
+macro ( install_doc )
+ parse_arguments ( _ARG "INTO" "" ${ARGN} )
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_DOC}/${_ARG_INTO} COMPONENT Documentation )
+ else ()
+ install ( FILES ${_file} DESTINATION ${INSTALL_DOC}/${_ARG_INTO} COMPONENT Documentation )
+ endif ()
+ endforeach()
+endmacro ()
+
+# install_example ( files/directories [INTO destination] )
+# This installs additional examples
+# USE: install_example ( examples/ exampleA )
+# USE: install_example ( super_example super_data INTO super)
+set ( CPACK_COMPONENT_EXAMPLE_DISPLAY_NAME "${DIST_NAME} Examples" )
+set ( CPACK_COMPONENT_EXAMPLE_DESCRIPTION "Examples and their associated data. Installed into ${INSTALL_EXAMPLE}." )
+macro ( install_example )
+ parse_arguments ( _ARG "INTO" "" ${ARGN} )
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_EXAMPLE}/${_ARG_INTO} COMPONENT Example )
+ else ()
+ install ( FILES ${_file} DESTINATION ${INSTALL_EXAMPLE}/${_ARG_INTO} COMPONENT Example )
+ endif ()
+ endforeach()
+endmacro ()
+
+# install_test ( files/directories [INTO destination] )
+# This installs tests and test files, DOES NOT EXECUTE TESTS
+# USE: install_test ( my_test data.sql )
+# USE: install_test ( feature_x_test INTO x )
+set ( CPACK_COMPONENT_TEST_DISPLAY_NAME "${DIST_NAME} Tests" )
+set ( CPACK_COMPONENT_TEST_DESCRIPTION "Tests and associated data. Installed into ${INSTALL_TEST}." )
+macro ( install_test )
+ parse_arguments ( _ARG "INTO" "" ${ARGN} )
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_TEST}/${_ARG_INTO} COMPONENT Test )
+ else ()
+ install ( FILES ${_file} DESTINATION ${INSTALL_TEST}/${_ARG_INTO} COMPONENT Test )
+ endif ()
+ endforeach()
+endmacro ()
+
+# install_foo ( files/directories [INTO destination] )
+# This installs optional or otherwise unneeded content
+# USE: install_foo ( etc/ example.doc )
+# USE: install_foo ( icon.png logo.png INTO icons)
+set ( CPACK_COMPONENT_OTHER_DISPLAY_NAME "${DIST_NAME} Unspecified Content" )
+set ( CPACK_COMPONENT_OTHER_DESCRIPTION "Other unspecified content. Installed into ${INSTALL_FOO}." )
+macro ( install_foo )
+ parse_arguments ( _ARG "INTO" "" ${ARGN} )
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_FOO}/${_ARG_INTO} COMPONENT Other )
+ else ()
+ install ( FILES ${_file} DESTINATION ${INSTALL_FOO}/${_ARG_INTO} COMPONENT Other )
+ endif ()
+ endforeach()
+endmacro ()
+
+## CTest defaults
+
+## CPack defaults
+set ( CPACK_GENERATOR "ZIP" )
+set ( CPACK_STRIP_FILES TRUE )
+set ( CPACK_PACKAGE_NAME "${DIST_NAME}" )
+set ( CPACK_PACKAGE_VERSION "${DIST_VERSION}")
+set ( CPACK_PACKAGE_VENDOR "LuaDist" )
+set ( CPACK_COMPONENTS_ALL Runtime Library Header Data Documentation Example Other )
+include ( CPack )
130 dist.cmake
View
@@ -1,130 +0,0 @@
-# LuaDist CMake utility library.
-# Provides variables and utility functions common to LuaDist CMake builds.
-#
-# Copyright (C) 2007-2010 LuaDist.
-# by David Manura, Peter Drahos
-# Redistribution and use of this file is allowed according to the terms of the MIT license.
-# For details see the COPYRIGHT file distributed with LuaDist.
-# Please note that the package source code is licensed under its own license.
-
-# Few convinence settings
-SET (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
-SET (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH})
-
-# Where to install module parts:
-set(INSTALL_BIN bin CACHE PATH "Where to install binaries to.")
-set(INSTALL_LIB lib CACHE PATH "Where to install libraries to.")
-set(INSTALL_INC include CACHE PATH "Where to install headers to.")
-set(INSTALL_ETC etc CACHE PATH "Where to store configuration files")
-set(INSTALL_LMOD share/lua/lmod CACHE PATH "Directory to install Lua modules.")
-set(INSTALL_CMOD share/lua/cmod CACHE PATH "Directory to install Lua binary modules.")
-set(INSTALL_DATA share/${PROJECT_NAME} CACHE PATH "Directory the package can store documentation, tests or other data in.")
-set(INSTALL_DOC ${INSTALL_DATA}/doc CACHE PATH "Recommended directory to install documentation into.")
-set(INSTALL_EXAMPLE ${INSTALL_DATA}/example CACHE PATH "Recommended directory to install examples into.")
-set(INSTALL_TEST ${INSTALL_DATA}/test CACHE PATH "Recommended directory to install tests into.")
-set(INSTALL_FOO ${INSTALL_DATA}/etc CACHE PATH "Where to install additional files")
-
-
-# In MSVC, prevent warnings that can occur when using standard libraries.
-if(MSVC)
- add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-endif(MSVC)
-
-# Adds Lua shared library module target `_target`.
-# Additional sources to build the module are listed after `_target`.
-macro(add_lua_module _target)
- find_package(Lua51 REQUIRED)
- include_directories(${LUA_INCLUDE_DIR}) #2DO: somehow apply only to _target?
-
- add_library(${_target} MODULE ${ARGN})
- set_target_properties(${_target} PROPERTIES PREFIX "")
- target_link_libraries(${_target} ${LUA_LIBRARY})
-
- IF(WIN32)
- set_target_properties(${_target} PROPERTIES LINK_FLAGS "-Wl,--enable-auto-import")
- ENDIF()
-
-endmacro(add_lua_module)
-
-# Runs Lua script `_testfile` under CTest tester.
-# Optional argument `_testcurrentdir` is current working directory to run test under
-# (defaults to ${CMAKE_CURRENT_BINARY_DIR}).
-# Both paths, if relative, are relative to ${CMAKE_CURRENT_SOURCE_DIR}.
-# Under LuaDist, set test=true in config.lua to enable testing.
-macro(add_lua_test _testfile)
- include(CTest)
- if(BUILD_TESTING)
- find_program(LUA NAMES lua lua.bat)
- get_filename_component(TESTFILEABS ${_testfile} ABSOLUTE)
- get_filename_component(TESTFILENAME ${_testfile} NAME)
- get_filename_component(TESTFILEBASE ${_testfile} NAME_WE)
-
- # Write wrapper script.
- set(TESTWRAPPER ${CMAKE_CURRENT_BINARY_DIR}/${TESTFILENAME})
- set(TESTWRAPPERSOURCE
-"package.path = '${CMAKE_CURRENT_BINARY_DIR}/?.lua\;${CMAKE_CURRENT_SOURCE_DIR}/?.lua\;' .. package.path
-package.cpath = '${CMAKE_CURRENT_BINARY_DIR}/?.so\;${CMAKE_CURRENT_BINARY_DIR}/?.dll\;' .. package.cpath
-return dofile '${TESTFILEABS}'
-" )
- if(${ARGC} GREATER 1)
- set(_testcurrentdir ${ARGV1})
- get_filename_component(TESTCURRENTDIRABS ${_testcurrentdir} ABSOLUTE)
- set(TESTWRAPPERSOURCE
-"require 'lfs'
-lfs.chdir('${TESTCURRENTDIRABS}')
-${TESTWRAPPERSOURCE}")
- endif()
- FILE(WRITE ${TESTWRAPPER} ${TESTWRAPPERSOURCE})
-
- add_test(${TESTFILEBASE} ${LUA} ${TESTWRAPPER})
- endif(BUILD_TESTING)
-
- # see also http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/CMakeModules/UsePythonTest.cmake
-endmacro(add_lua_test)
-
-# Converts Lua source file `_source` to binary string embedded in C source
-# file `_target`. Optionally compiles Lua source to byte code (not available
-# under LuaJIT2, which doesn't have a bytecode loader). Additionally, Lua
-# versions of bin2c [1] and luac [2] may be passed respectively as additional
-# arguments.
-#
-# [1] http://lua-users.org/wiki/BinToCee
-# [2] http://lua-users.org/wiki/LuaCompilerInLua
-function(add_lua_bin2c _target _source)
- find_program(LUA NAMES lua lua.bat)
- execute_process(COMMAND ${LUA} -e "string.dump(function()end)" RESULT_VARIABLE _LUA_DUMP_RESULT ERROR_QUIET)
- if (NOT ${_LUA_DUMP_RESULT})
- SET(HAVE_LUA_DUMP true)
- endif()
- message("-- string.dump=${HAVE_LUA_DUMP}")
-
- if (ARGV2)
- get_filename_component(BIN2C ${ARGV2} ABSOLUTE)
- set(BIN2C ${LUA} ${BIN2C})
- else()
- find_program(BIN2C NAMES bin2c bin2c.bat)
- endif()
- if (HAVE_LUA_DUMP)
- if (ARGV3)
- get_filename_component(LUAC ${ARGV3} ABSOLUTE)
- set(LUAC ${LUA} ${LUAC})
- else()
- find_program(LUAC NAMES luac luac.bat)
- endif()
- endif (HAVE_LUA_DUMP)
- message("-- bin2c=${BIN2C}")
- message("-- luac=${LUAC}")
-
- get_filename_component(SOURCEABS ${_source} ABSOLUTE)
- if (HAVE_LUA_DUMP)
- get_filename_component(SOURCEBASE ${_source} NAME_WE)
- add_custom_command(
- OUTPUT ${_target} DEPENDS ${_source}
- COMMAND ${LUAC} -o ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ${SOURCEABS}
- COMMAND ${BIN2C} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ">${_target}" )
- else()
- add_custom_command(
- OUTPUT ${_target} DEPENDS ${SOURCEABS}
- COMMAND ${BIN2C} ${_source} ">${_target}" )
- endif()
-endfunction(add_lua_bin2c)
2  dist.info
View
@@ -1,7 +1,7 @@
--- This file is part of LuaDist project
name = "libpng"
-version = "1.4.1"
+version = "1.5.10"
author = "Guy Eric Schalnat, Andreas Dilger, Glenn Randers-Pehrson (current maintainer), and others"
desc = "official PNG reference library"
Please sign in to comment.
Something went wrong with that request. Please try again.