Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] Fail early when downloading dependencies fails. #1572

Open
shamefulCake1 opened this issue Feb 10, 2025 · 0 comments
Open

[patch] Fail early when downloading dependencies fails. #1572

shamefulCake1 opened this issue Feb 10, 2025 · 0 comments

Comments

@shamefulCake1
Copy link

If the required dependencies are not present, it does not really make sense to try and download the following ones again and again.

It does not make sense for either required dependencies or optional, but for the optional ones it is more dangerous, because it makes the builds unpredictable.

I suggest using the following patch, so that if cmake tries to download something and fails, the failure should report itself early, precluding the need to scroll up to find the error in the log.

This is the patch:

diff --git a/src/external/boost.cmake b/src/external/boost.cmake
index a8c4d93e1..5c26eb49c 100644
--- a/src/external/boost.cmake
+++ b/src/external/boost.cmake
@@ -27,7 +27,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_BOOST)
 			LINK ${BOOST_LINK}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- Boost - download failed.")
+			message(FATAL_ERROR "- Boost - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/cgal.cmake b/src/external/cgal.cmake
index f8c6930d3..51307ed34 100644
--- a/src/external/cgal.cmake
+++ b/src/external/cgal.cmake
@@ -33,7 +33,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_CGAL)
 			MD5 ${CGAL_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- CGAL - download failed.")
+			message(FATAL_ERROR "- CGAL - download failed.")
 			set(CGAL_DOWNLOAD_SUCCESS FALSE)
 		endif()
 	endif()
@@ -50,7 +50,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_CGAL)
 			MD5 ${CGAL_AUX_MD5}
 			DIR ${CGAL_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- CGAL auxiliary libraries - download failed.")
+			message(FATAL_ERROR "- CGAL auxiliary libraries - download failed.")
 			set(CGAL_DOWNLOAD_SUCCESS FALSE)
 		endif()
 	endif()
diff --git a/src/external/e57.cmake b/src/external/e57.cmake
index 44bf91b39..501a3ce1f 100644
--- a/src/external/e57.cmake
+++ b/src/external/e57.cmake
@@ -22,7 +22,7 @@ if (TARGET XercesC::XercesC)
 				LINK ${LIBE57_LINK}
 				DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 			if (NOT download_and_unzip_SUCCESS)
-				message(STATUS "- LibE57 - download failed.")
+				message(FATAL_ERROR "- LibE57 - download failed.")
 			endif()
 		endif()
 
diff --git a/src/external/embree.cmake b/src/external/embree.cmake
index 652bd1902..497bdb0c9 100644
--- a/src/external/embree.cmake
+++ b/src/external/embree.cmake
@@ -32,7 +32,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_DLL_EMBREE AND WIN32)
 			#MD5 ${TBB_WIN_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- TBB - download failed.")
+			message(FATAL_ERROR "- TBB - download failed.")
 		endif()
 	endif()
 
