mirror of
				https://github.com/eclipse/upm.git
				synced 2025-11-04 00:54:21 +03:00 
			
		
		
		
	ipk: add cpack ipk generation
* added similar cmake modules used in libmaa Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
		@@ -12,8 +12,35 @@ find_package (PkgConfig REQUIRED)
 | 
				
			|||||||
pkg_check_modules (MAA REQUIRED maa>=0.2.6)
 | 
					pkg_check_modules (MAA REQUIRED maa>=0.2.6)
 | 
				
			||||||
message (INFO " found libmaa version: ${MAA_VERSION}")
 | 
					message (INFO " found libmaa version: ${MAA_VERSION}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
 | 
				
			||||||
 | 
					set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Make a version file containing the current version from git.
 | 
				
			||||||
 | 
					include (GetGitRevisionDescription)
 | 
				
			||||||
 | 
					git_describe (VERSION "--tags")
 | 
				
			||||||
 | 
					if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND")
 | 
				
			||||||
 | 
					  message (WARNING " - Install git to compile a production libmaa!")
 | 
				
			||||||
 | 
					  set (VERSION "v0.1.1-dirty")
 | 
				
			||||||
 | 
					endif ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					message (INFO " - UPM Version ${VERSION}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#parse the version information into pieces.
 | 
				
			||||||
 | 
					string (REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}")
 | 
				
			||||||
 | 
					string (REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}")
 | 
				
			||||||
 | 
					string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VERSION}")
 | 
				
			||||||
 | 
					string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+).*" "\\1" VERSION_COMMIT "${VERSION}")
 | 
				
			||||||
 | 
					string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+\\-(.*)" "\\1" VERSION_SHA1 "${VERSION}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set (upm_VERSION_MAJOR ${VERSION_MAJOR})
 | 
				
			||||||
 | 
					set (upm_VERSION_MINOR ${VERSION_MINOR})
 | 
				
			||||||
 | 
					set (upm_VERSION_PATCH ${VERSION_PATCH})
 | 
				
			||||||
 | 
					set (upm_VERSION_STRING ${maa_VERSION_MAJOR}.${maa_VERSION_MINOR}.${maa_VERSION_PATCH})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set (CMAKE_SWIG_FLAGS "")
 | 
					set (CMAKE_SWIG_FLAGS "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					option (IPK "Generate IPK using CPack" OFF)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# add a target to generate API documentation with Doxygen
 | 
					# add a target to generate API documentation with Doxygen
 | 
				
			||||||
find_package (Doxygen)
 | 
					find_package (Doxygen)
 | 
				
			||||||
if (DOXYGEN_FOUND)
 | 
					if (DOXYGEN_FOUND)
 | 
				
			||||||
@@ -25,6 +52,27 @@ if (DOXYGEN_FOUND)
 | 
				
			|||||||
  )
 | 
					  )
 | 
				
			||||||
endif (DOXYGEN_FOUND)
 | 
					endif (DOXYGEN_FOUND)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (IPK)
 | 
				
			||||||
 | 
					  include (TargetArch)
 | 
				
			||||||
 | 
					  target_architecture (DETECTED_ARCH)
 | 
				
			||||||
 | 
					  message( INFO " - Target arch is ${DETECTED_ARCH}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  set(CPACK_GENERATOR "DEB")
 | 
				
			||||||
 | 
					  set(OPKG_ARCH ${DETECTED_ARCH})
 | 
				
			||||||
 | 
					  set(CPACK_BINARY_DIR ${CMAKE_BINARY_DIR})
 | 
				
			||||||
 | 
					  set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Intel IoT-Devkit") #required
 | 
				
			||||||
 | 
					  set(CPACK_PACKAGE_VERSION ${upm_VERSION_MAJOR}.${upm_VERSION_MINOR}.${upm_VERSION_PATCH}.${VERSION_COMMIT})
 | 
				
			||||||
 | 
					  set(CPACK_PACKAGE_NAME "libupm${upm_VERSION_MAJOR}")
 | 
				
			||||||
 | 
					  set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
 | 
				
			||||||
 | 
					  set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DETECTED_ARCH})
 | 
				
			||||||
 | 
					  set(CPACK_SYSTEM_NAME ${DETECTED_ARCH})
 | 
				
			||||||
 | 
					  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmaa0 (>= ${MAA_VERSION})")
 | 
				
			||||||
 | 
					  set(CPACK_DEBIAN_PACKAGE_PROVIDES "libupm-dev, libupm-dbg, libupm-doc")
 | 
				
			||||||
 | 
					  set(CPACK_DEBIAN_PACKAGE_REPLACES "libupm-dev, libupm-dbg, libupm-doc")
 | 
				
			||||||
 | 
					  set(CPACK_DEBIAN_PACKAGE_CONFLICTS "libupm-dev, libupm-dbg, libupm-doc")
 | 
				
			||||||
 | 
					  set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
 | 
				
			||||||
  include (CPack)
 | 
					  include (CPack)
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_subdirectory (src)
 | 
					add_subdirectory (src)
 | 
				
			||||||
add_subdirectory (examples)
 | 
					add_subdirectory (examples)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										222
									
								
								cmake/modules/CPackDeb.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										222
									
								
								cmake/modules/CPackDeb.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,222 @@
 | 
				
			|||||||
 | 
					# - The builtin (binary) CPack Deb generator (Unix only)
 | 
				
			||||||
 | 
					# CPackDeb may be used to create Deb package using CPack.
 | 
				
			||||||
 | 
					# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
 | 
				
			||||||
 | 
					# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# However CPackRPM has specific features which are controlled by
 | 
				
			||||||
 | 
					# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on 
 | 
				
			||||||
 | 
					# the wiki: 
 | 
				
			||||||
 | 
					#  http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
 | 
				
			||||||
 | 
					# However as a handy reminder here comes the list of specific variables:
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  CPACK_DEBIAN_PACKAGE_NAME
 | 
				
			||||||
 | 
					#     Mandatory : YES
 | 
				
			||||||
 | 
					#     Default   : CPACK_PACKAGE_NAME (lower case)
 | 
				
			||||||
 | 
					#     The debian package summary
 | 
				
			||||||
 | 
					# CPACK_DEBIAN_PACKAGE_VERSION
 | 
				
			||||||
 | 
					#     Mandatory : YES
 | 
				
			||||||
 | 
					#     Default   : CPACK_PACKAGE_VERSION
 | 
				
			||||||
 | 
					#     The debian package version
 | 
				
			||||||
 | 
					# CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
 | 
				
			||||||
 | 
					#     Mandatory : YES
 | 
				
			||||||
 | 
					#     Default   : Output of dpkg --print-architecture or i386
 | 
				
			||||||
 | 
					#     The debian package architecture
 | 
				
			||||||
 | 
					# CPACK_DEBIAN_PACKAGE_DEPENDS
 | 
				
			||||||
 | 
					#     Mandatory : NO
 | 
				
			||||||
 | 
					#     Default   : -
 | 
				
			||||||
 | 
					#     May be used to set deb dependencies. 
 | 
				
			||||||
 | 
					# CPACK_DEBIAN_PACKAGE_MAINTAINER
 | 
				
			||||||
 | 
					#     Mandatory : YES
 | 
				
			||||||
 | 
					#     Default   : CPACK_PACKAGE_CONTACT
 | 
				
			||||||
 | 
					#     The debian package maintainer
 | 
				
			||||||
 | 
					# CPACK_DEBIAN_PACKAGE_DESCRIPTION
 | 
				
			||||||
 | 
					#     Mandatory : YES
 | 
				
			||||||
 | 
					#     Default   : CPACK_PACKAGE_DESCRIPTION_SUMMARY
 | 
				
			||||||
 | 
					#     The debian package description
 | 
				
			||||||
 | 
					# CPACK_DEBIAN_PACKAGE_SECTION
 | 
				
			||||||
 | 
					#     Mandatory : YES
 | 
				
			||||||
 | 
					#     Default   : 'devel'
 | 
				
			||||||
 | 
					#     The debian package section
 | 
				
			||||||
 | 
					# CPACK_DEBIAN_PACKAGE_PRIORITY
 | 
				
			||||||
 | 
					#     Mandatory : YES
 | 
				
			||||||
 | 
					#     Default   : 'optional'
 | 
				
			||||||
 | 
					#     The debian package priority
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#=============================================================================
 | 
				
			||||||
 | 
					# Copyright 2007-2009 Kitware, Inc.
 | 
				
			||||||
 | 
					# Copyright 2007-2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Distributed under the OSI-approved BSD License (the "License");
 | 
				
			||||||
 | 
					# see accompanying file Copyright.txt for details.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This software is distributed WITHOUT ANY WARRANTY; without even the
 | 
				
			||||||
 | 
					# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 | 
				
			||||||
 | 
					# See the License for more information.
 | 
				
			||||||
 | 
					#=============================================================================
 | 
				
			||||||
 | 
					# (To distributed this file outside of CMake, substitute the full
 | 
				
			||||||
 | 
					#  License text for the above reference.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# CPack script for creating Debian package
 | 
				
			||||||
 | 
					# Author: Mathieu Malaterre
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# http://wiki.debian.org/HowToPackageForDebian
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					IF(CMAKE_BINARY_DIR)
 | 
				
			||||||
 | 
					  MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.")
 | 
				
			||||||
 | 
					ENDIF(CMAKE_BINARY_DIR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					IF(NOT UNIX)
 | 
				
			||||||
 | 
					  MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.")
 | 
				
			||||||
 | 
					ENDIF(NOT UNIX)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Let's define the control file found in debian package:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Binary package:
 | 
				
			||||||
 | 
					# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# DEBIAN/control
 | 
				
			||||||
 | 
					# debian policy enforce lower case for package name
 | 
				
			||||||
 | 
					# Package: (mandatory)
 | 
				
			||||||
 | 
					IF(NOT CPACK_DEBIAN_PACKAGE_NAME)
 | 
				
			||||||
 | 
					  STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
 | 
				
			||||||
 | 
					ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Version: (mandatory)
 | 
				
			||||||
 | 
					IF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
 | 
				
			||||||
 | 
					  IF(NOT CPACK_PACKAGE_VERSION)
 | 
				
			||||||
 | 
					    MESSAGE(FATAL_ERROR "Debian package requires a package version")
 | 
				
			||||||
 | 
					  ENDIF(NOT CPACK_PACKAGE_VERSION)
 | 
				
			||||||
 | 
					  SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
 | 
				
			||||||
 | 
					ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Architecture: (mandatory)
 | 
				
			||||||
 | 
					IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
 | 
				
			||||||
 | 
					  # There is no such thing as i686 architecture on debian, you should use i386 instead
 | 
				
			||||||
 | 
					  # $ dpkg --print-architecture
 | 
				
			||||||
 | 
					  FIND_PROGRAM(DPKG_CMD dpkg)
 | 
				
			||||||
 | 
					  IF(NOT DPKG_CMD)
 | 
				
			||||||
 | 
					    MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
 | 
				
			||||||
 | 
					    SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
 | 
				
			||||||
 | 
					  ENDIF(NOT DPKG_CMD)
 | 
				
			||||||
 | 
					  EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
 | 
				
			||||||
 | 
					    OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
 | 
				
			||||||
 | 
					    OUTPUT_STRIP_TRAILING_WHITESPACE
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# have a look at GET_PROPERTY(result GLOBAL PROPERTY ENABLED_FEATURES),
 | 
				
			||||||
 | 
					# this returns the successful FIND_PACKAGE() calls, maybe this can help
 | 
				
			||||||
 | 
					# Depends:
 | 
				
			||||||
 | 
					# You should set: DEBIAN_PACKAGE_DEPENDS
 | 
				
			||||||
 | 
					# TODO: automate 'objdump -p | grep NEEDED'
 | 
				
			||||||
 | 
					IF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
 | 
				
			||||||
 | 
					  MESSAGE(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.")
 | 
				
			||||||
 | 
					ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Maintainer: (mandatory)
 | 
				
			||||||
 | 
					IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
 | 
				
			||||||
 | 
					  IF(NOT CPACK_PACKAGE_CONTACT)
 | 
				
			||||||
 | 
					    MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER")
 | 
				
			||||||
 | 
					  ENDIF(NOT CPACK_PACKAGE_CONTACT)
 | 
				
			||||||
 | 
					  SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
 | 
				
			||||||
 | 
					ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Description: (mandatory)
 | 
				
			||||||
 | 
					IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
 | 
				
			||||||
 | 
					  IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
 | 
				
			||||||
 | 
					    MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION")
 | 
				
			||||||
 | 
					  ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
 | 
				
			||||||
 | 
					  SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
 | 
				
			||||||
 | 
					ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Section: (recommended)
 | 
				
			||||||
 | 
					IF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
 | 
				
			||||||
 | 
					  SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
 | 
				
			||||||
 | 
					ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Priority: (recommended)
 | 
				
			||||||
 | 
					IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
 | 
				
			||||||
 | 
					  SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
 | 
				
			||||||
 | 
					ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Recommends:
 | 
				
			||||||
 | 
					# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Suggests:
 | 
				
			||||||
 | 
					# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
 | 
				
			||||||
 | 
					# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive)
 | 
				
			||||||
 | 
					# Typical examples are: 
 | 
				
			||||||
 | 
					# - conffiles
 | 
				
			||||||
 | 
					# - postinst
 | 
				
			||||||
 | 
					# - postrm
 | 
				
			||||||
 | 
					# - prerm"
 | 
				
			||||||
 | 
					# Usage:
 | 
				
			||||||
 | 
					# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA 
 | 
				
			||||||
 | 
					#    "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# For debian source packages:
 | 
				
			||||||
 | 
					# debian/control
 | 
				
			||||||
 | 
					# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# .dsc
 | 
				
			||||||
 | 
					# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Builds-Depends:
 | 
				
			||||||
 | 
					#IF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
 | 
				
			||||||
 | 
					#  SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS
 | 
				
			||||||
 | 
					#    "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4"
 | 
				
			||||||
 | 
					#  )
 | 
				
			||||||
 | 
					#ENDIF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Description: (mandatory)
 | 
				
			||||||
 | 
					#if(NOT CPACK_SECTION)
 | 
				
			||||||
 | 
					#    message(FATAL_ERROR "opkg package requires a package section")
 | 
				
			||||||
 | 
					#endif(NOT CPACK_SECTION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Package for opkg
 | 
				
			||||||
 | 
					FIND_PROGRAM(OPKG_CMD opkg-build)
 | 
				
			||||||
 | 
					if( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
 | 
				
			||||||
 | 
					  message("CPack: opkg-build not found. Skipping packaging")
 | 
				
			||||||
 | 
					else( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
 | 
				
			||||||
 | 
					  SET(CPACK_OPKG_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
 | 
				
			||||||
 | 
					  FILE(MAKE_DIRECTORY ${CPACK_OPKG_ROOTDIR}/CONTROL)
 | 
				
			||||||
 | 
					  set(CPACK_OPKG_CONTROL_FILE "${CPACK_OPKG_ROOTDIR}/CONTROL/control")
 | 
				
			||||||
 | 
					  # Write controlfile
 | 
				
			||||||
 | 
					  FILE(WRITE ${CPACK_OPKG_CONTROL_FILE}
 | 
				
			||||||
 | 
					    "Package: ${CPACK_PACKAGE_NAME}
 | 
				
			||||||
 | 
					Version: ${CPACK_PACKAGE_VERSION}
 | 
				
			||||||
 | 
					Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
 | 
				
			||||||
 | 
					Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}
 | 
				
			||||||
 | 
					Section: ${CPACK_DEBIAN_PACKAGE_SECTION}
 | 
				
			||||||
 | 
					Priority: optional
 | 
				
			||||||
 | 
					Maintainer: ${CPACK_DEBIAN_PACKAGE_MAINTAINER}
 | 
				
			||||||
 | 
					Depends: ${CPACK_DEBIAN_PACKAGE_DEPENDS}
 | 
				
			||||||
 | 
					Provides: ${CPACK_DEBIAN_PACKAGE_PROVIDES}
 | 
				
			||||||
 | 
					Replaces: ${CPACK_DEBIAN_PACKAGE_REPLACES}
 | 
				
			||||||
 | 
					Conflicts: ${CPACK_DEBIAN_PACKAGE_CONFLICTS}
 | 
				
			||||||
 | 
					Source: https://github.com/intel-iot-devkit/upm
 | 
				
			||||||
 | 
					#Essential: no
 | 
				
			||||||
 | 
					")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set(OPKG_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
 | 
				
			||||||
 | 
					  execute_process(
 | 
				
			||||||
 | 
					    COMMAND "${OPKG_CMD}" "-o" "0" "${CPACK_PACKAGE_FILE_NAME}" "."
 | 
				
			||||||
 | 
					    RESULT_VARIABLE _result
 | 
				
			||||||
 | 
					    OUTPUT_VARIABLE _res_output
 | 
				
			||||||
 | 
					    ERROR_VARIABLE  _res_error
 | 
				
			||||||
 | 
					    WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if(${_result})
 | 
				
			||||||
 | 
					    message("Result '${_result}'")
 | 
				
			||||||
 | 
					    message("Output '${_res_output}'")
 | 
				
			||||||
 | 
					    message("Error  '${_res_error}'")
 | 
				
			||||||
 | 
					  else(${_result})
 | 
				
			||||||
 | 
					    message("CPack: Package ${OPKG_FILE_NAME}.ipk generated.")
 | 
				
			||||||
 | 
					    set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
 | 
				
			||||||
 | 
					    file(RENAME ${CPACK_TOPLEVEL_DIRECTORY}/${OPKG_FILE_NAME}.ipk ${CPACK_BINARY_DIR}/${OPKG_FILE_NAME}.ipk)
 | 
				
			||||||
 | 
					  endif(${_result})
 | 
				
			||||||
 | 
					endif( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" )
 | 
				
			||||||
							
								
								
									
										130
									
								
								cmake/modules/GetGitRevisionDescription.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										130
									
								
								cmake/modules/GetGitRevisionDescription.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,130 @@
 | 
				
			|||||||
 | 
					# - Returns a version string from Git
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# These functions force a re-configure on each git commit so that you can
 | 
				
			||||||
 | 
					# trust the values of the variables in your build system.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Returns the refspec and sha hash of the current head revision
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  git_describe(<var> [<additional arguments to git describe> ...])
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Returns the results of git describe on the source tree, and adjusting
 | 
				
			||||||
 | 
					# the output so that it tests false if an error occurs.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  git_get_exact_tag(<var> [<additional arguments to git describe> ...])
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Returns the results of git describe --exact-match on the source tree,
 | 
				
			||||||
 | 
					# and adjusting the output so that it tests false if there was no exact
 | 
				
			||||||
 | 
					# matching tag.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Requires CMake 2.6 or newer (uses the 'function' command)
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Original Author:
 | 
				
			||||||
 | 
					# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
 | 
				
			||||||
 | 
					# http://academic.cleardefinition.com
 | 
				
			||||||
 | 
					# Iowa State University HCI Graduate Program/VRAC
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Copyright Iowa State University 2009-2010.
 | 
				
			||||||
 | 
					# Distributed under the Boost Software License, Version 1.0.
 | 
				
			||||||
 | 
					# (See accompanying file LICENSE_1_0.txt or copy at
 | 
				
			||||||
 | 
					# http://www.boost.org/LICENSE_1_0.txt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if(__get_git_revision_description)
 | 
				
			||||||
 | 
						return()
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					set(__get_git_revision_description YES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# We must run the following at "include" time, not at function call time,
 | 
				
			||||||
 | 
					# to find the path to this module rather than the path to a calling list file
 | 
				
			||||||
 | 
					get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function(get_git_head_revision _refspecvar _hashvar)
 | 
				
			||||||
 | 
						set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 | 
				
			||||||
 | 
						set(GIT_DIR "${GIT_PARENT_DIR}/.git")
 | 
				
			||||||
 | 
						while(NOT EXISTS "${GIT_DIR}")	# .git dir not found, search parent directories
 | 
				
			||||||
 | 
							set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
 | 
				
			||||||
 | 
							get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
 | 
				
			||||||
 | 
							if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
 | 
				
			||||||
 | 
								# We have reached the root directory, we are not in git
 | 
				
			||||||
 | 
								set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
 | 
				
			||||||
 | 
								set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
 | 
				
			||||||
 | 
								return()
 | 
				
			||||||
 | 
							endif()
 | 
				
			||||||
 | 
							set(GIT_DIR "${GIT_PARENT_DIR}/.git")
 | 
				
			||||||
 | 
						endwhile()
 | 
				
			||||||
 | 
						# check if this is a submodule
 | 
				
			||||||
 | 
						if(NOT IS_DIRECTORY ${GIT_DIR})
 | 
				
			||||||
 | 
							file(READ ${GIT_DIR} submodule)
 | 
				
			||||||
 | 
							string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
 | 
				
			||||||
 | 
							get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
 | 
				
			||||||
 | 
							get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
						set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
 | 
				
			||||||
 | 
						if(NOT EXISTS "${GIT_DATA}")
 | 
				
			||||||
 | 
							file(MAKE_DIRECTORY "${GIT_DATA}")
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(NOT EXISTS "${GIT_DIR}/HEAD")
 | 
				
			||||||
 | 
							return()
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
						set(HEAD_FILE "${GIT_DATA}/HEAD")
 | 
				
			||||||
 | 
						configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
 | 
				
			||||||
 | 
							"${GIT_DATA}/grabRef.cmake"
 | 
				
			||||||
 | 
							@ONLY)
 | 
				
			||||||
 | 
						include("${GIT_DATA}/grabRef.cmake")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
 | 
				
			||||||
 | 
						set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
 | 
				
			||||||
 | 
					endfunction()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function(git_describe _var)
 | 
				
			||||||
 | 
						if(NOT GIT_FOUND)
 | 
				
			||||||
 | 
							find_package(Git QUIET)
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
						get_git_head_revision(refspec hash)
 | 
				
			||||||
 | 
						if(NOT GIT_FOUND)
 | 
				
			||||||
 | 
							set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
 | 
				
			||||||
 | 
							return()
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
						if(NOT hash)
 | 
				
			||||||
 | 
							set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
 | 
				
			||||||
 | 
							return()
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# TODO sanitize
 | 
				
			||||||
 | 
						#if((${ARGN}" MATCHES "&&") OR
 | 
				
			||||||
 | 
						#	(ARGN MATCHES "||") OR
 | 
				
			||||||
 | 
						#	(ARGN MATCHES "\\;"))
 | 
				
			||||||
 | 
						#	message("Please report the following error to the project!")
 | 
				
			||||||
 | 
						#	message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
 | 
				
			||||||
 | 
						#endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						#message(STATUS "Arguments to execute_process: ${ARGN}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						execute_process(COMMAND
 | 
				
			||||||
 | 
							"${GIT_EXECUTABLE}"
 | 
				
			||||||
 | 
							describe
 | 
				
			||||||
 | 
							${hash}
 | 
				
			||||||
 | 
							${ARGN}
 | 
				
			||||||
 | 
							WORKING_DIRECTORY
 | 
				
			||||||
 | 
							"${CMAKE_SOURCE_DIR}"
 | 
				
			||||||
 | 
							RESULT_VARIABLE
 | 
				
			||||||
 | 
							res
 | 
				
			||||||
 | 
							OUTPUT_VARIABLE
 | 
				
			||||||
 | 
							out
 | 
				
			||||||
 | 
							ERROR_QUIET
 | 
				
			||||||
 | 
							OUTPUT_STRIP_TRAILING_WHITESPACE)
 | 
				
			||||||
 | 
						if(NOT res EQUAL 0)
 | 
				
			||||||
 | 
							set(out "${out}-${res}-NOTFOUND")
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						set(${_var} "${out}" PARENT_SCOPE)
 | 
				
			||||||
 | 
					endfunction()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function(git_get_exact_tag _var)
 | 
				
			||||||
 | 
						git_describe(out --exact-match ${ARGN})
 | 
				
			||||||
 | 
						set(${_var} "${out}" PARENT_SCOPE)
 | 
				
			||||||
 | 
					endfunction()
 | 
				
			||||||
							
								
								
									
										38
									
								
								cmake/modules/GetGitRevisionDescription.cmake.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								cmake/modules/GetGitRevisionDescription.cmake.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					# 
 | 
				
			||||||
 | 
					# Internal file for GetGitRevisionDescription.cmake
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Requires CMake 2.6 or newer (uses the 'function' command)
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Original Author:
 | 
				
			||||||
 | 
					# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
 | 
				
			||||||
 | 
					# http://academic.cleardefinition.com
 | 
				
			||||||
 | 
					# Iowa State University HCI Graduate Program/VRAC
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Copyright Iowa State University 2009-2010.
 | 
				
			||||||
 | 
					# Distributed under the Boost Software License, Version 1.0.
 | 
				
			||||||
 | 
					# (See accompanying file LICENSE_1_0.txt or copy at
 | 
				
			||||||
 | 
					# http://www.boost.org/LICENSE_1_0.txt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set(HEAD_HASH)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
 | 
				
			||||||
 | 
					if(HEAD_CONTENTS MATCHES "ref")
 | 
				
			||||||
 | 
						# named branch
 | 
				
			||||||
 | 
						string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
 | 
				
			||||||
 | 
						if(EXISTS "@GIT_DIR@/${HEAD_REF}")
 | 
				
			||||||
 | 
							configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
 | 
				
			||||||
 | 
						elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
 | 
				
			||||||
 | 
							configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
 | 
				
			||||||
 | 
							set(HEAD_HASH "${HEAD_REF}")
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
					else()
 | 
				
			||||||
 | 
						# detached HEAD
 | 
				
			||||||
 | 
						configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if(NOT HEAD_HASH)
 | 
				
			||||||
 | 
						file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
 | 
				
			||||||
 | 
						string(STRIP "${HEAD_HASH}" HEAD_HASH)
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
							
								
								
									
										23
									
								
								cmake/modules/LICENSE_1_0.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								cmake/modules/LICENSE_1_0.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					Boost Software License - Version 1.0 - August 17th, 2003
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Permission is hereby granted, free of charge, to any person or organization
 | 
				
			||||||
 | 
					obtaining a copy of the software and accompanying documentation covered by
 | 
				
			||||||
 | 
					this license (the "Software") to use, reproduce, display, distribute,
 | 
				
			||||||
 | 
					execute, and transmit the Software, and to prepare derivative works of the
 | 
				
			||||||
 | 
					Software, and to permit third-parties to whom the Software is furnished to
 | 
				
			||||||
 | 
					do so, all subject to the following:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The copyright notices in the Software and this entire statement, including
 | 
				
			||||||
 | 
					the above license grant, this restriction and the following disclaimer,
 | 
				
			||||||
 | 
					must be included in all copies of the Software, in whole or in part, and
 | 
				
			||||||
 | 
					all derivative works of the Software, unless such copies or derivative
 | 
				
			||||||
 | 
					works are solely in the form of machine-executable object code generated by
 | 
				
			||||||
 | 
					a source language processor.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
				
			||||||
 | 
					IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
				
			||||||
 | 
					FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
 | 
				
			||||||
 | 
					SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
 | 
				
			||||||
 | 
					FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
 | 
				
			||||||
 | 
					ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 | 
				
			||||||
 | 
					DEALINGS IN THE SOFTWARE.
 | 
				
			||||||
							
								
								
									
										136
									
								
								cmake/modules/TargetArch.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								cmake/modules/TargetArch.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,136 @@
 | 
				
			|||||||
 | 
					# Based on the Qt 5 processor detection code, so should be very accurate
 | 
				
			||||||
 | 
					# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
 | 
				
			||||||
 | 
					# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Regarding POWER/PowerPC, just as is noted in the Qt source,
 | 
				
			||||||
 | 
					# "There are many more known variants/revisions that we do not handle/detect."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set(archdetect_c_code "
 | 
				
			||||||
 | 
					#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
 | 
				
			||||||
 | 
					    #if defined(__ARM_ARCH_7__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_7A__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_7R__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_7M__) \\
 | 
				
			||||||
 | 
					        || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
 | 
				
			||||||
 | 
					        #error cmake_ARCH armv7
 | 
				
			||||||
 | 
					    #elif defined(__ARM_ARCH_6__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_6J__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_6T2__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_6Z__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_6K__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_6ZK__) \\
 | 
				
			||||||
 | 
					        || defined(__ARM_ARCH_6M__) \\
 | 
				
			||||||
 | 
					        || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
 | 
				
			||||||
 | 
					        #error cmake_ARCH armv6
 | 
				
			||||||
 | 
					    #elif defined(__ARM_ARCH_5TEJ__) \\
 | 
				
			||||||
 | 
					        || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
 | 
				
			||||||
 | 
					        #error cmake_ARCH armv5
 | 
				
			||||||
 | 
					    #else
 | 
				
			||||||
 | 
					        #error cmake_ARCH arm
 | 
				
			||||||
 | 
					    #endif
 | 
				
			||||||
 | 
					#elif defined(__i586) || defined(__i586__)
 | 
				
			||||||
 | 
					    #error cmake_ARCH i586
 | 
				
			||||||
 | 
					#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
 | 
				
			||||||
 | 
					    #error cmake_ARCH i386
 | 
				
			||||||
 | 
					#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
 | 
				
			||||||
 | 
					    #error cmake_ARCH x86_64
 | 
				
			||||||
 | 
					#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
 | 
				
			||||||
 | 
					    #error cmake_ARCH ia64
 | 
				
			||||||
 | 
					#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
 | 
				
			||||||
 | 
					      || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC)  \\
 | 
				
			||||||
 | 
					      || defined(_M_MPPC) || defined(_M_PPC)
 | 
				
			||||||
 | 
					    #if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
 | 
				
			||||||
 | 
					        #error cmake_ARCH ppc64
 | 
				
			||||||
 | 
					    #else
 | 
				
			||||||
 | 
					        #error cmake_ARCH ppc
 | 
				
			||||||
 | 
					    #endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#error cmake_ARCH unknown
 | 
				
			||||||
 | 
					")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Set ppc_support to TRUE before including this file or ppc and ppc64
 | 
				
			||||||
 | 
					# will be treated as invalid architectures since they are no longer supported by Apple
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function(target_architecture output_var)
 | 
				
			||||||
 | 
					    if(APPLE AND CMAKE_OSX_ARCHITECTURES)
 | 
				
			||||||
 | 
					        # On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
 | 
				
			||||||
 | 
					        # First let's normalize the order of the values
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Note that it's not possible to compile PowerPC applications if you are using
 | 
				
			||||||
 | 
					        # the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
 | 
				
			||||||
 | 
					        # disable it by default
 | 
				
			||||||
 | 
					        # See this page for more information:
 | 
				
			||||||
 | 
					        # http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
 | 
				
			||||||
 | 
					        # On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
 | 
				
			||||||
 | 
					            if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
 | 
				
			||||||
 | 
					                set(osx_arch_ppc TRUE)
 | 
				
			||||||
 | 
					            elseif("${osx_arch}" STREQUAL "i386")
 | 
				
			||||||
 | 
					                set(osx_arch_i386 TRUE)
 | 
				
			||||||
 | 
					            elseif("${osx_arch}" STREQUAL "x86_64")
 | 
				
			||||||
 | 
					                set(osx_arch_x86_64 TRUE)
 | 
				
			||||||
 | 
					            elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
 | 
				
			||||||
 | 
					                set(osx_arch_ppc64 TRUE)
 | 
				
			||||||
 | 
					            else()
 | 
				
			||||||
 | 
					                message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
 | 
				
			||||||
 | 
					            endif()
 | 
				
			||||||
 | 
					        endforeach()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Now add all the architectures in our normalized order
 | 
				
			||||||
 | 
					        if(osx_arch_ppc)
 | 
				
			||||||
 | 
					            list(APPEND ARCH ppc)
 | 
				
			||||||
 | 
					        endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(osx_arch_i386)
 | 
				
			||||||
 | 
					            list(APPEND ARCH i386)
 | 
				
			||||||
 | 
					        endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(osx_arch_x86_64)
 | 
				
			||||||
 | 
					            list(APPEND ARCH x86_64)
 | 
				
			||||||
 | 
					        endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(osx_arch_ppc64)
 | 
				
			||||||
 | 
					            list(APPEND ARCH ppc64)
 | 
				
			||||||
 | 
					        endif()
 | 
				
			||||||
 | 
					    else()
 | 
				
			||||||
 | 
					        file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        enable_language(C)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Detect the architecture in a rather creative way...
 | 
				
			||||||
 | 
					        # This compiles a small C program which is a series of ifdefs that selects a
 | 
				
			||||||
 | 
					        # particular #error preprocessor directive whose message string contains the
 | 
				
			||||||
 | 
					        # target architecture. The program will always fail to compile (both because
 | 
				
			||||||
 | 
					        # file is not a valid C program, and obviously because of the presence of the
 | 
				
			||||||
 | 
					        # #error preprocessor directives... but by exploiting the preprocessor in this
 | 
				
			||||||
 | 
					        # way, we can detect the correct target architecture even when cross-compiling,
 | 
				
			||||||
 | 
					        # since the program itself never needs to be run (only the compiler/preprocessor)
 | 
				
			||||||
 | 
					        try_run(
 | 
				
			||||||
 | 
					            run_result_unused
 | 
				
			||||||
 | 
					            compile_result_unused
 | 
				
			||||||
 | 
					            "${CMAKE_BINARY_DIR}"
 | 
				
			||||||
 | 
					            "${CMAKE_BINARY_DIR}/arch.c"
 | 
				
			||||||
 | 
					            COMPILE_OUTPUT_VARIABLE ARCH
 | 
				
			||||||
 | 
					            CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Parse the architecture name from the compiler output
 | 
				
			||||||
 | 
					        string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Get rid of the value marker leaving just the architecture name
 | 
				
			||||||
 | 
					        string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # If we are compiling with an unknown architecture this variable should
 | 
				
			||||||
 | 
					        # already be set to "unknown" but in the case that it's empty (i.e. due
 | 
				
			||||||
 | 
					        # to a typo in the code), then set it to unknown
 | 
				
			||||||
 | 
					        if (NOT ARCH)
 | 
				
			||||||
 | 
					            set(ARCH unknown)
 | 
				
			||||||
 | 
					        endif()
 | 
				
			||||||
 | 
					    endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set(${output_var} "${ARCH}" PARENT_SCOPE)
 | 
				
			||||||
 | 
					endfunction()
 | 
				
			||||||
							
								
								
									
										4
									
								
								cmake/modules/version.c.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								cmake/modules/version.c.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const char* gVERSION = "@VERSION@";
 | 
				
			||||||
 | 
					const char* gVERSION_SHORT = "@VERSION_SHORT@";
 | 
				
			||||||
		Reference in New Issue
	
	Block a user