From 4f0808a6355ed82da0af162b0aa302db89ef7b69 Mon Sep 17 00:00:00 2001 From: Jon Szymaniak Date: Sat, 24 Aug 2013 18:13:23 -0400 Subject: [PATCH] host: Minor rearrangement of the host-common directory --- host/CMakeLists.txt | 22 +++++++++++++++++----- host/common/CMakeLists.txt | 8 -------- host/common/{ => include}/conversions.h | 0 host/common/{ => include}/host_config.h.in | 3 +++ host/common/{ => include}/minmax.h | 0 host/common/{ => src}/conversions.c | 0 host/libraries/libbladeRF/CMakeLists.txt | 2 ++ 7 files changed, 22 insertions(+), 13 deletions(-) delete mode 100644 host/common/CMakeLists.txt rename host/common/{ => include}/conversions.h (100%) rename host/common/{ => include}/host_config.h.in (94%) rename host/common/{ => include}/minmax.h (100%) rename host/common/{ => src}/conversions.c (100%) diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 149a0a27..4146deea 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -27,12 +27,20 @@ set(BLADERF_FW_COMMON_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../firmware_common) # Source and headers common amongst host software set(BLADERF_HOST_COMMON_INCLUDE_DIRS - ${CMAKE_CURRENT_LIST_DIR}/common - ${CMAKE_CURRENT_BINARY_DIR}/common + ${CMAKE_CURRENT_LIST_DIR}/common/include + ${CMAKE_CURRENT_BINARY_DIR}/common/include ) -set(BLADERF_HOST_COMMON_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/common) +set(BLADERF_HOST_COMMON_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/common/src) +################################################################################ +# Configure host-specific items +################################################################################ +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/common/include/host_config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/common/include/host_config.h + @ONLY +) ################################################################################ # Compiler configuration @@ -93,11 +101,15 @@ else() message(FATAL_ERROR "Unsupported host operating system: ${CMAKE_SYSTEM_NAME}") endif() +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/common/include/host_config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/common/include/host_config.h + @ONLY +) + ################################################################################ # Process subdirectories ################################################################################ - -add_subdirectory(common) add_subdirectory(libraries) add_subdirectory(misc) add_subdirectory(utilities) diff --git a/host/common/CMakeLists.txt b/host/common/CMakeLists.txt deleted file mode 100644 index ea95b90e..00000000 --- a/host/common/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(bladerf_host_common C) - -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/host_config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/host_config.h - @ONLY -) diff --git a/host/common/conversions.h b/host/common/include/conversions.h similarity index 100% rename from host/common/conversions.h rename to host/common/include/conversions.h diff --git a/host/common/host_config.h.in b/host/common/include/host_config.h.in similarity index 94% rename from host/common/host_config.h.in rename to host/common/include/host_config.h.in index b8f375b6..b0d19c33 100644 --- a/host/common/host_config.h.in +++ b/host/common/include/host_config.h.in @@ -86,6 +86,9 @@ * portability! * * http://stackoverflow.com/questions/5440611/how-to-rewrite-c-struct-designated-initializers-to-c89-resp-msvc-c-compiler + * + * Here's a sample regexep you could use in vim to clean these up in your code: + * @\(\s\+\)\(\.[a-zA-Z0-9_]\+\)\s*=\s*\([a-zA-Z0-9_]\+\)\(,\)\?@\1FIELD_INIT(\2,\3)\4@gc */ #if BLADERF_OS_WINDOWS # define FIELD_INIT(field, ...) field = __VA_ARGS__ diff --git a/host/common/minmax.h b/host/common/include/minmax.h similarity index 100% rename from host/common/minmax.h rename to host/common/include/minmax.h diff --git a/host/common/conversions.c b/host/common/src/conversions.c similarity index 100% rename from host/common/conversions.c rename to host/common/src/conversions.c diff --git a/host/libraries/libbladeRF/CMakeLists.txt b/host/libraries/libbladeRF/CMakeLists.txt index cdd15a45..73536023 100644 --- a/host/libraries/libbladeRF/CMakeLists.txt +++ b/host/libraries/libbladeRF/CMakeLists.txt @@ -130,6 +130,8 @@ set(LIBBLADERF_SOURCE ${BLADERF_HOST_COMMON_SOURCE_DIR}/conversions.c ) +message(STATUS "In libraries ${BLADERF_HOST_COMMON_SOURCE_DIR}") + if(ENABLE_BACKEND_LIBUSB) set(LIBBLADERF_SOURCE ${LIBBLADERF_SOURCE} src/backend/libusb.c) endif()