From 398222229056368134760502d033ed9c5880243d Mon Sep 17 00:00:00 2001
From: Paul Heinzlreiter <paul.heinzlreiter@risc-software.at>
Date: Wed, 7 Sep 2016 14:00:55 +0200
Subject: [PATCH] * working on cmake

---
 bh_tree_mpi/CMakeLists.txt                         | 7 +++++--
 bh_tree_mpi/{ => datastructures}/BarnesHutTree.cpp | 0
 bh_tree_mpi/{ => datastructures}/BarnesHutTree.hpp | 0
 bh_tree_mpi/{ => datastructures}/Body.cpp          | 0
 bh_tree_mpi/{ => datastructures}/Body.hpp          | 0
 bh_tree_mpi/{ => datastructures}/Box.cpp           | 0
 bh_tree_mpi/{ => datastructures}/Box.hpp           | 0
 bh_tree_mpi/datastructures/CMakeLists.txt          | 2 ++
 bh_tree_mpi/{ => datastructures}/Node.cpp          | 0
 bh_tree_mpi/{ => datastructures}/Node.hpp          | 0
 bh_tree_mpi/{ => datastructures}/Tree.cpp          | 0
 bh_tree_mpi/{ => datastructures}/Tree.hpp          | 1 -
 bh_tree_mpi/main.cpp                               | 4 ++--
 bh_tree_mpi/mpimain.cpp                            | 4 ++--
 bh_tree_mpi/simulation/CMakeLists.txt              | 3 +++
 bh_tree_mpi/{ => simulation}/MpiBodyComm.cpp       | 0
 bh_tree_mpi/{ => simulation}/MpiBodyComm.hpp       | 2 +-
 bh_tree_mpi/{ => simulation}/MpiSimulation.cpp     | 8 ++++----
 bh_tree_mpi/{ => simulation}/MpiSimulation.hpp     | 0
 bh_tree_mpi/{ => simulation}/PthreadSimulation.cpp | 0
 bh_tree_mpi/{ => simulation}/PthreadSimulation.hpp | 0
 bh_tree_mpi/{ => simulation}/ReadWriteLock.cpp     | 0
 bh_tree_mpi/{ => simulation}/ReadWriteLock.hpp     | 0
 bh_tree_mpi/{ => simulation}/Simulation.cpp        | 0
 bh_tree_mpi/{ => simulation}/Simulation.hpp        | 0
 25 files changed, 19 insertions(+), 12 deletions(-)
 rename bh_tree_mpi/{ => datastructures}/BarnesHutTree.cpp (100%)
 rename bh_tree_mpi/{ => datastructures}/BarnesHutTree.hpp (100%)
 rename bh_tree_mpi/{ => datastructures}/Body.cpp (100%)
 rename bh_tree_mpi/{ => datastructures}/Body.hpp (100%)
 rename bh_tree_mpi/{ => datastructures}/Box.cpp (100%)
 rename bh_tree_mpi/{ => datastructures}/Box.hpp (100%)
 create mode 100644 bh_tree_mpi/datastructures/CMakeLists.txt
 rename bh_tree_mpi/{ => datastructures}/Node.cpp (100%)
 rename bh_tree_mpi/{ => datastructures}/Node.hpp (100%)
 rename bh_tree_mpi/{ => datastructures}/Tree.cpp (100%)
 rename bh_tree_mpi/{ => datastructures}/Tree.hpp (97%)
 create mode 100644 bh_tree_mpi/simulation/CMakeLists.txt
 rename bh_tree_mpi/{ => simulation}/MpiBodyComm.cpp (100%)
 rename bh_tree_mpi/{ => simulation}/MpiBodyComm.hpp (96%)
 rename bh_tree_mpi/{ => simulation}/MpiSimulation.cpp (98%)
 rename bh_tree_mpi/{ => simulation}/MpiSimulation.hpp (100%)
 rename bh_tree_mpi/{ => simulation}/PthreadSimulation.cpp (100%)
 rename bh_tree_mpi/{ => simulation}/PthreadSimulation.hpp (100%)
 rename bh_tree_mpi/{ => simulation}/ReadWriteLock.cpp (100%)
 rename bh_tree_mpi/{ => simulation}/ReadWriteLock.hpp (100%)
 rename bh_tree_mpi/{ => simulation}/Simulation.cpp (100%)
 rename bh_tree_mpi/{ => simulation}/Simulation.hpp (100%)

diff --git a/bh_tree_mpi/CMakeLists.txt b/bh_tree_mpi/CMakeLists.txt
index 8ec5bbd..2047fde 100644
--- a/bh_tree_mpi/CMakeLists.txt
+++ b/bh_tree_mpi/CMakeLists.txt
@@ -2,10 +2,13 @@ cmake_minimum_required (VERSION 2.6)
 project (bh_tree_mpi)
 
 find_package(MPI REQUIRED)
