Skip to content

Commit 890217f

Browse files
committedAug 25, 2018
pmt: replace file generation with pre-generated files
1 parent f076b90 commit 890217f

16 files changed

+2699
-579
lines changed
 

‎docs/doxygen/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ configure_file(
4141

4242
set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html)
4343

44-
if(ENABLE_GNURADIO_RUNTIME)
45-
list(APPEND GENERATED_DEPS pmt_generated)
46-
endif(ENABLE_GNURADIO_RUNTIME)
47-
4844
########################################################################
4945
# Make and install doxygen docs
5046
########################################################################

‎gnuradio-runtime/include/pmt/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ install(FILES
2525
pmt.h
2626
pmt_pool.h
2727
pmt_sugar.h
28+
pmt_serial_tags.h
2829
DESTINATION ${GR_INCLUDE_DIR}/pmt
2930
)

‎gnuradio-runtime/lib/pmt/gen-serial-tags.py ‎gnuradio-runtime/include/pmt/pmt_serial_tags.h

+34-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
22
//
33
// Copyright 2011 Free Software Foundation, Inc.
44
//
@@ -19,38 +19,44 @@
1919
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2020
//
2121
//
22-
// THIS FILE IS MACHINE GENERATED FROM %s. DO NOT EDIT BY HAND.
23-
// See %s for additional commentary.
22+
// THIS FILE IS MACHINE GENERATED FROM gen-serial-tags.py. DO NOT EDIT BY HAND.
23+
// See pmt-serial-tags.scm for additional commentary.
2424
//
2525

2626
#ifndef INCLUDED_PMT_SERIAL_TAGS_H
2727
#define INCLUDED_PMT_SERIAL_TAGS_H
2828

