| 1 | #################################################
 | 
|---|
| 2 | #   ___________    ____ ______  __ __  _____    #
 | 
|---|
| 3 | #   \____ \__  \ _/ ___\\____ \|  |  \/  ___/   #
 | 
|---|
| 4 | #   |  |_> > __ \\  \___|  |_> >  |  /\___ \    #
 | 
|---|
| 5 | #   |   __(____  /\___  >   __/|____//____  >   #
 | 
|---|
| 6 | #   |__|       \/     \/|__|              \/    #
 | 
|---|
| 7 | #                                               #
 | 
|---|
| 8 | #################################################
 | 
|---|
| 9 | 
 | 
|---|
| 10 | project(Pacpus)
 | 
|---|
| 11 | cmake_minimum_required(VERSION 2.8)
 | 
|---|
| 12 | 
 | 
|---|
| 13 | #cmake_policy(SET CMP0020  NEW) # for QT5.1 on windows / not work on linux
 | 
|---|
| 14 | 
 | 
|---|
| 15 | # ========================================
 | 
|---|
| 16 | # Pacpus version
 | 
|---|
| 17 | # ========================================
 | 
|---|
| 18 | set(PACPUS_MAJOR_VERSION 0)
 | 
|---|
| 19 | set(PACPUS_MINOR_VERSION 1)
 | 
|---|
| 20 | set(PACPUS_PATCH_VERSION 0)
 | 
|---|
| 21 | set(PACPUS_VERSION
 | 
|---|
| 22 |     "${PACPUS_MAJOR_VERSION}.${PACPUS_MINOR_VERSION}.${PACPUS_PATCH_VERSION}")
 | 
|---|
| 23 | 
 | 
|---|
| 24 | # ========================================
 | 
|---|
| 25 | # CMake variables
 | 
|---|
| 26 | # ========================================
 | 
|---|
| 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)
 | 
|---|
| 31 | set(PACPUS_INCLUDE_DIR      ${PACPUS_ROOT_DIR}/include/)
 | 
|---|
| 32 | set(PACPUS_SCRIPTS_DIR      ${PACPUS_ROOT_DIR}/scripts)
 | 
|---|
| 33 | set(PACPUS_SOURCE_DIR       ${PACPUS_ROOT_DIR}/src)
 | 
|---|
| 34 | set(IS_BUILDING_PACPUS      TRUE)
 | 
|---|
| 35 | 
 | 
|---|
| 36 | # ========================================
 | 
|---|
| 37 | # Configure CMake
 | 
|---|
| 38 | # ========================================
 | 
|---|
| 39 | list(APPEND CMAKE_MODULE_PATH ${PACPUS_CMAKE_DIR})
 | 
|---|
| 40 | 
 | 
|---|
| 41 | # ========================================
 | 
|---|
| 42 | # Import some functions
 | 
|---|
| 43 | # ========================================
 | 
|---|
| 44 | include(${PACPUS_CMAKE_DIR}/PacpusUtilities.cmake)
 | 
|---|
| 45 | 
 | 
|---|
| 46 | # ========================================
 | 
|---|
| 47 | # Configure Pacpus
 | 
|---|
| 48 | # ========================================
 | 
|---|
| 49 | include(${PACPUS_CMAKE_DIR}/PacpusConfiguration.cmake)
 | 
|---|
| 50 | 
 | 
|---|
| 51 | # ========================================
 | 
|---|
| 52 | # Find dependencies
 | 
|---|
| 53 | # ========================================
 | 
|---|
| 54 | include(${PACPUS_CMAKE_DIR}/PacpusDependencies.cmake)
 | 
|---|
| 55 | 
 | 
|---|
| 56 | # ========================================
 | 
|---|
| 57 | # Handle platform specific behaviors
 | 
|---|
| 58 | # ========================================
 | 
|---|
| 59 | include(${PACPUS_CMAKE_DIR}/PacpusPlatforms.cmake)
 | 
|---|
| 60 | 
 | 
|---|
| 61 | # ========================================
 | 
|---|
| 62 | # Pre-configuration of the compiler
 | 
|---|
| 63 | # ========================================
 | 
|---|
| 64 | # Includes directories
 | 
|---|
| 65 | include_directories(
 | 
|---|
| 66 |   ${PACPUS_DEPENDENCIES_INC}
 | 
|---|
| 67 |   ${PACPUS_INCLUDE_DIR}
 | 
|---|
| 68 | )
 | 
|---|
| 69 | # Compiler flags coming from PacpusDependencies and PacpusPlatforms
 | 
|---|
| 70 | add_definitions(${PACPUS_DEFINITIONS})
 | 
|---|
| 71 | 
 | 
|---|
| 72 | # ========================================
 | 
|---|
| 73 | # Build the Pacpus' modules
 | 
|---|
| 74 | # ========================================
 | 
|---|
| 75 | add_subdirectory(${PACPUS_SOURCE_DIR})
 | 
|---|
| 76 | 
 | 
|---|
| 77 | # ========================================
 | 
|---|
| 78 | # Build the documentation if enabled
 | 
|---|
| 79 | # ========================================
 | 
|---|
| 80 | if(PACPUS_BUILD_DOC)
 | 
|---|
| 81 |     add_subdirectory(${PACPUS_DOC_DIR})
 | 
|---|
| 82 | endif()
 | 
|---|
| 83 | 
 | 
|---|
| 84 | # ========================================
 | 
|---|
| 85 | # Pacpus Installation
 | 
|---|
| 86 | # ========================================
 | 
|---|
| 87 | include(${PACPUS_CMAKE_DIR}/PacpusInstall.cmake)
 | 
|---|
| 88 | 
 | 
|---|
| 89 | # ========================================
 | 
|---|
| 90 | # Summary
 | 
|---|
| 91 | # ========================================
 | 
|---|
| 92 | pacpus_info("")
 | 
|---|
| 93 | pacpus_info("=====================================================================")
 | 
|---|
| 94 | pacpus_info("Configuration for Pacpus ${PACPUS_VERSION}")
 | 
|---|
| 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})
 | 
|---|
| 118 | pacpus_info("")
 | 
|---|
| 119 | pacpus_info("  Options:")
 | 
|---|
| 120 | pacpus_info("    Logging enabled:" ${PACPUS_USE_LOG})
 | 
|---|
| 121 | pacpus_info("    Installation of 3rd party:" ${PACPUS_INSTALL_3RD})
 | 
|---|
| 122 | pacpus_info("    Documentation enabled:" ${PACPUS_BUILD_DOC})
 | 
|---|
| 123 | pacpus_info("")
 | 
|---|
| 124 | if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
 | 
|---|
| 125 |     message(WARNING "The src directory is the same as bin directory. \"make clean\" may damage the source tree")
 | 
|---|
| 126 | endif()
 | 
|---|