From bef3321c269f3b394dce5e1b0ab2a408736d3364 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 22 Sep 2014 14:41:46 +0200
Subject: [PATCH] Added tetgen 1.5.0 as a submodule.

This module is automatically checked out when OGS_BUILD_GUI=ON and the executable
gets packaged with the Data Explorer.

Tetgen source is hosted at https://github.com/ufz/tetgen.git
---
 .gitmodules                        |  3 +++
 ThirdParty/CMakeLists.txt          | 10 ++++++++++
 ThirdParty/tetgen                  |  1 +
 scripts/cmake/SubmoduleSetup.cmake |  6 +++++-
 4 files changed, 19 insertions(+), 1 deletion(-)
 create mode 160000 ThirdParty/tetgen

diff --git a/.gitmodules b/.gitmodules
index 16e5ec3036b..cc275fed76c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,3 +7,6 @@
 [submodule "ThirdParty/VtkOsgConverter"]
 	path = ThirdParty/VtkOsgConverter
 	url = git://github.com/ufz-vislab/VtkOsgConverter.git
+[submodule "ThirdParty/tetgen"]
+	path = ThirdParty/tetgen
+	url = https://github.com/ufz/tetgen.git
diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt
index 7856812f94c..f1d9f23c1a7 100644
--- a/ThirdParty/CMakeLists.txt
+++ b/ThirdParty/CMakeLists.txt
@@ -33,3 +33,13 @@ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/VtkOsgConverter/CMakeLists.txt
 	AND OGS_USE_OPTIONAL_SUBMODULES)
 	ADD_SUBDIRECTORY(VtkOsgConverter)
 ENDIF()
+
+# tetgen
+IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tetgen/CMakeLists.txt)
+	ADD_SUBDIRECTORY(tetgen)
+	IF(APPLE)
+		INSTALL (PROGRAMS $<TARGET_FILE:tetgen> DESTINATION ogs-gui.app/Contents/MacOS COMPONENT ogs_extras)
+	ELSE()
+		INSTALL (PROGRAMS $<TARGET_FILE:tetgen> DESTINATION bin COMPONENT ogs_extras)
+	ENDIF()
+ENDIF()
diff --git a/ThirdParty/tetgen b/ThirdParty/tetgen
new file mode 160000
index 00000000000..9c4b70d479c
--- /dev/null
+++ b/ThirdParty/tetgen
@@ -0,0 +1 @@
+Subproject commit 9c4b70d479c6f67cb9e16dbe65f81ec3b821acad
diff --git a/scripts/cmake/SubmoduleSetup.cmake b/scripts/cmake/SubmoduleSetup.cmake
index 885a6fd0c1c..115251634e1 100644
--- a/scripts/cmake/SubmoduleSetup.cmake
+++ b/scripts/cmake/SubmoduleSetup.cmake
@@ -9,6 +9,10 @@ SET(REQUIRED_SUBMODULES
 	${OGS_ADDITIONAL_SUBMODULES_TO_CHECKOUT}
 )
 
+IF(OGS_BUILD_GUI)
+	SET(REQUIRED_SUBMODULES ${REQUIRED_SUBMODULES} ThirdParty/tetgen)
+ENDIF()
+
 FOREACH(SUBMODULE ${REQUIRED_SUBMODULES})
 	IF(WIN32)
 		SET(SUBMODULE_STATE 1)
@@ -34,4 +38,4 @@ FOREACH(SUBMODULE ${REQUIRED_SUBMODULES})
 			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 		)
 	ENDIF()
-ENDFOREACH()
\ No newline at end of file
+ENDFOREACH()
-- 
GitLab