2929
enum pst_tags {
30-
%s
30+
PST_TRUE = 0x00,
31+
PST_FALSE = 0x01,
32+
PST_SYMBOL = 0x02,
33+
PST_INT32 = 0x03,
34+
PST_DOUBLE = 0x04,
35+
PST_COMPLEX = 0x05,
36+
PST_NULL = 0x06,
37+
PST_PAIR = 0x07,
38+
PST_VECTOR = 0x08,
39+
PST_DICT = 0x09,
40+
PST_UNIFORM_VECTOR = 0x0a,
41+
PST_UINT64 = 0x0b,
42+
PST_TUPLE = 0x0c,
43+
UVI_ENDIAN_MASK = 0x80,
44+
UVI_SUBTYPE_MASK = 0x7f,
45+
UVI_LITTLE_ENDIAN = 0x00,
46+
UVI_BIG_ENDIAN = 0x80,
47+
UVI_U8 = 0x00,
48+
UVI_S8 = 0x01,
49+
UVI_U16 = 0x02,
50+
UVI_S16 = 0x03,
51+
UVI_U32 = 0x04,
52+
UVI_S32 = 0x05,
53+
UVI_U64 = 0x06,
54+
UVI_S64 = 0x07,
55+
UVI_F32 = 0x08,
56+
UVI_F64 = 0x09,
57+
UVI_C32 = 0x0a,
58+
UVI_C64 = 0x0b,
59+
PST_COMMENT = 0x3b,
60+
PST_COMMENT_END = 0x0a
3161
};
3262
#endif /* INCLUDED_PMT_SERIAL_TAGS_H */
33-
"""
34-
35-
from __future__ import print_function
36-
from __future__ import unicode_literals
37-
38-
import sys, os, re
39-
40-
if __name__ == '__main__':
41-
if len(sys.argv) != 3:
42-
print("Usage %s <input_scm_file> <output_hdr_file>"%__file__)
43-
exit()
44-
input_scm_file, output_hdr_file = sys.argv[1:]
45-
enums = list()
46-
for line in open(input_scm_file).readlines():
47-
match = re.match('^\s*\(define\s+([\w|-]+)\s+#x([0-9a-fA-F]+)\)', line)
48-
if not match: continue
49-
name, value = match.groups()
50-
name = name.upper().replace('-', '_')
51-
enums.append(' %s = 0x%s'%(name, value))
52-
open(output_hdr_file, 'w').write(__doc__%(
53-
os.path.basename(__file__),
54-
os.path.basename(input_scm_file),
55-
',\n'.join(enums),
56-
))

‎gnuradio-runtime/lib/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,6 @@ add_library(gnuradio-runtime SHARED ${gnuradio_runtime_sources})
198198
target_link_libraries(gnuradio-runtime ${gnuradio_runtime_libs})
199199
GR_LIBRARY_FOO(gnuradio-runtime)
200200

201-
add_dependencies(gnuradio-runtime
202-
pmt_generated runtime_generated_includes
203-
)
204-
205-
206201
#######################################################
207202
# STATIC LIB BUILD
208203
#######################################################

‎gnuradio-runtime/lib/pmt/CMakeLists.txt

+3-60
Original file line numberDiff line numberDiff line change
@@ -23,57 +23,8 @@
2323
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
2424
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
2525

26-
########################################################################
27-
# Generate serial tags header file
28-
########################################################################
29-
30-
get_filename_component(PMT_SERIAL_TAGS_H
31-
${CMAKE_CURRENT_BINARY_DIR}/../../include/pmt/pmt_serial_tags.h ABSOLUTE
32-
)
33-
34-
add_custom_command(
35-
OUTPUT ${PMT_SERIAL_TAGS_H}
36-
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen-serial-tags.py
37-
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/pmt-serial-tags.scm
38-
COMMAND ${PYTHON_EXECUTABLE}
39-
${CMAKE_CURRENT_SOURCE_DIR}/gen-serial-tags.py
40-
${CMAKE_CURRENT_SOURCE_DIR}/pmt-serial-tags.scm
41-
${PMT_SERIAL_TAGS_H}
42-
)
43-
44-
install(
45-
FILES ${PMT_SERIAL_TAGS_H}
46-
DESTINATION ${GR_INCLUDE_DIR}/pmt
47-
)
48-
49-
include(AddFileDependencies)
50-
ADD_FILE_DEPENDENCIES(
51-
${CMAKE_CURRENT_SOURCE_DIR}/pmt_serialize.cc
52-
${PMT_SERIAL_TAGS_H}
53-
)
54-
55-
########################################################################
56-
# Generate other pmt stuff
57-
########################################################################
58-
add_custom_command(
59-
OUTPUT
60-
${CMAKE_CURRENT_BINARY_DIR}/pmt_unv_int.h
61-
${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.h
62-
${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc
63-
${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc
64-
DEPENDS
65-
${CMAKE_CURRENT_SOURCE_DIR}/generate_unv.py
66-
${CMAKE_CURRENT_SOURCE_DIR}/unv_template.h.t
67-
${CMAKE_CURRENT_SOURCE_DIR}/unv_template.cc.t
68-
${CMAKE_CURRENT_SOURCE_DIR}/unv_qa_template.cc.t
69-
COMMAND ${PYTHON_EXECUTABLE} -B -c
70-
"import os, sys; srcdir='${CMAKE_CURRENT_SOURCE_DIR}'; sys.path.append(srcdir); os.environ['srcdir']=srcdir; from generate_unv import main; main()"
71-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
72-
VERBATIM
73-
)
74-
7526
set(pmt_sources
76-
${CMAKE_CURRENT_BINARY_DIR}/pmt_unv.cc
27+
${CMAKE_CURRENT_SOURCE_DIR}/pmt_unv.cc
7728
${CMAKE_CURRENT_SOURCE_DIR}/pmt.cc
7829
${CMAKE_CURRENT_SOURCE_DIR}/pmt_io.cc
7930
${CMAKE_CURRENT_SOURCE_DIR}/pmt_pool.cc
@@ -85,10 +36,6 @@ list(APPEND gnuradio_pmt_libs
8536
${LOG4CPP_LIBRARIES}
8637
)
8738

88-
add_custom_target(pmt_generated
89-
DEPENDS ${PMT_SERIAL_TAGS_H} ${CMAKE_CURRENT_BINARY_DIR}/pmt_unv_int.h)
90-
91-
9239
#Add Windows DLL resource file if using MSVC
9340
if(MSVC)
9441
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
@@ -109,14 +56,10 @@ target_link_libraries(gnuradio-pmt ${gnuradio_pmt_libs})
10956

11057
GR_LIBRARY_FOO(gnuradio-pmt)
11158

112-
add_dependencies(gnuradio-pmt
113-
pmt_generated
114-
)
115-
11659
if(ENABLE_STATIC_LIBS)
11760
add_library(gnuradio-pmt_static STATIC ${pmt_sources})
11861

119-
add_dependencies(gnuradio-pmt_static pmt_generated)
62+
add_dependencies(gnuradio-pmt_static)
12063

12164
if(NOT WIN32)
12265
set_target_properties(gnuradio-pmt_static
@@ -140,7 +83,7 @@ include(GrTest)
14083
list(APPEND test_gnuradio_pmt_sources
14184
qa_pmt.cc
14285
qa_pmt_prims.cc
143-
${CMAKE_CURRENT_BINARY_DIR}/qa_pmt_unv.cc
86+
qa_pmt_unv.cc
14487
)
14588

14689
include_directories(${CPPUNIT_INCLUDE_DIRS})

‎gnuradio-runtime/lib/pmt/generate_unv.py

-192
This file was deleted.

0 commit comments

Comments
 (0)