From 106c8e353f7143dfee18eab9d84309436e465319 Mon Sep 17 00:00:00 2001
From: gypaos <gypaos@gmail.com>
Date: Thu, 22 Oct 2020 15:20:25 +0200
Subject: [PATCH] [CT] update CMakeLists.txt with CXX_FLAGS from ROOT

---
 .../ComptonTelescope/online/CMakeLists.txt    | 19 ++++++++++++---
 .../online/src/CMakeLists.txt                 | 24 +++++++++----------
 .../ComptonTelescope/online/src/online.cpp    | 14 +++++------
 3 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/Projects/ComptonTelescope/online/CMakeLists.txt b/Projects/ComptonTelescope/online/CMakeLists.txt
index 69a5aa11e..6f36d687f 100644
--- a/Projects/ComptonTelescope/online/CMakeLists.txt
+++ b/Projects/ComptonTelescope/online/CMakeLists.txt
@@ -4,10 +4,23 @@ set (CCAM_VERSION_MAJOR 0)
 set (CCAM_VERSION_MINOR 1)
 set(CMAKE_BUILD_TYPE Release)
 
+# ROOT stuff                                                                    
+list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})                                    
+find_package(ROOT REQUIRED)                                                     
+include_directories(${ROOT_INCLUDE_DIRS})                                       
+                                                                                
+# nptool stuff                                                                  
+find_package(NPLib)                                                             
+include(${NPLib_USE_FILE})                                                      
+message("  found: ${NPLIB}")                                                    
+message("  include directory: ${NPLib_INCLUDE_DIRS}")                           
+message("  detector list (empty if all): ${NPLib_DETECTOR_LIST}")               
+message("  library directory: ${NPLib_LIB_DIRS}")                               
+link_directories(${NPLIB}/lib)                                                  
+
 # support for c++11
-#set (CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11 -m64")
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m64")
+set (CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
 
 # set directories
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
diff --git a/Projects/ComptonTelescope/online/src/CMakeLists.txt b/Projects/ComptonTelescope/online/src/CMakeLists.txt
index 62beb054a..5e7a3617e 100644
--- a/Projects/ComptonTelescope/online/src/CMakeLists.txt
+++ b/Projects/ComptonTelescope/online/src/CMakeLists.txt
@@ -1,17 +1,16 @@
 # ROOT stuff
-list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
-find_package(ROOT REQUIRED)
-include_directories(${ROOT_INCLUDE_DIRS})
+#list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
+#find_package(ROOT REQUIRED)
+#include_directories(${ROOT_INCLUDE_DIRS})
 
 # nptool stuff
-#list(APPEND CMAKE_PREFIX_PATH $ENV{NPTOOL})
-find_package(NPLib)
-include(${NPLib_USE_FILE})
-message("  found: ${NPLIB}")
-message("  include directory: ${NPLib_INCLUDE_DIRS}")
-message("  detector list (empty if all): ${NPLib_DETECTOR_LIST}")
-message("  library directory: ${NPLib_LIB_DIRS}")
-link_directories(${NPLIB}/lib)
+#find_package(NPLib)
+#include(${NPLib_USE_FILE})
+#message("  found: ${NPLIB}")
+#message("  include directory: ${NPLib_INCLUDE_DIRS}")
+#message("  detector list (empty if all): ${NPLib_DETECTOR_LIST}")
+#message("  library directory: ${NPLib_LIB_DIRS}")
+#link_directories(${NPLIB}/lib)
 
 # build DecodeR shared library
 add_library(DecodeR SHARED DecodeR.cpp)
@@ -20,5 +19,6 @@ add_library(DecodeR SHARED DecodeR.cpp)
 add_executable(online online.cpp)
 
 # link library rules
+# !!!! Example1.detector not found when NPComptonTelescope is added !!!!
 #target_link_libraries(online DecodeR ${ROOT_LIBRARIES} NPCore NPPhysics NPComptonTelescope)
-target_link_libraries(online ${ROOT_LIBRARIES} NPCore NPPhysics)
+target_link_libraries(online DecodeR ${ROOT_LIBRARIES} NPCore NPPhysics)
diff --git a/Projects/ComptonTelescope/online/src/online.cpp b/Projects/ComptonTelescope/online/src/online.cpp
index 86c77065d..2e0a1fccf 100644
--- a/Projects/ComptonTelescope/online/src/online.cpp
+++ b/Projects/ComptonTelescope/online/src/online.cpp
@@ -2,8 +2,8 @@
 #include "NPOptionManager.h"
 #include "RootOutput.h"
 #include "NPDetectorManager.h"
-//#include "TComptonTelescopeData.h"
-//#include "TComptonTelescopePhysics.h"
+#include "TComptonTelescopeData.h"
+#include "TComptonTelescopePhysics.h"
 
 // root headers
 
@@ -39,10 +39,8 @@ int main()
   string detectorfileName = NPOptionManager::getInstance()->GetDetectorFile();
   cout << "detector file name from NPOptionManager: " << detectorfileName << "\n";
   NPL::DetectorManager* m_NPDetectorManager = new NPL::DetectorManager();
-//  m_NPDetectorManager->ReadConfigurationFile(detectorfileName);
   m_NPDetectorManager->ReadConfigurationFile(detectorfileName);
-  m_NPDetectorManager->InitializeRootOutput();
-//  m_NPDetectorManager->InitializeRootInput();
+//  m_NPDetectorManager->InitializeRootOutput();
 
   // Essential!
   #if __cplusplus > 199711L && NPMULTITHREADING
@@ -54,8 +52,8 @@ int main()
   // this part is commented for debugging purposes, but it works on its own
   ///////////////////////////////////////////////////////////////////////////
   // instantiate raw ComptonCAM data pointer
-  /*   auto ccamData = new TComptonTelescopeData();
-       ccamData->Dump();
+/*  auto ccamData = new TComptonTelescopeData();
+  ccamData->Dump();
   // connect raw CCAM data pointer to physics class
   //   auto ccamPhys = (TComptonTelescopePhysics*) m_NPDetectorManager->GetDetector("ComptonTelescope");
   //   ccamPhys->SetRawDataPointer(ccamData);
@@ -110,7 +108,7 @@ int main()
   }
   delete D;
   delete [] buffer;
-  */
+*/
   // test zone...
   /*
      ccamData->SetCTTrackerFrontETowerNbr(1);
-- 
GitLab