From f5142ff2ab74282288e719cf1b9c933c07673b19 Mon Sep 17 00:00:00 2001
From: Armin Co <armin.co@hs-bochum.de>
Date: Sun, 26 Apr 2020 13:21:50 +0200
Subject: [PATCH] CMake poking

---
 .gitmodules                    |  6 ++++++
 CMakeLists.txt                 |  3 ++-
 gtk_qpong_app/CMakeLists.txt   |  8 +-------
 imgui_app/CMakeLists.txt       | 10 ++++++++++
 imgui_app/imgui_playground.cpp | 11 +++++++++++
 libs/cpp_starter_project       |  1 +
 libs/imgui                     |  1 +
 qpong_core/CMakeLists.txt      | 10 +++++++++-
 8 files changed, 41 insertions(+), 9 deletions(-)
 create mode 100644 imgui_app/CMakeLists.txt
 create mode 100644 imgui_app/imgui_playground.cpp
 create mode 160000 libs/cpp_starter_project
 create mode 160000 libs/imgui

diff --git a/.gitmodules b/.gitmodules
index 26b7b90..75e2a9f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,9 @@
 [submodule "libs/googletest"]
 	path = libs/googletest
 	url = https://github.com/google/googletest.git
+[submodule "libs/imgui"]
+	path = libs/imgui
+	url = https://github.com/armin-co/imgui.git
+[submodule "libs/cpp_starter_project"]
+	path = libs/cpp_starter_project
+	url = https://github.com/armin-co/cpp_starter_project.git
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f3c5d7..98f9a32 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,8 +23,9 @@ find_package(PkgConfig REQUIRED)
 
 # Add qpong lib for core qpong functionality
 add_subdirectory(qpong_core)
-include_directories(qpong_core)
 
+# Dear ImGui based application
+add_subdirectory(imgui_app)
 
 # Add dir with gtk qpong app
 add_subdirectory(gtk_qpong_app)
diff --git a/gtk_qpong_app/CMakeLists.txt b/gtk_qpong_app/CMakeLists.txt
index bafe30a..3333790 100644
--- a/gtk_qpong_app/CMakeLists.txt
+++ b/gtk_qpong_app/CMakeLists.txt
@@ -13,6 +13,7 @@ link_directories(${GTKMM_LIBRARY_DIRS})
 
 # get all GTKMM dependencies and configuration
 include_directories(${GTKMM_INCLUDE_DIRS})
+include_directories(../qpong_core)
 
 if(APPLE)
     include_directories(/usr/local/include)
@@ -28,16 +29,9 @@ add_executable( qpong.app
 )
 
 
-# we do need some threads
-find_package(Threads)
-
-
 # link all necessary libs to the target
 target_link_libraries( qpong.app 
     qpong_core
-    ${CMAKE_THREAD_LIBS_INIT}
     ${GTKMM_LIBRARIES}
-    fftw3
-    fftw3_omp
     m # math
 )
diff --git a/imgui_app/CMakeLists.txt b/imgui_app/CMakeLists.txt
new file mode 100644
index 0000000..a1015dc
--- /dev/null
+++ b/imgui_app/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Specific settings for macOS
+if(APPLE)
+    link_directories("/usr/local/lib")
+    message("ATTENTION: You probably have to export the PKG_CONFIG_PATH.")
+    message("For example: export PKG_CONFIG_PATH=\"/usr/local/lib:/usr/local/opt/zlib/lib/pkgconfig\"")
+endif()
+
+
+add_executable(imgui_playground.app 
+imgui_playground.cpp)
\ No newline at end of file
diff --git a/imgui_app/imgui_playground.cpp b/imgui_app/imgui_playground.cpp
new file mode 100644
index 0000000..78d3231
--- /dev/null
+++ b/imgui_app/imgui_playground.cpp
@@ -0,0 +1,11 @@
+/// @file   imgui_playground.cppp
+/// @author Armin Co
+/// @brief  Working example for Dear ImGui with OpenGL3 and SDL2
+///
+
+
+int main(void)
+{
+
+    return 0;
+}
\ No newline at end of file
diff --git a/libs/cpp_starter_project b/libs/cpp_starter_project
new file mode 160000
index 0000000..d7a2b6b
--- /dev/null
+++ b/libs/cpp_starter_project
@@ -0,0 +1 @@
+Subproject commit d7a2b6b891d75edc68c9d88dca7e24cd73e378b8
diff --git a/libs/imgui b/libs/imgui
new file mode 160000
index 0000000..ae93691
--- /dev/null
+++ b/libs/imgui
@@ -0,0 +1 @@
+Subproject commit ae93691360ad28e6c217138ead55c874dda26f80
diff --git a/qpong_core/CMakeLists.txt b/qpong_core/CMakeLists.txt
index b6f2974..3e2f2ab 100644
--- a/qpong_core/CMakeLists.txt
+++ b/qpong_core/CMakeLists.txt
@@ -4,4 +4,12 @@ if(APPLE)
 endif()
 
 # Core QPong library
-add_library(qpong_core Particle.cpp ImageBuffer.cpp Player.cpp)
\ No newline at end of file
+add_library(qpong_core Particle.cpp ImageBuffer.cpp Player.cpp)
+
+find_package(Threads)
+
+target_link_libraries( qpong_core
+    ${CMAKE_THREAD_LIBS_INIT}
+    fftw3
+    fftw3_omp
+)
\ No newline at end of file
-- 
GitLab