-include_directories(${MPI_INCLUDE_PATH})
+include_directories(${MPI_INCLUDE_PATH} datastructures simulation)
+
+add_subdirectory(datastructures)
+add_subdirectory(simulation)
 
 add_executable(bh_tree_mpi mpimain.cpp)
-target_link_libraries(bh_tree_mpi ${MPI_LIBRARIES})
+target_link_libraries(bh_tree_mpi datastructures simulation ${MPI_LIBRARIES})
 
 if(MPI_COMPILE_FLAGS)
   set_target_properties(bh_tree_mpi PROPERTIES
diff --git a/bh_tree_mpi/BarnesHutTree.cpp b/bh_tree_mpi/datastructures/BarnesHutTree.cpp
similarity index 100%
rename from bh_tree_mpi/BarnesHutTree.cpp
rename to bh_tree_mpi/datastructures/BarnesHutTree.cpp
diff --git a/bh_tree_mpi/BarnesHutTree.hpp b/bh_tree_mpi/datastructures/BarnesHutTree.hpp
similarity index 100%
rename from bh_tree_mpi/BarnesHutTree.hpp
rename to bh_tree_mpi/datastructures/BarnesHutTree.hpp
diff --git a/bh_tree_mpi/Body.cpp b/bh_tree_mpi/datastructures/Body.cpp
similarity index 100%
rename from bh_tree_mpi/Body.cpp
rename to bh_tree_mpi/datastructures/Body.cpp
diff --git a/bh_tree_mpi/Body.hpp b/bh_tree_mpi/datastructures/Body.hpp
similarity index 100%
rename from bh_tree_mpi/Body.hpp
rename to bh_tree_mpi/datastructures/Body.hpp
diff --git a/bh_tree_mpi/Box.cpp b/bh_tree_mpi/datastructures/Box.cpp
similarity index 100%
rename from bh_tree_mpi/Box.cpp
rename to bh_tree_mpi/datastructures/Box.cpp
diff --git a/bh_tree_mpi/Box.hpp b/bh_tree_mpi/datastructures/Box.hpp
similarity index 100%
rename from bh_tree_mpi/Box.hpp
rename to bh_tree_mpi/datastructures/Box.hpp
diff --git a/bh_tree_mpi/datastructures/CMakeLists.txt b/bh_tree_mpi/datastructures/CMakeLists.txt
new file mode 100644
index 0000000..1efa115
--- /dev/null
+++ b/bh_tree_mpi/datastructures/CMakeLists.txt
@@ -0,0 +1,2 @@
+file( GLOB datastructures_SOURCES *.hpp *.cpp )
+add_library( datastructures ${datastructures_SOURCES} )
\ No newline at end of file
diff --git a/bh_tree_mpi/Node.cpp b/bh_tree_mpi/datastructures/Node.cpp
similarity index 100%
rename from bh_tree_mpi/Node.cpp
rename to bh_tree_mpi/datastructures/Node.cpp
diff --git a/bh_tree_mpi/Node.hpp b/bh_tree_mpi/datastructures/Node.hpp
similarity index 100%
rename from bh_tree_mpi/Node.hpp
rename to bh_tree_mpi/datastructures/Node.hpp
diff --git a/bh_tree_mpi/Tree.cpp b/bh_tree_mpi/datastructures/Tree.cpp
similarity index 100%
rename from bh_tree_mpi/Tree.cpp
rename to bh_tree_mpi/datastructures/Tree.cpp
diff --git a/bh_tree_mpi/Tree.hpp b/bh_tree_mpi/datastructures/Tree.hpp
similarity index 97%
rename from bh_tree_mpi/Tree.hpp
rename to bh_tree_mpi/datastructures/Tree.hpp
index d895754..4609e4a 100644
--- a/bh_tree_mpi/Tree.hpp
+++ b/bh_tree_mpi/datastructures/Tree.hpp
@@ -18,7 +18,6 @@ namespace nbody {
 		friend class Node;
 	protected:
 		Node* nodes;
-		//Control control;
 		unsigned int maxLeafBodies;
 	public:
 		static vector<Body> dubinskiParse(string filename);
diff --git a/bh_tree_mpi/main.cpp b/bh_tree_mpi/main.cpp
index 134361e..b295db1 100644
--- a/bh_tree_mpi/main.cpp
+++ b/bh_tree_mpi/main.cpp
@@ -1,5 +1,5 @@
-#include "BarnesHutTree.hpp"
-#include "MpiSimulation.hpp"
+#include <BarnesHutTree.hpp>
+#include <MpiSimulation.hpp>
 #include <iostream>
 #include <mpi.h>
 
diff --git a/bh_tree_mpi/mpimain.cpp b/bh_tree_mpi/mpimain.cpp
index 134361e..b295db1 100644
--- a/bh_tree_mpi/mpimain.cpp
+++ b/bh_tree_mpi/mpimain.cpp
@@ -1,5 +1,5 @@
-#include "BarnesHutTree.hpp"
-#include "MpiSimulation.hpp"
+#include <BarnesHutTree.hpp>
+#include <MpiSimulation.hpp>
 #include <iostream>
 #include <mpi.h>
 
diff --git a/bh_tree_mpi/simulation/CMakeLists.txt b/bh_tree_mpi/simulation/CMakeLists.txt
new file mode 100644
index 0000000..2dc4762
--- /dev/null
+++ b/bh_tree_mpi/simulation/CMakeLists.txt
@@ -0,0 +1,3 @@
+file( GLOB simulation_SOURCES *.hpp *.cpp )
+include_directories(../datastructures)
+add_library( simulation ${simulation_SOURCES} )
\ No newline at end of file
diff --git a/bh_tree_mpi/MpiBodyComm.cpp b/bh_tree_mpi/simulation/MpiBodyComm.cpp
similarity index 100%
rename from bh_tree_mpi/MpiBodyComm.cpp
rename to bh_tree_mpi/simulation/MpiBodyComm.cpp
diff --git a/bh_tree_mpi/MpiBodyComm.hpp b/bh_tree_mpi/simulation/MpiBodyComm.hpp
similarity index 96%
rename from bh_tree_mpi/MpiBodyComm.hpp
rename to bh_tree_mpi/simulation/MpiBodyComm.hpp
index 2f71abd..24f3805 100644
--- a/bh_tree_mpi/MpiBodyComm.hpp
+++ b/bh_tree_mpi/simulation/MpiBodyComm.hpp
@@ -4,7 +4,7 @@
 
 #include <mpi.h>
 #include <vector>
-#include "Body.hpp"
+#include <Body.hpp>
 
 namespace nbody {
 	using namespace std;
diff --git a/bh_tree_mpi/MpiSimulation.cpp b/bh_tree_mpi/simulation/MpiSimulation.cpp
similarity index 98%
rename from bh_tree_mpi/MpiSimulation.cpp
rename to bh_tree_mpi/simulation/MpiSimulation.cpp
index aca3c7c..c9c6c2c 100644
--- a/bh_tree_mpi/MpiSimulation.cpp
+++ b/bh_tree_mpi/simulation/MpiSimulation.cpp
@@ -1,10 +1,10 @@
 #include <iostream>
 #include <cmath>
-#include "Body.hpp"
-#include "Box.hpp"
+#include <Body.hpp>
+#include <Box.hpp>
+#include <Tree.hpp>
+#include <Node.hpp>
 #include "MpiSimulation.hpp"
-#include "Tree.hpp"
-#include "Node.hpp"
 
 namespace nbody {
 	using namespace std;
diff --git a/bh_tree_mpi/MpiSimulation.hpp b/bh_tree_mpi/simulation/MpiSimulation.hpp
similarity index 100%
rename from bh_tree_mpi/MpiSimulation.hpp
rename to bh_tree_mpi/simulation/MpiSimulation.hpp
diff --git a/bh_tree_mpi/PthreadSimulation.cpp b/bh_tree_mpi/simulation/PthreadSimulation.cpp
similarity index 100%
rename from bh_tree_mpi/PthreadSimulation.cpp
rename to bh_tree_mpi/simulation/PthreadSimulation.cpp
diff --git a/bh_tree_mpi/PthreadSimulation.hpp b/bh_tree_mpi/simulation/PthreadSimulation.hpp
similarity index 100%
rename from bh_tree_mpi/PthreadSimulation.hpp
rename to bh_tree_mpi/simulation/PthreadSimulation.hpp
diff --git a/bh_tree_mpi/ReadWriteLock.cpp b/bh_tree_mpi/simulation/ReadWriteLock.cpp
similarity index 100%
rename from bh_tree_mpi/ReadWriteLock.cpp
rename to bh_tree_mpi/simulation/ReadWriteLock.cpp
diff --git a/bh_tree_mpi/ReadWriteLock.hpp b/bh_tree_mpi/simulation/ReadWriteLock.hpp
similarity index 100%
rename from bh_tree_mpi/ReadWriteLock.hpp
rename to bh_tree_mpi/simulation/ReadWriteLock.hpp
diff --git a/bh_tree_mpi/Simulation.cpp b/bh_tree_mpi/simulation/Simulation.cpp
similarity index 100%
rename from bh_tree_mpi/Simulation.cpp
rename to bh_tree_mpi/simulation/Simulation.cpp
diff --git a/bh_tree_mpi/Simulation.hpp b/bh_tree_mpi/simulation/Simulation.hpp
similarity index 100%
rename from bh_tree_mpi/Simulation.hpp
rename to bh_tree_mpi/simulation/Simulation.hpp
-- 
GitLab