From 1404ce80e789f81e4b0e66584547f7edd75a734c Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Fri, 18 Sep 2009 15:46:59 +0000
Subject: [PATCH] Bug 1310: Added Pipeline to CMake build. Fixed Python install
 path bug

---
 CEP/CMakeLists.txt                       |  1 +
 CEP/DP3/DPPP/include/DPPP/CMakeLists.txt |  1 +
 CEP/DP3/DPPP/src/CMakeLists.txt          |  1 +
 CEP/Pipeline/CMakeLists.txt              | 52 ++++++++++++++++++++++++
 CEP/Pipeline/library/CMakeLists.txt      | 37 +++++++++++++++++
 CMake/PythonInstall.cmake                |  4 +-
 LCS/pyparameterset/src/CMakeLists.txt    |  3 +-
 LCS/pytools/src/CMakeLists.txt           |  2 +-
 8 files changed, 97 insertions(+), 4 deletions(-)
 create mode 100644 CEP/Pipeline/CMakeLists.txt
 create mode 100644 CEP/Pipeline/library/CMakeLists.txt

diff --git a/CEP/CMakeLists.txt b/CEP/CMakeLists.txt
index 163f31f4d13..20d47d86284 100644
--- a/CEP/CMakeLists.txt
+++ b/CEP/CMakeLists.txt
@@ -40,6 +40,7 @@ lofar_add_subdirectory(ParmDB)
 lofar_add_subdirectory(Calibration)
 lofar_add_subdirectory(DP3)
 lofar_add_subdirectory(Imager)
+
 lofar_add_subdirectory(Pipeline)
 lofar_add_subdirectory(pyparmdb)
 
diff --git a/CEP/DP3/DPPP/include/DPPP/CMakeLists.txt b/CEP/DP3/DPPP/include/DPPP/CMakeLists.txt
index 825d0b1a40b..6e9170ddfaa 100644
--- a/CEP/DP3/DPPP/include/DPPP/CMakeLists.txt
+++ b/CEP/DP3/DPPP/include/DPPP/CMakeLists.txt
@@ -32,6 +32,7 @@ set(inst_HEADERS
   DataBuffer.h
   TimeBuffer.h
   RunDetails.h
+  ProgressMeter.h
   Pipeline.h)
 
 # Create symbolic link to include directory.
diff --git a/CEP/DP3/DPPP/src/CMakeLists.txt b/CEP/DP3/DPPP/src/CMakeLists.txt
index 27050234508..2ac23bf454b 100644
--- a/CEP/DP3/DPPP/src/CMakeLists.txt
+++ b/CEP/DP3/DPPP/src/CMakeLists.txt
@@ -34,6 +34,7 @@ lofar_add_library(dppp
   DataBuffer.cc
   TimeBuffer.cc
   RunDetails.cc
+  ProgressMeter.cc
   Pipeline.cc)
 
 lofar_add_bin_program(CS1_IDPPP IDPPP.cc PipelineProcessControl.cc)
diff --git a/CEP/Pipeline/CMakeLists.txt b/CEP/Pipeline/CMakeLists.txt
new file mode 100644
index 00000000000..c83b60f37ac
--- /dev/null
+++ b/CEP/Pipeline/CMakeLists.txt
@@ -0,0 +1,52 @@
+#  $Id$
+#
+#  Copyright (C) 2008-2009
+#  ASTRON (Netherlands Foundation for Research in Astronomy)
+#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+#
+#  This program 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 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program 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 this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(Pipeline)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS pytools)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Python REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(Core)
+add_subdirectory(library)
diff --git a/CEP/Pipeline/library/CMakeLists.txt b/CEP/Pipeline/library/CMakeLists.txt
new file mode 100644
index 00000000000..ea2a94b3d16
--- /dev/null
+++ b/CEP/Pipeline/library/CMakeLists.txt
@@ -0,0 +1,37 @@
+# $Id$
+#
+# Copyright (C) 2008-2009
+# ASTRON (Netherlands Foundation for Research in Astronomy)
+# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+#
+# This program 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+include(PythonInstall)
+
+# Python modules.
+python_install(
+  __init__.py
+  Observation.py
+  sysconfig.py
+  DESTINATION lofar/pipeline)
+
+# Python scripts
+install(PROGRAMS
+  dppp_node.py
+  DPPP.py
+  MakeVDS.py
+  MWImager.py
+  StandardImagingPipeline.py
+  DESTINATION bin)
diff --git a/CMake/PythonInstall.cmake b/CMake/PythonInstall.cmake
index f9ae2f76cd2..1ea9c5eadfa 100644
--- a/CMake/PythonInstall.cmake
+++ b/CMake/PythonInstall.cmake
@@ -48,12 +48,14 @@ macro(python_install)
     message(FATAL_ERROR "python_install: destination directory invalid")
   endif(_dest_dir MATCHES "^$" OR _dest_dir MATCHES ";")
 
+  # Set python package install directory.
   set(_dest_dir "${PYTHON_INSTALL_DIR}/${_dest_dir}")
 
   # Byte-compile each Python file and add both .py and .pyc to install list.
+  file(RELATIVE_PATH _rel_path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
   set(_pyc_files)
   foreach(_py ${_py_files})
-    set(_comment "Byte-compiling ${_py}")
+    set(_comment "Byte-compiling ${_rel_path}/${_py}")
     set(_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_py}c)
     set(_py ${CMAKE_CURRENT_SOURCE_DIR}/${_py})
     add_custom_command(OUTPUT ${_pyc}
diff --git a/LCS/pyparameterset/src/CMakeLists.txt b/LCS/pyparameterset/src/CMakeLists.txt
index 9d8e8f65456..99a088affd2 100644
--- a/LCS/pyparameterset/src/CMakeLists.txt
+++ b/LCS/pyparameterset/src/CMakeLists.txt
@@ -34,5 +34,4 @@ lofar_add_bin_program(versionpyparameterset
 
 # Install Python modules
 include(PythonInstall)
-python_install(__init__.py 
-  DESTINATION ${PYTHON_INSTALL_DIR}/lofar/parameterset)
+python_install(__init__.py DESTINATION lofar/parameterset)
diff --git a/LCS/pytools/src/CMakeLists.txt b/LCS/pytools/src/CMakeLists.txt
index bf37d83250c..01aea4df331 100644
--- a/LCS/pytools/src/CMakeLists.txt
+++ b/LCS/pytools/src/CMakeLists.txt
@@ -20,5 +20,5 @@
 
 include(PythonInstall)
 
-python_install(__init__.py DESTINATION ${PYTHON_INSTALL_DIR}/lofar)
+python_install(__init__.py DESTINATION lofar)
 
-- 
GitLab