Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated cmake macros

  • Loading branch information...
commit 1a821c3bb012e13f3f09eb1147a8f03d040f758e 1 parent 171588b
@drahosp drahosp authored
View
45 .travis.yml
@@ -2,39 +2,40 @@
# LuaDist Travis-CI Hook
#
-# Since CMake is not directly supported we use erlang VMs
-language: erlang
-
+# We assume C build environments
+language: C
+
# Try using multiple Lua Implementations
env:
- - LUA="" # Use automatic dependencies
- - LUA="luajit" # Try with LuaJIT
-# - CMAKE="-DCMAKE_VARIABLE=value"
-# - LUA="lua-5.1.5"
+ - TOOL="" # Use native compiler (GCC usually)
+ - COMPILER="clang" # Use clang
+ - TOOL="i686-w64-mingw32" # 32bit MinGW
+ - TOOL="x86_64-w64-mingw32" # 64bit MinGW
+ - TOOL="arm-linux-gnueabihf" # ARM hard-float (hf), linux
-# Allow luajit to fail
+# Crosscompile builds may fail
matrix:
allow_failures:
- - env: LUA="luajit"
-
-# We need CMake and LuaDist
+ - env: TOOL="i686-w64-mingw32"
+ - env: TOOL="x86_64-w64-mingw32"
+ - env: TOOL="arm-linux-gnueabihf"
+
+# Install dependencies
install:
- - export MODULE=`basename $PWD`
- - sudo apt-get install cmake >/dev/null 2>&1
- - git clone git://github.com/LuaDist/bootstrap.git _luadist >/dev/null 2>&1
- - cd _luadist
- - git submodule update --init >/dev/null 2>&1
- - ./bootstrap >/dev/null 2>&1
- - export LUADIST=$PWD/_install/bin/luadist
- - cd $HOME
+ - git clone git://github.com/LuaDist/_util.git ~/_util
+ - ~/_util/travis install
+
+# Bootstap
+before_script:
+ - ~/_util/travis bootstrap
-# Use LuaDist to deploy the module
+# Build the module
script:
- - $LUADIST _test install $LUA $MODULE-scm $CMAKE -verbose=true -test=true
+ - ~/_util/travis build
# Execute additional tests or commands
#after_script:
-# - [run additional test commans]
+# - ~/_util/travis test
# Only watch the master branch
branches:
View
426 CMakeLists.txt
@@ -1,220 +1,212 @@
-# This is a slightly modified CMakeLists.txt file to suit LuaDist needs.
-
-# $Id$
-
-PROJECT(gd) # LuaDist: do NOT change!
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-
-SET(GD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-
-SET(PACKAGE GD)
-SET(PACKAGE_NAME GD)
-SET(CMAKE_MODULE_PATH "${GD_SOURCE_DIR}/cmake/modules")
-
-INCLUDE(dist.cmake)
-
-OPTION(ENABLE_PNG "Enable PNG support" 1)
-OPTION(ENABLE_JPEG "Enable JPEG support" 1)
-OPTION(ENABLE_TIFF "Enable TIFF support" 1)
-OPTION(ENABLE_XPM "Enable XPM support" 1)
-OPTION(ENABLE_FREETYPE "Enable Freetype2 support" 1)
-OPTION(ENABLE_WBMP "Enable WBMP support" 1)
-OPTION(ENABLE_FONTCONFIG "Enable FontConfig support" 1)
-
-if (BUILD_TEST)
- ENABLE_TESTING()
-endif(BUILD_TEST)
-
-if (NOT WIN32)
- if(CMAKE_BUILD_TYPE)
- STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
- IF (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0")
- ENDIF (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
- endif(CMAKE_BUILD_TYPE)
-endif (NOT WIN32)
-
-if (USE_EXT_GD)
- message("Using GD at: ${USE_EXT_GD}")
- INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
- FIND_PACKAGE(GD)
- if (GD_FOUND)
- INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
- LINK_DIRECTORIES(BEFORE ${GD_LIBRARIES})
- SET(GD_LIB ${GD_LIBRARIES})
- SET(GD_LIBS_DIR ${GD_LIBRARY})
-
- message("GD libs #: ${GD_LIBRARIES}")
- message("GD lib #: ${GD_LIBRARY}")
- message("GD include: ${GD_INCLUDE_DIR}")
- else (GD_FOUND)
- message("No gd found")
- endif (GD_FOUND)
-else (USE_EXT_GD)
-
- SET(GD_VERSION_MAJOR "2")
- SET(GD_VERSION_MINOR "1")
- SET(GD_VERSION_PATCH "0")
- SET(GD_VERSION "${GD_VERSION_MAJOR}.${GD_VERSION_MINOR}.${GD_VERSION_PATCH}")
- SET(GD_VERSION_STRING "${GD_VERSION}")
-
- SET(GD_VERSION_INT "20100")
-
- SET(CMAKE_REQUIRED_INCLUDES "/usr/include" "/usr/local/include")
-
- include(CheckIncludeFiles)
- include(CheckIncludeFile)
-
- include(AC_HEADER_STDC)
- include(CheckPrototypeExists)
- SET(FONTCONFIG_FIND_QUIETLY, 1)
-
- message(STATUS "PNG Support: ${ENABLE_PNG}")
-
- if (ENABLE_PNG)
- FIND_PACKAGE(PNG REQUIRED)
- endif (ENABLE_PNG)
-
- FIND_PACKAGE(ZLIB)
-
- IF (NOT WIN32)
- FIND_PACKAGE(PTHREAD)
- ENDIF (NOT WIN32)
-
- FIND_PACKAGE(Freetype)
- FIND_PACKAGE(XPM)
-
- if (ENABLE_JPEG)
- FIND_PACKAGE(JPEG)
- endif (ENABLE_JPEG)
-
- if (ENABLE_TIFF)
- FIND_PACKAGE(TIFF)
- endif (ENABLE_TIFF)
-
- if (NOT WIN32)
- FIND_PACKAGE(PTHREAD)
- endif (NOT WIN32)
-
- if (ENABLE_FREETYPE)
- FIND_PACKAGE(Freetype)
- endif (ENABLE_FREETYPE)
-
- if (ENABLE_XPM)
- FIND_PACKAGE(XPM)
- endif (ENABLE_XPM)
-
- if (ENABLE_FONTCONFIG)
- FIND_PACKAGE(Fontconfig)
- endif (ENABLE_FONTCONFIG)
-
- if (FREETYPE_FOUND)
- INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIR})
- SET(HAVE_FT2BUILD_H 1)
- SET(HAVE_LIBFREETYPE 1)
- ENDIF(FREETYPE_FOUND)
-
- IF(ZLIB_FOUND)
- INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
- SET(HAVE_LIBZ 1)
- SET(HAVE_LIBPNG_PNG_H 1)
- ENDIF(ZLIB_FOUND)
-
- IF(PNG_FOUND)
- INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
- SET(HAVE_LIBPNG 1)
- ENDIF(PNG_FOUND)
-
- IF(XPM_FOUND)
- INCLUDE_DIRECTORIES(${XPM_INCLUDE_DIR})
- SET(HAVE_LIBXPM 1)
- ENDIF(XPM_FOUND)
-
- IF(JPEG_FOUND)
- INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
- SET(HAVE_LIBJPEG 1)
- ENDIF(JPEG_FOUND)
-
- IF(TIFF_FOUND)
- INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
- SET(HAVE_LIBTIFF 1)
- ENDIF(TIFF_FOUND)
-
- IF(FONTCONFIG_FOUND)
- INCLUDE_DIRECTORIES(${FONTCONFIG_INCLUDE_DIR})
- SET(HAVE_LIBFONTCONFIG 1)
- ELSE (FONTCONFIG_FOUND)
- SET(FONTCONFIG_LIBRARIES "")
- SET(FONTCONFIG_INCLUDE_DIR "")
- SET(FONTCONFIG_LIB_DIR "")
- ENDIF(FONTCONFIG_FOUND)
-
- SET(HAVE_CONFIG_H 1)
-
- ADD_DEFINITIONS(-DHAVE_CONFIG_H)
-
- CONFIGURE_FILE(${GD_SOURCE_DIR}/src/config.h.cmake ${CMAKE_BINARY_DIR}/config.h ESCAPE_QUOTES)
-
- set(BUILD_SHARED_LIBS On)
-
- if (WIN32)
- SET(GD_LIB bgd)
- ADD_DEFINITIONS( -DWIN32 -D_WIN32 -DMSWIN32 -DBGDWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0600)
-
- if(NOT MINGW AND MSVC_VERSION GREATER 1399)
- ADD_DEFINITIONS("/D_CRT_SECURE_NO_DEPRECATE")
- endif(NOT MINGW AND MSVC_VERSION GREATER 1399)
- if (MINGW OR MSYS)
- ADD_DEFINITIONS("-mms-bitfields -m32")
- endif (MINGW OR MSYS)
- else (WIN32)
- SET(GD_LIB gd)
- endif (WIN32)
-
- SET(GD_LIB_STATIC "${GD_LIB}-static")
-
- IF(PROFILE)
- add_definitions("-pg")
- set(CMAKE_EXE_LINKER_FLAGS ${LINK_FLAGS} "-pg")
- ENDIF(PROFILE)
-
- SET(GD_INCLUDE_DIR "${GD_SOURCE_DIR}/src" "${GD_SOURCE_DIR}")
- INCLUDE_DIRECTORIES(before ${FONTCONFIG_INCLUDE_DIR})
-
- add_subdirectory(src)
-endif (USE_EXT_GD)
-
-add_subdirectory(tests)
-add_subdirectory(examples)
-
-
-SET(CPACK_PACKAGE_NAME "libgd")
-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libGD, powerful and easy to use graphic library")
-SET(CPACK_PACKAGE_VENDOR "http://www.libgd.org")
-SET(CPACK_PACKAGE_VERSION_MAJOR "2")
-SET(CPACK_PACKAGE_VERSION_MINOR "1")
-SET(CPACK_PACKAGE_VERSION_PATCH "0")
-
-if(WIN32)
- set(CPACK_GENERATOR ZIP)
-else(WIN32)
- set(CPACK_GENERATOR TGZ)
-endif(WIN32)
-
-
-set(CPACK_SOURCE_GENERATOR TGZ)
-set(CPACK_SOURCE_IGNORE_FILES
-"~$"
-"\\\\.swp$"
-"\\\\.cvsignore$"
-"^${PROJECT_SOURCE_DIR}.*/CVS/"
-"^${PROJECT_SOURCE_DIR}/debian/"
-"^${PROJECT_SOURCE_DIR}/old/"
-"^${PROJECT_SOURCE_DIR}/bld/"
-"^${PROJECT_SOURCE_DIR}/autom4te\\\\.cache/"
-)
+# This is a slightly modified original CMakeLists.txt file to suit LuaDist needs.
+
+project ( gd )
+cmake_minimum_required ( VERSION 2.8 )
+
+set ( GD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
+
+set ( PACKAGE GD )
+set ( PACKAGE_NAME GD )
+set ( CMAKE_MODULE_PATH "${GD_SOURCE_DIR}/cmake/modules" )
+
+include ( cmake/dist.cmake )
+
+option ( ENABLE_PNG "Enable PNG support" 1 )
+option ( ENABLE_JPEG "Enable JPEG support" 1 )
+option ( ENABLE_TIFF "Enable TIFF support" 1 )
+option ( ENABLE_XPM "Enable XPM support" 1 )
+option ( ENABLE_FREETYPE "Enable Freetype2 support" 1 )
+option ( ENABLE_WBMP "Enable WBMP support" 1 )
+option ( ENABLE_FONTCONFIG "Enable FontConfig support" 1 )
+
+if ( BUILD_TEST )
+ enable_testing ( )
+endif ( BUILD_TEST )
+
+if ( NOT WIN32 )
+ if ( CMAKE_BUILD_TYPE )
+ string ( TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER )
+ if ( CMAKE_BUILD_TYPE_TOLOWER MATCHES debug )
+ set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -O0" )
+ endif ( CMAKE_BUILD_TYPE_TOLOWER MATCHES debug )
+ endif ( CMAKE_BUILD_TYPE )
+endif ( NOT WIN32 )
+
+if ( USE_EXT_GD )
+ message ( "Using GD at: ${USE_EXT_GD}" )
+ include_directories ( BEFORE ${GD_INCLUDE_DIR} )
+ find_package ( GD )
+ if ( GD_FOUND )
+ include_directories ( BEFORE ${GD_INCLUDE_DIR} )
+ link_directories ( BEFORE ${GD_LIBRARIES} )
+ set ( GD_LIB ${GD_LIBRARIES} )
+ set ( GD_LIBS_DIR ${GD_LIBRARY} )
+
+ message ( "GD libs #: ${GD_LIBRARIES}" )
+ message ( "GD lib #: ${GD_LIBRARY}" )
+ message ( "GD include: ${GD_INCLUDE_DIR}" )
+ else ( GD_FOUND )
+ message ( "No gd found" )
+ endif ( GD_FOUND )
+else ( USE_EXT_GD )
+
+ set ( GD_VERSION_MAJOR "2" )
+ set ( GD_VERSION_MINOR "1" )
+ set ( GD_VERSION_PATCH "0" )
+ set ( GD_VERSION "${GD_VERSION_MAJOR}.${GD_VERSION_MINOR}.${GD_VERSION_PATCH}" )
+ set ( GD_VERSION_STRING "${GD_VERSION}" )
+
+ set ( GD_VERSION_INT "20100" )
+
+ set ( CMAKE_REQUIRED_INCLUDES "/usr/include" "/usr/local/include" )
+
+ include ( CheckIncludeFiles )
+ include ( CheckIncludeFile )
+
+ include ( AC_HEADER_STDC )
+ include ( CheckPrototypeExists )
+ set ( FONTCONFIG_FIND_QUIETLY, 1 )
+
+ message ( STATUS "PNG Support: ${ENABLE_PNG}" )
+
+ if ( ENABLE_PNG )
+ find_package ( PNG REQUIRED )
+ endif ( ENABLE_PNG )
+
+ find_package ( ZLIB )
+
+ if ( NOT WIN32 )
+ find_package ( PTHREAD )
+ endif ( NOT WIN32 )
+
+ find_package ( Freetype )
+ find_package ( XPM )
+
+ if ( ENABLE_JPEG )
+ find_package ( JPEG )
+ endif ( ENABLE_JPEG )
+
+ if ( ENABLE_TIFF )
+ find_package ( TIFF )
+ endif ( ENABLE_TIFF )
+
+ if ( NOT WIN32 )
+ find_package ( PTHREAD )
+ endif ( NOT WIN32 )
+
+ if ( ENABLE_FREETYPE )
+ find_package ( Freetype )
+ endif ( ENABLE_FREETYPE )
+
+ if ( ENABLE_XPM )
+ find_package ( XPM )
+ endif ( ENABLE_XPM )
+
+ if ( ENABLE_FONTCONFIG )
+ find_package ( Fontconfig )
+ endif ( ENABLE_FONTCONFIG )
+
+ if ( FREETYPE_FOUND )
+ include_directories ( ${FREETYPE_INCLUDE_DIR} )
+ set ( HAVE_FT2BUILD_H 1 )
+ set ( HAVE_LIBFREETYPE 1 )
+ endif ( FREETYPE_FOUND )
+
+ if ( ZLIB_FOUND )
+ include_directories ( ${PNG_INCLUDE_DIR} )
+ set ( HAVE_LIBZ 1 )
+ set ( HAVE_LIBPNG_PNG_H 1 )
+ endif ( ZLIB_FOUND )
+
+ if ( PNG_FOUND )
+ include_directories ( ${PNG_INCLUDE_DIR} )
+ set ( HAVE_LIBPNG 1 )
+ endif ( PNG_FOUND )
+
+ if ( XPM_FOUND )
+ include_directories ( ${XPM_INCLUDE_DIR} )
+ set ( HAVE_LIBXPM 1 )
+ endif ( XPM_FOUND )
+
+ if ( JPEG_FOUND )
+ include_directories ( ${JPEG_INCLUDE_DIR} )
+ set ( HAVE_LIBJPEG 1 )
+ endif ( JPEG_FOUND )
+
+ if ( TIFF_FOUND )
+ include_directories ( ${TIFF_INCLUDE_DIR} )
+ set ( HAVE_LIBTIFF 1 )
+ endif ( TIFF_FOUND )
+
+ if ( FONTCONFIG_FOUND )
+ include_directories ( ${FONTCONFIG_INCLUDE_DIR} )
+ set ( HAVE_LIBFONTCONFIG 1 )
+ else ( FONTCONFIG_FOUND )
+ set ( FONTCONFIG_LIBRARIES "" )
+ set ( FONTCONFIG_INCLUDE_DIR "" )
+ set ( FONTCONFIG_LIB_DIR "" )
+ endif ( FONTCONFIG_FOUND )
+
+ set ( HAVE_CONFIG_H 1 )
+
+ add_definitions ( -DHAVE_CONFIG_H )
+
+ configure_file ( ${GD_SOURCE_DIR}/src/config.h.cmake ${CMAKE_BINARY_DIR}/config.h
+ ESCAPE_QUOTES )
+
+ set ( BUILD_SHARED_LIBS On )
+
+ if ( WIN32 )
+ set ( GD_LIB bgd )
+ add_definitions ( -DWIN32 -D_WIN32 -DMSWIN32 -DBGDWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500
+ -D_WIN32_IE=0x0600 )
+
+ if ( NOT MINGW AND MSVC_VERSION GREATER 1399 )
+ add_definitions ( "/D_CRT_SECURE_NO_DEPRECATE" )
+ endif ( NOT MINGW AND MSVC_VERSION GREATER 1399 )
+ if ( MINGW OR MSYS )
+ add_definitions ( "-mms-bitfields -m32" )
+ endif ( MINGW OR MSYS )
+ else ( WIN32 )
+ set ( GD_LIB gd )
+ endif ( WIN32 )
+
+ set ( GD_LIB_STATIC "${GD_LIB}-static" )
+
+ if ( PROFILE )
+ add_definitions ( "-pg" )
+ set ( CMAKE_EXE_LINKER_FLAGS ${LINK_FLAGS} "-pg" )
+ endif ( PROFILE )
+
+ set ( GD_INCLUDE_DIR "${GD_SOURCE_DIR}/src" "${GD_SOURCE_DIR}" )
+ include_directories ( before ${FONTCONFIG_INCLUDE_DIR} )
+
+ add_subdirectory ( src )
+endif ( USE_EXT_GD )
+
+add_subdirectory ( tests )
+add_subdirectory ( examples )
+
+set ( CPACK_PACKAGE_NAME "libgd" )
+set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "libGD, powerful and easy to use graphic library" )
+set ( CPACK_PACKAGE_VENDOR "http://www.libgd.org" )
+set ( CPACK_PACKAGE_VERSION_MAJOR "2" )
+set ( CPACK_PACKAGE_VERSION_MINOR "1" )
+set ( CPACK_PACKAGE_VERSION_PATCH "0" )
+
+if ( WIN32 )
+ set ( CPACK_GENERATOR ZIP )
+else ( WIN32 )
+ set ( CPACK_GENERATOR TGZ )
+endif ( WIN32 )
+
+set ( CPACK_SOURCE_GENERATOR TGZ )
+set ( CPACK_SOURCE_IGNORE_FILES "~$" "\\\\.swp$" "\\\\.cvsignore$" "^${PROJECT_SOURCE_DIR}.*/CVS/"
+ "^${PROJECT_SOURCE_DIR}/debian/" "^${PROJECT_SOURCE_DIR}/old/" "^${PROJECT_SOURCE_DIR}/bld/"
+ "^${PROJECT_SOURCE_DIR}/autom4te\\\\.cache/" )
#~ install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR}) # LuaDist: ???
-INCLUDE(CPack)
+include ( CPack )
# LuaDist: install additional stuff
-install(FILES ChangeLog NEWS docs/README.TXT docs/README-JPEG.TXT docs/README.JPN docs/README.TESTING DESTINATION ${INSTALL_DOC})
+install_data ( ChangeLog NEWS docs/README.TXT docs/README-JPEG.TXT docs/README.JPN
+ docs/README.TESTING )
View
321 cmake/dist.cmake
@@ -0,0 +1,321 @@
+# 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
+if ( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/dist.info )
+ message ( FATAL_ERROR
+ "Missing dist.info file (${CMAKE_CURRENT_SOURCE_DIR}/dist.info)." )
+endif ()
+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_LICENSE: ${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 ()
+
+# helper function for various install_* functions, for PATTERN/REGEX args.
+macro ( _complete_install_args )
+ if ( NOT("${_ARG_PATTERN}" STREQUAL "") )
+ set ( _ARG_PATTERN PATTERN ${_ARG_PATTERN} )
+ endif ()
+ if ( NOT("${_ARG_REGEX}" STREQUAL "") )
+ set ( _ARG_REGEX REGEX ${_ARG_REGEX} )
+ endif ()
+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 )
+# For directories, supports optional PATTERN/REGEX arguments like install().
+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;PATTERN;REGEX" "" ${ARGN} )
+ _complete_install_args()
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_INC}/${_ARG_INTO}
+ COMPONENT Header ${_ARG_PATTERN} ${_ARG_REGEX} )
+ 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 )
+# For directories, supports optional PATTERN/REGEX arguments like install().
+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;PATTERN;REGEX" "" ${ARGN} )
+ _complete_install_args()
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file}
+ DESTINATION ${INSTALL_DATA}/${_ARG_INTO}
+ COMPONENT Data ${_ARG_PATTERN} ${_ARG_REGEX} )
+ 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 )
+# For directories, supports optional PATTERN/REGEX arguments like install().
+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;PATTERN;REGEX" "" ${ARGN} )
+ _complete_install_args()
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_DOC}/${_ARG_INTO}
+ COMPONENT Documentation ${_ARG_PATTERN} ${_ARG_REGEX} )
+ 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)
+# For directories, supports optional PATTERN/REGEX argument like install().
+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;PATTERN;REGEX" "" ${ARGN} )
+ _complete_install_args()
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_EXAMPLE}/${_ARG_INTO}
+ COMPONENT Example ${_ARG_PATTERN} ${_ARG_REGEX} )
+ 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 )
+# For directories, supports optional PATTERN/REGEX argument like install().
+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;PATTERN;REGEX" "" ${ARGN} )
+ _complete_install_args()
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_TEST}/${_ARG_INTO}
+ COMPONENT Test ${_ARG_PATTERN} ${_ARG_REGEX} )
+ 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)
+# For directories, supports optional PATTERN/REGEX argument like install().
+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;PATTERN;REGEX" "" ${ARGN} )
+ _complete_install_args()
+ foreach ( _file ${_ARG_DEFAULT_ARGS} )
+ if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" )
+ install ( DIRECTORY ${_file} DESTINATION ${INSTALL_FOO}/${_ARG_INTO}
+ COMPONENT Other ${_ARG_PATTERN} ${_ARG_REGEX} )
+ 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 )
View
130 dist.cmake
@@ -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)
View
115 src/CMakeLists.txt
@@ -1,98 +1,43 @@
-
-SET (LIBGD_SRC_FILES
- gd.c
- gdfx.c
- gdfx.h
- gd_color.c
- gd_color.h
- gd_color_map.c
- gd_color_map.h
- gd_crop.c
- gd_transform.c
- gd_security.c
- gdpp.cxx
- gdpp.h
- gd_bmp.c
- bmp.h
- gd_filter.c
- gd_gd.c
- gd_gd2.c
- gd_io.c
- gd_io.h
- gd_io_stream.cxx
- gd_io_stream.h
- gd_io_dp.c
- gd_gif_in.c
- gd_gif_out.c
- gd_io_file.c
- gd_io_ss.c
- gd_jpeg.c
- gd_nnquant.c
- gd_nnquant.h
- gd_pixelate.c
- gd_png.c
- gd_tiff.c
- gd_tga.c
- gd_tga.h
- gd_ss.c
- gd_topal.c
- gd_wbmp.c
- gdcache.c
- gdcache.h
- gdfontg.c
- gdfontg.h
- gdfontl.c
- gdfontl.h
- gdfontmb.c
- gdfontmb.h
- gdfonts.c
- gdfonts.h
- gdfontt.c
- gdfontt.h
- gdft.c
- gdhelpers.c
- gdhelpers.h
- gdkanji.c
- gdtables.c
- gdxpm.c
- jisx0208.h
- wbmp.c
- gd.h
- wbmp.h
-)
-
-
-add_library(${GD_LIB} ${LIBGD_SRC_FILES})
+set ( LIBGD_SRC_FILES gd.c gdfx.c gdfx.h gd_color.c gd_color.h gd_color_map.c gd_color_map.h
+ gd_crop.c gd_transform.c gd_security.c gdpp.cxx gdpp.h gd_bmp.c bmp.h gd_filter.c
+ gd_gd.c gd_gd2.c gd_io.c gd_io.h gd_io_stream.cxx gd_io_stream.h gd_io_dp.c gd_gif_in.c
+ gd_gif_out.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_nnquant.c gd_nnquant.h gd_pixelate.c
+ gd_png.c gd_tiff.c gd_tga.c gd_tga.h gd_ss.c gd_topal.c gd_wbmp.c gdcache.c gdcache.h
+ gdfontg.c gdfontg.h gdfontl.c gdfontl.h gdfontmb.c gdfontmb.h gdfonts.c gdfonts.h
+ gdfontt.c gdfontt.h gdft.c gdhelpers.c gdhelpers.h gdkanji.c gdtables.c gdxpm.c
+ jisx0208.h wbmp.c gd.h wbmp.h )
+
+add_library ( ${GD_LIB} ${LIBGD_SRC_FILES} )
#~ add_library(${GD_LIB_STATIC} STATIC ${LIBGD_SRC_FILES}) # LuaDist: we build only dynamic
-if (WIN32 AND NOT MINGW AND NOT MSYS)
-# SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib")
-ENDIF(WIN32 AND NOT MINGW AND NOT MSYS)
+if ( WIN32 AND NOT MINGW AND NOT MSYS )
+ # SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib")
+endif ( WIN32 AND NOT MINGW AND NOT MSYS )
-if (MINGW OR MSYS)
- ADD_DEFINITIONS("-mms-bitfields")
-endif (MINGW OR MSYS)
+if ( MINGW OR MSYS )
+ add_definitions ( "-mms-bitfields" )
+endif ( MINGW OR MSYS )
-INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/ ${GD_SOURCE_DIR}/src)
+include_directories ( ${CMAKE_BINARY_DIR}/ ${GD_SOURCE_DIR}/src )
-target_link_libraries(${GD_LIB} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARIES})
+target_link_libraries ( ${GD_LIB} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES}
+ ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARIES} )
# LuaDist: we build only dynamic:
# target_link_libraries(${GD_LIB_STATIC} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARIES})
-set(GD_PROGRAMS annotate gdparttopng gdtopng gd2copypal gd2topng pngtogd pngtogd2 webpng gd2togif gdcmpgif giftogd2)
-foreach(program ${GD_PROGRAMS})
- add_executable(${program} ${program}.c)
- target_link_libraries(${program} ${GD_LIB})
-endforeach(program)
+set ( GD_PROGRAMS annotate gdparttopng gdtopng gd2copypal gd2topng pngtogd pngtogd2
+ webpng gd2togif gdcmpgif giftogd2 )
+foreach ( program ${GD_PROGRAMS} )
+ add_executable ( ${program} ${program}.c )
+ target_link_libraries ( ${program} ${GD_LIB} )
+ install_executable( ${program} )
+endforeach ( program )
# LuaDist: changed instalation paths:
-install(TARGETS ${GD_LIB} ${GD_PROGRAMS} # ${GD_LIB_STATIC} # LuaDist: we build only dynamic
- RUNTIME DESTINATION ${INSTALL_BIN}
- LIBRARY DESTINATION ${INSTALL_LIB}
- ARCHIVE DESTINATION ${INSTALL_LIB})
+install_library ( ${GD_LIB} )
-install(PROGRAMS bdftogd DESTINATION ${INSTALL_FOO})
-install(FILES gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h gd_color_map.h DESTINATION ${INSTALL_INC})
+install_header ( gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h
+ gdfontt.h gd_color_map.h )
# LuaDist: install additional stuff
-install(FILES entities.html COPYING DESTINATION ${INSTALL_DOC})
+install_doc ( entities.html )
View
95 tests/CMakeLists.txt
@@ -1,74 +1,41 @@
+if ( BUILD_TEST )
+ set ( DART_TESTING_TIMEOUT 5 )
-if (BUILD_TEST)
- SET(DART_TESTING_TIMEOUT 5)
+ include ( Dart )
- INCLUDE(Dart)
+ set ( GDTEST_SOURCE_DIR ${GD_SOURCE_DIR}/tests/gdtest )
- set(GDTEST_SOURCE_DIR ${GD_SOURCE_DIR}/tests/gdtest)
+ if ( ENABLE_GCOV AND CMAKE_COMPILER_IS_GNUCC )
+ set ( CMAKE_BUILD_TYPE TESTINGGCOV )
+ set ( CMAKE_CXX_FLAGS_TESTINGGCOV "-g3 -O0" )
+ set ( CMAKE_C_FLAGS_TESTINGGCOV "-g3 -O0" )
+ endif ( ENABLE_GCOV AND CMAKE_COMPILER_IS_GNUCC )
- IF (ENABLE_GCOV AND CMAKE_COMPILER_IS_GNUCC)
- SET(CMAKE_BUILD_TYPE TESTINGGCOV)
- SET(CMAKE_CXX_FLAGS_TESTINGGCOV "-g3 -O0")
- SET(CMAKE_C_FLAGS_TESTINGGCOV "-g3 -O0")
- endif (ENABLE_GCOV AND CMAKE_COMPILER_IS_GNUCC)
+ message ( STATUS "gd include dir: ${GD_INCLUDE_DIR}" )
+ message ( STATUS "gd libs dir: ${GD_LIBS_DIR}" )
- message(STATUS "gd include dir: ${GD_INCLUDE_DIR}" )
- message(STATUS "gd libs dir: ${GD_LIBS_DIR}" )
+ include_directories ( BEFORE ${GD_INCLUDE_DIR} "${GDTEST_SOURCE_DIR}" )
+ link_directories ( "${GD_LIBS_DIR}" "${GDTEST_BINARY_DIR}/gdtest" )
- include_directories (BEFORE ${GD_INCLUDE_DIR} "${GDTEST_SOURCE_DIR}")
- link_directories ("${GD_LIBS_DIR}" "${GDTEST_BINARY_DIR}/gdtest")
+ include_directories ( BEFORE ${GD_INCLUDE_DIR} "${GDTEST_SOURCE_DIR}" "${CMAKE_BINARY_DIR}"
+ "${CMAKE_BINARY_DIR}/tests/gdtest" )
- include_directories (BEFORE ${GD_INCLUDE_DIR} "${GDTEST_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/tests/gdtest")
+ set ( TESTS_DIRS gdtest bmp freetype gd gd2 gdimagearc gdimagecolorclosest gdimagecolordeallocate
+ gdimagecolorexact gdimagecolorreplace gdimagecolorresolve gdimagecolortransparent
+ gdimagecopy gdimagecopyrotated #gdimageellipse
+ gdimagefill gdimagefilledellipse gdimagefilledpolygon gdimagefilledrectangle
+ gdimagefilltoborder gdimageline gdimageopenpolygon gdimagepixelate gdimagepolygon
+ gdimagerectangle gdimagescatterex gdimagesetpixel gdimagestringft gdimagestringftex
+ gdnewfilectx gdtiled gif jpeg png tga tiff wbmp xpm )
- SET(TESTS_DIRS
- gdtest
- bmp
- freetype
- gd
- gd2
- gdimagearc
- gdimagecolorclosest
- gdimagecolordeallocate
- gdimagecolorexact
- gdimagecolorreplace
- gdimagecolorresolve
- gdimagecolortransparent
- gdimagecopy
- gdimagecopyrotated
- #gdimageellipse
- gdimagefill
- gdimagefilledellipse
- gdimagefilledpolygon
- gdimagefilledrectangle
- gdimagefilltoborder
- gdimageline
- gdimageopenpolygon
- gdimagepixelate
- gdimagepolygon
- gdimagerectangle
- gdimagescatterex
- gdimagesetpixel
- gdimagestringft
- gdimagestringftex
- gdnewfilectx
- gdtiled
- gif
- jpeg
- png
- tga
- tiff
- wbmp
- xpm
- )
+ if ( WIN32 )
+ set ( GDTESTS_TARGET_LINK "gdTest" )
+ else ( WIN32 )
+ set ( GDTESTS_TARGET_LINK "gdTest" )
+ endif ( WIN32 )
- IF (WIN32)
- SET(GDTESTS_TARGET_LINK "gdTest")
- ELSE (WIN32)
- SET(GDTESTS_TARGET_LINK "gdTest")
- ENDIF (WIN32)
+ foreach ( test_dir ${TESTS_DIRS} )
+ add_subdirectory ( ${test_dir} )
+ endforeach ( test_dir )
- FOREACH(test_dir ${TESTS_DIRS})
- add_subdirectory (${test_dir})
- ENDFOREACH(test_dir)
-
-endif (BUILD_TEST)
+endif ( BUILD_TEST )
Please sign in to comment.
Something went wrong with that request. Please try again.