From f0ba72dc444bd22177d457e3101b0cda9fa2080d Mon Sep 17 00:00:00 2001 From: jmespadero Date: Thu, 19 Dec 2019 23:46:42 +0100 Subject: [PATCH 1/5] Install sample directory --- src/CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 446adaa1b..e4efb6693 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -117,16 +117,19 @@ if(INSTALL_TO_UNIX_LAYOUT) set(MESHLAB_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/meshlab) set(MESHLAB_PLUGIN_INSTALL_DIR ${MESHLAB_LIB_INSTALL_DIR}/plugins) set(MESHLAB_SHADER_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/meshlab/shaders) + set(MESHLAB_SAMPLE_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/meshlab) else() set(MESHLAB_BIN_INSTALL_DIR .) set(MESHLAB_LIB_INSTALL_DIR .) set(MESHLAB_PLUGIN_INSTALL_DIR plugins) set(MESHLAB_SHADER_INSTALL_DIR shaders) + set(MESHLAB_SAMPLE_INSTALL_DIR .) endif() set(MESHLAB_BUILD_DISTRIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/distrib) set(MESHLAB_PLUGIN_OUTPUT_DIR ${MESHLAB_BUILD_DISTRIB_DIR}/plugins) set(MESHLAB_SHADER_OUTPUT_DIR ${MESHLAB_BUILD_DISTRIB_DIR}/shaders) +set(MESHLAB_SAMPLE_OUTPUT_DIR ${MESHLAB_BUILD_DISTRIB_DIR}/sample) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MESHLAB_BUILD_DISTRIB_DIR}) @@ -321,6 +324,20 @@ foreach(FN ${SHADERS}) list(APPEND COPIED_FILES "${OUTFN}") endforeach() +#Copy sample meshes files to distrib directory +if(NOT ${CMAKE_CURRENT_SOURCE_DIR}/distrib EQUAL ${MESHLAB_BUILD_DISTRIB_DIR} ) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/distrib/sample DESTINATION ${MESHLAB_BUILD_DISTRIB_DIR} ) +endif() + +install( + DIRECTORY ${MESHLAB_BUILD_DISTRIB_DIR}/sample + DESTINATION ${MESHLAB_SAMPLE_INSTALL_DIR} + COMPONENT Samples) +file(GLOB_RECURSE SAMPLE + LIST_DIRECTORIES false + ${MESHLAB_BUILD_DISTRIB_DIR}/sample/* ) +list(APPEND COPIED_FILES ${SAMPLE} ) + # Custom target add_custom_target(copy-distrib-files ALL DEPENDS ${COPIED_FILES}) set_property(TARGET copy-distrib-files PROPERTY FOLDER Core) From e6374a4e4522a0d7de58849e55c22a440fdfe62d Mon Sep 17 00:00:00 2001 From: jmespadero Date: Fri, 20 Dec 2019 09:54:52 +0100 Subject: [PATCH 2/5] install options for sample and sample/rangemaps --- src/CMakeLists.txt | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e4efb6693..b772ed854 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -102,6 +102,13 @@ else() set(INSTALL_TO_UNIX_LAYOUT ON) endif() +option(INSTALL_SAMPLE_MESHES + "Should the sample meshes in src/distrib/samples be installed? It will increase the build size in 14 Mb." + ON) +option(INSTALL_SAMPLE_RANGEMAPS + "Should the sample rangemaps in src/distrib/samples/rangemaps be installed? It will increase the build size in 67 Mb." + OFF) + ### Settings needed for both "external" and internal code set(CMAKE_POSITION_INDEPENDENT_CODE ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON) @@ -324,19 +331,27 @@ foreach(FN ${SHADERS}) list(APPEND COPIED_FILES "${OUTFN}") endforeach() -#Copy sample meshes files to distrib directory -if(NOT ${CMAKE_CURRENT_SOURCE_DIR}/distrib EQUAL ${MESHLAB_BUILD_DISTRIB_DIR} ) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/distrib/sample DESTINATION ${MESHLAB_BUILD_DISTRIB_DIR} ) +if(${INSTALL_SAMPLE_MESHES}) + #Copy sample meshes files to distrib directory + if(NOT ${CMAKE_CURRENT_SOURCE_DIR}/distrib EQUAL ${MESHLAB_BUILD_DISTRIB_DIR} ) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/distrib/sample + DESTINATION ${MESHLAB_BUILD_DISTRIB_DIR} + PATTERN "*/rangemaps" EXCLUDE ) + if(${INSTALL_SAMPLE_RANGEMAPS} ) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/distrib/sample/rangemaps DESTINATION ${MESHLAB_SAMPLE_OUTPUT_DIR} ) + endif() + endif() + + #Rules to install sample files from distrib/sample directory + install( + DIRECTORY ${MESHLAB_SAMPLE_OUTPUT_DIR} + DESTINATION ${MESHLAB_SAMPLE_INSTALL_DIR} + COMPONENT Samples) + file(GLOB_RECURSE SAMPLE + LIST_DIRECTORIES false + ${MESHLAB_SAMPLE_OUTPUT_DIR}/* ) + list(APPEND COPIED_FILES ${SAMPLE} ) endif() - -install( - DIRECTORY ${MESHLAB_BUILD_DISTRIB_DIR}/sample - DESTINATION ${MESHLAB_SAMPLE_INSTALL_DIR} - COMPONENT Samples) -file(GLOB_RECURSE SAMPLE - LIST_DIRECTORIES false - ${MESHLAB_BUILD_DISTRIB_DIR}/sample/* ) -list(APPEND COPIED_FILES ${SAMPLE} ) # Custom target add_custom_target(copy-distrib-files ALL DEPENDS ${COPIED_FILES}) From cb4bc1a68db1b595c2c6e1045843212a38c468a6 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 20 Dec 2019 15:22:21 -0600 Subject: [PATCH 3/5] cmake: Clean up sample installs --- src/CMakeLists.txt | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b772ed854..66c1334a0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -306,6 +306,7 @@ endforeach() ### Copy/install other files +# This variable keeps track of the output filenames that need to be copied at build time set(COPIED_FILES) # shaders @@ -331,32 +332,26 @@ foreach(FN ${SHADERS}) list(APPEND COPIED_FILES "${OUTFN}") endforeach() -if(${INSTALL_SAMPLE_MESHES}) - #Copy sample meshes files to distrib directory - if(NOT ${CMAKE_CURRENT_SOURCE_DIR}/distrib EQUAL ${MESHLAB_BUILD_DISTRIB_DIR} ) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/distrib/sample - DESTINATION ${MESHLAB_BUILD_DISTRIB_DIR} - PATTERN "*/rangemaps" EXCLUDE ) - if(${INSTALL_SAMPLE_RANGEMAPS} ) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/distrib/sample/rangemaps DESTINATION ${MESHLAB_SAMPLE_OUTPUT_DIR} ) - endif() - endif() - - #Rules to install sample files from distrib/sample directory - install( - DIRECTORY ${MESHLAB_SAMPLE_OUTPUT_DIR} - DESTINATION ${MESHLAB_SAMPLE_INSTALL_DIR} - COMPONENT Samples) - file(GLOB_RECURSE SAMPLE - LIST_DIRECTORIES false - ${MESHLAB_SAMPLE_OUTPUT_DIR}/* ) - list(APPEND COPIED_FILES ${SAMPLE} ) -endif() - -# Custom target +# Custom target - to trigger the execution of the custom commands above. add_custom_target(copy-distrib-files ALL DEPENDS ${COPIED_FILES}) set_property(TARGET copy-distrib-files PROPERTY FOLDER Core) +if(INSTALL_SAMPLE_MESHES) + # Install sample files from distrib/sample directory (except for the rangemaps) + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/distrib/sample + DESTINATION ${MESHLAB_SAMPLE_INSTALL_DIR} + COMPONENT Samples + PATTERN "*/rangemaps" EXCLUDE) +endif() +if(INSTALL_SAMPLE_RANGEMAPS) + # Install sample rangemaps + install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/distrib/sample/rangemaps + DESTINATION ${MESHLAB_SAMPLE_INSTALL_DIR}/sample + COMPONENT Samples) +endif() + if(NOT WIN32 AND NOT APPLE) install(FILES install/meshlab.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) install(FILES install/meshlab.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor) From de704d1909c3cbacb58ecc53a647ca80d74f538a Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 20 Dec 2019 15:23:30 -0600 Subject: [PATCH 4/5] cmake: Clean up sample installs and disable by default. The readme in that directory says they're for "internal testing use" suggesting they shouldn't be in normal install packages. --- src/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66c1334a0..e7218bf88 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,11 +103,12 @@ else() endif() option(INSTALL_SAMPLE_MESHES - "Should the sample meshes in src/distrib/samples be installed? It will increase the build size in 14 Mb." - ON) -option(INSTALL_SAMPLE_RANGEMAPS - "Should the sample rangemaps in src/distrib/samples/rangemaps be installed? It will increase the build size in 67 Mb." + "Should the sample meshes in src/distrib/samples be installed? It will increase the installed size by 14 MiB." OFF) +option( + INSTALL_SAMPLE_RANGEMAPS + "Should the sample rangemaps in src/distrib/samples/rangemaps be installed? It will increase the installed size by 67 MiB." + OFF) ### Settings needed for both "external" and internal code set(CMAKE_POSITION_INDEPENDENT_CODE ON) From 75cc67228d1e323f980dab161594375c4af6bb80 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 20 Dec 2019 15:23:40 -0600 Subject: [PATCH 5/5] Improve cmake-format config. --- src/.cmake-format.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/.cmake-format.json b/src/.cmake-format.json index 42a8dec41..e2b5ee8dd 100644 --- a/src/.cmake-format.json +++ b/src/.cmake-format.json @@ -12,5 +12,6 @@ "install" ], "first_comment_is_literal": true, - "line_width": 120 + "line_width": 120, + "enable_markup": false }