Statistics
| Branch: | Tag: | Revision:

root / host / Modules / UHDComponent.cmake @ 8dffb7d5

History | View | Annotate | Download (3.63 KB)

1
#
2
# Copyright 2010 Ettus Research LLC
3
#
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
#
17

    
18
########################################################################
19
SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE)
20
SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE)
21

    
22
########################################################################
23
# Register a component into the system
24
#  - name the component string name
25
#  - var the global enable variable
26
#  - enb the default enable setting
27
#  - deps a list of dependencies
28
#  - dis the default disable setting
29
########################################################################
30
FUNCTION(LIBUHD_REGISTER_COMPONENT name var enb deps dis)
31
    INCLUDE(CMakeDependentOption)
32
    MESSAGE(STATUS "")
33
    MESSAGE(STATUS "Configuring ${name} support...")
34
    IF(DEFINED ${var})
35
        MESSAGE(STATUS "${name} support configured ${var}=${${var}}")
36
    ELSE(DEFINED ${var}) #not defined: automatic enabling of component
37
        MESSAGE(STATUS "${name} support configured automatically")
38
    ENDIF(DEFINED ${var})
39

    
40
    #setup the dependent option for this component
41
    CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis})
42

    
43
    #remove previous occurrence of component in either list
44
    IF(DEFINED _uhd_enabled_components)
45
        LIST(REMOVE_ITEM _uhd_enabled_components ${name})
46
    ENDIF(DEFINED _uhd_enabled_components)
47
    IF(DEFINED _uhd_disabled_components)
48
        LIST(REMOVE_ITEM _uhd_disabled_components ${name})
49
    ENDIF(DEFINED _uhd_disabled_components)
50

    
51
    #append the component into one of the lists
52
    IF(${var})
53
        MESSAGE(STATUS "  Enabling ${name} support.")
54
        LIST(APPEND _uhd_enabled_components ${name})
55
    ELSE(${var})
56
        MESSAGE(STATUS "  Disabling ${name} support.")
57
        LIST(APPEND _uhd_disabled_components ${name})
58
    ENDIF(${var})
59

    
60
    #make components lists into global variables
61
    SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE)
62
    SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE)
63
ENDFUNCTION(LIBUHD_REGISTER_COMPONENT)
64

    
65
########################################################################
66
# Print the registered component summary
67
########################################################################
68
FUNCTION(UHD_PRINT_COMPONENT_SUMMARY)
69
    MESSAGE(STATUS "")
70
    MESSAGE(STATUS "######################################################")
71
    MESSAGE(STATUS "# LibUHD enabled components                           ")
72
    MESSAGE(STATUS "######################################################")
73
    FOREACH(comp ${_uhd_enabled_components})
74
        MESSAGE(STATUS "  * ${comp}")
75
    ENDFOREACH(comp)
76

    
77
    MESSAGE(STATUS "")
78
    MESSAGE(STATUS "######################################################")
79
    MESSAGE(STATUS "# LibUHD disabled components                          ")
80
    MESSAGE(STATUS "######################################################")
81
    FOREACH(comp ${_uhd_disabled_components})
82
        MESSAGE(STATUS "  * ${comp}")
83
    ENDFOREACH(comp)
84

    
85
    MESSAGE(STATUS "")
86
ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY)