summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/Modules/GrSwig.cmake13
-rw-r--r--gnuradio-core/src/lib/gengen/CMakeLists.txt43
-rw-r--r--gnuradio-core/src/lib/swig/CMakeLists.txt2
-rw-r--r--gr-trellis/src/lib/CMakeLists.txt49
4 files changed, 46 insertions, 61 deletions
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index d554f78d1..f8f339f1b 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -47,9 +47,17 @@ macro(GR_SWIG_MAKE name)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
+ #create a dummy target that depend on other targets
+ set(tag_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.tag)
+ add_custom_command(
+ OUTPUT ${tag_file}
+ DEPENDS ${GR_SWIG_TARGET_DEPS}
+ COMMAND ${CMAKE_COMMAND} -E touch ${tag_file}
+ )
+
#append the specified include directories
include_directories(${GR_SWIG_INCLUDE_DIRS})
- list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS})
+ list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${GR_SWIG_SOURCE_DEPS} ${tag_file})
find_package(PythonLibs)
include_directories(${PYTHON_INCLUDE_DIRS})
@@ -67,9 +75,6 @@ macro(GR_SWIG_MAKE name)
include(UseSWIG)
SWIG_ADD_MODULE(${name} python ${ifiles})
SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES})
- if(GR_SWIG_TARGET_DEPS)
- add_dependencies(${SWIG_MODULE_${name}_REAL_NAME} ${GR_SWIG_TARGET_DEPS})
- endif(GR_SWIG_TARGET_DEPS)
endmacro(GR_SWIG_MAKE)
diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt
index e3da278f2..a7292f131 100644
--- a/gnuradio-core/src/lib/gengen/CMakeLists.txt
+++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt
@@ -118,37 +118,28 @@ add_custom_target(gengen_generated DEPENDS
########################################################################
# Create the master gengen swig include files
########################################################################
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.py "
-import os, sys
-if __name__ == '__main__':
- incs = sys.argv[2:]
- h_incs = '\\n'.join(['#include<%s.h>'%(os.path.splitext(os.path.basename(inc))[0]) for inc in incs])
- i_incs = '\\n'.join(['%%include<%s>'%(os.path.basename(inc)) for inc in incs])
- open(sys.argv[1], 'w').write('''
+set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i.in)
+file(WRITE ${generated_index} "
//
// This file is machine generated. All edits will be overwritten
//
-
-%%{
-%s
-%%}
-
-%s
-
-'''%(h_incs, i_incs))
")
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i
- DEPENDS ${generated_gengen_swigs}
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
- ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.py
- ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i
- ${generated_gengen_swigs}
-)
-
-add_custom_target(gengen_generated_index DEPENDS
- ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i
+file(APPEND ${generated_index} "%{\n")
+foreach(swig_file ${generated_gengen_swigs})
+ get_filename_component(name ${swig_file} NAME_WE)
+ file(APPEND ${generated_index} "#include<${name}.h>\n")
+endforeach(swig_file)
+file(APPEND ${generated_index} "%}\n")
+
+foreach(swig_file ${generated_gengen_swigs})
+ get_filename_component(name ${swig_file} NAME)
+ file(APPEND ${generated_index} "%include<${name}>\n")
+endforeach(swig_file)
+
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/gengen_generated.i
)
########################################################################
diff --git a/gnuradio-core/src/lib/swig/CMakeLists.txt b/gnuradio-core/src/lib/swig/CMakeLists.txt
index b10b7c186..aa289a18a 100644
--- a/gnuradio-core/src/lib/swig/CMakeLists.txt
+++ b/gnuradio-core/src/lib/swig/CMakeLists.txt
@@ -43,7 +43,7 @@ set(GR_SWIG_LIBRARIES gnuradio-core)
# X86_64, g++'s resident set size was 650MB!
# ----------------------------------------------------------------
-set(GR_SWIG_TARGET_DEPS gengen_generated gengen_generated_index filter_generated)
+set(GR_SWIG_TARGET_DEPS gengen_generated filter_generated)
GR_SWIG_MAKE(gnuradio_core_runtime gnuradio_core_runtime.i)
GR_SWIG_MAKE(gnuradio_core_general gnuradio_core_general.i)
diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt
index 61cc0d650..5a1c33c44 100644
--- a/gr-trellis/src/lib/CMakeLists.txt
+++ b/gr-trellis/src/lib/CMakeLists.txt
@@ -108,33 +108,28 @@ add_custom_target(trellis_generated DEPENDS
########################################################################
# Create the master trellis swig include files
########################################################################
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.py "
-import os, sys
-if __name__ == '__main__':
- incs = sys.argv[2:]
- h_incs = '\\n'.join(['#include<%s.h>'%(os.path.splitext(os.path.basename(inc))[0]) for inc in incs])
- i_incs = '\\n'.join(['%%include<%s>'%(os.path.basename(inc)) for inc in incs])
- open(sys.argv[1], 'w').write('''
+set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i.in)
+file(WRITE ${generated_index} "
//
// This file is machine generated. All edits will be overwritten
//
-
-%%{
-%s
-%%}
-
-%s
-
-'''%(h_incs, i_incs))
")
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i
- DEPENDS ${generated_trellis_swigs}
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
- ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.py
- ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i
- ${generated_trellis_swigs}
+file(APPEND ${generated_index} "%{\n")
+foreach(swig_file ${generated_trellis_swigs})
+ get_filename_component(name ${swig_file} NAME_WE)
+ file(APPEND ${generated_index} "#include<${name}.h>\n")
+endforeach(swig_file)
+file(APPEND ${generated_index} "%}\n")
+
+foreach(swig_file ${generated_trellis_swigs})
+ get_filename_component(name ${swig_file} NAME)
+ file(APPEND ${generated_index} "%include<${name}>\n")
+endforeach(swig_file)
+
+execute_process(
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i
)
########################################################################
@@ -186,6 +181,7 @@ install(FILES
if(ENABLE_PYTHON)
install(FILES
+ trellis.i
${generated_trellis_swigs}
fsm.i
interleaver.i
@@ -204,8 +200,7 @@ if(ENABLE_PYTHON)
include(GrPython)
include(GrSwig)
-set(GR_SWIG_SOURCE_DEPS ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i)
-set(GR_SWIG_TARGET_DEPS trellis_generated trellis_generated_index)
+set(GR_SWIG_TARGET_DEPS trellis_generated)
set(GR_SWIG_INCLUDE_DIRS
${GR_TRELLIS_INCLUDE_DIRS}
${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
@@ -220,10 +215,4 @@ GR_SWIG_INSTALL(
COMPONENT "trellis_python"
)
-install(
- FILES trellis.i
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
- COMPONENT "trellis_swig"
-)
-
endif(ENABLE_PYTHON)