zibbr

Random 3d and p2p stuff that was originally the beginnings of an overly ambitious p2p virtual world thingy
git clone https://code.literati.org/zibbr.git
Log | Files | Refs

MacroLogFeature.cmake (5490B)


      1 #-------------------------------------------------------------------
      2 # This file is part of the CMake build system for OGRE
      3 #     (Object-oriented Graphics Rendering Engine)
      4 # For the latest info, see http://www.ogre3d.org/
      5 #
      6 # The contents of this file are placed in the public domain. Feel
      7 # free to make use of it in any way you like.
      8 #-------------------------------------------------------------------
      9 
     10 # This file defines the Feature Logging macros.
     11 #
     12 # MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
     13 #   Logs the information so that it can be displayed at the end
     14 #   of the configure run
     15 #   VAR : TRUE or FALSE, indicating whether the feature is supported
     16 #   FEATURE: name of the feature, e.g. "libjpeg"
     17 #   DESCRIPTION: description what this feature provides
     18 #   URL: home page
     19 #   REQUIRED: TRUE or FALSE, indicating whether the featue is required
     20 #   MIN_VERSION: minimum version number. empty string if unneeded
     21 #   COMMENTS: More info you may want to provide.  empty string if unnecessary
     22 #
     23 # MACRO_DISPLAY_FEATURE_LOG()
     24 #   Call this to display the collected results.
     25 #   Exits CMake with a FATAL error message if a required feature is missing
     26 #
     27 # Example:
     28 #
     29 # INCLUDE(MacroLogFeature)
     30 #
     31 # FIND_PACKAGE(JPEG)
     32 # MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
     33 # ...
     34 # MACRO_DISPLAY_FEATURE_LOG()
     35 
     36 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
     37 # Copyright (c) 2006, Allen Winter, <winter@kde.org>
     38 #
     39 # Redistribution and use is allowed according to the terms of the BSD license.
     40 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
     41 
     42 IF (NOT _macroLogFeatureAlreadyIncluded)
     43    SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
     44    IF (EXISTS ${_file})
     45       FILE(REMOVE ${_file})
     46    ENDIF (EXISTS ${_file})
     47 
     48    SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
     49    IF (EXISTS ${_file})
     50       FILE(REMOVE ${_file})
     51    ENDIF (EXISTS ${_file})
     52 
     53    SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
     54    IF (EXISTS ${_file})
     55       FILE(REMOVE ${_file})
     56   ENDIF (EXISTS ${_file})
     57 
     58   SET(_macroLogFeatureAlreadyIncluded TRUE)
     59 ENDIF (NOT _macroLogFeatureAlreadyIncluded)
     60 
     61 
     62 MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
     63 
     64    SET(_required "${ARGV4}")
     65    SET(_minvers "${ARGV5}")
     66    SET(_comments "${ARGV6}")
     67 
     68    IF (${_var})
     69      SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
     70    ELSE (${_var})
     71      IF (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
     72        SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
     73      ELSE (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
     74        SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
     75      ENDIF (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
     76    ENDIF (${_var})
     77 
     78    SET(_logtext "+ ${_package}")
     79 
     80    IF (NOT ${_var})
     81       IF (${_minvers} MATCHES ".*")
     82         SET(_logtext "${_logtext}, ${_minvers}")
     83       ENDIF (${_minvers} MATCHES ".*")
     84       SET(_logtext "${_logtext}: ${_description} <${_url}>")
     85       IF (${_comments} MATCHES ".*")
     86         SET(_logtext "${_logtext}\n${_comments}")
     87       ENDIF (${_comments} MATCHES ".*")
     88 #      SET(_logtext "${_logtext}\n") #double-space missing features?
     89    ENDIF (NOT ${_var})
     90    FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
     91  
     92 ENDMACRO(MACRO_LOG_FEATURE)
     93 
     94 
     95 MACRO(MACRO_DISPLAY_FEATURE_LOG)
     96 
     97    SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
     98    IF (EXISTS ${_file})
     99       FILE(READ ${_file} _requirements)
    100       MESSAGE(FATAL_ERROR "\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- Please install them before continuing this software installation.\n-- If you are in Windows, try passing -DOGRE_DEPENDENCIES_DIR=<path to dependencies>\n-----------------------------------------------------------------------------\n${_requirements}-----------------------------------------------------------------------------")
    101       FILE(REMOVE ${_file})
    102       MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
    103    ENDIF (EXISTS ${_file})
    104 
    105    SET(_summary "\n")
    106 
    107    SET(_elist 0)
    108    SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
    109    IF (EXISTS ${_file})
    110       SET(_elist 1)
    111       FILE(READ ${_file} _enabled)
    112       FILE(REMOVE ${_file})
    113       SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n${_enabled}")
    114    ENDIF (EXISTS ${_file})
    115 
    116    SET(_dlist 0)
    117    SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
    118    IF (EXISTS ${_file})
    119       SET(_dlist 1)
    120       FILE(READ ${_file} _disabled)
    121       FILE(REMOVE ${_file})
    122       SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n${_disabled}")
    123    ELSE (EXISTS ${_file})
    124       IF (${_elist})
    125         SET(_summary "${_summary}Congratulations! All external packages have been found.\n")
    126       ENDIF (${_elist})
    127    ENDIF (EXISTS ${_file})
    128 
    129    IF (${_elist} OR ${_dlist})
    130       SET(_summary "${_summary}-----------------------------------------------------------------------------\n")
    131    ENDIF (${_elist} OR ${_dlist})
    132    MESSAGE(STATUS "${_summary}")
    133 
    134 ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)