|
1 |
| -# Copyright 2011,2012 Free Software Foundation, Inc. |
| 1 | +# Copyright 2013 Free Software Foundation, Inc. |
2 | 2 | #
|
3 | 3 | # This file is part of GNU Radio
|
4 | 4 | #
|
|
19 | 19 |
|
20 | 20 |
|
21 | 21 | ########################################################################
|
22 |
| -# Project setup |
| 22 | +# Setup dependencies |
23 | 23 | ########################################################################
|
24 |
| -cmake_minimum_required(VERSION 2.6) |
25 |
| -project(gr-zmqblocks CXX C) |
26 |
| -enable_testing() |
27 |
| - |
28 |
| -#select the release build type by default to get optimization flags |
29 |
| -if(NOT CMAKE_BUILD_TYPE) |
30 |
| - set(CMAKE_BUILD_TYPE "Release") |
31 |
| - message(STATUS "Build type not specified: defaulting to release.") |
32 |
| -endif(NOT CMAKE_BUILD_TYPE) |
33 |
| -set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") |
34 |
| - |
35 |
| -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) |
36 |
| - |
37 |
| -# don't use doxygen by default |
38 |
| -option(ENABLE_DOXYGEN "Build and install documentation" OFF) |
| 24 | +include(GrBoost) |
| 25 | +find_package(ZeroMQ) |
39 | 26 |
|
40 | 27 | ########################################################################
|
41 |
| -# Compiler specific setup |
| 28 | +# Register component |
42 | 29 | ########################################################################
|
43 |
| -if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32) |
44 |
| - #http://gcc.gnu.org/wiki/Visibility |
45 |
| - add_definitions(-fvisibility=hidden) |
46 |
| -endif() |
| 30 | +include(GrComponent) |
47 | 31 |
|
48 |
| -######################################################################## |
49 |
| -# Find boost |
50 |
| -######################################################################## |
51 |
| -if(UNIX AND EXISTS "/usr/lib64") |
52 |
| - list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix |
53 |
| -endif(UNIX AND EXISTS "/usr/lib64") |
54 |
| -set(Boost_ADDITIONAL_VERSIONS |
55 |
| - "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" |
56 |
| - "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" |
57 |
| - "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" |
58 |
| - "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" |
59 |
| - "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" |
60 |
| - "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" |
61 |
| - "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" |
| 32 | +GR_REGISTER_COMPONENT("gr-zeromq" ENABLE_GR_ZEROMQ |
| 33 | + Boost_FOUND |
| 34 | + ENABLE_GNURADIO_RUNTIME |
| 35 | + ZEROMQ_FOUND |
62 | 36 | )
|
63 |
| -find_package(Boost "1.35" COMPONENTS filesystem system) |
64 | 37 |
|
65 |
| -if(NOT Boost_FOUND) |
66 |
| - message(FATAL_ERROR "Boost required to compile zmqblocks") |
67 |
| -endif() |
| 38 | +GR_SET_GLOBAL(GR_ZEROMQ_INCLUDE_DIRS |
| 39 | + ${CMAKE_CURRENT_SOURCE_DIR}/lib |
| 40 | + ${CMAKE_CURRENT_SOURCE_DIR}/include |
| 41 | +) |
68 | 42 |
|
69 |
| -######################################################################## |
70 |
| -# Install directories |
71 |
| -######################################################################## |
72 |
| -include(GrPlatform) #define LIB_SUFFIX |
73 |
| -set(GR_RUNTIME_DIR bin) |
74 |
| -set(GR_LIBRARY_DIR lib${LIB_SUFFIX}) |
75 |
| -set(GR_INCLUDE_DIR include/zmqblocks) |
76 |
| -set(GR_DATA_DIR share) |
77 |
| -set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME}) |
78 |
| -set(GR_DOC_DIR ${GR_DATA_DIR}/doc) |
79 |
| -set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}) |
80 |
| -set(GR_CONF_DIR etc) |
81 |
| -set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d) |
82 |
| -set(GR_LIBEXEC_DIR libexec) |
83 |
| -set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME}) |
84 |
| -set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks) |
| 43 | +SET(GR_PKG_ZEROMQ_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/zeromq) |
85 | 44 |
|
86 | 45 | ########################################################################
|
87 |
| -# Find gnuradio build dependencies |
| 46 | +# Begin conditional configuration |
88 | 47 | ########################################################################
|
89 |
| -find_package(GnuradioRuntime) |
90 |
| -find_package(CppUnit) |
91 |
| -find_package(ZeroMQ REQUIRED) |
92 |
| - |
93 |
| -# To run a more advanced search for GNU Radio and it's components and |
94 |
| -# versions, use the following. Add any components required to the list |
95 |
| -# of GR_REQUIRED_COMPONENTS (in all caps) and change "version" to the |
96 |
| -# minimum API compatible version required. |
97 |
| -# |
98 |
| -# set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER ...) |
99 |
| -# find_package(Gnuradio "version") |
| 48 | +if(ENABLE_GR_ZEROMQ) |
100 | 49 |
|
101 |
| -if(NOT GNURADIO_RUNTIME_FOUND) |
102 |
| - message(FATAL_ERROR "GnuRadio Runtime required to compile zmqblocks") |
103 |
| -endif() |
104 |
| -if(NOT CPPUNIT_FOUND) |
105 |
| - message(FATAL_ERROR "CppUnit required to compile zmqblocks") |
106 |
| -endif() |
107 | 50 |
|
108 | 51 | ########################################################################
|
109 |
| -# Setup the include and linker paths |
| 52 | +# Setup CPack components |
110 | 53 | ########################################################################
|
111 |
| -include_directories( |
112 |
| - ${CMAKE_SOURCE_DIR}/include |
113 |
| - ${Boost_INCLUDE_DIRS} |
114 |
| - ${CPPUNIT_INCLUDE_DIRS} |
115 |
| - ${GNURADIO_RUNTIME_INCLUDE_DIRS} |
116 |
| - ${ZeroMQ_INCLUDE_DIRS} |
| 54 | +include(GrPackage) |
| 55 | +CPACK_SET(CPACK_COMPONENT_GROUP_ZEROMQ_DESCRIPTION "GNU Radio ZeromMQ Interface Blocks") |
| 56 | + |
| 57 | +CPACK_COMPONENT("zeromq_runtime" |
| 58 | + GROUP "ZeroMQ Blocks" |
| 59 | + DISPLAY_NAME "Runtime" |
| 60 | + DESCRIPTION "Runtime" |
| 61 | + DEPENDS "runtime_runtime" |
117 | 62 | )
|
118 | 63 |
|
119 |
| -link_directories( |
120 |
| - ${Boost_LIBRARY_DIRS} |
121 |
| - ${CPPUNIT_LIBRARY_DIRS} |
122 |
| - ${GNURADIO_RUNTIME_LIBRARY_DIRS} |
| 64 | +CPACK_COMPONENT("zeromq_devel" |
| 65 | + GROUP "ZeroMQ Blocks" |
| 66 | + DISPLAY_NAME "Development" |
| 67 | + DESCRIPTION "C++ headers, package config, import libraries" |
| 68 | + DEPENDS "runtime_devel" |
123 | 69 | )
|
124 | 70 |
|
125 |
| -# Set component parameters |
126 |
| -set(GR_ZMQBLOCKS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) |
127 |
| -set(GR_ZMQBLOCKS_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/swig CACHE INTERNAL "" FORCE) |
| 71 | +CPACK_COMPONENT("zeromq_python" |
| 72 | + GROUP "ZeroMQ Blocks" |
| 73 | + DISPLAY_NAME "Python" |
| 74 | + DESCRIPTION "Python modules for runtime; GRC xml files" |
| 75 | + DEPENDS "runtime_python;zeromq_runtime" |
| 76 | +) |
| 77 | + |
| 78 | +CPACK_COMPONENT("zeromq_swig" |
| 79 | + GROUP "ZeroMQ Blocks" |
| 80 | + DISPLAY_NAME "SWIG" |
| 81 | + DESCRIPTION "SWIG development .i files" |
| 82 | + DEPENDS "runtime_swig;zeromq_python;zeromq_devel" |
| 83 | +) |
| 84 | + |
| 85 | +######################################################################## |
| 86 | +# Add subdirectories |
| 87 | +######################################################################## |
| 88 | +#add_subdirectory(include/gnuradio/zeromq) |
| 89 | +#add_subdirectory(lib) |
| 90 | +#if(ENABLE_PYTHON) |
| 91 | +# add_subdirectory(swig) |
| 92 | +# add_subdirectory(python/zeromq) |
| 93 | +# add_subdirectory(grc) |
| 94 | +# add_subdirectory(examples) |
| 95 | +#endif(ENABLE_PYTHON) |
| 96 | +#add_subdirectory(doc) |
128 | 97 |
|
129 | 98 | ########################################################################
|
130 |
| -# Create uninstall target |
| 99 | +# Create Pkg Config File |
131 | 100 | ########################################################################
|
132 | 101 | configure_file(
|
133 |
| - ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in |
134 |
| - ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake |
| 102 | + ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-zeromq.pc.in |
| 103 | + ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-zeromq.pc |
135 | 104 | @ONLY)
|
136 | 105 |
|
137 |
| -add_custom_target(uninstall |
138 |
| - ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake |
| 106 | +install( |
| 107 | + FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-zeromq.pc |
| 108 | + DESTINATION ${GR_LIBRARY_DIR}/pkgconfig |
| 109 | + COMPONENT "zeromq_devel" |
139 | 110 | )
|
140 | 111 |
|
141 |
| -######################################################################## |
142 |
| -# Add subdirectories |
143 |
| -######################################################################## |
144 |
| -add_subdirectory(include/zmqblocks) |
145 |
| -add_subdirectory(lib) |
146 |
| -add_subdirectory(swig) |
147 |
| -add_subdirectory(python/zmqblocks) |
148 |
| -add_subdirectory(grc) |
149 |
| -add_subdirectory(examples) |
150 |
| -add_subdirectory(docs) |
| 112 | +endif(ENABLE_GR_ZEROMQ) |
0 commit comments