From e3409d2b762da7e75df936e7992d5b3b3ccf4f26 Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Tue, 30 Jun 2009 11:12:57 +0000
Subject: [PATCH] Bug 1310: Added CEPCU to CMake build.

---
 MAC/APL/CEPCU/CMakeLists.txt                  | 52 +++++++++++++++++++
 .../CEPCU/src/ApplController/CMakeLists.txt   | 51 ++++++++++++++++--
 .../CEPCU/src/BGPlogProcessor/CMakeLists.txt  | 27 ++++++++++
 .../CEPCU/src/CEPlogProcessor/CMakeLists.txt  | 27 ++++++++++
 MAC/APL/CEPCU/src/CMakeLists.txt              | 37 +++++++++++++
 .../CEPCU/src/OnlineControl/CMakeLists.txt    | 29 +++++++++++
 .../CEPCU/test/ApplController/CMakeLists.txt  | 28 ++++++++++
 .../src/CTStartDaemon/CMakeLists.txt          |  1 +
 8 files changed, 248 insertions(+), 4 deletions(-)
 create mode 100644 MAC/APL/CEPCU/CMakeLists.txt
 create mode 100644 MAC/APL/CEPCU/src/BGPlogProcessor/CMakeLists.txt
 create mode 100644 MAC/APL/CEPCU/src/CEPlogProcessor/CMakeLists.txt
 create mode 100644 MAC/APL/CEPCU/src/CMakeLists.txt
 create mode 100644 MAC/APL/CEPCU/src/OnlineControl/CMakeLists.txt
 create mode 100644 MAC/APL/CEPCU/test/ApplController/CMakeLists.txt

diff --git a/MAC/APL/CEPCU/CMakeLists.txt b/MAC/APL/CEPCU/CMakeLists.txt
new file mode 100644
index 00000000000..e8b85683c39
--- /dev/null
+++ b/MAC/APL/CEPCU/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(CEPCU)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+# Do not split the following line, otherwise makeversion will fail!
+lofar_add_package(${PROJECT_NAME} 3.1 DEPENDS Common ApplCommon ALC PLC MACIO GCFTM GCFRTDB APLCommon)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost REQUIRED date_time)
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(src)
+# add_subdirectory(test/ApplController)   # Tests currently do NOT compile 
diff --git a/MAC/APL/CEPCU/src/ApplController/CMakeLists.txt b/MAC/APL/CEPCU/src/ApplController/CMakeLists.txt
index 7055b453f72..f3b876ff8d0 100644
--- a/MAC/APL/CEPCU/src/ApplController/CMakeLists.txt
+++ b/MAC/APL/CEPCU/src/ApplController/CMakeLists.txt
@@ -1,5 +1,25 @@
+#  $Id: CMakeLists.txt 13516 2009-06-30 10:05:44Z loose $
+#
+#  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
 