@@ -45,7 +45,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_DLL_EMBREE AND WIN32)
 			#MD5 ${EMBREE_WIN_MD5}
 			DIR ${EMBREE_WIN_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- embree dll - download failed.")
+			message(FATAL_ERROR "- embree dll - download failed.")
 		endif()
 	endif()
 
@@ -92,7 +92,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_EMBREE AND (UNIX AND NOT APPLE) AND TBB_FOU
 			#MD5 ${ISPC_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- embree ispc - download failed.")
+			message(FATAL_ERROR "- embree ispc - download failed.")
 		endif()
 	endif()
 
@@ -106,7 +106,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_EMBREE AND (UNIX AND NOT APPLE) AND TBB_FOU
 			#MD5 ${EMBREE_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- embree - download failed.")
+			message(FATAL_ERROR "- embree - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/levmar.cmake b/src/external/levmar.cmake
index 96d76bfdc..657f221c4 100644
--- a/src/external/levmar.cmake
+++ b/src/external/levmar.cmake
@@ -21,7 +21,7 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LEVMAR)
 			MD5 ${LEVMAR_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- Levmar - download failed.")
+			message(FATAL_ERROR "- Levmar - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/lib3ds.cmake b/src/external/lib3ds.cmake
index ec84d40a6..157fd34a1 100644
--- a/src/external/lib3ds.cmake
+++ b/src/external/lib3ds.cmake
@@ -27,7 +27,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIB3DS)
 			MD5 ${LIB3DS_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- Lib3DS - download failed.")
+			message(FATAL_ERROR "- Lib3DS - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/libigl.cmake b/src/external/libigl.cmake
index 3666f375d..0dfcca07d 100644
--- a/src/external/libigl.cmake
+++ b/src/external/libigl.cmake
@@ -21,7 +21,7 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_LIBIGL)
 			MD5 ${LIBIGL_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- LibIGL - download failed.")
+			message(FATAL_ERROR "- LibIGL - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/muparser.cmake b/src/external/muparser.cmake
index 191f4ad23..c288aefa2 100644
--- a/src/external/muparser.cmake
+++ b/src/external/muparser.cmake
@@ -26,7 +26,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_MUPARSER)
 			MD5 ${MUPARSER_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- muparser - download failed.")
+			message(FATAL_ERROR "- muparser - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/nexus.cmake b/src/external/nexus.cmake
index 117634acc..a2bab63fe 100644
--- a/src/external/nexus.cmake
+++ b/src/external/nexus.cmake
@@ -22,7 +22,7 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_NEXUS)
 			#MD5 ${NEXUS_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- nexus - download failed.")
+			message(FATAL_ERROR "- nexus - download failed.")
 		endif()
 	endif()
 
@@ -38,7 +38,7 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_NEXUS)
 			#MD5 ${CORTO_MD5}
 			DIR "${NEXUS_DIR}/src/")
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- corto - download failed.")
+			message(FATAL_ERROR "- corto - download failed.")
 		else()
 			file(RENAME ${NEXUS_DIR}/src/corto-master ${NEXUS_DIR}/src/corto)
 		endif()
diff --git a/src/external/openctm.cmake b/src/external/openctm.cmake
index c5dda5949..d2efa8e13 100644
--- a/src/external/openctm.cmake
+++ b/src/external/openctm.cmake
@@ -26,7 +26,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_OPENCTM)
 			MD5 ${OPENCTM_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- OpenCTM - download failed.")
+			message(FATAL_ERROR "- OpenCTM - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/qhull.cmake b/src/external/qhull.cmake
index c0cc2940f..b19c3ac73 100644
--- a/src/external/qhull.cmake
+++ b/src/external/qhull.cmake
@@ -26,7 +26,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_QHULL)
 			MD5 ${QHULL_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- Qhull - download failed.")
+			message(FATAL_ERROR "- Qhull - download failed.")
 		else()
 			# remove target uninstall to avoid duplicates
 			# todo - make PR to Qhull to solve this
diff --git a/src/external/ssynth.cmake b/src/external/ssynth.cmake
index 5dea45a0b..35680544c 100644
--- a/src/external/ssynth.cmake
+++ b/src/external/ssynth.cmake
@@ -19,7 +19,7 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_STRUCTURE_SYNTH)
 			MD5 ${SSYNTH_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- Structure Synth - download failed.")
+			message(FATAL_ERROR "- Structure Synth - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/tinygltf.cmake b/src/external/tinygltf.cmake
index 768516f60..9a6c00f3b 100644
--- a/src/external/tinygltf.cmake
+++ b/src/external/tinygltf.cmake
@@ -19,7 +19,7 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_TINYGLTF)
 			MD5 ${TINYGLTF_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- tinygltf - download failed.")
+			message(FATAL_ERROR "- tinygltf - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/u3d.cmake b/src/external/u3d.cmake
index bba000f4c..e352a769c 100644
--- a/src/external/u3d.cmake
+++ b/src/external/u3d.cmake
@@ -19,7 +19,7 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_U3D)
 			MD5 ${U3D_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- u3d - download failed.")
+			message(FATAL_ERROR "- u3d - download failed.")
 		endif()
 	endif()
 
diff --git a/src/external/xerces.cmake b/src/external/xerces.cmake
index e14720a83..46058804d 100644
--- a/src/external/xerces.cmake
+++ b/src/external/xerces.cmake
@@ -28,7 +28,7 @@ elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_XERCES)
 			MD5 ${XERCES_C_MD5}
 			DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
 		if (NOT download_and_unzip_SUCCESS)
-			message(STATUS "- Xerces-C - download failed.")
+			message(FATAL_ERROR "- Xerces-C - download failed.")
 		endif()
 	endif()

Sorry, I can't submit a pull request, because the Github's broken 2fa won't let me have any code uploaded. But the patch should be trivial to apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant