[89] | 1 | #################################################
|
---|
| 2 | # ___________ ____ ______ __ __ _____ #
|
---|
| 3 | # \____ \__ \ _/ ___\\____ \| | \/ ___/ #
|
---|
| 4 | # | |_> > __ \\ \___| |_> > | /\___ \ #
|
---|
| 5 | # | __(____ /\___ > __/|____//____ > #
|
---|
| 6 | # |__| \/ \/|__| \/ #
|
---|
| 7 | # #
|
---|
| 8 | #################################################
|
---|
| 9 |
|
---|
| 10 | project(Pacpus)
|
---|
| 11 | cmake_minimum_required(VERSION 2.8)
|
---|
[124] | 12 |
|
---|
[128] | 13 | if(POLICY CMP0020)
|
---|
[185] | 14 | cmake_policy(SET CMP0020 NEW) # for QT5.1 on windows / not work on linux
|
---|
[128] | 15 | endif()
|
---|
[124] | 16 |
|
---|
[185] | 17 | ################################################################################
|
---|
[89] | 18 | # Pacpus version
|
---|
[185] | 19 | set(${PROJECT_NAME}_MAJOR_VERSION 0)
|
---|
| 20 | set(${PROJECT_NAME}_MINOR_VERSION 1)
|
---|
| 21 | set(${PROJECT_NAME}_PATCH_VERSION 0)
|
---|
| 22 | set(${PROJECT_NAME}_VERSION
|
---|
| 23 | "${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION}")
|
---|
[89] | 24 |
|
---|
[185] | 25 | ################################################################################
|
---|
[89] | 26 | # CMake variables
|
---|
| 27 | set(PACPUS_ROOT_DIR ${CMAKE_SOURCE_DIR})
|
---|
| 28 | set(PACPUS_3RD_PARTY_DIR ${PACPUS_ROOT_DIR}/3rd)
|
---|
| 29 | set(PACPUS_CMAKE_DIR ${PACPUS_ROOT_DIR}/cmake)
|
---|
| 30 | set(PACPUS_DOC_DIR ${PACPUS_ROOT_DIR}/doc)
|
---|
[185] | 31 | set(PACPUS_EXAMPLES_DIR ${PACPUS_ROOT_DIR}/examples)
|
---|
[187] | 32 | set(PACPUS_INCLUDE_DIR ${PACPUS_ROOT_DIR}/include)
|
---|
[89] | 33 | set(PACPUS_SCRIPTS_DIR ${PACPUS_ROOT_DIR}/scripts)
|
---|
| 34 | set(PACPUS_SOURCE_DIR ${PACPUS_ROOT_DIR}/src)
|
---|
| 35 | set(IS_BUILDING_PACPUS TRUE)
|
---|
| 36 |
|
---|
[185] | 37 | ################################################################################
|
---|
[89] | 38 | # Configure CMake
|
---|
| 39 | list(APPEND CMAKE_MODULE_PATH ${PACPUS_CMAKE_DIR})
|
---|
| 40 |
|
---|
[185] | 41 | ################################################################################
|
---|
[89] | 42 | # Import some functions
|
---|
| 43 | include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake)
|
---|
| 44 |
|
---|
[185] | 45 | ################################################################################
|
---|
[89] | 46 | # Configure Pacpus
|
---|
| 47 | include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake)
|
---|
| 48 |
|
---|
[185] | 49 | ################################################################################
|
---|
[89] | 50 | # Find dependencies
|
---|
| 51 | include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake)
|
---|
| 52 |
|
---|
[185] | 53 | ################################################################################
|
---|
[140] | 54 | # Handle platform-specific behaviour
|
---|
[89] | 55 | include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake)
|
---|
| 56 |
|
---|
[185] | 57 | ################################################################################
|
---|
[140] | 58 | # Compiler flags coming from PacpusDependencies and PacpusPlatforms
|
---|
| 59 | #message(STATUS "\${PACPUS_DEFINITIONS} = ${PACPUS_DEFINITIONS}")
|
---|
| 60 | add_definitions(${PACPUS_DEFINITIONS})
|
---|
| 61 |
|
---|
[185] | 62 | ################################################################################
|
---|
[89] | 63 | # Includes directories
|
---|
| 64 | include_directories(
|
---|
[140] | 65 | ${PACPUS_DEPENDENCIES_INC}
|
---|
| 66 | ${PACPUS_INCLUDE_DIR}
|
---|
[89] | 67 | )
|
---|
| 68 |
|
---|
[185] | 69 | ################################################################################
|
---|
[89] | 70 | # Build the Pacpus' modules
|
---|
| 71 | add_subdirectory(${PACPUS_SOURCE_DIR})
|
---|
| 72 |
|
---|
[185] | 73 | ################################################################################
|
---|
| 74 | # DOCUMENTATION
|
---|
[89] | 75 | if(PACPUS_BUILD_DOC)
|
---|
| 76 | add_subdirectory(${PACPUS_DOC_DIR})
|
---|
| 77 | endif()
|
---|
| 78 |
|
---|
[185] | 79 | ################################################################################
|
---|
[89] | 80 | # Pacpus Installation
|
---|
| 81 | include(${PACPUS_CMAKE_DIR}/PacpusInstall.cmake)
|
---|
[175] | 82 | set(ENV{PACPUS_ROOT} ${PACPUS_INSTALL_DIR})
|
---|
[89] | 83 |
|
---|
[185] | 84 | ################################################################################
|
---|
| 85 | # EXAMPLES
|
---|
| 86 | if(PACPUS_BUILD_EXAMPLES)
|
---|
| 87 | add_subdirectory(${PACPUS_EXAMPLES_DIR})
|
---|
| 88 | endif()
|
---|
| 89 |
|
---|
| 90 | ################################################################################
|
---|
| 91 | # SUMMARY
|
---|
[89] | 92 | pacpus_info("")
|
---|
| 93 | pacpus_info("=====================================================================")
|
---|
[185] | 94 | pacpus_info("Configuration for Pacpus ${${PROJECT_NAME}_VERSION}")
|
---|
[89] | 95 | pacpus_info("=====================================================================")
|
---|
| 96 | pacpus_info("")
|
---|
| 97 | pacpus_info(" Platform:")
|
---|
| 98 | pacpus_info(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
---|
| 99 | if(CMAKE_CROSS_COMPILING)
|
---|
| 100 | pacpus_info(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
|
---|
| 101 | endif()
|
---|
| 102 | pacpus_info(" CMake:" ${CMAKE_VERSION})
|
---|
| 103 | pacpus_info(" CMake generator:" ${CMAKE_GENERATOR})
|
---|
| 104 | pacpus_info(" CMake build tool:" ${CMAKE_BUILD_TOOL})
|
---|
| 105 | if(MSVC)
|
---|
| 106 | pacpus_info(" MSVC:" ${MSVC_VERSION})
|
---|
| 107 | else()
|
---|
| 108 | pacpus_info(" Configuration:" ${CMAKE_BUILD_TYPE})
|
---|
| 109 | endif()
|
---|
| 110 | pacpus_info("")
|
---|
| 111 | pacpus_info(" Compiler:")
|
---|
| 112 | pacpus_info(" C++ Compiler:" ${CMAKE_CXX_COMPILER})
|
---|
| 113 | pacpus_info(" C++ flags (release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
|
---|
| 114 | pacpus_info(" C++ flags (debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
|
---|
| 115 | pacpus_info("")
|
---|
| 116 | pacpus_info(" Result:")
|
---|
| 117 | pacpus_info(" Install directory:" ${PACPUS_INSTALL_DIR})
|
---|
[162] | 118 | pacpus_info(" Install with version number:" ${PACPUS_INSTALL_WITH_VERSION_NUMBER})
|
---|
[89] | 119 | pacpus_info("")
|
---|
| 120 | pacpus_info(" Options:")
|
---|
| 121 | pacpus_info(" Logging enabled:" ${PACPUS_USE_LOG})
|
---|
| 122 | pacpus_info(" Installation of 3rd party:" ${PACPUS_INSTALL_3RD})
|
---|
| 123 | pacpus_info(" Documentation enabled:" ${PACPUS_BUILD_DOC})
|
---|
| 124 | pacpus_info("")
|
---|
| 125 | if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
---|
[162] | 126 | message(WARNING "The source directory is the same as build directory. \"make clean\" may damage the source tree")
|
---|
[89] | 127 | endif()
|
---|