From 2d5da429eefcd91bf35c5825769ed78fdeecd5bf Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Thu, 23 Jul 2020 09:39:20 +0300
Subject: [PATCH] Reuse precomp headers

---
 applications/gui2/CMakeLists.txt        | 1 +
 components/codecs/CMakeLists.txt        | 2 ++
 components/net/cpp/CMakeLists.txt       | 2 ++
 components/operators/CMakeLists.txt     | 2 ++
 components/renderers/cpp/CMakeLists.txt | 2 ++
 components/rgbd-sources/CMakeLists.txt  | 2 ++
 components/streams/CMakeLists.txt       | 2 ++
 components/structures/CMakeLists.txt    | 3 +++
 8 files changed, 16 insertions(+)

diff --git a/applications/gui2/CMakeLists.txt b/applications/gui2/CMakeLists.txt
index 60032ebeb..7dce75891 100644
--- a/applications/gui2/CMakeLists.txt
+++ b/applications/gui2/CMakeLists.txt
@@ -73,3 +73,4 @@ target_include_directories(ftl-gui2 PUBLIC
 #target_include_directories(cv-node PUBLIC ${PROJECT_SOURCE_DIR}/include)
 target_link_libraries(ftl-gui2 ftlcommon ftldata ftlctrl ftlrgbd ftlstreams ftlrender Threads::Threads ${OpenCV_LIBS} openvr ftlnet nanogui ${NANOGUI_EXTRA_LIBS} ceres)
 
+target_precompile_headers(ftl-gui2 REUSE_FROM ftldata)
diff --git a/components/codecs/CMakeLists.txt b/components/codecs/CMakeLists.txt
index 1891b2a10..25c169219 100644
--- a/components/codecs/CMakeLists.txt
+++ b/components/codecs/CMakeLists.txt
@@ -63,6 +63,8 @@ target_include_directories(ftlcodecs PUBLIC
 #target_include_directories(cv-node PUBLIC ${PROJECT_SOURCE_DIR}/include)
 target_link_libraries(ftlcodecs ftlcommon ${OpenCV_LIBS} ${CUDA_LIBRARIES} Eigen3::Eigen nvcuvid cuda)
 
+target_precompile_headers(ftlcodecs REUSE_FROM ftlcommon)
+
 if (BUILD_TESTS)
 add_subdirectory(test)
 endif()
diff --git a/components/net/cpp/CMakeLists.txt b/components/net/cpp/CMakeLists.txt
index c765fa538..04e89bdfe 100644
--- a/components/net/cpp/CMakeLists.txt
+++ b/components/net/cpp/CMakeLists.txt
@@ -18,6 +18,8 @@ target_include_directories(ftlnet PUBLIC
 	PRIVATE src)
 target_link_libraries(ftlnet ftlctrl ftlcommon Threads::Threads glog::glog ${UUID_LIBRARIES})
 
+target_precompile_headers(ftlnet REUSE_FROM ftlcommon)
+
 install(TARGETS ftlnet EXPORT ftlnet-config
 	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
 	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
diff --git a/components/operators/CMakeLists.txt b/components/operators/CMakeLists.txt
index a00ff8e6f..5eb5cb71c 100644
--- a/components/operators/CMakeLists.txt
+++ b/components/operators/CMakeLists.txt
@@ -57,6 +57,8 @@ target_include_directories(ftloperators PUBLIC
 
 target_link_libraries(ftloperators ftlrender ftlrgbd ftlcommon sgm libstereo Eigen3::Eigen Threads::Threads ${OpenCV_LIBS})
 
+target_precompile_headers(ftloperators REUSE_FROM ftldata)
+
 set_property(TARGET ftloperators PROPERTY CUDA_ARCHITECTURES OFF)
 
 if (BUILD_TESTS)
diff --git a/components/renderers/cpp/CMakeLists.txt b/components/renderers/cpp/CMakeLists.txt
index 905845f57..5b720cf77 100644
--- a/components/renderers/cpp/CMakeLists.txt
+++ b/components/renderers/cpp/CMakeLists.txt
@@ -29,6 +29,8 @@ target_include_directories(ftlrender PUBLIC
 	PRIVATE src)
 target_link_libraries(ftlrender ftlrgbd ftlcommon Eigen3::Eigen Threads::Threads nanogui ${NANOGUI_EXTRA_LIBS} ${OpenCV_LIBS})
 
+target_precompile_headers(ftlrender REUSE_FROM ftldata)
+
 set_property(TARGET ftlrender PROPERTY CUDA_ARCHITECTURES OFF)
 
 #ADD_SUBDIRECTORY(test)
diff --git a/components/rgbd-sources/CMakeLists.txt b/components/rgbd-sources/CMakeLists.txt
index 6c428a23c..5a3db7105 100644
--- a/components/rgbd-sources/CMakeLists.txt
+++ b/components/rgbd-sources/CMakeLists.txt
@@ -38,6 +38,8 @@ endif()
 
 target_link_libraries(ftlrgbd ftlcalibration ftlcommon ${OpenCV_LIBS} ${LIBSGM_LIBRARIES} ${CUDA_LIBRARIES} Eigen3::Eigen realsense ftlnet ${LibArchive_LIBRARIES} ftlcodecs ftloperators ftldata ${X11_X11_LIB} ${X11_Xext_LIB} ${X11_Xtst_LIB} ${X11_XTest_LIB} Pylon)
 
+target_precompile_headers(ftlrgbd REUSE_FROM ftldata)
+
 if (BUILD_TESTS)
 add_subdirectory(test)
 endif()
diff --git a/components/streams/CMakeLists.txt b/components/streams/CMakeLists.txt
index 7bb5dc6ac..cdbf7be84 100644
--- a/components/streams/CMakeLists.txt
+++ b/components/streams/CMakeLists.txt
@@ -34,6 +34,8 @@ target_include_directories(ftlstreams PUBLIC
 #target_include_directories(cv-node PUBLIC ${PROJECT_SOURCE_DIR}/include)
 target_link_libraries(ftlstreams ftlrgbd ftlrender ftlcommon ${OpenCV_LIBS} Eigen3::Eigen ftlnet ftlcodecs ftlaudio openvr)
 
+target_precompile_headers(ftlstreams REUSE_FROM ftldata)
+
 if (BUILD_TESTS)
 add_subdirectory(test)
 endif()
diff --git a/components/structures/CMakeLists.txt b/components/structures/CMakeLists.txt
index f339a3301..29fafd1ac 100644
--- a/components/structures/CMakeLists.txt
+++ b/components/structures/CMakeLists.txt
@@ -7,6 +7,9 @@ target_include_directories(ftldata PUBLIC
 target_link_libraries(ftldata ftlcommon Eigen3::Eigen ftlcodecs)
 
 target_precompile_headers(ftldata
+	PRIVATE include/ftl/utility/msgpack.hpp
+	PRIVATE include/ftl/utility/msgpack_optional.hpp
+	PRIVATE include/ftl/cuda_common.hpp
 	PRIVATE include/ftl/data/new_frame.hpp
 	PRIVATE include/ftl/data/new_frameset.hpp
 )
-- 
GitLab