-add_executable (ApplController
+lofar_add_bin_program(ApplController 
+  ApplControllerMain.cc
   ACCmdImpl.cc
   ACDaemonComm.cc
   APAdmin.cc
@@ -12,6 +32,29 @@ add_executable (ApplController
   PR_MPI.cc
   PR_BGL.cc
   StateEngine.cc
-  ApplController.cc
-  ApplControllerMain.cc
-)
\ No newline at end of file
+  ApplController.cc)
+                                                  
+lofar_add_bin_program(ACDaemon 
+  ACDaemonMain.cc
+  ACRequestPool.cc
+  ACDaemon.cc)
+
+lofar_add_bin_program(ACcli ACcli.cc)
+
+lofar_add_bin_program(ACuserMenu ACuserMenu.cc)
+
+install(PROGRAMS 
+  startAP.sh
+  startBGL.sh
+  startMPI.sh
+  stopAP.sh
+  stopBGL.sh 
+  stopMPI.sh
+  DESTINATION bin)
+  
+install(FILES
+  ACDaemon.log_prop 
+  ACDaemon.conf
+  ApplController.log_prop
+  ACuserMenu.log_prop
+  DESTINATION etc)
diff --git a/MAC/APL/CEPCU/src/BGPlogProcessor/CMakeLists.txt b/MAC/APL/CEPCU/src/BGPlogProcessor/CMakeLists.txt
new file mode 100644
index 00000000000..53d7d001dba
--- /dev/null
+++ b/MAC/APL/CEPCU/src/BGPlogProcessor/CMakeLists.txt
@@ -0,0 +1,27 @@
+#  $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
+
+lofar_add_bin_program(BGPlogProcessor 
+  BGPlogProcessorMain.cc
+  BGPlogProcessor.cc)
+
+install(FILES 
+  BGPlogProcessor.conf 
+  DESTINATION etc)
diff --git a/MAC/APL/CEPCU/src/CEPlogProcessor/CMakeLists.txt b/MAC/APL/CEPCU/src/CEPlogProcessor/CMakeLists.txt
new file mode 100644
index 00000000000..dea945317ef
--- /dev/null
+++ b/MAC/APL/CEPCU/src/CEPlogProcessor/CMakeLists.txt
@@ -0,0 +1,27 @@
+#  $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
+
+lofar_add_bin_program(CEPlogProcessor 
+  CEPlogProcessorMain.cc
+  CEPlogProcessor.cc)
+
+install(FILES 
+  CEPlogProcessor.conf 
+  DESTINATION etc)
diff --git a/MAC/APL/CEPCU/src/CMakeLists.txt b/MAC/APL/CEPCU/src/CMakeLists.txt
new file mode 100644
index 00000000000..b2000a9c3b2
--- /dev/null
+++ b/MAC/APL/CEPCU/src/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(LofarPackageVersion)
+
+# Create symbolic link in binary include directory to current directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/CEPCU)
+
+lofar_add_library(cepcu Package__Version.cc)
+lofar_add_bin_program(versioncepcu versioncepcu.cc)
+
+add_subdirectory(ApplController)
+add_subdirectory(CEPlogProcessor)
+add_subdirectory(BGPlogProcessor)
+if(HAVE_PVSS)
+  add_subdirectory(OnlineControl)
+#  add_subdirectory(OfflineControl)
+endif(HAVE_PVSS)
diff --git a/MAC/APL/CEPCU/src/OnlineControl/CMakeLists.txt b/MAC/APL/CEPCU/src/OnlineControl/CMakeLists.txt
new file mode 100644
index 00000000000..f5eb9fe28cb
--- /dev/null
+++ b/MAC/APL/CEPCU/src/OnlineControl/CMakeLists.txt
@@ -0,0 +1,29 @@
+#  $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
+
+# Add current source directory to -I path. This is needed because OnlineControl
+# uses angle brackets for internal header files, instead of quotes.
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+lofar_add_bin_program(OnlineControl
+  OnlineControlMain.cc
+  OnlineControl.cc
+  CEPApplMgr.cc)
diff --git a/MAC/APL/CEPCU/test/ApplController/CMakeLists.txt b/MAC/APL/CEPCU/test/ApplController/CMakeLists.txt
new file mode 100644
index 00000000000..6050e71ee11
--- /dev/null
+++ b/MAC/APL/CEPCU/test/ApplController/CMakeLists.txt
@@ -0,0 +1,28 @@
+#  $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(LofarCTest)
+
+# Add current binary directory to -I path, so that the generated C++ header
+# files can be found.
+#include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+lofar_add_test(APExample APExample.cc APCmdImpl.cc)
+lofar_add_test(APTest APTest.cc APCmdImpl.cc)
diff --git a/MAC/APL/CUDaemons/src/CTStartDaemon/CMakeLists.txt b/MAC/APL/CUDaemons/src/CTStartDaemon/CMakeLists.txt
index 97b19ce6bcc..c5af292d6e6 100644
--- a/MAC/APL/CUDaemons/src/CTStartDaemon/CMakeLists.txt
+++ b/MAC/APL/CUDaemons/src/CTStartDaemon/CMakeLists.txt
@@ -19,4 +19,5 @@
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 lofar_add_bin_program(CTStartDaemon CTStartDaemonMain.cc CTStartDaemon.cc)
+install(PROGRAMS startController.sh DESTINATION bin)
 install(FILES CTStartDaemon.conf DESTINATION etc)
-- 
GitLab