From fb2675f6add4ac634e05b1c907a7bebea3004bc0 Mon Sep 17 00:00:00 2001
From: Soeren Peters <peters@irmb.tu-bs.de>
Date: Thu, 13 Aug 2020 15:34:34 +0200
Subject: [PATCH] Added a little bit documentation and formatting.

---
 CMake/VirtualFluidsMacros.cmake          | 45 +++++++++++++++++++++---
 CMakeLists.txt                           |  4 +--
 src/cpu/VirtualFluidsCore/CMakeLists.txt |  4 +--
 3 files changed, 44 insertions(+), 9 deletions(-)

diff --git a/CMake/VirtualFluidsMacros.cmake b/CMake/VirtualFluidsMacros.cmake
index 3d780000e..ae759c265 100644
--- a/CMake/VirtualFluidsMacros.cmake
+++ b/CMake/VirtualFluidsMacros.cmake
@@ -1,5 +1,15 @@
-
-
+#################################################################################
+#   _    ___      __              __________      _     __
+# | |  / (_)____/ /___  ______ _/ / ____/ /_  __(_)___/ /____
+# | | / / / ___/ __/ / / / __ `/ / /_  / / / / / / __  / ___/
+# | |/ / / /  / /_/ /_/ / /_/ / / __/ / / /_/ / / /_/ (__  )
+# |___/_/_/   \__/\__,_/\__,_/_/_/   /_/\__,_/_/\__,_/____/
+#
+#################################################################################
+
+#################################################################################
+## set global project file endings
+#################################################################################
 set (VIRTUAL_FLUIDS_GLOB_FILES
         *.cpp
         *.c
@@ -8,14 +18,31 @@ set (VIRTUAL_FLUIDS_GLOB_FILES
         CACHE INTERNAL "File endings to glob for source files" )
 
 
-
+#################################################################################
+## Sets the library name to the current folder name.
+## output parameter: library_name
+#################################################################################
 function (vf_get_library_name library_name)
     get_filename_component(library_name_out ${CMAKE_CURRENT_SOURCE_DIR} NAME)
     set(${library_name} ${library_name_out} PARENT_SCOPE)
 endfunction(vf_get_library_name)
 
 
-
+#################################################################################
+## Add a target, link the libraries and add the compiler flags to the target
+## The name of the target is vf_get_library_name().
+##
+## parameter:
+## BUILDTYPE - STATIC; SHARED; EXECUTABLE
+## DEPENDS   - libraries to link
+## FILES     - adds these files to the target
+## FOLDER    - adds all files in these folders to the targets
+## EXCLUDE   - excludes these files from the target
+##
+## note: If no files and folders are passed, all files from the level of current
+##       CMakeLists.txt are added recursively.
+##
+#################################################################################
 function(vf_add_library)
     message("Start new Cmake")
 
@@ -179,6 +206,13 @@ function(vf_add_library)
 
 endfunction(vf_add_library)
 
+
+
+#################################################################################
+## Add a test executable corresponding to the added target.
+## Must be called after vf_add_library().
+## The name of the test executable is: vf_get_library_name()Tests
+#################################################################################
 function(vf_add_tests)
     if (NOT BUILD_VF_UNIT_TESTS)
         return()
@@ -188,11 +222,12 @@ function(vf_add_tests)
     set (targetName ${folder_name}Tests)
     message(Add Test binary: ${targetName})
     file ( GLOB_RECURSE all_files ${VIRTUAL_FLUIDS_GLOB_FILES} )
+
     set(sourceFiles ${sourceFiles} ${all_files})
     includeTestFiles (${folder_name} "${sourceFiles}")
 
     message(${MY_SRCS})
-    ADD_EXECUTABLE(${targetName} ${MY_SRCS})
+    add_executable(${targetName} ${MY_SRCS})
 
     target_link_libraries(${targetName} PRIVATE ${folder_name})
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c09bd74e..56002944b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,9 +41,9 @@ add_subdirectory(src/basics)
 #  VIRTUAL FLUIDS CPU / GPU
 #################################################################################
 #if (BUILD_VF_CPU)
-include (cpu.cmake)
+#include (cpu.cmake)
 #endif()
 #if(BUILD_VF_GPU)
-#include (gpu.cmake)
+include (gpu.cmake)
 #endif()
 
diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt
index 415006db7..472b2e5c2 100644
--- a/src/cpu/VirtualFluidsCore/CMakeLists.txt
+++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt
@@ -93,7 +93,7 @@ message("CAB_ADDITIONAL_LINK_LIBRARIES: " ${CAB_ADDITIONAL_LINK_LIBRARIES})
 ###   CREATE PROJECT                                          ###
 #################################################################
 #CREATE_CAB_PROJECT(VirtualFluids STATIC)
-include (${CMAKE_SOURCE_DIR}/CMake/VirtualFluidsMacros.cmake)
+#include (${CMAKE_SOURCE_DIR}/CMake/VirtualFluidsMacros.cmake)
 
 vf_add_library(BUILDTYPE static DEPENDS basics MuParser ${MPI_LIBRARY})
 
@@ -105,6 +105,6 @@ target_include_directories(${library_name} PRIVATE ${CMAKE_SOURCE_DIR}/src/basic
 target_include_directories(${library_name} PRIVATE ${CMAKE_SOURCE_DIR}/src/basics/basics/container)
 target_include_directories(${library_name} PRIVATE ${CMAKE_SOURCE_DIR}/src/basics/basics/memory)
 target_include_directories(${library_name} PRIVATE ${CMAKE_SOURCE_DIR}/src/basics/basics/objects)
-target_include_directories(${library_name} PRIVATE ${CMAKE_SOURCE_DIR}/src/basics/basics/transmiitter)
+target_include_directories(${library_name} PRIVATE ${CMAKE_SOURCE_DIR}/src/basics/basics/transmitter)
 target_include_directories(${library_name} PRIVATE ${CMAKE_SOURCE_DIR}/src/basics/basics/utilities)
 target_include_directories(${library_name} PRIVATE ${CMAKE_SOURCE_DIR}/src/basics/basics/writer)
-- 
GitLab