summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/CMakeLists.txt37
-rw-r--r--host/config/Component.cmake82
-rw-r--r--host/docs/CMakeLists.txt16
-rw-r--r--host/docs/build.rst2
-rw-r--r--host/lib/CMakeLists.txt40
-rw-r--r--host/lib/transport/CMakeLists.txt13
-rw-r--r--host/lib/usrp/usrp1/CMakeLists.txt7
-rw-r--r--host/lib/usrp/usrp2/CMakeLists.txt2
-rw-r--r--host/lib/usrp/usrp_e100/CMakeLists.txt2
9 files changed, 135 insertions, 66 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 75331ddfc..efc439af0 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -22,6 +22,7 @@ ENABLE_TESTING()
########################################################################
# Config Files (include order is important)
########################################################################
+INCLUDE(${CMAKE_SOURCE_DIR}/config/Component.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/config/Python.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/config/Version.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/config/CPack.cmake)
@@ -34,7 +35,6 @@ SET(LIBRARY_DIR lib${LIB_SUFFIX})
SET(INCLUDE_DIR include)
SET(PKG_DATA_DIR share/uhd)
SET(PKG_DOC_DIR share/doc/uhd)
-MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
########################################################################
# Local Include Dir
@@ -134,11 +134,38 @@ INSTALL(FILES
)
########################################################################
+# Register top level components
+########################################################################
+SET(ENABLE_LIBUHD ON) #always enabled
+LIBUHD_REGISTER_COMPONENT("Examples" ENABLE_EXAMPLES ON "ENABLE_LIBUHD" OFF)
+LIBUHD_REGISTER_COMPONENT("Utils" ENABLE_UTILS ON "ENABLE_LIBUHD" OFF)
+LIBUHD_REGISTER_COMPONENT("Tests" ENABLE_TESTS ON "ENABLE_LIBUHD" OFF)
+
+########################################################################
# Add the subdirectories
########################################################################
ADD_SUBDIRECTORY(docs)
-ADD_SUBDIRECTORY(examples)
+
+IF(ENABLE_EXAMPLES)
+ ADD_SUBDIRECTORY(examples)
+ENDIF(ENABLE_EXAMPLES)
+
ADD_SUBDIRECTORY(include)
-ADD_SUBDIRECTORY(lib)
-ADD_SUBDIRECTORY(test)
-ADD_SUBDIRECTORY(utils)
+
+IF(ENABLE_LIBUHD)
+ ADD_SUBDIRECTORY(lib)
+ENDIF(ENABLE_LIBUHD)
+
+IF(ENABLE_TESTS)
+ ADD_SUBDIRECTORY(test)
+ENDIF(ENABLE_TESTS)
+
+IF(ENABLE_UTILS)
+ ADD_SUBDIRECTORY(utils)
+ENDIF(ENABLE_UTILS)
+
+########################################################################
+# Print Summary
+########################################################################
+UHD_PRINT_COMPONENT_SUMMARY()
+MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
diff --git a/host/config/Component.cmake b/host/config/Component.cmake
new file mode 100644
index 000000000..5384cc53f
--- /dev/null
+++ b/host/config/Component.cmake
@@ -0,0 +1,82 @@
+#
+# Copyright 2010 Ettus Research LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE)
+SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE)
+
+########################################################################
+# Register a component into the system
+# Usage: LIBUHD_REGISTER_COMPONENT(<name> <var> <enb> <deps> <dis>)
+########################################################################
+FUNCTION(LIBUHD_REGISTER_COMPONENT name var)
+ INCLUDE(CMakeDependentOption)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "Configuring ${name} support...")
+ IF(DEFINED ${var})
+ MESSAGE(STATUS "${name} support configured ${var}=${${var}}")
+ ELSE(DEFINED ${var}) #not defined: automatic enabling of component
+ MESSAGE(STATUS "${name} support configured automatically")
+ ENDIF(DEFINED ${var})
+
+ #setup the dependent option for this component
+ CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${ARGN})
+
+ #remove previous occurrence of component in either list
+ IF(DEFINED _uhd_enabled_components)
+ LIST(REMOVE_ITEM _uhd_enabled_components ${name})
+ ENDIF(DEFINED _uhd_enabled_components)
+ IF(DEFINED _uhd_disabled_components)
+ LIST(REMOVE_ITEM _uhd_disabled_components ${name})
+ ENDIF(DEFINED _uhd_disabled_components)
+
+ #append the component into one of the lists
+ IF(${var})
+ MESSAGE(STATUS " Enabling ${name} support.")
+ LIST(APPEND _uhd_enabled_components ${name})
+ ELSE(${var})
+ MESSAGE(STATUS " Disabling ${name} support.")
+ LIST(APPEND _uhd_disabled_components ${name})
+ ENDIF(${var})
+
+ #make components lists into global variables
+ SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE)
+ SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE)
+ENDFUNCTION(LIBUHD_REGISTER_COMPONENT)
+
+########################################################################
+# Print the registered component summary
+########################################################################
+FUNCTION(UHD_PRINT_COMPONENT_SUMMARY)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "######################################################")
+ MESSAGE(STATUS "# LibUHD enabled components ")
+ MESSAGE(STATUS "######################################################")
+ FOREACH(comp ${_uhd_enabled_components})
+ MESSAGE(STATUS " * ${comp}")
+ ENDFOREACH(comp)
+
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "######################################################")
+ MESSAGE(STATUS "# LibUHD disabled components ")
+ MESSAGE(STATUS "######################################################")
+ FOREACH(comp ${_uhd_disabled_components})
+ MESSAGE(STATUS " * ${comp}")
+ ENDFOREACH(comp)
+
+ MESSAGE(STATUS "")
+ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY)
diff --git a/host/docs/CMakeLists.txt b/host/docs/CMakeLists.txt
index 296ce9922..d6a7801bf 100644
--- a/host/docs/CMakeLists.txt
+++ b/host/docs/CMakeLists.txt
@@ -41,10 +41,16 @@ FIND_PROGRAM(RST2HTML rst2html)
IF(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
MESSAGE(STATUS "Checking for rst2html (docutils) - not found")
MESSAGE(STATUS " Disabled generation of HTML manual.")
+ SET(HAVE_RST2HTML FALSE)
ELSE(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
MESSAGE(STATUS "Checking for rst2html (docutils) - found")
MESSAGE(STATUS " Enabled generation of HTML manual.")
+ SET(HAVE_RST2HTML TRUE)
+ENDIF(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
+
+LIBUHD_REGISTER_COMPONENT("Manual" ENABLE_MANUAL ON "HAVE_RST2HTML" OFF)
+IF(ENABLE_MANUAL)
#setup rst2html options
SET(stylesheet ${CMAKE_CURRENT_SOURCE_DIR}/style.css)
SET(rst2html_options
@@ -73,7 +79,7 @@ ELSE(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
#make the html manual a build-time dependency
ADD_CUSTOM_TARGET(manual_html ALL DEPENDS ${manual_html_files})
-ENDIF(${RST2HTML} STREQUAL "RST2HTML-NOTFOUND")
+ENDIF(ENABLE_MANUAL)
INSTALL(FILES ${manual_sources} DESTINATION ${PKG_DOC_DIR}/manual/rst)
@@ -84,7 +90,9 @@ MESSAGE(STATUS "")
MESSAGE(STATUS "Checking for doxygen")
INCLUDE(FindDoxygen)
-IF(DOXYGEN_FOUND)
+LIBUHD_REGISTER_COMPONENT("Doxygen" ENABLE_DOXYGEN ON "DOXYGEN_FOUND" OFF)
+
+IF(ENABLE_DOXYGEN)
MESSAGE(STATUS " Enabled generation of Doxygen documentation.")
#generate the doxygen configuration file
@@ -105,6 +113,6 @@ IF(DOXYGEN_FOUND)
#make the doxygen generation a built-time dependency
ADD_CUSTOM_TARGET(doxygen_docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN})
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DESTINATION ${PKG_DOC_DIR})
-ELSE(DOXYGEN_FOUND)
+ELSE(ENABLE_DOXYGEN)
MESSAGE(STATUS " Disabled generation of Doxygen documentation.")
-ENDIF(DOXYGEN_FOUND)
+ENDIF(ENABLE_DOXYGEN)
diff --git a/host/docs/build.rst b/host/docs/build.rst
index a41ce8331..812b5c1a9 100644
--- a/host/docs/build.rst
+++ b/host/docs/build.rst
@@ -39,7 +39,7 @@ Other compilers have not been tested yet or confirmed working.
CMake
^^^^^^^^^^^^^^^^
* **Purpose:** generates project build files
-* **Version:** at least 2.8
+* **Version:** at least 2.6
* **Usage:** build time (required)
* **Download URL:** http://www.cmake.org/cmake/resources/software.html
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index a198b476a..e4de7bcc7 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -61,25 +61,6 @@ MACRO(LIBUHD_PYTHON_GEN_SOURCE pyfile outfile)
LIBUHD_APPEND_SOURCES(${outfile})
ENDMACRO(LIBUHD_PYTHON_GEN_SOURCE)
-MACRO(LIBUHD_REGISTER_COMPONENT name var auto)
- MESSAGE(STATUS "")
- MESSAGE(STATUS "Configuring ${name} support...")
- IF(DEFINED ${var})
- MESSAGE(STATUS "${name} support configured ${var}=${${var}}")
- ELSE(DEFINED ${var}) #not defined: automatic enabling of component
- SET(${var} ${auto})
- MESSAGE(STATUS "${name} support configured automatically")
- ENDIF(DEFINED ${var})
- OPTION(${var} "enable ${name} support" ${${var}})
- IF(${var})
- MESSAGE(STATUS " Enabling ${name} support.")
- LIST(APPEND _libuhd_enabled_components ${name})
- ELSE(${var})
- MESSAGE(STATUS " Disabling ${name} support.")
- LIST(APPEND _libuhd_disabled_components ${name})
- ENDIF(${var})
-ENDMACRO(LIBUHD_REGISTER_COMPONENT)
-
########################################################################
# Include CMakeLists.txt from subdirectories
########################################################################
@@ -128,24 +109,3 @@ INSTALL(TARGETS uhd
ARCHIVE DESTINATION ${LIBRARY_DIR} # .lib file
RUNTIME DESTINATION ${LIBRARY_DIR} # .dll file
)
-
-########################################################################
-# Print configuration summary
-########################################################################
-MESSAGE(STATUS "")
-MESSAGE(STATUS "######################################################")
-MESSAGE(STATUS "# LibUHD enabled components ")
-MESSAGE(STATUS "######################################################")
-FOREACH(comp ${_libuhd_enabled_components})
- MESSAGE(STATUS " * ${comp}")
-ENDFOREACH(comp)
-
-MESSAGE(STATUS "")
-MESSAGE(STATUS "######################################################")
-MESSAGE(STATUS "# LibUHD disabled components ")
-MESSAGE(STATUS "######################################################")
-FOREACH(comp ${_libuhd_disabled_components})
- MESSAGE(STATUS " * ${comp}")
-ENDFOREACH(comp)
-
-MESSAGE(STATUS "")
diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt
index b5f1fc940..4d0a0f1f7 100644
--- a/host/lib/transport/CMakeLists.txt
+++ b/host/lib/transport/CMakeLists.txt
@@ -20,12 +20,12 @@
########################################################################
# Setup libusb
########################################################################
-MESSAGE(STATUS "")
-MESSAGE(STATUS "Configuring USB support...")
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/lib/transport)
FIND_PACKAGE(USB1 REQUIRED)
-IF(LIBUSB_FOUND)
+LIBUHD_REGISTER_COMPONENT("USB" ENABLE_USB ON "ENABLE_LIBUHD;LIBUSB_FOUND" OFF)
+
+IF(ENABLE_USB)
MESSAGE(STATUS "USB support enabled via libusb.")
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIR})
LIBUHD_APPEND_LIBS(${LIBUSB_LIBRARIES})
@@ -38,14 +38,11 @@ IF(LIBUSB_FOUND)
IF(MSVC) #include our custom stdint for libusb
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/transport/msvc)
ENDIF(MSVC)
- SET(HAVE_USB_SUPPORT TRUE)
-ELSE(LIBUSB_FOUND)
- MESSAGE(STATUS "USB support disabled.")
+ELSE(ENABLE_USB)
LIBUHD_APPEND_SOURCES(
${CMAKE_SOURCE_DIR}/lib/transport/usb_dummy_impl.cpp
)
- SET(HAVE_USB_SUPPORT FALSE)
-ENDIF(LIBUSB_FOUND)
+ENDIF(ENABLE_USB)
########################################################################
# Check for SIMD headers
diff --git a/host/lib/usrp/usrp1/CMakeLists.txt b/host/lib/usrp/usrp1/CMakeLists.txt
index 8b6ba78d2..13db50790 100644
--- a/host/lib/usrp/usrp1/CMakeLists.txt
+++ b/host/lib/usrp/usrp1/CMakeLists.txt
@@ -20,12 +20,7 @@
########################################################################
# Conditionally configure the USRP1 support
########################################################################
-LIBUHD_REGISTER_COMPONENT("USRP1" ENABLE_USRP1 ${HAVE_USB_SUPPORT})
-
-#sanity check when USRP1 support enabled
-IF(ENABLE_USRP1 AND NOT HAVE_USB_SUPPORT)
- MESSAGE(FATAL_ERROR "USRP1 support enabled without USB support")
-ENDIF(ENABLE_USRP1 AND NOT HAVE_USB_SUPPORT)
+LIBUHD_REGISTER_COMPONENT("USRP1" ENABLE_USRP1 ON "ENABLE_LIBUHD;ENABLE_USB" OFF)
IF(ENABLE_USRP1)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../firmware/fx2/common)
diff --git a/host/lib/usrp/usrp2/CMakeLists.txt b/host/lib/usrp/usrp2/CMakeLists.txt
index afd69cae9..43f384015 100644
--- a/host/lib/usrp/usrp2/CMakeLists.txt
+++ b/host/lib/usrp/usrp2/CMakeLists.txt
@@ -20,7 +20,7 @@
########################################################################
# Conditionally configure the USRP2 support
########################################################################
-LIBUHD_REGISTER_COMPONENT("USRP2" ENABLE_USRP2 TRUE)
+LIBUHD_REGISTER_COMPONENT("USRP2" ENABLE_USRP2 ON "ENABLE_LIBUHD" OFF)
IF(ENABLE_USRP2)
LIBUHD_APPEND_SOURCES(
diff --git a/host/lib/usrp/usrp_e100/CMakeLists.txt b/host/lib/usrp/usrp_e100/CMakeLists.txt
index 3c5c58ee0..42db82321 100644
--- a/host/lib/usrp/usrp_e100/CMakeLists.txt
+++ b/host/lib/usrp/usrp_e100/CMakeLists.txt
@@ -20,7 +20,7 @@
########################################################################
# Conditionally configure the USRP-E100 support
########################################################################
-LIBUHD_REGISTER_COMPONENT("USRP-E100" ENABLE_USRP_E100 FALSE)
+LIBUHD_REGISTER_COMPONENT("USRP-E100" ENABLE_USRP_E100 OFF "ENABLE_LIBUHD" ON)
IF(ENABLE_USRP_E100)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/usrp/usrp_e100/include)