[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 98/101: cmake: add DIRECTORY support to GR_
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 98/101: cmake: add DIRECTORY support to GR_PYTHON_INSTALL and use it for grc |
Date: |
Thu, 16 Mar 2017 14:58:15 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch python3
in repository gnuradio.
commit 98806de9e5b623b8301426f648e097f408369316
Author: Sebastian Koslowski <address@hidden>
Date: Thu Jan 12 15:58:38 2017 +0100
cmake: add DIRECTORY support to GR_PYTHON_INSTALL and use it for grc
---
cmake/Modules/GrPython.cmake | 78 ++++++++++++++++++++++++++++++++++++++-
grc/CMakeLists.txt | 18 +++++----
grc/core/CMakeLists.txt | 35 ------------------
grc/core/generator/CMakeLists.txt | 30 ---------------
grc/core/utils/CMakeLists.txt | 25 -------------
grc/gui/CMakeLists.txt | 27 --------------
grc/gui/canvas/CMakeLists.txt | 25 -------------
7 files changed, 86 insertions(+), 152 deletions(-)
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
index 0bfa92d..49461e5 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
+# Copyright 2010-2011,2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -130,7 +130,7 @@ endfunction(GR_UNIQUE_TARGET)
########################################################################
function(GR_PYTHON_INSTALL)
include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION" "FILES;PROGRAMS"
${ARGN})
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION"
"FILES;PROGRAMS;DIRECTORY" ${ARGN})
####################################################################
if(GR_PYTHON_INSTALL_FILES)
@@ -185,6 +185,80 @@ function(GR_PYTHON_INSTALL)
)
####################################################################
+ elseif(GR_PYTHON_INSTALL_DIRECTORY)
+ ####################################################################
+ install(${ARGN}) #installs regular python files
+
+ # collect all python files in given directories
+ # #############################################
+ unset(pysrcfiles)
+ foreach(pydir ${GR_PYTHON_INSTALL_DIRECTORY})
+ file(GLOB_RECURSE pysrcfiles_tmp "${pydir}/*.py")
+ list(APPEND pysrcfiles ${pysrcfiles_tmp})
+ endforeach(pydir)
+
+ # build target lists
+ # ##################
+ unset(pycfiles) # pyc targets
+ unset(pyofiles) # pyo targets
+ unset(pygen_paths) # all paths of py[oc] targets
+ foreach(pyfile ${pysrcfiles})
+ # determine if this file is in the source or binary directory
+ file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR}
${pyfile})
+ string(LENGTH "${source_rel_path}" source_rel_path_len)
+ file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR}
${pyfile})
+ string(LENGTH "${binary_rel_path}" binary_rel_path_len)
+
+ # and set the generated path appropriately
+ if(${source_rel_path_len} GREATER ${binary_rel_path_len})
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
+ else()
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
+ endif()
+ list(APPEND pycfiles "${pygenfile}c")
+ list(APPEND pyofiles "${pygenfile}o")
+
+ get_filename_component(pygen_path "${pygenfile}" DIRECTORY)
+ list(APPEND pygen_paths "${pygen_path}")
+ file(MAKE_DIRECTORY "${pygen_path}")
+ endforeach(pyfile)
+ list(REMOVE_DUPLICATES pygen_paths)
+ list(SORT pygen_paths)
+
+ # generate the py[oc] files
+ # #########################
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
+ )
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
+ COMMAND ${PYTHON_EXECUTABLE} -O
${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
+ )
+ set(python_install_gen_targets ${pycfiles} ${pyofiles})
+
+ # per-directory install rules
+ # ###########################
+ foreach(pygen_path ${pygen_paths})
+ # find all targets in that directory (no "list(FILTER ...)")
+ unset(pygen_path_targets)
+ foreach(pyget_target ${python_install_gen_targets})
+ get_filename_component(pyget_target_path "${pyget_target}"
PATH)
+ if(pygen_path STREQUAL pyget_target_path)
+ list(APPEND pygen_path_targets "${pyget_target}")
+ endif()
+ endforeach(pyget_target)
+
+ # install relative to current binary dir
+ file(RELATIVE_PATH pygen_path_rel "${CMAKE_CURRENT_BINARY_DIR}"
"${pygen_path}")
+ list(SORT pygen_path_targets)
+ install(
+ FILES ${pygen_path_targets}
+ DESTINATION
"${GR_PYTHON_INSTALL_DESTINATION}/${pygen_path_rel}"
+ )
+ endforeach(pygen_path)
+
+ ####################################################################
elseif(GR_PYTHON_INSTALL_PROGRAMS)
####################################################################
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index eed5202..3aa05e9 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -48,9 +48,6 @@ GR_REGISTER_COMPONENT("gnuradio-companion" ENABLE_GRC
${grc_python_deps}
)
-########################################################################
-# Begin conditional configuration
-########################################################################
if(ENABLE_GRC)
########################################################################
@@ -85,15 +82,22 @@ install(
DESTINATION ${GR_PREFSDIR}
)
+########################################################################
+# Install (+ compile) python sources and data files
+########################################################################
file(GLOB py_files "*.py")
-
GR_PYTHON_INSTALL(
FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc
+ DESTINATION "${GR_PYTHON_DIR}/gnuradio/grc"
)
+GR_PYTHON_INSTALL(
+ DIRECTORY core gui
+ DESTINATION "${GR_PYTHON_DIR}/gnuradio/grc"
+ FILES_MATCHING REGEX "\\.(py|dtd|grc|tmpl)$"
+)
########################################################################
-# Appens NSIS commands to set environment variables
+# Append NSIS commands to set environment variables
########################################################################
if(WIN32)
@@ -112,8 +116,6 @@ endif(WIN32)
# Add subdirectories
########################################################################
add_subdirectory(blocks)
-add_subdirectory(gui)
-add_subdirectory(core)
add_subdirectory(scripts)
endif(ENABLE_GRC)
diff --git a/grc/core/CMakeLists.txt b/grc/core/CMakeLists.txt
deleted file mode 100644
index f340127..0000000
--- a/grc/core/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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, or (at your option)
-# any later version.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-file(GLOB py_files "*.py")
-
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core
-)
-
-file(GLOB dtd_files "*.dtd")
-
-install(
- FILES ${dtd_files} default_flow_graph.grc
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core
-)
-
-add_subdirectory(generator)
-add_subdirectory(utils)
diff --git a/grc/core/generator/CMakeLists.txt
b/grc/core/generator/CMakeLists.txt
deleted file mode 100644
index 492ad7c..0000000
--- a/grc/core/generator/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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, or (at your option)
-# any later version.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-file(GLOB py_files "*.py")
-
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/generator
-)
-
-install(FILES
- flow_graph.tmpl
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/generator
-)
diff --git a/grc/core/utils/CMakeLists.txt b/grc/core/utils/CMakeLists.txt
deleted file mode 100644
index 3ba6525..0000000
--- a/grc/core/utils/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2015 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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, or (at your option)
-# any later version.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-file(GLOB py_files "*.py")
-
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/utils
-)
diff --git a/grc/gui/CMakeLists.txt b/grc/gui/CMakeLists.txt
deleted file mode 100644
index f4c6242..0000000
--- a/grc/gui/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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, or (at your option)
-# any later version.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-file(GLOB py_files "*.py")
-
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/gui
-)
-
-add_subdirectory(canvas)
diff --git a/grc/gui/canvas/CMakeLists.txt b/grc/gui/canvas/CMakeLists.txt
deleted file mode 100644
index e24e8c2..0000000
--- a/grc/gui/canvas/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2016 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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, or (at your option)
-# any later version.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-file(GLOB py_files "*.py")
-
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/utils
-)
- [Commit-gnuradio] [gnuradio] 93/101: grc: gtk3: python3 error, some cmake fixes, (continued)
- [Commit-gnuradio] [gnuradio] 93/101: grc: gtk3: python3 error, some cmake fixes, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 85/101: grc: refactor: Moved the notebook and console into separate classes., git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 61/101: grc: gtk3: draw ports before blocks and simplyfied draw code, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 80/101: grc: gtk3: fix MessageDialog for Variable Panel config, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 87/101: grc: refactor: Added logging, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 77/101: grc: gtk3: make screnshots as png, pdf and svg, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 81/101: grc: refactor: make gr.prefs() optional (for testing), git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 99/101: grc: gtk3: update cmake requirements, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 92/101: grc: gtk3: fix block layout sizes when zooming, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 94/101: grc: gtk3: reimplemented custom bg colors for param entry boxes, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 98/101: cmake: add DIRECTORY support to GR_PYTHON_INSTALL and use it for grc,
git <=
- [Commit-gnuradio] [gnuradio] 11/101: grc: py3k compat using python-modernize, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 75/101: grc: gtk3: rewrite file dialogs and support multiple extentions for screenshots, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 70/101: grc: gtk3: fancier coloring for disabled and bypassed blocks, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 83/101: grc: refactor: Cleaned up imports, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 88/101: grc: gtk3: fix multi-block move, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 91/101: grc: gtk3: fix canvas extent after zooming, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 100/101: grc: gtk minor fixes, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 01/101: grc: Main window opens with pygobject and gtk3. Still throws tons of errors., git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 72/101: Merge remote-tracking branch 'upstream/next' into gtk3, git, 2017/03/16
- [Commit-gnuradio] [gnuradio] 71/101: grc: gtk3: fixup dialogs, git, 2017/03/16