alvin888 commited on
Commit
e2ebf5f
·
verified ·
1 Parent(s): 481ac56

Upload 1461 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +22 -0
  2. README.md +1 -12
  3. app.py +78 -0
  4. install.sh +3 -0
  5. install_sugar.sh +52 -0
  6. post_process.py +99 -0
  7. requirements.txt +4 -0
  8. run.sh +5 -0
  9. sugar/.DS_Store +0 -0
  10. sugar/LICENSE.md +83 -0
  11. sugar/README.md +436 -0
  12. sugar/__init__.py +0 -0
  13. sugar/__pycache__/__init__.cpython-39.pyc +0 -0
  14. sugar/blender/__init__.py +0 -0
  15. sugar/blender/export_camera_trajectory.py +42 -0
  16. sugar/blender/export_pose_bones.py +62 -0
  17. sugar/blender/export_reference_points.py +58 -0
  18. sugar/blender/export_tpose_bones.py +37 -0
  19. sugar/blender/export_tpose_points.py +58 -0
  20. sugar/configs/__init__.py +0 -0
  21. sugar/configs/metrics/scenes.json +16 -0
  22. sugar/environment.yml +246 -0
  23. sugar/extract_mesh.py +47 -0
  24. sugar/extract_refined_mesh_with_texture.py +46 -0
  25. sugar/gaussian_splatting/.DS_Store +0 -0
  26. sugar/gaussian_splatting/LICENSE.md +83 -0
  27. sugar/gaussian_splatting/SIBR_viewers/.DS_Store +0 -0
  28. sugar/gaussian_splatting/SIBR_viewers/.gitignore +45 -0
  29. sugar/gaussian_splatting/SIBR_viewers/CMakeLists.txt +213 -0
  30. sugar/gaussian_splatting/SIBR_viewers/LICENSE.md +83 -0
  31. sugar/gaussian_splatting/SIBR_viewers/README.md +142 -0
  32. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/MSVCsetUserCommand.cmake +149 -0
  33. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindASSIMP.cmake +114 -0
  34. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindEGL.cmake +161 -0
  35. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindEmbree.cmake +94 -0
  36. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindFFMPEG.cmake +110 -0
  37. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindGLFW.cmake +109 -0
  38. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Win3rdParty.cmake +337 -0
  39. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/cmake_policies.cmake +19 -0
  40. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/dependencies.cmake +324 -0
  41. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/downloadAndExtractZipFile.cmake +243 -0
  42. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/git_describe.cmake +114 -0
  43. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/include_once.cmake +22 -0
  44. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/install_runtime.cmake +887 -0
  45. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/parse_arguments_multi.cmake +304 -0
  46. sugar/gaussian_splatting/SIBR_viewers/cmake/linux/sibr_library.cmake +174 -0
  47. sugar/gaussian_splatting/SIBR_viewers/cmake/windows/MSVCsetUserCommand.cmake +149 -0
  48. sugar/gaussian_splatting/SIBR_viewers/cmake/windows/Modules/FindASSIMP.cmake +104 -0
  49. sugar/gaussian_splatting/SIBR_viewers/cmake/windows/Modules/FindEmbree.cmake +95 -0
  50. sugar/gaussian_splatting/SIBR_viewers/cmake/windows/Modules/FindFFmpeg.cmake +104 -0
.gitattributes CHANGED
@@ -55,3 +55,25 @@ ObjectReconApp/sugar/media/overview/playroom_hybrid.gif filter=lfs diff=lfs merg
55
  ObjectReconApp/sugar/media/overview/playroom_notex.gif filter=lfs diff=lfs merge=lfs -text
56
  ObjectReconApp/sugar/media/overview/qant03_hybrid.gif filter=lfs diff=lfs merge=lfs -text
57
  ObjectReconApp/sugar/media/overview/qant03_notex.gif filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  ObjectReconApp/sugar/media/overview/playroom_notex.gif filter=lfs diff=lfs merge=lfs -text
56
  ObjectReconApp/sugar/media/overview/qant03_hybrid.gif filter=lfs diff=lfs merge=lfs -text
57
  ObjectReconApp/sugar/media/overview/qant03_notex.gif filter=lfs diff=lfs merge=lfs -text
58
+ sugar/gaussian_splatting/SIBR_viewers/docs/img/diagramas/sequence/Renderers/seq_ulr_stream.pdf filter=lfs diff=lfs merge=lfs -text
59
+ sugar/gaussian_splatting/SIBR_viewers/docs/img/multiviewmanager.png filter=lfs diff=lfs merge=lfs -text
60
+ sugar/gaussian_splatting/SIBR_viewers/docs/img/ulr_screenshot.png filter=lfs diff=lfs merge=lfs -text
61
+ sugar/gaussian_splatting/submodules/diff-gaussian-rasterization/third_party/glm/doc/manual.pdf filter=lfs diff=lfs merge=lfs -text
62
+ sugar/media/blender/full_teaser.png filter=lfs diff=lfs merge=lfs -text
63
+ sugar/media/examples/attack.gif filter=lfs diff=lfs merge=lfs -text
64
+ sugar/media/examples/process_0.png filter=lfs diff=lfs merge=lfs -text
65
+ sugar/media/examples/process_1.png filter=lfs diff=lfs merge=lfs -text
66
+ sugar/media/examples/viewer_example.png filter=lfs diff=lfs merge=lfs -text
67
+ sugar/media/examples/walk.gif filter=lfs diff=lfs merge=lfs -text
68
+ sugar/media/overview/counter_hybrid.gif filter=lfs diff=lfs merge=lfs -text
69
+ sugar/media/overview/counter_notex.gif filter=lfs diff=lfs merge=lfs -text
70
+ sugar/media/overview/dukemon_hybrid.gif filter=lfs diff=lfs merge=lfs -text
71
+ sugar/media/overview/dukemon_notex.gif filter=lfs diff=lfs merge=lfs -text
72
+ sugar/media/overview/garden_hybrid.gif filter=lfs diff=lfs merge=lfs -text
73
+ sugar/media/overview/garden_notex.gif filter=lfs diff=lfs merge=lfs -text
74
+ sugar/media/overview/kitchen_hybrid.gif filter=lfs diff=lfs merge=lfs -text
75
+ sugar/media/overview/kitchen_notex.gif filter=lfs diff=lfs merge=lfs -text
76
+ sugar/media/overview/playroom_hybrid.gif filter=lfs diff=lfs merge=lfs -text
77
+ sugar/media/overview/playroom_notex.gif filter=lfs diff=lfs merge=lfs -text
78
+ sugar/media/overview/qant03_hybrid.gif filter=lfs diff=lfs merge=lfs -text
79
+ sugar/media/overview/qant03_notex.gif filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,12 +1 @@
1
- ---
2
- title: 3D Reconstruction Demo
3
- emoji: 📚
4
- colorFrom: red
5
- colorTo: yellow
6
- sdk: gradio
7
- sdk_version: 4.19.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # ObjectReconApp
 
 
 
 
 
 
 
 
 
 
 
app.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch
3
+ import subprocess
4
+ import gradio as gr
5
+ from tqdm import tqdm
6
+ import post_process
7
+ import shutil
8
+ from sugar.gaussian_splatting import convert
9
+ from sugar.gaussian_splatting import train as train_gs
10
+ from sugar import train as train_sugar
11
+
12
+
13
+ def process_images(images):
14
+ print("Preparing directories...")
15
+ # Specify the target folder where you want to copy the images
16
+ target_folder = "data/custom/input/"
17
+
18
+ # Remove and Create the target folder if it doesn't exist
19
+ os.removedirs(target_folder)
20
+ os.makedirs(target_folder, exist_ok=True)
21
+
22
+ # Copy each image to the target folder
23
+ file_paths = []
24
+ for image in tqdm(images):
25
+ image_path = image.name # Get the original image path
26
+ new_path = os.path.join(target_folder, os.path.basename(image_path)) # Construct the new path
27
+ shutil.move(image_path, new_path) # Move the image to the target folder
28
+ file_paths.append(new_path)
29
+
30
+ return file_paths
31
+
32
+
33
+ def get_3d(file_paths):
34
+ # Your 3D model reconstruction logic using the file paths goes here
35
+ # For demonstration, I'll just return the file paths
36
+ print(file_paths)
37
+ file_paths = process_images(file_paths)
38
+ print(file_paths)
39
+
40
+ # 3d reconstruction
41
+ torch.cuda.empty_cache()
42
+
43
+ # subprocess.run(['python', 'sugar/gaussian_splatting/convert.py', '-s', 'data/custom/'])
44
+ convert.main()
45
+ torch.cuda.empty_cache()
46
+
47
+ # subprocess.run(['python', 'sugar/gaussian_splatting/train.py', '-s', 'data/custom/', '--iterations', '7000', '-m', 'output/custom/'])
48
+ train_gs.main()
49
+ torch.cuda.empty_cache()
50
+
51
+ # subprocess.run(['python', 'sugar/train.py', '-c', 'output/custom/', '-r', 'density', '-t', 'True', '--export_ply', 'True'])
52
+ train_sugar.main()
53
+ torch.cuda.empty_cache()
54
+
55
+ out_dir = "output/final_mesh/custom/"
56
+ os.makedirs(out_dir, exist_ok=True)
57
+ post_process.post_process_textured_mesh("output/refined_mesh/custom/sugarfine_3Dgs7000_densityestim02_sdfnorm02_level03_decim1000000_normalconsistency01_gaussperface6.obj", "output/final_mesh/custom/custom.obj", crop=True, remesh=False, repair=True, viz=False, save=True)
58
+ torch.cuda.empty_cache()
59
+
60
+ return f"output/refined_mesh/custom/sugarfine_3Dgs7000_densityestim02_sdfnorm02_level03_decim1000000_normalconsistency01_gaussperface6.obj", f"output/final_mesh/custom/custom.glb"
61
+
62
+
63
+ demo = gr.Interface(
64
+ fn=get_3d, # Function that will be called when the button is clicked
65
+ inputs=gr.Files(file_types=["image", "video"], file_count="multiple"),
66
+ outputs=[
67
+ gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model (Recon.)"),
68
+ gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model (Final)"),
69
+ ],
70
+ title="Alteredverse::3D Model Reconstruction",
71
+ description="Upload a video or set of images to reconstruct a 3D model.",
72
+ )
73
+
74
+
75
+ if __name__ == "__main__":
76
+ demo.queue()
77
+ # demo.launch(share=True)
78
+ demo.launch()
install.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ sh install_sugar.sh
2
+ conda activate sugar
3
+ pip install -r requirements.txt
install_sugar.sh ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #conda env create -f environment.yml
2
+ #conda activate sugar
3
+
4
+ ### sugar installation
5
+ conda create --name sugar -y python=3.9
6
+ conda activate sugar
7
+ conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia
8
+ conda install -c fvcore -c iopath -c conda-forge fvcore iopath
9
+ conda install pytorch3d==0.7.4 -c pytorch3d
10
+ conda install -c plotly plotly
11
+ conda install -c conda-forge rich
12
+ conda install -c conda-forge plyfile==0.8.1
13
+ conda install -c conda-forge jupyterlab
14
+ conda install -c conda-forge nodejs
15
+ conda install -c conda-forge ipywidgets
16
+ pip install open3d
17
+ pip install --upgrade PyMCubes
18
+ conda install -c conda-forge colmap -y
19
+ conda install -c conda-forge ffmpeg -y
20
+
21
+ cd sugar/gaussian_splatting/submodules/diff-gaussian-rasterization/ || exit
22
+ pip install -e .
23
+ cd ../simple-knn/ || exit
24
+ pip install -e .
25
+ cd ../../../../
26
+
27
+ curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash -
28
+ sudo apt-get install -y nodejs
29
+ sudo apt-get install -y aptitude
30
+ sudo aptitude install -y npm
31
+ cd sugar_viewer || exit
32
+ npm install
33
+ cd ../
34
+
35
+
36
+ # apt install openssh-server
37
+
38
+ # background remover tools
39
+ pip install rembg[gpu,cli]
40
+ pip install --upgrade pip
41
+ pip install backgroundremover
42
+ pip install carvekit --extra-index-url https://download.pytorch.org/whl/cu117
43
+
44
+
45
+ # mip_sugar
46
+ #pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
47
+ #
48
+ #cd mip_splatting/submodules/diff-gaussian-rasterization/ || exit
49
+ #pip install -e .
50
+ #cd ../simple-knn/ || exit
51
+ #pip install -e .
52
+ #cd ../../../
post_process.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import trimesh
3
+ import numpy as np
4
+
5
+
6
+ def crop_mesh(mesh, desired_bounding_box_length=15, viz=False):
7
+ print("Cropping mesh...")
8
+ mesh_bounds = mesh.bounding_box.bounds
9
+ center = (mesh_bounds[0] + mesh_bounds[1]) / 2
10
+ bbox_half_size = desired_bounding_box_length / 2
11
+
12
+ cropped_mesh = mesh
13
+ for axis in [(1, 0, 0), (0, 1, 0), (0, 0, 1)]: # Iterate through X, Y, Z axes
14
+ plane_origin = center + bbox_half_size * np.array(axis) # Convert axis to NumPy array for multiplication
15
+ plane_normal = - np.array(axis) # Negate the NumPy array version of axis
16
+ cropped_mesh = cropped_mesh.slice_plane(plane_origin, plane_normal)
17
+
18
+ if viz:
19
+ print("Visualizing cropped mesh...")
20
+ cropped_mesh.show()
21
+
22
+ return cropped_mesh
23
+
24
+
25
+ def remesh_mesh(mesh, viz=False):
26
+ print("Remeshing...")
27
+ # Concat the uv with the vertices and subdivide
28
+ vertices, faces = trimesh.remesh.subdivide(
29
+ vertices=np.hstack((mesh.vertices, mesh.visual.uv.copy())),
30
+ faces=mesh.faces
31
+ )
32
+
33
+ mesh.vertices = vertices[:, :3]
34
+ mesh.faces = faces
35
+ mesh.visual.uv = vertices[:, 3:]
36
+
37
+ if viz:
38
+ print("Visualizing remeshed mesh...")
39
+ mesh.show()
40
+
41
+ return mesh
42
+
43
+
44
+ def repair_mesh(mesh, viz=False):
45
+ print("Repairing...")
46
+ # Access repair functions from the 'repair' module:
47
+ trimesh.repair.fix_winding(mesh) # Ensure consistent winding order first
48
+ trimesh.repair.fix_normals(mesh) # Recalculate normals based on winding
49
+ trimesh.repair.fix_inversion(mesh) # Fix inverted faces
50
+ trimesh.repair.fill_holes(mesh) # Fill holes after fixing topology
51
+ trimesh.repair.broken_faces(mesh) # Handle broken faces after filling holes
52
+ # trimesh.repair.stitch(mesh) # Stitch disconnected components (optional)
53
+
54
+ if viz:
55
+ mesh.show()
56
+
57
+ return mesh
58
+
59
+
60
+ def post_process_textured_mesh(mesh_path, out_path, crop=False, remesh=False, repair=True, viz=False, save=True):
61
+ print("Loading mesh...")
62
+ mesh = trimesh.load(mesh_path)
63
+
64
+ if viz:
65
+ mesh.show()
66
+
67
+ # crop mesh
68
+ if crop:
69
+ mesh = crop_mesh(mesh)
70
+
71
+ # remesh and repair and remesh
72
+ if remesh:
73
+ mesh = remesh_mesh(mesh)
74
+
75
+ if repair:
76
+ mesh = repair_mesh(mesh)
77
+
78
+ # visualize
79
+ if viz:
80
+ print("Visualizing processed mesh...")
81
+ mesh.show()
82
+
83
+ # save the cropped mesh and texture
84
+ if save:
85
+ print("Saving mesh...")
86
+ mesh.export(out_path)
87
+
88
+ print("Finished!")
89
+
90
+
91
+ if __name__ == "__main__":
92
+ mesh_dir = "output/refined_mesh/custom/"
93
+ input_mesh_path = os.path.join(mesh_dir, "sugarfine_3Dgs7000_densityestim02_sdfnorm02_level03_decim1000000_normalconsistency01_gaussperface6.obj")
94
+
95
+ out_dir = "output/final_mesh/custom/"
96
+ os.makedirs(out_dir, exist_ok=True)
97
+ output_mesh_path = os.path.join(out_dir, 'custom.glb')
98
+
99
+ post_process_textured_mesh(input_mesh_path, output_mesh_path, crop=False, remesh=False, repair=True, viz=False, save=True)
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ tqdm
3
+ trimesh
4
+ shapely
run.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ python sugar/gaussian_splatting/convert.py -s data/custom/
2
+ python sugar/gaussian_splatting/train.py -s data/custom/ --iterations 7000 -m output/custom/
3
+ python sugar/train.py -s data/custom/ -c output/custom/ -r density -t True --export_ply True
4
+
5
+ python post_process.py
sugar/.DS_Store ADDED
Binary file (10.2 kB). View file
 
sugar/LICENSE.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Gaussian-Splatting License
2
+ ===========================
3
+
4
+ **Inria** and **the Max Planck Institut for Informatik (MPII)** hold all the ownership rights on the *Software* named **gaussian-splatting**.
5
+ The *Software* is in the process of being registered with the Agence pour la Protection des
6
+ Programmes (APP).
7
+
8
+ The *Software* is still being developed by the *Licensor*.
9
+
10
+ *Licensor*'s goal is to allow the research community to use, test and evaluate
11
+ the *Software*.
12
+
13
+ ## 1. Definitions
14
+
15
+ *Licensee* means any person or entity that uses the *Software* and distributes
16
+ its *Work*.
17
+
18
+ *Licensor* means the owners of the *Software*, i.e Inria and MPII
19
+
20
+ *Software* means the original work of authorship made available under this
21
+ License ie gaussian-splatting.
22
+
23
+ *Work* means the *Software* and any additions to or derivative works of the
24
+ *Software* that are made available under this License.
25
+
26
+
27
+ ## 2. Purpose
28
+ This license is intended to define the rights granted to the *Licensee* by
29
+ Licensors under the *Software*.
30
+
31
+ ## 3. Rights granted
32
+
33
+ For the above reasons Licensors have decided to distribute the *Software*.
34
+ Licensors grant non-exclusive rights to use the *Software* for research purposes
35
+ to research users (both academic and industrial), free of charge, without right
36
+ to sublicense.. The *Software* may be used "non-commercially", i.e., for research
37
+ and/or evaluation purposes only.
38
+
39
+ Subject to the terms and conditions of this License, you are granted a
40
+ non-exclusive, royalty-free, license to reproduce, prepare derivative works of,
41
+ publicly display, publicly perform and distribute its *Work* and any resulting
42
+ derivative works in any form.
43
+
44
+ ## 4. Limitations
45
+
46
+ **4.1 Redistribution.** You may reproduce or distribute the *Work* only if (a) you do
47
+ so under this License, (b) you include a complete copy of this License with
48
+ your distribution, and (c) you retain without modification any copyright,
49
+ patent, trademark, or attribution notices that are present in the *Work*.
50
+
51
+ **4.2 Derivative Works.** You may specify that additional or different terms apply
52
+ to the use, reproduction, and distribution of your derivative works of the *Work*
53
+ ("Your Terms") only if (a) Your Terms provide that the use limitation in
54
+ Section 2 applies to your derivative works, and (b) you identify the specific
55
+ derivative works that are subject to Your Terms. Notwithstanding Your Terms,
56
+ this License (including the redistribution requirements in Section 3.1) will
57
+ continue to apply to the *Work* itself.
58
+
59
+ **4.3** Any other use without of prior consent of Licensors is prohibited. Research
60
+ users explicitly acknowledge having received from Licensors all information
61
+ allowing to appreciate the adequacy between of the *Software* and their needs and
62
+ to undertake all necessary precautions for its execution and use.
63
+
64
+ **4.4** The *Software* is provided both as a compiled library file and as source
65
+ code. In case of using the *Software* for a publication or other results obtained
66
+ through the use of the *Software*, users are strongly encouraged to cite the
67
+ corresponding publications as explained in the documentation of the *Software*.
68
+
69
+ ## 5. Disclaimer
70
+
71
+ THE USER CANNOT USE, EXPLOIT OR DISTRIBUTE THE *SOFTWARE* FOR COMMERCIAL PURPOSES
72
+ WITHOUT PRIOR AND EXPLICIT CONSENT OF LICENSORS. YOU MUST CONTACT INRIA FOR ANY
73
+ UNAUTHORIZED USE: [email protected] . ANY SUCH ACTION WILL
74
+ CONSTITUTE A FORGERY. THIS *SOFTWARE* IS PROVIDED "AS IS" WITHOUT ANY WARRANTIES
75
+ OF ANY NATURE AND ANY EXPRESS OR IMPLIED WARRANTIES, WITH REGARDS TO COMMERCIAL
76
+ USE, PROFESSIONNAL USE, LEGAL OR NOT, OR OTHER, OR COMMERCIALISATION OR
77
+ ADAPTATION. UNLESS EXPLICITLY PROVIDED BY LAW, IN NO EVENT, SHALL INRIA OR THE
78
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
79
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
80
+ GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
81
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING FROM, OUT OF OR
83
+ IN CONNECTION WITH THE *SOFTWARE* OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE*.
sugar/README.md ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+
3
+ # SuGaR: Surface-Aligned Gaussian Splatting for Efficient 3D Mesh Reconstruction and High-Quality Mesh Rendering
4
+
5
+ <font size="4">
6
+ <a href="https://anttwo.github.io/" style="font-size:100%;">Antoine Guédon</a>&emsp;
7
+ <a href="https://vincentlepetit.github.io/" style="font-size:100%;">Vincent Lepetit</a>&emsp;
8
+ </font>
9
+ <br>
10
+
11
+ <font size="4">
12
+ LIGM, Ecole des Ponts, Univ Gustave Eiffel, CNRS
13
+ </font>
14
+
15
+ | <a href="https://anttwo.github.io/sugar/">Webpage</a> | <a href="https://arxiv.org/abs/2311.12775">arXiv</a> | <a href="https://www.youtube.com/watch?v=MAkFyWfiBQo">Presentation video</a> | <a href="https://www.youtube.com/watch?v=YbjE0wnw67I">Viewer video</a> |
16
+
17
+ <img src="./media/examples/walk.gif" alt="walk.gif" width="350"/><img src="./media/examples/attack.gif" alt="attack.gif" width="350"/> <br>
18
+ <b>Our method extracts meshes from 3D Gaussian Splatting reconstructions and builds hybrid representations <br>that enable easy composition and animation in Gaussian Splatting scenes by manipulating the mesh.</b>
19
+ </div>
20
+
21
+ ## Abstract
22
+
23
+ _We propose a method to allow precise and extremely fast mesh extraction from <a href="https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/">3D Gaussian Splatting (SIGGRAPH 2023)</a>.
24
+ Gaussian Splatting has recently become very popular as it yields realistic rendering while being significantly faster to train than NeRFs. It is however challenging to extract a mesh from the millions of tiny 3D Gaussians as these Gaussians tend to be unorganized after optimization and no method has been proposed so far.
25
+ Our first key contribution is a regularization term that encourages the 3D Gaussians to align well with the surface of the scene.
26
+ We then introduce a method that exploits this alignment to sample points on the real surface of the scene and extract a mesh from the Gaussians using Poisson reconstruction, which is fast, scalable, and preserves details, in contrast to the Marching Cubes algorithm usually applied to extract meshes from Neural SDFs.
27
+ Finally, we introduce an optional refinement strategy that binds Gaussians to the surface of the mesh, and jointly optimizes these Gaussians and the mesh through Gaussian splatting rendering. This enables easy editing, sculpting, rigging, animating, or relighting of the Gaussians using traditional softwares (Blender, Unity, Unreal Engine, etc.) by manipulating the mesh instead of the Gaussians themselves.
28
+ Retrieving such an editable mesh for realistic rendering is done within minutes with our method, compared to hours with the state-of-the-art method on neural SDFs, while providing a better rendering quality in terms of PSNR, SSIM and LPIPS._
29
+
30
+ <div align="center">
31
+ <b>Hybrid representation (Mesh + Gaussians on the surface)</b><br>
32
+ <img src="./media/overview/garden_hybrid.gif" alt="garden_hybrid.gif" width="250"/>
33
+ <img src="./media/overview/kitchen_hybrid.gif" alt="kitchen_hybrid.gif" width="250"/>
34
+ <img src="./media/overview/counter_hybrid.gif" alt="counter_hybrid.gif" width="250"/><br>
35
+ <img src="./media/overview/playroom_hybrid.gif" alt="playroom_hybrid.gif" width="323"/>
36
+ <img src="./media/overview/qant03_hybrid.gif" alt="qant03_hybrid.gif" width="323"/>
37
+ <img src="./media/overview/dukemon_hybrid.gif" alt="_hybrid.gif" width="102"/><br>
38
+ <b>Underlying mesh without texture</b><br>
39
+ <img src="./media/overview/garden_notex.gif" alt="garden_notex.gif" width="250"/>
40
+ <img src="./media/overview/kitchen_notex.gif" alt="kitchen_notex.gif" width="250"/>
41
+ <img src="./media/overview/counter_notex.gif" alt="counter_notex.gif" width="250"/><br>
42
+ <img src="./media/overview/playroom_notex.gif" alt="playroom_notex.gif" width="323"/>
43
+ <img src="./media/overview/qant03_notex.gif" alt="qant03_notex.gif" width="323"/>
44
+ <img src="./media/overview/dukemon_notex.gif" alt="dukemon_notex.gif" width="102"/><br>
45
+ </div>
46
+
47
+
48
+ ## BibTeX
49
+
50
+ ```
51
+ @article{guedon2023sugar,
52
+ title={SuGaR: Surface-Aligned Gaussian Splatting for Efficient 3D Mesh Reconstruction and High-Quality Mesh Rendering},
53
+ author={Gu{\'e}don, Antoine and Lepetit, Vincent},
54
+ journal={arXiv preprint arXiv:2311.12775},
55
+ year={2023}
56
+ }
57
+ ```
58
+
59
+ ## Updates and To-do list
60
+
61
+ <details>
62
+ <summary><span style="font-weight: bold;">Updates</span></summary>
63
+ <ul>
64
+ <li><b>[01/09/2024]</b> Added a dedicated, real-time viewer to let users visualize and navigate in the reconstructed scenes (hybrid representation, textured mesh and wireframe mesh).</li>
65
+ <li><b>[12/20/2023]</b> Added a short notebook showing how to render images with the hybrid representation using the Gaussian Splatting rasterizer.</li>
66
+ <li><b>[12/18/2023]</b> Code release.</li>
67
+ </ul>
68
+ </details><br>
69
+
70
+ <details>
71
+ <summary><span style="font-weight: bold;">To-do list</span></summary>
72
+ <ul>
73
+ <li><b>Improvement:</b> Add an <code>if</code> block to <code>sugar_extractors/coarse_mesh.py</code> to skip foreground mesh reconstruction and avoid triggering an error if no surface point is detected inside the foreground bounding box. This can be useful for users that want to reconstruct "<i>background scenes</i>". </li>
74
+ <li><b>Using precomputed masks with SuGaR:</b> Add a mask functionality to the SuGaR optimization, to allow the user to mask out some pixels in the training images (like white backgrounds in synthetic datasets).
75
+ </li>
76
+ <li><b>Using SuGaR with Windows:</b> Adapt the code to make it compatible with Windows. Due to path-writing conventions, the current code is not compatible with Windows.
77
+ </li>
78
+ <li><b>Synthetic datasets:</b> Add the possibility to use the NeRF synthetic dataset (which has a different format than COLMAP scenes)
79
+ </li>
80
+ <li><b>Composition and animation:</b> Finish to clean the code for composition and animation, and add it to the <code>sugar_scene/sugar_compositor.py</code> script.
81
+ </li>
82
+ <li><b>Composition and animation:</b> Make a tutorial on how to use the scripts in the <code>blender</code> directory and the <code>sugar_scene/sugar_compositor.py</code> class to import composition and animation data into PyTorch and apply it to the SuGaR hybrid representation.
83
+ </li>
84
+ <!-- <li><b>Improvement:</b> Implement a simple method to avoid artifacts when reconstructing thin objects with poor coverage/visibility in the training images.</li>
85
+ </li> -->
86
+ </ul>
87
+ </details>
88
+
89
+ ## Overview
90
+
91
+ As we explain in the paper, SuGaR optimization starts with first optimizing a 3D Gaussian Splatting model for 7k iterations with no additional regularization term.
92
+ In this sense, SuGaR is a method that can be applied on top of any 3D Gaussian Splatting model, and a Gaussian Splatting model optimized for 7k iterations must be provided to SuGaR.
93
+
94
+ Consequently, the current implementation contains a version of the original <a href="https://github.com/graphdeco-inria/gaussian-splatting">3D Gaussian Splatting code</a>, and we built our model as a wrapper of a vanilla 3D Gaussian Splatting model.
95
+ Please note that, even though this wrapper implementation is convenient for many reasons, it may not be the most optimal one for memory usage, so we might change it in the future.
96
+
97
+ After optimizing a vanilla Gaussian Splatting model, the SuGaR pipeline consists of 3 main steps, and an optional one:
98
+ 1. **SuGaR optimization**: optimizing Gaussians alignment with the surface of the scene
99
+ 2. **Mesh extraction**: extracting a mesh from the optimized Gaussians
100
+ 3. **SuGaR refinement**: refining the Gaussians and the mesh together to build a hybrid representation
101
+ 4. **Textured mesh extraction (Optional)**: extracting a traditional textured mesh from the refined SuGaR model
102
+
103
+ <div align="center"><br>
104
+ <img src="./media/examples/process_0.png" alt="process_0.png" width="750"/><br>
105
+ <img src="./media/examples/process_1.png" alt="process_.png" width="750"/><br>
106
+ </div><br>
107
+
108
+ We provide a dedicated script for each of these steps, as well as a script `train.py` that runs the entire pipeline. We explain how to use this script in the next sections. <br>
109
+
110
+ Please note that the final step, _Textured mesh extraction_, is optional but is enabled by default in the `train.py` script. Indeed, it is very convenient to have a traditional textured mesh for visualization, composition and animation using traditional softwares such as Blender. However, this step is not needed to produce, modify or animate hybrid representations.
111
+
112
+ <div align="center">
113
+ <b>Hybrid representation (Mesh + Gaussians on the surface)</b><br>
114
+ <img src="./media/overview/garden_hybrid.png" alt="garden_hybrid.gif" height="135"/>
115
+ <img src="./media/overview/kitchen_hybrid.png" alt="kitchen_hybrid.gif" height="135"/>
116
+ <img src="./media/overview/qant03_hybrid.png" alt="qant03_hybrid.gif" height="135"/>
117
+ <img src="./media/overview/dukemon_hybrid.png" alt="_hybrid.gif" height="135"/><br>
118
+ <b>Underlying mesh with a traditional colored UV texture</b><br>
119
+ <img src="./media/overview/garden_texture.png" alt="garden_notex.gif" height="135"/>
120
+ <img src="./media/overview/kitchen_texture.png" alt="kitchen_notex.gif" height="135"/>
121
+ <img src="./media/overview/qant03_texture.png" alt="qant03_notex.gif" height="135"/>
122
+ <img src="./media/overview/dukemon_texture.png" alt="dukemon_notex.gif" height="135"/><br>
123
+ </div><br>
124
+
125
+ Below is another example of a scene showing a robot with a black and specular material. The following images display the hybrid representation (Mesh + Gaussians on the surface), the mesh with a traditional colored UV texture, and a depth map of the mesh:
126
+ <div align="center">
127
+ <b>Hybrid representation - Textured mesh - Depth map of the mesh</b><br>
128
+ <img src="./media/examples/alpha_hybrid.png" alt="alpha_hybrid.png" height="400"/>
129
+ <img src="./media/examples/alpha_texture.png" alt="alpha_texture.gif" height="400"/>
130
+ <img src="./media/examples/alpha_depth.png" alt="alpha_depth.gif" height="400"/>
131
+ </div>
132
+
133
+ ## Installation
134
+
135
+ ### 0. Requirements
136
+
137
+ The software requirements are the following:
138
+ - Conda (recommended for easy setup)
139
+ - C++ Compiler for PyTorch extensions
140
+ - CUDA toolkit 11.8 for PyTorch extensions
141
+ - C++ Compiler and CUDA SDK must be compatible
142
+
143
+ Please refer to the original <a href="https://github.com/graphdeco-inria/gaussian-splatting">3D Gaussian Splatting repository</a> for more details about requirements.
144
+
145
+ ### 1. Clone the repository
146
+
147
+ Start by cloning this repository:
148
+
149
+ ```shell
150
+ # HTTPS
151
+ git clone https://github.com/Anttwo/SuGaR.git --recursive
152
+ ```
153
+
154
+ or
155
+
156
+ ```shell
157
+ # SSH
158
+ git clone [email protected]:Anttwo/SuGaR.git --recursive
159
+ ```
160
+
161
+ ### 2. Install the required Python packages
162
+ To install the required Python packages and activate the environment, go inside the `SuGaR/` directory and run the following commands:
163
+
164
+ ```shell
165
+ conda env create -f environment.yml
166
+ conda activate sugar
167
+ ```
168
+
169
+ <details>
170
+ <summary><span style="font-weight: bold;">If this command fails to create a working environment</span></summary>
171
+
172
+ Then you can try to install the required packages manually by running the following commands:
173
+ ```shell
174
+ conda create --name sugar -y python=3.9
175
+ conda activate sugar
176
+ conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia
177
+ conda install -c fvcore -c iopath -c conda-forge fvcore iopath
178
+ conda install pytorch3d==0.7.4 -c pytorch3d
179
+ conda install -c plotly plotly
180
+ conda install -c conda-forge rich
181
+ conda install -c conda-forge plyfile==0.8.1
182
+ conda install -c conda-forge jupyterlab
183
+ conda install -c conda-forge nodejs
184
+ conda install -c conda-forge ipywidgets
185
+ pip install open3d
186
+ pip install --upgrade PyMCubes
187
+ ```
188
+ </details>
189
+
190
+ ### 3. Install the Gaussian Splatting rasterizer
191
+
192
+ Run the following commands inside the sugar directory to install the additional Python submodules required for Gaussian Splatting:
193
+
194
+ ```shell
195
+ cd gaussian_splatting/submodules/diff-gaussian-rasterization/
196
+ pip install -e .
197
+ cd ../simple-knn/
198
+ pip install -e .
199
+ cd ../../../
200
+ ```
201
+ Please refer to the <a href="https://github.com/graphdeco-inria/gaussian-splatting">3D Gaussian Splatting repository</a> for more details.
202
+
203
+
204
+ ## Quick Start
205
+
206
+ Start by optimizing a vanilla Gaussian Splatting model for 7k iterations by running the script `gaussian_splatting/train.py`, as shown below. Please refer to the original <a href="https://github.com/graphdeco-inria/gaussian-splatting">3D Gaussian Splatting repository</a> for more details. This optimization should be very fast, and last only a few minutes.
207
+
208
+ ```shell
209
+ python gaussian_splatting/train.py -s <path to COLMAP dataset> --iterations 7000 -m <path to the desired output directory>
210
+ ```
211
+
212
+ Then, run the script `train.py` in the root directory to optimize a SuGaR model.
213
+
214
+ ```shell
215
+ python train.py -s <path to COLMAP dataset> -c <path to the Gaussian Splatting checkpoint> -r <"density" or "sdf">
216
+ ```
217
+
218
+ The most important arguments for the `train.py` script are the following:
219
+ | Parameter | Type | Description |
220
+ | :-------: | :--: | :---------: |
221
+ | `--scene_path` / `-s` | `str` | Path to the source directory containing a COLMAP dataset.|
222
+ | `--checkpoint_path` / `-c` | `str` | Path to the checkpoint directory of the vanilla 3D Gaussian Splatting model. |
223
+ | `--regularization_type` / `-r` | `str` | Type of regularization to use for optimizing SuGaR. Can be `"density"` or `"sdf"`. For reconstructing detailed objects centered in the scene with 360° coverage, `"density"` provides a better foreground mesh. For a stronger regularization and a better balance between foreground and background, choose `"sdf"`. |
224
+ | `--eval` | `bool` | If True, performs an evaluation split of the training images. Default is `True`. |
225
+ | `--low_poly` | `bool` | If True, uses the standard config for a low poly mesh, with `200_000` vertices and `6` Gaussians per triangle. |
226
+ | `--high_poly` | `bool` | If True, uses the standard config for a high poly mesh, with `1_000_000` vertices and `1` Gaussian per triangle. |
227
+ | `--refinement_time` | `str` | Default configs for time to spend on refinement. Can be `"short"` (2k iterations), `"medium"` (7k iterations) or `"long"` (15k iterations). |
228
+ | `--export_uv_textured_mesh` / `-t` | `bool` | If True, will optimize and export a traditional textured mesh as an `.obj` file from the refined SuGaR model, after refinement. Computing a traditional color UV texture should take less than 10 minutes. Default is `True`. |
229
+ | `--export_ply` | `bool` | If True, export a `.ply` file with the refined 3D Gaussians at the end of the training. This file can be large (+/- 500MB), but is needed for using the dedicated viewer. Default is `True`. |
230
+
231
+ We provide more details about the two regularization methods `"density"` and `"sdf"` in the next section. For reconstructing detailed objects centered in the scene with 360° coverage, `"density"` provides a better foreground mesh. For a stronger regularization and a better balance between foreground and background, choose `"sdf"`. <br>
232
+ The default configuration is `high_poly` with `refinement_time` set to `"long"`. Results are saved in the `output/` directory.<br>
233
+
234
+ As we explain in the paper, this script extracts a mesh in 30~35 minutes on average on a single GPU. After mesh extraction, the refinement time only takes a few minutes when using `--refinement_time "short"`, but can take up to an hour when using `--refinement_time "long"`. A short refinement time is enough to produce a good-looking hybrid representation in most cases.
235
+
236
+ Please note that the optimization time may vary (from 20 to 45 minutes) depending on the complexity of the scene and the GPU used. Moreover, the current implementation splits the optimization into 3 scripts that can be run separately (SuGaR optimization, mesh extraction, model refinement) so it reloads the data at each part, which is not optimal and takes several minutes. We will update the code in a near future to optimize this.
237
+
238
+ Below is a detailed list of all the command line arguments for the `train.py` script.
239
+ <details>
240
+ <summary><span style="font-weight: bold;">All command line arguments for train.py</span></summary>
241
+
242
+ #### Data and initial 3D Gaussian Splatting optimization
243
+
244
+ | Parameter | Type | Description |
245
+ | :-------: | :--: | :---------: |
246
+ | `--scene_path` / `-s` | `str` | Path to the source directory containing a COLMAP data set.|
247
+ | `--checkpoint_path` / `-c` | `str` | Path to the checkpoint directory of the vanilla 3D Gaussian Splatting model. |
248
+ | `--iteration_to_load` / `-i` | `int` | Iteration to load from the 3DGS checkpoint directory. If not specified, loads the iteration `7000`. |
249
+ | `--eval` | `bool` | If True, performs an evaluation split of the training images. Default is `True`. |
250
+
251
+ #### SuGaR optimization
252
+ | Parameter | Type | Description |
253
+ | :-------: | :--: | :---------: |
254
+ | `--regularization_type` / `-r` | `str` | Type of regularization to use for optimizing SuGaR. Can be `"density"` or `"sdf"`. |
255
+ | `--gpu` | `int` | Index of GPU device to use. Default is `0`. |
256
+
257
+ #### Mesh extraction
258
+
259
+ | Parameter | Type | Description |
260
+ | :-------: | :--: | :---------: |
261
+ | `--surface_level` / `-l` |`int`| Surface level to extract the mesh at. Default is `0.3`. |
262
+ | `--n_vertices_in_mesh` / `-v` | `int` | Number of vertices in the extracted mesh. Default is `1_000_000`. |
263
+ | `--bboxmin` / `-b` | `str` | Min coordinates to use for foreground bounding box, formatted as a string `"(x,y,z)"`.|
264
+ | `--bboxmax` / `-B` | `str` | Max coordinates to use for foreground bounding box, formatted as a string `"(x,y,z)"`. |
265
+ | `--center_bbox` | `bool` | If True, centers the bbox. Default is True. |
266
+
267
+ #### SuGaR and mesh refinement (Hybrid representation)
268
+
269
+ | Parameter | Type | Description |
270
+ | :-------: | :--: | :---------: |
271
+ | `--gaussians_per_triangle` / `-g` | `int` | Number of gaussians per triangle. Default is `1`. |
272
+ | `--refinement_iterations` / `-f` | `int` | Number of refinement iterations. Default is `15_000`. |
273
+
274
+ #### (Optional) Parameters for traditional textured mesh extraction
275
+
276
+ | Parameter | Type | Description |
277
+ | :-------: | :--: | :---------: |
278
+ | `--export_uv_textured_mesh` / `-t` | `bool` | If True, will optimize and export a textured mesh as an .obj file from the refined SuGaR model. Computing a traditional colored UV texture should take less than 10 minutes. Default is `True`. |
279
+ | `--square_size` | `int` | Size of the square to use for the UV texture. Default is `10`. |
280
+ | `--postprocess_mesh` | `bool` | If True, postprocess the mesh by removing border triangles with low-density. This step takes a few minutes and is not needed in general, as it can also be risky. However, it increases the quality of the mesh in some cases, especially when very thin objects are visible only from one side in the images. Default is `False`. |
281
+ | `--postprocess_density_threshold` | `float` | Threshold to use for postprocessing the mesh. Default is `0.1`. |
282
+ | `--postprocess_iterations` | `int` | Number of iterations to use for postprocessing the mesh. Default is `5`. |
283
+
284
+ #### (Optional) Parameters for exporting PLY files for the dedicated viewer
285
+
286
+ | Parameter | Type | Description |
287
+ | :-------: | :--: | :---------: |
288
+ | `--export_ply` | `bool` | If True, export a `.ply` file with the refined 3D Gaussians at the end of the training. This file can be large (+/- 500MB), but is needed for using the dedicated viewer. Default is `True`. |
289
+
290
+ #### (Optional) Default configurations
291
+
292
+ | Parameter | Type | Description |
293
+ | :-------: | :--: | :---------: |
294
+ | `--low_poly` | `bool` | If True, uses standard config for a low poly mesh, with `200_000` vertices and `6` Gaussians per triangle. |
295
+ | `--high_poly` | `bool` | If True, uses standard config for a high poly mesh, with `1_000_000` vertices and `1` Gaussians per triangle. |
296
+ | `--refinement_time` | `str` | Default configs for time to spend on refinement. Can be `"short"` (2k iterations), `"medium"` (7k iterations) or `"long"` (15k iterations). |
297
+
298
+ </details>
299
+
300
+
301
+ ## Installing and using the real-time viewer
302
+
303
+ Please find <a href="https://www.youtube.com/watch?v=YbjE0wnw67I">here</a> a short video illustrating how to use the viewer.
304
+
305
+ ### 1. Installation
306
+
307
+ *The viewer is currently built for Linux and Mac OS. It is not compatible with Windows. For Windows users, we recommend to use WSL2 (Windows Subsystem for Linux), as it is very easy to install and use. Please refer to the <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">official documentation</a> for more details.<br> We thank <a href="https://github.com/mkkellogg/GaussianSplats3D">Mark Kellogg for his awesome 3D Gaussian Splatting implementation for Three.js</a>, which we used for building this viewer.*
308
+
309
+ Please start by installing the latest versions of Node.js (such as 21.x) and npm.
310
+ A simple way to do this is to run the following commands (using aptitude):
311
+
312
+ ```shell
313
+ curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash -
314
+ sudo apt-get install -y nodejs
315
+ sudo apt-get install aptitude
316
+ sudo aptitude install -y npm
317
+ ```
318
+
319
+ Then, go inside the `./sugar_viewer/` directory and run the following commands:
320
+
321
+ ```shell
322
+ npm install
323
+ cd ..
324
+ ```
325
+
326
+ ### 2. Usage
327
+
328
+ First, make sure you have exported a `.ply` file and an `.obj` file using the `train.py` script. The `.ply` file contains the refined 3D Gaussians, and the `.obj` file contains the textured mesh. These files are exported by default when running the `train.py` script, so if you ran the code with default values for `--export_ply` and `--export_uv_textured_mesh`, you should be good to go.
329
+
330
+ The ply file should be located in `./output/refined_ply/<your scene name>/`. Then, just run the following command in the root directory to start the viewer:
331
+
332
+ ```shell
333
+ python run_viewer.py -p <path to the .ply file>
334
+ ```
335
+ Please make sure your `.ply` file is located in the right folder, and use a relative path starting with `./output/refined_ply`.
336
+ This command will redirect you to a local URL. Click on the link to open the viewer in your browser. Click the icons on the top right to switch between the different representations (hybrid representation, textured mesh, wireframe mesh). Use the mouse to rotate the scene, and the mouse wheel to zoom in and out.
337
+
338
+ <div align="center" >
339
+ <img src="./media/examples/viewer_example.png" alt="viewer_example.png" width="800"/>
340
+ </div><br>
341
+
342
+ ## Tips for using SuGaR on your own data and obtain better reconstructions
343
+
344
+ ### 1. Capture images or videos that cover the entire surface of the scene
345
+
346
+ Using a smartphone or a camera, capture images or a video that cover the entire surface of the 3D scene you want to reconstruct. The easiest way to do this is to move around the scene while recording a video. Try to move slowly and smoothly in order to avoid motion blur. For consistent reconstruction and easier camera pose estimation with COLMAP, maintaining a uniform focal length and a constant exposure time is also important. We recommend to disable auto-focus on your smartphone to ensure that the focal length remains constant.
347
+
348
+ For better reconstructions, try to cover objects from several and different angles, especially for thin and detailed parts of the scene.
349
+ Indeed, SuGaR is able to reconstruct very thin and detailed objects, but some artifacts may appear if these thin objects are not covered enough and are visible only from one side in the training images.
350
+
351
+ <details>
352
+ <summary><span style="font-weight: bold;">Detailed explanation</span></summary>
353
+ SuGaR applies Poisson reconstruction with 3D points sampled on the parts of the surface that are visible in the training images. This visibility constraint is important to prevent sampling points on the backside of the Gaussian level sets, located behind the surface of the scene, which would produce a lot of self-collisions and many unnecessary vertices in the mesh after applying Poisson reconstruction.
354
+ However, this visibility constraint also means that SuGaR cannot reconstruct parts of the surface that are not visible in the training images. If thin objects are visible only from one side in the training images, the Poisson reconstruction will try to reconstruct a closed surface, and will extend the surface of the thin objects, which produces an inaccurate mesh.
355
+
356
+ _TODO: Add images illustrating such artifacts._
357
+ </details><br>
358
+
359
+ However, such artifacts are not visible in the hybrid representation, because the gaussian texturing gives low-opacity to these artifacts during refinement.
360
+
361
+ We already have simple ideas that could help to avoid such artifacts, such as **(a)** identifying new camera poses that cover parts of the surface non-visible in the training images that are likely to be on the same level set as the visible parts, and **(b)** adding these camera poses to the set of cameras used for sampling the points when applying Poisson reconstruction. We will update the code in a near future to include this.
362
+
363
+ To convert a video to images, you can install `ffmpeg` and run the following command:
364
+ ```shell
365
+ ffmpeg -i <Path to the video file> -qscale:v 1 -qmin 1 -vf fps=<FPS> %04d.jpg
366
+ ```
367
+ where `<FPS>` is the desired sampling rate of the video images. An FPS value of 1 corresponds to sampling one image per second. We recommend to adjust the sampling rate to the length of the video, so that the number of sampled images is between 100 and 300.
368
+
369
+ ### 2. Estimate camera poses with COLMAP
370
+
371
+ Please first install a recent version of COLMAP (ideally CUDA-powered) and make sure to put the images you want to use in a directory `<location>/input`. Then, run the script `gaussian_splatting/convert.py` from the original Gaussian splatting implementation to compute the camera poses from the images using COLMAP. Please refer to the original <a href="https://github.com/graphdeco-inria/gaussian-splatting">3D Gaussian Splatting repository</a> for more details.
372
+
373
+ ```shell
374
+ python gaussian_splatting/convert.py -s <location>
375
+ ```
376
+
377
+ Sometimes COLMAP fails to reconstruct all images into the same model and hence produces multiple sub-models. The smaller sub-models generally contain only a few images. However, by default, the script `convert.py` will apply Image Undistortion only on the first sub-model, which may contain only a few images.
378
+
379
+ If this is the case, a simple solution is to keep only the largest sub-model and discard the others. To do this, open the source directory containing your input images, then open the sub-directory `<Source_directory>/distorted/sparse/`. You should see several sub-directories named `0/`, `1/`, etc., each containing a sub-model. Remove all sub-directories except the one containing the largest files, and rename it to `0/`. Then, run the script `convert.py` one more time but skip the matching process:
380
+
381
+ ```shell
382
+ python gaussian_splatting/convert.py -s <location> --skip_matching
383
+ ```
384
+
385
+ _Note: If the sub-models have common registered images, they could be merged into a single model as post-processing step using COLMAP; However, merging sub-models requires to run another global bundle adjustment after the merge, which can be time consuming._
386
+
387
+
388
+ ### 3. Density or SDF? Choose a regularization method that fits your scene
389
+
390
+ As we explain in the paper, we provide two separate regularization methods for SuGaR: a density regularization and an SDF regularization. The density regularization is the simplest one and works well with objects centered in the scene. The SDF provides a stronger regularization, especially in background regions.
391
+ As a consequence, the SDF regularization produces higher metrics on standard datasets.
392
+ However, for reconstructing an object centered in the scene with images taken from all around the object, the simpler density regularization generally produces a better mesh.
393
+
394
+ Therefore, we recommend the following when using the `train.py` script:
395
+ - For reconstructing detailed objects centered in the scene with 360° coverage (such as the toys we reconstructed in our presentation video), start with the density regularization `-r 'density'`. However, this may result in more chaotic Gaussians in the background.
396
+ - For reconstructing more challenging scenes or enforcing a stronger regularization in the background, use the SDF regularization `-r 'sdf'`.
397
+
398
+ ### 4. (Optional) Adapt the scale and the bounding box of the scene
399
+
400
+ As it is explained in the original <a href="https://github.com/graphdeco-inria/gaussian-splatting">3D Gaussian Splatting repository</a>, the method is expected to reconstruct a scene with reasonable scale. For reconstructing much larger datasets, like a city district, the original authors recommend to lower the learning rates of the positions and scaling factors of the Gaussians. The more extensive the scene, the lower these values should be.
401
+
402
+ Concerning SuGaR, such learning rates should also be lowered when reconstructing a very large scene. Moreover, as we explain in the supplementary material of the paper, for extracting a mesh from the Gaussians with an optimal repartition of vertices, we apply two Poisson reconstructions in practice: one on _foreground_ Gaussians, and one on _background_ Gaussians. The foreground Gaussians are defined as the Gaussians located inside a predefined bounding box, and the background Gaussians are defined as the Gaussians located outside this bounding box.
403
+
404
+ By default, this bounding box is computed as the bounding box of all camera centers. This general approach is coherent with how the original 3D Gaussian Splatting scales the learning rates. We used this default bounding box for all the reconstructions shown in the paper and the presentation video.
405
+
406
+ However, this bounding box might not be optimal in very specific cases, especially when the user wants to reconstruct with high details a very specific object located somewhere in the scene, or if the scene is very large, or if the camera centers are very far from the scene.
407
+ The user is free to provide a custom bounding box to the `train.py` script, using the parameters `--bboxmin` and `--bboxmax`. Please note that the bounding box must be provided as strings, formatted as `"(x,y,z)"`, where `x`, `y` and `z` are the coordinates of the min and max points of the bounding box.
408
+
409
+
410
+ ## Rendering, composition and animation
411
+
412
+ The `view_sugar_results.ipynb` notebook and the `metrics.py` script provides examples of how to load a refined SuGaR model for rendering a scene with the hybrid representation and the Gaussian Splatting rasterizer. We will add more details about this in a near future.
413
+
414
+ We also provide in the `blender` directory several python scripts to export from Blender composition and animation data of SuGaR meshes modified or animated within Blender. Additionally, we provide in the `sugar_scene/sugar_compositor.py` script a Python class that can be used to import such animation or composition data into PyTorch and apply it to the SuGaR hybrid representation.
415
+
416
+ The hybrid representation allows for high-quality rendering of the scene with the Gaussian Splatting rasterizer, as shown below.<br>
417
+
418
+ <div align="center" >
419
+ <img src="./media/blender/full_teaser.png" alt="teaser.gif" width="800"/>
420
+ </div><br>
421
+
422
+ The usage of these scripts and class may be a bit tricky, so we will add a detailed tutorial on how to use them in a near future.
423
+
424
+
425
+ ## Evaluation
426
+
427
+ To evaluate the quality of the reconstructions, we provide a script `metrics.py` that computes the PSNR, SSIM and LPIPS metrics on test images. Start by optimizing SuGaR models for the desired scenes and a regularization method (`"density"` or `"sdf"`), then create a `.json` config file containing the paths to the scenes in the following format: `{source_images_dir_path: vanilla_gaussian_splatting_checkpoint_path}`.
428
+
429
+ Finally, run the script as follows:
430
+
431
+ ```shell
432
+ python metrics.py --scene_config <Path to the .json file> -r <"sdf" or "density">
433
+ ```
434
+
435
+ Results are saved in a `.json` file in the `output/metrics/` directory.
436
+ Please refer to the script for more details on the command line arguments.
sugar/__init__.py ADDED
File without changes
sugar/__pycache__/__init__.cpython-39.pyc ADDED
Binary file (192 Bytes). View file
 
sugar/blender/__init__.py ADDED
File without changes
sugar/blender/export_camera_trajectory.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import bpy
2
+ import csv
3
+ import os
4
+ import json
5
+
6
+ # Get the path to the current Blender file
7
+ blend_file_path = bpy.data.filepath
8
+
9
+ # Get the directory of the Blender file
10
+ blend_dir = os.path.dirname(blend_file_path)
11
+
12
+ # Construct the absolute path to the "data.csv" file
13
+ path = './'
14
+ data_file_path = os.path.join(blend_dir, path)
15
+ data_file_path = os.path.join(data_file_path, "camera_trajectory.json")
16
+ print('Camera poses file path:', data_file_path)
17
+
18
+ res_dict = {}
19
+ res_dict['matrix_world'] = []
20
+
21
+ start_frame = 1
22
+ end_frame = 71
23
+
24
+ # Save frame poses for all bones
25
+ for i_frame in range(start_frame, end_frame+1):
26
+ print('\nFrame', i_frame)
27
+
28
+ # Set frame
29
+ bpy.context.scene.frame_set(i_frame)
30
+
31
+ # Save camera pose
32
+ obj = bpy.context.active_object
33
+ res_dict['matrix_world'].append([[obj.matrix_world[i][j] for j in range(4)] for i in range(4)])
34
+
35
+ print('matrix world:')
36
+ print(res_dict['matrix_world'])
37
+
38
+
39
+ with open(data_file_path, "w") as outfile:
40
+ json.dump(res_dict, outfile)
41
+ print(f'Results saved to "{data_file_path}".')
42
+
sugar/blender/export_pose_bones.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import bpy
2
+ import csv
3
+ import os
4
+ import json
5
+
6
+ # Get the path to the current Blender file
7
+ blend_file_path = bpy.data.filepath
8
+
9
+ # Get the directory of the Blender file
10
+ blend_dir = os.path.dirname(blend_file_path)
11
+
12
+ path = './'
13
+
14
+ # Construct the absolute path to the "data.csv" file
15
+ data_file_path = os.path.join(blend_dir, path)
16
+ data_file_path = os.path.join(data_file_path, "animation.json") # TODO: Depends on the animation
17
+ print('Pose file path:', data_file_path)
18
+
19
+ start_frame = 1
20
+ end_frame = 100 # TODO: Depends on the animation
21
+
22
+ res_dict = {}
23
+
24
+ obj = bpy.context.active_object
25
+ armature = obj.data
26
+
27
+ # Initialize dict
28
+ res_dict['matrix_world'] = [[obj.matrix_world[i][j] for j in range(4)] for i in range(4)]
29
+ res_dict['rest_bones'] = {}
30
+ res_dict['pose_bones'] = {}
31
+
32
+ # Save rest poses for all bones
33
+ for bone in armature.bones:
34
+ mat = obj.matrix_world @ bone.matrix_local
35
+ mat_list = [[mat[i][j] for j in range(4)] for i in range(4)]
36
+ res_dict['rest_bones'][bone.name] = mat_list
37
+ res_dict['pose_bones'][bone.name] = []
38
+
39
+ # Save frame poses for all bones
40
+ for i_frame in range(start_frame, end_frame+1):
41
+ print('Frame', i_frame)
42
+
43
+ # Set frame
44
+ bpy.context.scene.frame_set(i_frame)
45
+
46
+ # Get object transform
47
+ obj = bpy.context.active_object
48
+
49
+ pose = obj.pose
50
+ armature = obj.data
51
+
52
+ print("pose_position:", armature.pose_position)
53
+
54
+ for bone in pose.bones:
55
+ mat = obj.matrix_world @ bone.matrix
56
+ mat_list = [[mat[i][j] for j in range(4)] for i in range(4)]
57
+ res_dict['pose_bones'][bone.name].append(mat_list)
58
+
59
+ with open(data_file_path, "w") as outfile:
60
+ json.dump(res_dict, outfile)
61
+ print(f'Results saved to "{data_file_path}".')
62
+
sugar/blender/export_reference_points.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import bpy
2
+ import csv
3
+ import os
4
+ import json
5
+
6
+ # Get the path to the current Blender file
7
+ blend_file_path = bpy.data.filepath
8
+
9
+ # Get the directory of the Blender file
10
+ blend_dir = os.path.dirname(blend_file_path)
11
+
12
+ path = './'
13
+
14
+ # Construct the absolute path to the "data.csv" file
15
+ data_file_path = os.path.join(blend_dir, path)
16
+ data_file_path = os.path.join(data_file_path, "scene_reference_points.json") # TODO: Depends on the scene
17
+ print('Points file path:', data_file_path)
18
+
19
+ # Get data
20
+ obj = bpy.context.active_object
21
+ m = bpy.context.object.evaluated_get(bpy.context.evaluated_depsgraph_get()).to_mesh()
22
+ vertices = m.vertices
23
+ print("Number of vertices:", len(m.vertices))
24
+
25
+ # Initialize dict
26
+ res_dict = {}
27
+ res_dict['matrix_world'] = [[obj.matrix_world[i][j] for j in range(4)] for i in range(4)]
28
+ res_dict['reference_points'] = []
29
+ res_dict['groups'] = []
30
+ res_dict['weights'] = []
31
+
32
+ # Get names of all vertex groups
33
+ vertex_group_names = {}
34
+ print("Vertex groups:")
35
+ for i in range(len(obj.vertex_groups)):
36
+ group = obj.vertex_groups[i]
37
+ print(group.index, ":", group.name)
38
+ vertex_group_names[str(group.index)] = group.name
39
+
40
+ for i in range(len(vertices)):
41
+
42
+ # Add coordinates
43
+ v = obj.matrix_world @ vertices[i].co
44
+ res_dict['reference_points'].append([v[0], v[1], v[2]])
45
+
46
+ # Add the names of the corresponding vertex groups
47
+ group_list = []
48
+ weight_list = []
49
+ for group in vertices[i].groups:
50
+ group_list.append(vertex_group_names[str(group.group)])
51
+ weight_list.append(group.weight)
52
+ res_dict['groups'].append(group_list)
53
+ res_dict['weights'].append(weight_list)
54
+
55
+ with open(data_file_path, "w") as outfile:
56
+ json.dump(res_dict, outfile)
57
+ print(f'Results saved to "{data_file_path}".')
58
+
sugar/blender/export_tpose_bones.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import bpy
2
+ import csv
3
+ import os
4
+ import json
5
+
6
+ # Get the path to the current Blender file
7
+ blend_file_path = bpy.data.filepath
8
+
9
+ # Get the directory of the Blender file
10
+ blend_dir = os.path.dirname(blend_file_path)
11
+
12
+ path = './'
13
+
14
+ # Construct the absolute path to the "data.csv" file
15
+ data_file_path = os.path.join(blend_dir, path)
16
+ data_file_path = os.path.join(data_file_path, "scene_tpose.json") # TODO: Depends on the scene
17
+ print('Pose file path:', data_file_path)
18
+
19
+ res_dict = {}
20
+
21
+ obj = bpy.context.active_object
22
+ armature = obj.data
23
+
24
+ # Initialize dict
25
+ res_dict['matrix_world'] = [[obj.matrix_world[i][j] for j in range(4)] for i in range(4)]
26
+ res_dict['tpose_bones'] = {}
27
+
28
+ # Save rest poses for all bones
29
+ for bone in armature.bones:
30
+ mat = obj.matrix_world @ bone.matrix_local
31
+ mat_list = [[mat[i][j] for j in range(4)] for i in range(4)]
32
+ res_dict['tpose_bones'][bone.name] = mat_list
33
+
34
+ with open(data_file_path, "w") as outfile:
35
+ json.dump(res_dict, outfile)
36
+ print(f'Results saved to "{data_file_path}".')
37
+
sugar/blender/export_tpose_points.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import bpy
2
+ import csv
3
+ import os
4
+ import json
5
+
6
+ # Get the path to the current Blender file
7
+ blend_file_path = bpy.data.filepath
8
+
9
+ # Get the directory of the Blender file
10
+ blend_dir = os.path.dirname(blend_file_path)
11
+
12
+ path = './'
13
+
14
+ # Construct the absolute path to the "data.csv" file
15
+ data_file_path = os.path.join(blend_dir, path)
16
+ data_file_path = os.path.join(data_file_path, "scene_tpose_points.json") # TODO: Depends on the scene
17
+ print('Points file path:', data_file_path)
18
+
19
+ # Get data
20
+ obj = bpy.context.active_object
21
+ m = bpy.context.object.evaluated_get(bpy.context.evaluated_depsgraph_get()).to_mesh()
22
+ vertices = m.vertices
23
+ print("Number of vertices:", len(m.vertices))
24
+
25
+ # Initialize dict
26
+ res_dict = {}
27
+ res_dict['matrix_world'] = [[obj.matrix_world[i][j] for j in range(4)] for i in range(4)]
28
+ res_dict['tpose_points'] = []
29
+ res_dict['groups'] = []
30
+ res_dict['weights'] = []
31
+
32
+ # Get names of all vertex groups
33
+ vertex_group_names = {}
34
+ print("Vertex groups:")
35
+ for i in range(len(obj.vertex_groups)):
36
+ group = obj.vertex_groups[i]
37
+ print(group.index, ":", group.name)
38
+ vertex_group_names[str(group.index)] = group.name
39
+
40
+ for i in range(len(vertices)):
41
+
42
+ # Add coordinates
43
+ v = obj.matrix_world @ vertices[i].co
44
+ res_dict['tpose_points'].append([v[0], v[1], v[2]])
45
+
46
+ # Add the names of the corresponding vertex groups
47
+ group_list = []
48
+ weight_list = []
49
+ for group in vertices[i].groups:
50
+ group_list.append(vertex_group_names[str(group.group)])
51
+ weight_list.append(group.weight)
52
+ res_dict['groups'].append(group_list)
53
+ res_dict['weights'].append(weight_list)
54
+
55
+ with open(data_file_path, "w") as outfile:
56
+ json.dump(res_dict, outfile)
57
+ print(f'Results saved to "{data_file_path}".')
58
+
sugar/configs/__init__.py ADDED
File without changes
sugar/configs/metrics/scenes.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ {
3
+ "../nerfs/data/nerfstudio/garden": "../nerfs/og_gaussian_splatting/output/b5287e20-5/",
4
+ "../nerfs/data/nerfstudio/kitchen": "../nerfs/og_gaussian_splatting/output/dbde7200-f/",
5
+ "../nerfs/data/nerfstudio/room": "../nerfs/og_gaussian_splatting/output/a4f1fad4-6/",
6
+ "../nerfs/data/nerfstudio/bicycle": "../nerfs/og_gaussian_splatting/output/7d853ef3-c/",
7
+ "../nerfs/data/nerfstudio/counter": "../nerfs/og_gaussian_splatting/output/56003f04-1/",
8
+ "../nerfs/data/nerfstudio/bonsai": "../nerfs/og_gaussian_splatting/output/24f88369-5/",
9
+ "../nerfs/data/nerfstudio/stump": "../nerfs/og_gaussian_splatting/output/c4e344f5-a/",
10
+
11
+ "../nerfs/data/nerfstudio/playroom": "../nerfs/og_gaussian_splatting/output/ebefd1c2-7/",
12
+ "../nerfs/data/nerfstudio/drjohnson": "../nerfs/og_gaussian_splatting/output/da1efd51-d/",
13
+
14
+ "../nerfs/data/nerfstudio/train": "../nerfs/og_gaussian_splatting/output/0b8edce2-7/",
15
+ "../nerfs/data/nerfstudio/truck": "../nerfs/og_gaussian_splatting/output/cc98c5bd-6/"
16
+ }
sugar/environment.yml ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: sugar
2
+ channels:
3
+ - pytorch3d
4
+ - plotly
5
+ - iopath
6
+ - pytorch
7
+ - nvidia
8
+ - conda-forge
9
+ - defaults
10
+ dependencies:
11
+ - _libgcc_mutex=0.1=main
12
+ - _openmp_mutex=5.1=1_gnu
13
+ - anyio=4.1.0=pyhd8ed1ab_0
14
+ - argon2-cffi=21.1.0=py39h3811e60_2
15
+ - arrow=1.3.0=pyhd8ed1ab_0
16
+ - asttokens=2.4.1=pyhd8ed1ab_0
17
+ - async-lru=2.0.4=pyhd8ed1ab_0
18
+ - attrs=23.1.0=pyh71513ae_1
19
+ - babel=2.14.0=pyhd8ed1ab_0
20
+ - beautifulsoup4=4.12.2=pyha770c72_0
21
+ - blas=1.0=mkl
22
+ - bleach=6.1.0=pyhd8ed1ab_0
23
+ - brotli-python=1.0.9=py39h6a678d5_7
24
+ - bzip2=1.0.8=h7b6447c_0
25
+ - ca-certificates=2023.11.17=hbcca054_0
26
+ - cached-property=1.5.2=hd8ed1ab_1
27
+ - cached_property=1.5.2=pyha770c72_1
28
+ - certifi=2023.11.17=pyhd8ed1ab_0
29
+ - cffi=1.16.0=py39h5eee18b_0
30
+ - charset-normalizer=2.0.4=pyhd3eb1b0_0
31
+ - colorama=0.4.6=pyhd8ed1ab_0
32
+ - cryptography=41.0.7=py39hdda0065_0
33
+ - cuda-cudart=11.8.89=0
34
+ - cuda-cupti=11.8.87=0
35
+ - cuda-libraries=11.8.0=0
36
+ - cuda-nvrtc=11.8.89=0
37
+ - cuda-nvtx=11.8.86=0
38
+ - cuda-runtime=11.8.0=0
39
+ - decorator=5.1.1=pyhd8ed1ab_0
40
+ - defusedxml=0.7.1=pyhd8ed1ab_0
41
+ - entrypoints=0.4=pyhd8ed1ab_0
42
+ - exceptiongroup=1.2.0=pyhd8ed1ab_0
43
+ - executing=2.0.1=pyhd8ed1ab_0
44
+ - ffmpeg=4.3=hf484d3e_0
45
+ - filelock=3.13.1=py39h06a4308_0
46
+ - fqdn=1.5.1=pyhd8ed1ab_0
47
+ - freetype=2.12.1=h4a9f257_0
48
+ - fvcore=0.1.5.post20221221=pyhd8ed1ab_0
49
+ - giflib=5.2.1=h5eee18b_3
50
+ - gmp=6.2.1=h295c915_3
51
+ - gmpy2=2.1.2=py39heeb90bb_0
52
+ - gnutls=3.6.15=he1e5248_0
53
+ - idna=3.4=py39h06a4308_0
54
+ - importlib-metadata=7.0.0=pyha770c72_0
55
+ - importlib_metadata=7.0.0=hd8ed1ab_0
56
+ - importlib_resources=6.1.1=pyhd8ed1ab_0
57
+ - intel-openmp=2023.1.0=hdb19cb5_46306
58
+ - iopath=0.1.9=py39
59
+ - ipykernel=5.5.5=py39hef51801_0
60
+ - ipython=8.18.1=pyh707e725_3
61
+ - ipython_genutils=0.2.0=py_1
62
+ - ipywidgets=8.1.1=pyhd8ed1ab_0
63
+ - isoduration=20.11.0=pyhd8ed1ab_0
64
+ - jedi=0.19.1=pyhd8ed1ab_0
65
+ - jinja2=3.1.2=py39h06a4308_0
66
+ - jpeg=9e=h5eee18b_1
67
+ - json5=0.9.14=pyhd8ed1ab_0
68
+ - jsonpointer=2.4=py39hf3d152e_3
69
+ - jsonschema=4.20.0=pyhd8ed1ab_0
70
+ - jsonschema-specifications=2023.11.2=pyhd8ed1ab_0
71
+ - jsonschema-with-format-nongpl=4.20.0=pyhd8ed1ab_0
72
+ - jupyter-lsp=2.2.1=pyhd8ed1ab_0
73
+ - jupyter_client=8.6.0=pyhd8ed1ab_0
74
+ - jupyter_core=5.5.0=py39hf3d152e_0
75
+ - jupyter_events=0.9.0=pyhd8ed1ab_0
76
+ - jupyter_server=2.12.1=pyhd8ed1ab_0
77
+ - jupyter_server_terminals=0.5.0=pyhd8ed1ab_0
78
+ - jupyterlab=4.0.9=pyhd8ed1ab_0
79
+ - jupyterlab_pygments=0.3.0=pyhd8ed1ab_0
80
+ - jupyterlab_server=2.25.2=pyhd8ed1ab_0
81
+ - jupyterlab_widgets=3.0.9=pyhd8ed1ab_0
82
+ - lame=3.100=h7b6447c_0
83
+ - lcms2=2.12=h3be6417_0
84
+ - ld_impl_linux-64=2.38=h1181459_1
85
+ - lerc=3.0=h295c915_0
86
+ - libcublas=11.11.3.6=0
87
+ - libcufft=10.9.0.58=0
88
+ - libcufile=1.8.1.2=0
89
+ - libcurand=10.3.4.101=0
90
+ - libcusolver=11.4.1.48=0
91
+ - libcusparse=11.7.5.86=0
92
+ - libdeflate=1.17=h5eee18b_1
93
+ - libffi=3.4.4=h6a678d5_0
94
+ - libgcc=7.2.0=h69d50b8_2
95
+ - libgcc-ng=11.2.0=h1234567_1
96
+ - libgomp=11.2.0=h1234567_1
97
+ - libiconv=1.16=h7f8727e_2
98
+ - libidn2=2.3.4=h5eee18b_0
99
+ - libnpp=11.8.0.86=0
100
+ - libnvjpeg=11.9.0.86=0
101
+ - libpng=1.6.39=h5eee18b_0
102
+ - libsodium=1.0.18=h36c2ea0_1
103
+ - libstdcxx-ng=11.2.0=h1234567_1
104
+ - libtasn1=4.19.0=h5eee18b_0
105
+ - libtiff=4.5.1=h6a678d5_0
106
+ - libunistring=0.9.10=h27cfd23_0
107
+ - libwebp=1.3.2=h11a3e52_0
108
+ - libwebp-base=1.3.2=h5eee18b_0
109
+ - lz4-c=1.9.4=h6a678d5_0
110
+ - markdown-it-py=3.0.0=pyhd8ed1ab_0
111
+ - markupsafe=2.1.1=py39h7f8727e_0
112
+ - matplotlib-inline=0.1.6=pyhd8ed1ab_0
113
+ - mdurl=0.1.0=pyhd8ed1ab_0
114
+ - mistune=3.0.2=pyhd8ed1ab_0
115
+ - mkl=2023.1.0=h213fc3f_46344
116
+ - mkl-service=2.4.0=py39h5eee18b_1
117
+ - mkl_fft=1.3.8=py39h5eee18b_0
118
+ - mkl_random=1.2.4=py39hdb19cb5_0
119
+ - mpc=1.1.0=h10f8cd9_1
120
+ - mpfr=4.0.2=hb69a4c5_1
121
+ - mpmath=1.3.0=py39h06a4308_0
122
+ - nbclient=0.8.0=pyhd8ed1ab_0
123
+ - nbconvert-core=7.12.0=pyhd8ed1ab_0
124
+ - ncurses=6.4=h6a678d5_0
125
+ - nettle=3.7.3=hbbd107a_1
126
+ - networkx=3.1=py39h06a4308_0
127
+ - nodejs=6.13.1=0
128
+ - notebook-shim=0.2.3=pyhd8ed1ab_0
129
+ - numpy=1.26.2=py39h5f9d8c6_0
130
+ - numpy-base=1.26.2=py39hb5e798b_0
131
+ - openh264=2.1.1=h4ff587b_0
132
+ - openjpeg=2.4.0=h3ad879b_0
133
+ - openssl=3.0.12=h7f8727e_0
134
+ - overrides=7.4.0=pyhd8ed1ab_0
135
+ - packaging=23.2=pyhd8ed1ab_0
136
+ - pandocfilters=1.5.0=pyhd8ed1ab_0
137
+ - parso=0.8.3=pyhd8ed1ab_0
138
+ - pickleshare=0.7.5=py_1003
139
+ - pillow=10.0.1=py39ha6cbd5a_0
140
+ - pip=23.3.1=py39h06a4308_0
141
+ - pkgutil-resolve-name=1.3.10=pyhd8ed1ab_1
142
+ - platformdirs=4.1.0=pyhd8ed1ab_0
143
+ - plotly=5.18.0=py_0
144
+ - plyfile=0.8.1=pyhd8ed1ab_0
145
+ - portalocker=2.8.2=py39hf3d152e_1
146
+ - prometheus_client=0.19.0=pyhd8ed1ab_0
147
+ - ptyprocess=0.7.0=pyhd3deb0d_0
148
+ - pure_eval=0.2.2=pyhd8ed1ab_0
149
+ - pycparser=2.21=pyhd3eb1b0_0
150
+ - pygments=2.17.2=pyhd8ed1ab_0
151
+ - pyopenssl=23.2.0=py39h06a4308_0
152
+ - pysocks=1.7.1=py39h06a4308_0
153
+ - python=3.9.18=h955ad1f_0
154
+ - python-dateutil=2.8.2=pyhd8ed1ab_0
155
+ - python-fastjsonschema=2.19.0=pyhd8ed1ab_0
156
+ - python-json-logger=2.0.7=pyhd8ed1ab_0
157
+ - python_abi=3.9=2_cp39
158
+ - pytorch=2.0.1=py3.9_cuda11.8_cudnn8.7.0_0
159
+ - pytorch-cuda=11.8=h7e8668a_5
160
+ - pytorch-mutex=1.0=cuda
161
+ - pytorch3d=0.7.4=py39_cu118_pyt201
162
+ - pytz=2023.3.post1=pyhd8ed1ab_0
163
+ - pyyaml=6.0=py39hb9d737c_4
164
+ - pyzmq=25.1.0=py39h6a678d5_0
165
+ - readline=8.2=h5eee18b_0
166
+ - referencing=0.32.0=pyhd8ed1ab_0
167
+ - requests=2.31.0=py39h06a4308_0
168
+ - rfc3339-validator=0.1.4=pyhd8ed1ab_0
169
+ - rfc3986-validator=0.1.1=pyh9f0ad1d_0
170
+ - rich=13.7.0=pyhd8ed1ab_0
171
+ - send2trash=1.8.2=pyh41d4057_0
172
+ - setuptools=68.2.2=py39h06a4308_0
173
+ - six=1.16.0=pyh6c4a22f_0
174
+ - sniffio=1.3.0=pyhd8ed1ab_0
175
+ - soupsieve=2.5=pyhd8ed1ab_1
176
+ - sqlite=3.41.2=h5eee18b_0
177
+ - stack_data=0.6.2=pyhd8ed1ab_0
178
+ - sympy=1.12=py39h06a4308_0
179
+ - tabulate=0.9.0=pyhd8ed1ab_1
180
+ - tbb=2021.8.0=hdb19cb5_0
181
+ - tenacity=8.2.2=py39h06a4308_0
182
+ - termcolor=2.3.0=pyhd8ed1ab_0
183
+ - terminado=0.18.0=pyh0d859eb_0
184
+ - tinycss2=1.2.1=pyhd8ed1ab_0
185
+ - tk=8.6.12=h1ccaba5_0
186
+ - tomli=2.0.1=pyhd8ed1ab_0
187
+ - torchaudio=2.0.2=py39_cu118
188
+ - torchtriton=2.0.0=py39
189
+ - torchvision=0.15.2=py39_cu118
190
+ - tornado=6.3.3=py39h5eee18b_0
191
+ - tqdm=4.66.1=pyhd8ed1ab_0
192
+ - traitlets=5.14.0=pyhd8ed1ab_0
193
+ - types-python-dateutil=2.8.19.14=pyhd8ed1ab_0
194
+ - typing_extensions=4.7.1=py39h06a4308_0
195
+ - typing_utils=0.1.0=pyhd8ed1ab_0
196
+ - uri-template=1.3.0=pyhd8ed1ab_0
197
+ - urllib3=1.26.18=py39h06a4308_0
198
+ - wcwidth=0.2.12=pyhd8ed1ab_0
199
+ - webcolors=1.13=pyhd8ed1ab_0
200
+ - webencodings=0.5.1=pyhd8ed1ab_2
201
+ - websocket-client=1.7.0=pyhd8ed1ab_0
202
+ - wheel=0.41.2=py39h06a4308_0
203
+ - widgetsnbextension=4.0.9=pyhd8ed1ab_0
204
+ - xz=5.4.5=h5eee18b_0
205
+ - yacs=0.1.8=pyhd8ed1ab_0
206
+ - yaml=0.2.5=h7f98852_2
207
+ - zeromq=4.3.4=h2531618_0
208
+ - zipp=3.17.0=pyhd8ed1ab_0
209
+ - zlib=1.2.13=h5eee18b_0
210
+ - zstd=1.5.5=hc292b87_0
211
+ - pip:
212
+ - addict==2.4.0
213
+ - ansi2html==1.9.1
214
+ - blinker==1.7.0
215
+ - click==8.1.7
216
+ - comm==0.2.0
217
+ - configargparse==1.7
218
+ - contourpy==1.2.0
219
+ - cycler==0.12.1
220
+ - dash==2.14.2
221
+ - dash-core-components==2.0.0
222
+ - dash-html-components==2.0.0
223
+ - dash-table==5.0.0
224
+ - flask==3.0.0
225
+ - fonttools==4.46.0
226
+ - itsdangerous==2.1.2
227
+ - joblib==1.3.2
228
+ - kiwisolver==1.4.5
229
+ - matplotlib==3.8.2
230
+ - nbformat==5.7.0
231
+ - nest-asyncio==1.5.8
232
+ - open3d==0.17.0
233
+ - pandas==2.1.4
234
+ - pexpect==4.9.0
235
+ - prompt-toolkit==3.0.43
236
+ - pymcubes==0.1.4
237
+ - pyparsing==3.1.1
238
+ - pyquaternion==0.9.9
239
+ - retrying==1.3.4
240
+ - rpds-py==0.15.2
241
+ - scikit-learn==1.3.2
242
+ - scipy==1.11.4
243
+ - stack-data==0.6.3
244
+ - threadpoolctl==3.2.0
245
+ - tzdata==2023.3
246
+ - werkzeug==3.0.1
sugar/extract_mesh.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ from sugar.sugar_utils.general_utils import str2bool
3
+ from sugar.sugar_extractors.coarse_mesh import extract_mesh_from_coarse_sugar
4
+
5
+ if __name__ == "__main__":
6
+ # Parser
7
+ parser = argparse.ArgumentParser(description='Script to extract a mesh from a coarse SuGaR scene.')
8
+ parser.add_argument('-s', '--scene_path',
9
+ type=str,
10
+ help='path to the scene data to use.')
11
+ parser.add_argument('-c', '--checkpoint_path',
12
+ type=str,
13
+ help='path to the vanilla 3D Gaussian Splatting Checkpoint to load.')
14
+ parser.add_argument('-i', '--iteration_to_load',
15
+ type=int, default=7000,
16
+ help='iteration to load.')
17
+
18
+ parser.add_argument('-m', '--coarse_model_path', type=str, default=None, help='')
19
+
20
+ parser.add_argument('-l', '--surface_level', type=float, default=None,
21
+ help='Surface level to extract the mesh at. If None, will extract levels 0.1, 0.3 and 0.5')
22
+ parser.add_argument('-d', '--decimation_target', type=int, default=None,
23
+ help='Target number of vertices to decimate the mesh to. If None, will decimate to 200_000 and 1_000_000.')
24
+
25
+ parser.add_argument('-o', '--mesh_output_dir',
26
+ type=str, default=None,
27
+ help='path to the output directory.')
28
+
29
+ parser.add_argument('-b', '--bboxmin', type=str, default=None, help='Min coordinates to use for foreground.')
30
+ parser.add_argument('-B', '--bboxmax', type=str, default=None, help='Max coordinates to use for foreground.')
31
+ parser.add_argument('--center_bbox', type=str2bool, default=False, help='If True, center the bounding box. Default is False.')
32
+
33
+ parser.add_argument('--gpu', type=int, default=0, help='Index of GPU device to use.')
34
+
35
+ parser.add_argument('--eval', type=str2bool, default=True, help='Use eval split.')
36
+ parser.add_argument('--use_centers_to_extract_mesh', type=str2bool, default=False,
37
+ help='If True, just use centers of the gaussians to extract mesh.')
38
+ parser.add_argument('--use_marching_cubes', type=str2bool, default=False,
39
+ help='If True, use marching cubes to extract mesh.')
40
+ parser.add_argument('--use_vanilla_3dgs', type=str2bool, default=False,
41
+ help='If True, use vanilla 3DGS to extract mesh.')
42
+
43
+ args = parser.parse_args()
44
+
45
+ # Call function
46
+ extract_mesh_from_coarse_sugar(args)
47
+
sugar/extract_refined_mesh_with_texture.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ from sugar.sugar_utils.general_utils import str2bool
3
+ from sugar.sugar_extractors.refined_mesh import extract_mesh_and_texture_from_refined_sugar
4
+
5
+ if __name__ == "__main__":
6
+ # Parser
7
+ parser = argparse.ArgumentParser(description='Script to train a full macarons model in large 3D scenes.')
8
+ parser.add_argument('-s', '--scene_path',
9
+ type=str,
10
+ help='(Required) path to the scene data to use.') # --OK
11
+ parser.add_argument('-i', '--iteration_to_load',
12
+ type=int, default=7000,
13
+ help='iteration to load.') # --OK
14
+ parser.add_argument('-c', '--checkpoint_path',
15
+ type=str,
16
+ help='(Required) path to the vanilla 3D Gaussian Splatting Checkpoint to load.') # --OK
17
+ parser.add_argument('-m', '--refined_model_path',
18
+ type=str,
19
+ help='(Required) Path to the refine model checkpoint.') # --OK
20
+ parser.add_argument('-o', '--mesh_output_dir',
21
+ type=str,
22
+ default=None,
23
+ help='path to the output directory.') # --OK
24
+ parser.add_argument('-n', '--n_gaussians_per_surface_triangle',
25
+ default=None, type=int, help='Number of gaussians per surface triangle.') # --OK
26
+ parser.add_argument('--square_size',
27
+ default=None, type=int, help='Size of the square to use for the texture.') # --OK
28
+
29
+ parser.add_argument('--eval', type=str2bool, default=True, help='Use eval split.')
30
+ parser.add_argument('-g', '--gpu', type=int, default=0, help='Index of GPU to use.')
31
+
32
+ # Optional postprocessing
33
+ parser.add_argument('--postprocess_mesh', type=str2bool, default=False,
34
+ help='If True, postprocess the mesh by removing border triangles with low-density. '
35
+ 'This step takes a few minutes and is not needed in general, as it can also be risky. '
36
+ 'However, it increases the quality of the mesh in some cases, especially when an object is visible only from one side.') # --OK
37
+ parser.add_argument('--postprocess_density_threshold', type=float, default=0.1,
38
+ help='Threshold to use for postprocessing the mesh.') # --OK
39
+ parser.add_argument('--postprocess_iterations', type=int, default=5,
40
+ help='Number of iterations to use for postprocessing the mesh.') # --OK
41
+
42
+ args = parser.parse_args()
43
+
44
+ # Call function
45
+ extract_mesh_and_texture_from_refined_sugar(args)
46
+
sugar/gaussian_splatting/.DS_Store ADDED
Binary file (8.2 kB). View file
 
sugar/gaussian_splatting/LICENSE.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Gaussian-Splatting License
2
+ ===========================
3
+
4
+ **Inria** and **the Max Planck Institut for Informatik (MPII)** hold all the ownership rights on the *Software* named **gaussian-splatting**.
5
+ The *Software* is in the process of being registered with the Agence pour la Protection des
6
+ Programmes (APP).
7
+
8
+ The *Software* is still being developed by the *Licensor*.
9
+
10
+ *Licensor*'s goal is to allow the research community to use, test and evaluate
11
+ the *Software*.
12
+
13
+ ## 1. Definitions
14
+
15
+ *Licensee* means any person or entity that uses the *Software* and distributes
16
+ its *Work*.
17
+
18
+ *Licensor* means the owners of the *Software*, i.e Inria and MPII
19
+
20
+ *Software* means the original work of authorship made available under this
21
+ License ie gaussian-splatting.
22
+
23
+ *Work* means the *Software* and any additions to or derivative works of the
24
+ *Software* that are made available under this License.
25
+
26
+
27
+ ## 2. Purpose
28
+ This license is intended to define the rights granted to the *Licensee* by
29
+ Licensors under the *Software*.
30
+
31
+ ## 3. Rights granted
32
+
33
+ For the above reasons Licensors have decided to distribute the *Software*.
34
+ Licensors grant non-exclusive rights to use the *Software* for research purposes
35
+ to research users (both academic and industrial), free of charge, without right
36
+ to sublicense.. The *Software* may be used "non-commercially", i.e., for research
37
+ and/or evaluation purposes only.
38
+
39
+ Subject to the terms and conditions of this License, you are granted a
40
+ non-exclusive, royalty-free, license to reproduce, prepare derivative works of,
41
+ publicly display, publicly perform and distribute its *Work* and any resulting
42
+ derivative works in any form.
43
+
44
+ ## 4. Limitations
45
+
46
+ **4.1 Redistribution.** You may reproduce or distribute the *Work* only if (a) you do
47
+ so under this License, (b) you include a complete copy of this License with
48
+ your distribution, and (c) you retain without modification any copyright,
49
+ patent, trademark, or attribution notices that are present in the *Work*.
50
+
51
+ **4.2 Derivative Works.** You may specify that additional or different terms apply
52
+ to the use, reproduction, and distribution of your derivative works of the *Work*
53
+ ("Your Terms") only if (a) Your Terms provide that the use limitation in
54
+ Section 2 applies to your derivative works, and (b) you identify the specific
55
+ derivative works that are subject to Your Terms. Notwithstanding Your Terms,
56
+ this License (including the redistribution requirements in Section 3.1) will
57
+ continue to apply to the *Work* itself.
58
+
59
+ **4.3** Any other use without of prior consent of Licensors is prohibited. Research
60
+ users explicitly acknowledge having received from Licensors all information
61
+ allowing to appreciate the adequacy between of the *Software* and their needs and
62
+ to undertake all necessary precautions for its execution and use.
63
+
64
+ **4.4** The *Software* is provided both as a compiled library file and as source
65
+ code. In case of using the *Software* for a publication or other results obtained
66
+ through the use of the *Software*, users are strongly encouraged to cite the
67
+ corresponding publications as explained in the documentation of the *Software*.
68
+
69
+ ## 5. Disclaimer
70
+
71
+ THE USER CANNOT USE, EXPLOIT OR DISTRIBUTE THE *SOFTWARE* FOR COMMERCIAL PURPOSES
72
+ WITHOUT PRIOR AND EXPLICIT CONSENT OF LICENSORS. YOU MUST CONTACT INRIA FOR ANY
73
+ UNAUTHORIZED USE: [email protected] . ANY SUCH ACTION WILL
74
+ CONSTITUTE A FORGERY. THIS *SOFTWARE* IS PROVIDED "AS IS" WITHOUT ANY WARRANTIES
75
+ OF ANY NATURE AND ANY EXPRESS OR IMPLIED WARRANTIES, WITH REGARDS TO COMMERCIAL
76
+ USE, PROFESSIONNAL USE, LEGAL OR NOT, OR OTHER, OR COMMERCIALISATION OR
77
+ ADAPTATION. UNLESS EXPLICITLY PROVIDED BY LAW, IN NO EVENT, SHALL INRIA OR THE
78
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
79
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
80
+ GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
81
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING FROM, OUT OF OR
83
+ IN CONNECTION WITH THE *SOFTWARE* OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE*.
sugar/gaussian_splatting/SIBR_viewers/.DS_Store ADDED
Binary file (6.15 kB). View file
 
sugar/gaussian_splatting/SIBR_viewers/.gitignore ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ extlibs/
2
+ build/
3
+ install/
4
+ src/projects/*
5
+ cmake-gui.exe.stackdump
6
+ __pycache__/
7
+
8
+ # emacs garbage
9
+ \#*
10
+ .\#*
11
+
12
+ # vim garbage
13
+ *.swp
14
+ *.swo
15
+ *.idea/
16
+ *.log
17
+ *.sh
18
+ *.tmp
19
+
20
+ hs_err_*
21
+
22
+ # re include common public projects
23
+ !src/projects/ulr/
24
+ !src/projects/dataset_tools/
25
+
26
+ # more vim garbage
27
+ # Swap
28
+ [._]*.s[a-v][a-z]
29
+ !*.svg # comment out if you don't need vector files
30
+ [._]*.sw[a-p]
31
+ [._]s[a-rt-v][a-z]
32
+ [._]ss[a-gi-z]
33
+ [._]sw[a-p]
34
+
35
+ # Session
36
+ Session.vim
37
+ Sessionx.vim
38
+
39
+ # Temporary
40
+ .netrwhist
41
+ *~
42
+ # Auto-generated tag files
43
+ tags
44
+ # Persistent undo
45
+ [._]*.un~
sugar/gaussian_splatting/SIBR_viewers/CMakeLists.txt ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+ CMAKE_MINIMUM_REQUIRED(VERSION 3.22)
11
+
12
+ set (CMAKE_SYSTEM_VERSION 10.0.15063.0 CACHE INTERNAL "Cmake system version" FORCE)
13
+ PROJECT(sibr_projects)
14
+
15
+ set(REQUIRED_VERSION "3.22.0")
16
+ set(CHECKED_VERSION "3.27.0")
17
+
18
+ if (CMAKE_VERSION VERSION_LESS REQUIRED_VERSION)
19
+ message(WARNING "Deprecated version of cmake. Please update to at least ${REQUIRED_VERSION} (${CHECKED_VERSION} recommended).")
20
+ elseif (CMAKE_VERSION VERSION_GREATER CHECKED_VERSION)
21
+ message(WARNING "Untested version of cmake. If you checked everything is working properly, please update ${CHECKED_VERSION} in the main CmakeLists.txt with the version you tested.")
22
+ endif()
23
+
24
+ ## Include cmake stuff (functions/macros) : Modules files
25
+ if(WIN32)
26
+ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows)
27
+ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/Modules)
28
+ else()
29
+ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux)
30
+ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux/Modules)
31
+ endif()
32
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
33
+
34
+ ## To maintain cmake versions compatibilities
35
+ include(cmake_policies)
36
+ setPolicies()
37
+
38
+ include(git_describe)
39
+ git_describe(GIT_BRANCH SIBR_CORE_BRANCH GIT_COMMIT_HASH SIBR_CORE_COMMIT_HASH GIT_TAG SIBR_CORE_TAG GIT_VERSION SIBR_CORE_VERSION)
40
+
41
+ message(STATUS "SIBR version :\n BRANCH ${SIBR_CORE_BRANCH}\n COMMIT_HASH ${SIBR_CORE_COMMIT_HASH}\n TAG ${SIBR_CORE_TAG}\n VERSION ${SIBR_CORE_VERSION}")
42
+
43
+ if(NOT WIN32)
44
+ set(CMAKE_CXX_STANDARD 17)
45
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
46
+ endif()
47
+
48
+
49
+ if (WIN32)
50
+ ## Allow C++11 + other flags
51
+ include(CheckCXXCompilerFlag)
52
+ get_filename_component(currentBuildTool ${CMAKE_BUILD_TOOL} NAME_WE) # tool that can launch the native build system. returned value may be the full path
53
+ if(${currentBuildTool} MATCHES "(msdev|devenv|nmake|MSBuild)")
54
+
55
+ add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/W3;/DNOMINMAX;/MP;-D_USE_MATH_DEFINES>")
56
+ #add_definitions(/W3 /DNOMINMAX /MP -D_USE_MATH_DEFINES)# /D_ITERATOR_DEBUG_LEVEL=1 because you need all external DLl to compile with this flag too
57
+ set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING "" FORCE)
58
+ set(CMAKE_CXX_STANDARD 14)
59
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
60
+ set(CMAKE_CXX_EXTENSIONS OFF)
61
+ elseif(${currentBuildTool} MATCHES "(make|gmake)")
62
+ add_definitions("-Wall -Wno-unknown-pragmas -Wno-sign-compare -g -std=c++14 -D__forceinline=\"inline\ __attribute__((always_inline))\"")
63
+ # CHECK_CXX_COMPILER_FLAG("-std=gnu++11" COMPILER_SUPPORTS_CXX11)
64
+ # CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" COMPILER_SUPPORTS_CXX0X)
65
+ # if(COMPILER_SUPPORTS_CXX11)
66
+ # add_definitions(-std=gnu++11)
67
+ # elseif(COMPILER_SUPPORTS_CXX0X)
68
+ # add_definitions(-std=gnu++0x)
69
+ # else()
70
+ # message(SEND_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
71
+ # endif()
72
+ elseif(APPLE) ## \todo TODO: do a better test and send error on unsupported c++14 compiler
73
+ add_definitions(-std=c++14 -stdlib=libc++)
74
+ endif()
75
+ else()
76
+ ## Allow C++11 + other flags
77
+ include(CheckCXXCompilerFlag)
78
+ get_filename_component(currentBuildTool ${CMAKE_BUILD_TOOL} NAME_WE) # tool that can launch the native build system. returned value may be the full path
79
+ if(${currentBuildTool} MATCHES "(msdev|devenv|nmake|MSBuild)")
80
+
81
+ add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/W3;/DNOMINMAX;/MP;-D_USE_MATH_DEFINES>")
82
+ #add_definitions(/W3 /DNOMINMAX /MP -D_USE_MATH_DEFINES)# /D_ITERATOR_DEBUG_LEVEL=1 because you need all external DLl to compile with this flag too
83
+ set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING "" FORCE)
84
+ set(CMAKE_CXX_STANDARD 14)
85
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
86
+ set(CMAKE_CXX_EXTENSIONS OFF)
87
+ elseif(${currentBuildTool} MATCHES "(make|gmake|ninja)")
88
+ add_definitions("-fpermissive -fPIC -Wall -Wno-unknown-pragmas -Wno-sign-compare -g -std=c++17 -D__forceinline=\"inline\ __attribute__((always_inline))\"")
89
+ elseif(APPLE) ## \todo TODO: do a better test and send error on unsupported c++14 compiler
90
+ add_definitions(-std=c++17 -stdlib=libc++)
91
+ endif()
92
+ endif()
93
+
94
+ set(INSTALL_STANDALONE ON)
95
+
96
+ ## Set default build output binaries (used also in sub CMakeLists.txt) :
97
+ set(BIN_BUILT_DIR "bin")
98
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
99
+ set(ARCHI_BUILT_DIR "x64")
100
+ set(LIB_BUILT_DIR "lib64")
101
+ else()
102
+ set(ARCHI_BUILT_DIR "x86")
103
+ set(LIB_BUILT_DIR "lib")
104
+ endif()
105
+
106
+ option(SEPARATE_CONFIGURATIONS "Clearer separation between configurations" OFF)
107
+ SET(CMAKE_INSTALL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/install)
108
+ SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_ROOT})
109
+
110
+ if(DEFINED CMAKE_BUILD_TYPE) ## for mono config type (make/nmake/ninja based)
111
+ if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
112
+ set(CMAKE_DEBUG_POSTFIX "_d")
113
+ elseif(${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo")
114
+ set(CMAKE_RELWITHDEBINFO_POSTFIX "_rwdi")
115
+ elseif(${CMAKE_BUILD_TYPE} MATCHES "MinSizeRel")
116
+ set(CMAKE_MINSIZEREL_POSTFIX "_msr")
117
+ elseif(${CMAKE_BUILD_TYPE} MATCHES "Release")
118
+ set(CMAKE_RELEASE_POSTFIX "")
119
+ endif()
120
+
121
+ if(SEPARATE_CONFIGURATIONS)
122
+ SET(CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE} ${CMAKE_INSTALL_ROOT}/${CMAKE_BUILD_TYPE})
123
+ else()
124
+ SET(CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE} ${CMAKE_INSTALL_ROOT})
125
+ endif()
126
+
127
+ MESSAGE(STATUS "Install path set to ${CMAKE_INSTALL_PREFIX}.")
128
+ SET(CMAKE_OUTPUT_LIB_${CMAKE_BUILD_TYPE} ${CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE}}/lib)
129
+ SET(CMAKE_OUTPUT_BIN_${CMAKE_BUILD_TYPE} ${CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE}}/bin)
130
+
131
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} ${CMAKE_OUTPUT_LIB_${CMAKE_BUILD_TYPE}})
132
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} ${CMAKE_OUTPUT_LIB_${CMAKE_BUILD_TYPE}})
133
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} ${CMAKE_OUTPUT_BIN_${CMAKE_BUILD_TYPE}})
134
+ set(CMAKE_PDB_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE} ${CMAKE_OUTPUT_BIN_${CMAKE_BUILD_TYPE}})
135
+ endif()
136
+ foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
137
+ string(TOUPPER ${CONFIG_TYPES} CONFIG_TYPES_UC)
138
+ if(${CONFIG_TYPES} MATCHES "Debug")
139
+ set(CMAKE_DEBUG_POSTFIX "_d")
140
+ elseif(${CONFIG_TYPES} MATCHES "RelWithDebInfo")
141
+ set(CMAKE_RELWITHDEBINFO_POSTFIX "_rwdi")
142
+ elseif(${CONFIG_TYPES} MATCHES "MinSizeRel")
143
+ set(CMAKE_MINSIZEREL_POSTFIX "_msr")
144
+ elseif(${CMAKE_BUILD_TYPE} MATCHES "Release")
145
+ set(CMAKE_RELEASE_POSTFIX "")
146
+ endif()
147
+
148
+ if(SEPARATE_CONFIGURATIONS)
149
+ SET(CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC} ${CMAKE_INSTALL_ROOT}/${CONFIG_TYPES})
150
+ else()
151
+ SET(CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC} ${CMAKE_INSTALL_ROOT})
152
+ endif()
153
+
154
+ MESSAGE(STATUS "Install path for ${CONFIG_TYPES} set to ${CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC}}.")
155
+ SET(CMAKE_OUTPUT_LIB_${CONFIG_TYPES_UC} ${CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC}}/lib)
156
+ SET(CMAKE_OUTPUT_BIN_${CONFIG_TYPES_UC} ${CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC}}/bin)
157
+
158
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC} ${CMAKE_OUTPUT_LIB_${CONFIG_TYPES_UC}})
159
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC} ${CMAKE_OUTPUT_LIB_${CONFIG_TYPES_UC}})
160
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC} ${CMAKE_OUTPUT_BIN_${CONFIG_TYPES_UC}})
161
+ set(CMAKE_PDB_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC} ${CMAKE_OUTPUT_BIN_${CONFIG_TYPES_UC}})
162
+ endforeach()
163
+
164
+
165
+ # Settings for RPATH
166
+ if (NOT WIN32)
167
+ # Default config of Fedora at INRIA has no LD_LIBRARY_PATH (for security reasons I guess)
168
+ # So at least I had "./" in RPATH and found link paths
169
+ #set(CMAKE_SKIP_RPATH TRUE)
170
+ #SET(CMAKE_SKIP_BUILD_RPATH FALSE)
171
+ SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
172
+
173
+ SET(CMAKE_INSTALL_RPATH "$ORIGIN")
174
+ #SET(CMAKE_INSTALL_RPATH "./")
175
+ #SET(CMAKE_INSTALL_RPATH "./:/usr/lib64/:/usr/lib/:/usr/local/lib64/:/usr/local/lib/") # This one causes be a problem -> a "default" version of libGL (swrast) is located in /usr/lib64 and was selected instead of nvidia one (in /usr/lib64/nividia)
176
+
177
+ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
178
+ endif()
179
+
180
+
181
+ set(SIBR_PROGRAMARGS "" CACHE STRING "Default program arguments used in Visual Studio target properties")
182
+ if ("${SIBR_PROGRAMARGS}" STREQUAL "")
183
+ if (DEFINED ENV{SIBR_PROGRAMARGS})
184
+ set(SIBR_PROGRAMARGS "$ENV{SIBR_PROGRAMARGS}" CACHE STRING "Default program arguments used in Visual Studio target properties" FORCE)
185
+ message( STATUS "Using program options found in environment variable 'SIBR_PROGRAMARGS' => '${SIBR_PROGRAMARGS}'")
186
+ else()
187
+ message(
188
+ "Note you can provide default program options for Visual Studio target properties by either setting"
189
+ " a value for the cmake cached variable 'SIBR_PROGRAMARGS' or by setting a new environment "
190
+ "variable 'SIBR_PROGRAMARGS'")
191
+ endif()
192
+ endif()
193
+
194
+ add_custom_target(PREBUILD ALL)
195
+
196
+ ## Include all projects
197
+ set(SIBR_PROJECTS_SAMPLES_SUBPAGE_REF "")
198
+ set(SIBR_PROJECTS_OURS_SUBPAGE_REF "")
199
+ set(SIBR_PROJECTS_TOOLBOX_SUBPAGE_REF "")
200
+ set(SIBR_PROJECTS_OTHERS_SUBPAGE_REF "")
201
+ set(SIBR_PROJECTS_SAMPLES_REF_REF "")
202
+ set(SIBR_PROJECTS_OURS_REF_REF "")
203
+ set(SIBR_PROJECTS_TOOLBOX_REF_REF "")
204
+ set(SIBR_PROJECTS_OTHERS_REF_REF "")
205
+ set(DOXY_APP_SPECIFIC_IMG_PATH "")
206
+ set(DOXY_DOC_EXCLUDE_PATTERNS_DIRS "")
207
+ ADD_SUBDIRECTORY(src)
208
+
209
+
210
+ ## handle documentation
211
+ if (WIN32)
212
+ ADD_SUBDIRECTORY(docs)
213
+ endif()
sugar/gaussian_splatting/SIBR_viewers/LICENSE.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SIBR License
2
+ ============
3
+
4
+ **Inria** and **UCA** hold all the ownership rights on the *Software* named **sibr-core**.
5
+ The *Software* has been registered with the Agence pour la Protection des
6
+ Programmes (APP) under IDDN.FR.001.430020.000.S.P.2019.000.31235
7
+
8
+ The *Software* is still being developed by the *Licensor*.
9
+
10
+ *Licensor*'s goal is to allow the research community to use, test and evaluate
11
+ the *Software*.
12
+
13
+ ## 1. Definitions
14
+
15
+ *Licensee* means any person or entity that uses the *Software* and distributes
16
+ its *Work*.
17
+
18
+ *Licensor* means the owners of the *Software*, i.e Inria and UCA
19
+
20
+ *Software* means the original work of authorship made available under this
21
+ License ie Sibr-core.
22
+
23
+ *Work* means the *Software* and any additions to or derivative works of the
24
+ *Software* that are made available under this License.
25
+
26
+
27
+ ## 2. Purpose
28
+ This license is intended to define the rights granted to the *Licensee* by
29
+ Licensors under the *Software*.
30
+
31
+ ## 3. Rights granted
32
+
33
+ For the above reasons Licensors have decided to distribute the *Software*.
34
+ Licensors grant non-exclusive rights to use the *Software* for research purposes
35
+ to research users (both academic and industrial), free of charge, without right
36
+ to sublicense.. The *Software* may be used "non-commercially", i.e., for research
37
+ and/or evaluation purposes only.
38
+
39
+ Subject to the terms and conditions of this License, you are granted a
40
+ non-exclusive, royalty-free, license to reproduce, prepare derivative works of,
41
+ publicly display, publicly perform and distribute its *Work* and any resulting
42
+ derivative works in any form.
43
+
44
+ ## 4. Limitations
45
+
46
+ **4.1 Redistribution.** You may reproduce or distribute the *Work* only if (a) you do
47
+ so under this License, (b) you include a complete copy of this License with
48
+ your distribution, and (c) you retain without modification any copyright,
49
+ patent, trademark, or attribution notices that are present in the *Work*.
50
+
51
+ **4.2 Derivative Works.** You may specify that additional or different terms apply
52
+ to the use, reproduction, and distribution of your derivative works of the *Work*
53
+ ("Your Terms") only if (a) Your Terms provide that the use limitation in
54
+ Section 2 applies to your derivative works, and (b) you identify the specific
55
+ derivative works that are subject to Your Terms. Notwithstanding Your Terms,
56
+ this License (including the redistribution requirements in Section 3.1) will
57
+ continue to apply to the *Work* itself.
58
+
59
+ **4.3** Any other use without of prior consent of Licensors is prohibited. Research
60
+ users explicitly acknowledge having received from Licensors all information
61
+ allowing to appreciate the adequacy between of the *Software* and their needs and
62
+ to undertake all necessary precautions for its execution and use.
63
+
64
+ **4.4** The *Software* is provided both as a compiled library file and as source
65
+ code. In case of using the *Software* for a publication or other results obtained
66
+ through the use of the *Software*, users are strongly encouraged to cite the
67
+ corresponding publications as explained in the documentation of the *Software*.
68
+
69
+ ## 5. Disclaimer
70
+
71
+ THE USER CANNOT USE, EXPLOIT OR DISTRIBUTE THE *SOFTWARE* FOR COMMERCIAL PURPOSES
72
+ WITHOUT PRIOR AND EXPLICIT CONSENT OF LICENSORS. YOU MUST CONTACT INRIA FOR ANY
73
+ UNAUTHORIZED USE: [email protected] . ANY SUCH ACTION WILL
74
+ CONSTITUTE A FORGERY. THIS *SOFTWARE* IS PROVIDED "AS IS" WITHOUT ANY WARRANTIES
75
+ OF ANY NATURE AND ANY EXPRESS OR IMPLIED WARRANTIES, WITH REGARDS TO COMMERCIAL
76
+ USE, PROFESSIONNAL USE, LEGAL OR NOT, OR OTHER, OR COMMERCIALISATION OR
77
+ ADAPTATION. UNLESS EXPLICITLY PROVIDED BY LAW, IN NO EVENT, SHALL INRIA OR THE
78
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
79
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
80
+ GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
81
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING FROM, OUT OF OR
83
+ IN CONNECTION WITH THE *SOFTWARE* OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE*.
sugar/gaussian_splatting/SIBR_viewers/README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SIBR Core
2
+
3
+ **SIBR** is a System for Image-Based Rendering.
4
+ It is built around the *sibr-core* in this repo and several *Projects* implementing published research papers.
5
+ For more complete documentation, see here: [SIBR Documentation](https://sibr.gitlabpages.inria.fr)
6
+
7
+ This **SIBR core** repository provides :
8
+ - a basic Image-Based Renderer
9
+ - a per-pixel implementation of Unstructured Lumigraph (ULR)
10
+ - several dataset tools & pipelines do process input images
11
+
12
+ Details on how to run in the documentation and in the section below.
13
+ If you use this code in a publication, please cite the system as follows:
14
+
15
+ ```
16
+ @misc{sibr2020,
17
+ author = "Bonopera, Sebastien and Esnault, Jerome and Prakash, Siddhant and Rodriguez, Simon and Thonat, Theo and Benadel, Mehdi and Chaurasia, Gaurav and Philip, Julien and Drettakis, George",
18
+ title = "sibr: A System for Image Based Rendering",
19
+ year = "2020",
20
+ url = "https://gitlab.inria.fr/sibr/sibr_core"
21
+ }
22
+ ```
23
+
24
+ ## Setup
25
+
26
+ **Note**: The current release is for *Windows 10* only. We are planning a Linux release soon.
27
+
28
+ #### Binary distribution
29
+
30
+ The easiest way to use SIBR is to download the binary distribution. All steps described below, including all preprocessing for your datasets will work using this code.
31
+
32
+ Download the distribution from the page: https://sibr.gitlabpages.inria.fr/download.html (Core, 57Mb); unzip the file and rename the directory "install".
33
+
34
+ #### Install requirements
35
+
36
+ - [**Visual Studio 2019**](https://visualstudio.microsoft.com/fr/downloads/)
37
+ - [**Cmake 3.16+**](https://cmake.org/download)
38
+ - [**7zip**](https://www.7-zip.org)
39
+ - [**Python 3.8+**](https://www.python.org/downloads/) for shaders installation scripts and dataset preprocess scripts
40
+ - [**Doxygen 1.8.17+**](https://www.doxygen.nl/download.html#srcbin) for documentation
41
+ - [**CUDA 10.1+**](https://developer.nvidia.com/cuda-downloads) and [**CUDnn**](https://developer.nvidia.com/cudnn) if projects requires it
42
+
43
+ Make sure Python, CUDA and Doxygen are in the PATH
44
+
45
+ If you have Chocolatey, you can grab most of these with this command:
46
+
47
+ ```sh
48
+ choco install cmake 7zip python3 doxygen.install cuda
49
+
50
+ ## Visual Studio is available on Chocolatey,
51
+ ## though we do advise to set it from Visual Studio Installer and to choose your licensing accordingly
52
+ choco install visualstudio2019community
53
+ ```
54
+
55
+ #### Generation of the solution
56
+
57
+ - Checkout this repository's master branch:
58
+
59
+ ```sh
60
+ ## through HTTPS
61
+ git clone https://gitlab.inria.fr/sibr/sibr_core.git -b master
62
+ ## through SSH
63
+ git clone [email protected]:sibr/sibr_core.git -b master
64
+ ```
65
+ - Run Cmake-gui once, select the repo root as a source directory, `build/` as the build directory. Configure, select the Visual Studio C++ Win64 compiler
66
+ - Select the projects you want to generate among the BUILD elements in the list (you can group Cmake flags by categories to access those faster)
67
+ - Generate
68
+
69
+ #### Compilation
70
+
71
+ - Open the generated Visual Studio solution (`build/sibr_projects.sln`)
72
+ - Build the `ALL_BUILD` target, and then the `INSTALL` target
73
+ - The compiled executables will be put in `install/bin`
74
+ - TODO: are the DLLs properly installed?
75
+
76
+ #### Compilation of the documentation
77
+
78
+ - Open the generated Visual Studio solution (`build/sibr_projects.sln`)
79
+ - Build the `DOCUMENTATION` target
80
+ - Run `install/docs/index.html` in a browser
81
+
82
+
83
+ ## Scripts
84
+
85
+ Some scripts will require you to install `PIL`, and `convert` from `ImageMagick`.
86
+
87
+ ```sh
88
+ ## To install pillow
89
+ python -m pip install pillow
90
+
91
+ ## If you have Chocolatey, you can install imagemagick from this command
92
+ choco install imagemagick
93
+ ```
94
+
95
+ ## Troubleshooting
96
+
97
+ #### Bugs and Issues
98
+
99
+ We will track bugs and issues through the Issues interface on gitlab. Inria gitlab does not allow creation of external accounts, so if you have an issue/bug please email <code>[email protected]</code> and we will either create a guest account or create the issue on our side.
100
+
101
+ #### Cmake complaining about the version
102
+
103
+ if you are the first to use a very recent Cmake version, you will have to update `CHECKED_VERSION` in the root `CmakeLists.txt`.
104
+
105
+ #### Weird OpenCV error
106
+
107
+ you probably selected the 32-bits compiler in Cmake-gui.
108
+
109
+ #### `Cmd.exe failed with error 009` or similar
110
+
111
+ make sure Python is installed and in the path.
112
+
113
+ #### `BUILD_ALL` or `INSTALL` fail because of a project you don't really need
114
+
115
+ build and install each project separately by selecting the proper targets.
116
+
117
+ #### Error in CUDA headers under Visual Studio 2019
118
+
119
+ make sure CUDA >= 10.1 (first version to support VS2019) is installed.
120
+
121
+ ## To run an example
122
+
123
+ For more details, please see the documentation: http://sibr.gitlabpages.inria.fr
124
+
125
+ Download a dataset from: https://repo-sam.inria.fr/fungraph/sibr-datasets/
126
+
127
+ e.g., the *sibr-museum-front* dataset in the *DATASETS_PATH* directory.
128
+
129
+ ```
130
+ wget https://repo-sam.inria.fr/fungraph/sibr-datasets/museum_front27_ulr.zip
131
+ ```
132
+
133
+ Once you have built the system or downloaded the binaries (see above), go to *install/bin* and you can run:
134
+ ```
135
+ sibr_ulrv2_app.exe --path DATASETS_PATH/sibr-museum-front
136
+ ```
137
+
138
+ You will have an interactive viewer and you can navigate freely in the captured scene.
139
+ Our default interactive viewer has a main view running the algorithm and a top view to visualize the position of the calibrated cameras. By default you are in WASD mode, and can toggle to trackball using the "y" key. Please see the page [Interface](https://sibr.gitlabpages.inria.fr/docs/nightly/howto_sibr_useful_objects.html) for more details on the interface.
140
+
141
+ Please see the documentation on how to create a dataset from your own scene, and the various other IBR algorithms available.
142
+
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/MSVCsetUserCommand.cmake ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ if(__MSVCsetUserCommand_cmake_INCLUDED__)
12
+ return()
13
+ else()
14
+ set(__MSVCsetUserCommand_cmake_INCLUDED__ ON)
15
+ endif()
16
+
17
+ ## Allow to configure the Debugger settings of visual studio
18
+ ## Note: Using this command under linux doesn't affect anything
19
+ ## On run Debug Windows local : visual will try to load a specific COMMAND with ARGS in the provided WORKING_DIR
20
+ ##
21
+ ## usage:
22
+ ## MSVCsetUserCommand( <targetName>
23
+ ## [COMMAND <myCustomAppToLaunch> | [ PATH <myCustomDirWhereIsDefaultTargetFileNameToLaunch> [FILE <myCustomExecFileToLaunch>] ] ]
24
+ ## ARGS <associatedArguments>
25
+ ## WORKING_DIR <whereStartTheProgram>
26
+ ## )
27
+ ##
28
+ ## Warning 1 : All arugments () must be passed under quotes
29
+ ## Warning 2 : WORKING_DIR path arg have to finish with remain slah '/'
30
+ ## Warning 3 : use COMMAND for external app OR PATH (optionaly with FILE) option(s) to set your built/installed/moved target
31
+ ##
32
+ ## Example 1:
33
+ ## include(MSVCsetUserCommand)
34
+ ## MSVCsetUserCommand( UnityRenderingPlugin
35
+ ## COMMAND "C:/Program Files (x86)/Unity/Editor/Unity.exe"
36
+ ## ARGS "-force-opengl -projectPath \"${CMAKE_HOME_DIRECTORY}/UnityPlugins/RenderingPluginExample/UnityProject\""
37
+ ## WORKING_DIR "${CMAKE_HOME_DIRECTORY}/UnityPlugins/RenderingPluginExample/UnityProject"
38
+ ## VERBOSE
39
+ ## )
40
+ ##
41
+ ## Example 2:
42
+ ## include(MSVCsetUserCommand)
43
+ ## MSVCsetUserCommand( ibrApp
44
+ ## PATH "C:/Program Files (x86)/workspace/IBR/install"
45
+ ## FILE "ibrApp${CMAKE_EXECUTABLE_SUFFIX}" ## this option line is optional since the target name didn't change between build and install step
46
+ ## ARGS "-path \"${CMAKE_HOME_DIRECTORY}/dataset\""
47
+ ## WORKING_DIR "${CMAKE_HOME_DIRECTORY}"
48
+ ## VERBOSE
49
+ ## )
50
+ ##
51
+ function(MSVCsetUserCommand targetName)
52
+ cmake_parse_arguments(MSVCsuc "VERBOSE" "PATH;FILE;COMMAND;ARGS;WORKING_DIR" "" ${ARGN} )
53
+
54
+ ## If no arguments are given, do not create an unecessary .vcxproj.user file
55
+ set(MSVCsuc_DEFAULT OFF)
56
+
57
+ if(MSVCsuc_PATH AND MSVCsuc_DEFAULT)
58
+ set(MSVCsuc_DEFAULT OFF)
59
+ endif()
60
+
61
+ if(MSVCsuc_FILE AND MSVCsuc_DEFAULT)
62
+ set(MSVCsuc_DEFAULT OFF)
63
+ endif()
64
+
65
+ if(NOT MSVCsuc_COMMAND)
66
+ if(MSVCsuc_PATH AND MSVCsuc_FILE)
67
+ set(MSVCsuc_COMMAND "${MSVCsuc_PATH}\\${MSVCsuc_FILE}")
68
+ elseif(MSVCsuc_PATH)
69
+ set(MSVCsuc_COMMAND "${MSVCsuc_PATH}\\$(TargetFileName)")
70
+ else()
71
+ set(MSVCsuc_COMMAND "$(TargetPath)") ## => $(TargetDir)\$(TargetName)$(TargetExt)
72
+ endif()
73
+ elseif(MSVCsuc_DEFAULT)
74
+ set(MSVCsuc_DEFAULT OFF)
75
+ endif()
76
+
77
+ # NOTE: there was a typo here. there is an else if written after else statement
78
+ # changing the order of the else if statement
79
+ if(MSVCsuc_WORKING_DIR)
80
+ file(TO_NATIVE_PATH ${MSVCsuc_WORKING_DIR} MSVCsuc_WORKING_DIR)
81
+ elseif(MSVCsuc_DEFAULT)
82
+ set(MSVCsuc_DEFAULT OFF)
83
+ else()
84
+ set(MSVCsuc_WORKING_DIR "$(ProjectDir)")
85
+ endif()
86
+
87
+ if(NOT MSVCsuc_ARGS)
88
+ set(MSVCsuc_ARGS "")
89
+ elseif(MSVCsuc_DEFAULT)
90
+ set(MSVCsuc_DEFAULT OFF)
91
+ endif()
92
+
93
+ if(MSVC10 OR (MSVC AND MSVC_VERSION GREATER 1600)) # 2010 or newer
94
+
95
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
96
+ set(PLATEFORM_BITS x64)
97
+ else()
98
+ set(PLATEFORM_BITS Win32)
99
+ endif()
100
+
101
+ if(NOT MSVCsuc_DEFAULT AND PLATEFORM_BITS)
102
+
103
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${targetName}.vcxproj.user"
104
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>
105
+ <Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
106
+ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|${PLATEFORM_BITS}'\">
107
+ <LocalDebuggerCommand>${MSVCsuc_COMMAND}</LocalDebuggerCommand>
108
+ <LocalDebuggerCommandArguments>${MSVCsuc_ARGS}</LocalDebuggerCommandArguments>
109
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
110
+ <LocalDebuggerWorkingDirectory>${MSVCsuc_WORKING_DIR}</LocalDebuggerWorkingDirectory>
111
+ </PropertyGroup>
112
+ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|${PLATEFORM_BITS}'\">
113
+ <LocalDebuggerCommand>${MSVCsuc_COMMAND}</LocalDebuggerCommand>
114
+ <LocalDebuggerCommandArguments>${MSVCsuc_ARGS}</LocalDebuggerCommandArguments>
115
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
116
+ <LocalDebuggerWorkingDirectory>${MSVCsuc_WORKING_DIR}</LocalDebuggerWorkingDirectory>
117
+ </PropertyGroup>
118
+ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='MinSizeRel|${PLATEFORM_BITS}'\">
119
+ <LocalDebuggerCommand>${MSVCsuc_COMMAND}</LocalDebuggerCommand>
120
+ <LocalDebuggerCommandArguments>${MSVCsuc_ARGS}</LocalDebuggerCommandArguments>
121
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
122
+ <LocalDebuggerWorkingDirectory>${MSVCsuc_WORKING_DIR}</LocalDebuggerWorkingDirectory>
123
+ </PropertyGroup>
124
+ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RelWithDebInfo|${PLATEFORM_BITS}'\">
125
+ <LocalDebuggerCommand>${MSVCsuc_COMMAND}</LocalDebuggerCommand>
126
+ <LocalDebuggerCommandArguments>${MSVCsuc_ARGS}</LocalDebuggerCommandArguments>
127
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
128
+ <LocalDebuggerWorkingDirectory>${MSVCsuc_WORKING_DIR}</LocalDebuggerWorkingDirectory>
129
+ </PropertyGroup>
130
+ </Project>"
131
+ )
132
+ if(MSVCsuc_VERBOSE)
133
+ message(STATUS "[MSVCsetUserCommand] Write ${CMAKE_CURRENT_BINARY_DIR}/${targetName}.vcxproj.user file")
134
+ message(STATUS " to execute ${MSVCsuc_COMMAND} ${MSVCsuc_ARGS}")
135
+ message(STATUS " from derectory ${MSVCsuc_WORKING_DIR}")
136
+ message(STATUS " on visual studio run debugger button")
137
+ endif()
138
+
139
+ else()
140
+ message(WARNING "PLATEFORM_BITS is undefined...")
141
+ endif()
142
+
143
+ else()
144
+ if(MSVCsuc_VERBOSE)
145
+ message(WARNING "MSVCsetUserCommand is disable because too old MSVC is used (need MSVC10 2010 or newer)")
146
+ endif()
147
+ endif()
148
+
149
+ endfunction()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindASSIMP.cmake ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## Try to find the ASSIMP library
12
+ ## Once done this will define
13
+ ##
14
+ ## ASSIMP_FOUND - system has ASSIMP
15
+ ## ASSIMP_INCLUDE_DIR - The ASSIMP include directory
16
+ ## ASSIMP_LIBRARIES - The libraries needed to use ASSIMP
17
+ ## ASSIMP_CMD - the full path of ASSIMP executable
18
+ ## ASSIMP_DYNAMIC_LIB - the Assimp dynamic lib (available only on windows as .dll file for the moment)
19
+ ##
20
+ ## Edited for using a bugfixed version of Assimp
21
+
22
+ if(NOT ASSIMP_DIR)
23
+ set(ASSIMP_DIR "$ENV{ASSIMP_DIR}" CACHE PATH "ASSIMP root directory")
24
+ message("NO ASSIMP DIR " ASSIMP_DIR )
25
+ file(TO_CMAKE_PATH "/data/graphdeco/share/usr/local" ASSIMP_DIR)
26
+ set(ASSIMP_DIR "/data/graphdeco/share/usr/local" )
27
+ message("SETTING ASSIMP DIR " ASSIMP_DIR )
28
+ endif()
29
+ if(ASSIMP_DIR)
30
+ file(TO_CMAKE_PATH ${ASSIMP_DIR} ASSIMP_DIR)
31
+ file(TO_CMAKE_PATH "/data/graphdeco/share/usr/local" ASSIMP_DIR)
32
+ message("ASSIMP DIR " ASSIMP_DIR )
33
+ endif()
34
+
35
+
36
+ ## set the LIB POSTFIX to find in a right directory according to what kind of compiler we use (32/64bits)
37
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
38
+ set(ASSIMP_SEARCH_LIB "lib64")
39
+ set(ASSIMP_SEARCH_BIN "bin64")
40
+ set(ASSIMP_SEARCH_LIB_PATHSUFFIXE "x64")
41
+ else()
42
+ set(ASSIMP_SEARCH_LIB "lib32")
43
+ set(ASSIMP_SEARCH_BIN "bin32")
44
+ set(ASSIMP_SEARCH_LIB_PATHSUFFIXE "x86")
45
+ endif()
46
+
47
+ set(PROGRAMFILESx86 "PROGRAMFILES(x86)")
48
+
49
+
50
+ FIND_PATH(ASSIMP_INCLUDE_DIR
51
+ NAMES assimp/config.h
52
+ PATHS
53
+ ${ASSIMP_DIR}
54
+ ## linux
55
+ /usr
56
+ /usr/include
57
+ /usr/local
58
+ /opt/local
59
+ ## windows
60
+ "$ENV{PROGRAMFILES}/Assimp"
61
+ "$ENV{${PROGRAMFILESx86}}/Assimp"
62
+ "$ENV{ProgramW6432}/Assimp"
63
+ PATH_SUFFIXES include
64
+ )
65
+
66
+
67
+ FIND_LIBRARY(ASSIMP_LIBRARY
68
+ NAMES assimp-vc140-mt assimp
69
+ PATHS
70
+ ${ASSIMP_DIR}/${ASSIMP_SEARCH_LIB}
71
+ ${ASSIMP_DIR}/lib
72
+ ${ASSIMP_DIR}/lib64
73
+ ## linux
74
+ /usr/${ASSIMP_SEARCH_LIB}
75
+ /usr/local/${ASSIMP_SEARCH_LIB}
76
+ /opt/local/${ASSIMP_SEARCH_LIB}
77
+ /usr/lib
78
+ /usr/lib64
79
+ /usr/local/lib
80
+ /opt/local/lib
81
+ ## windows
82
+ "$ENV{PROGRAMFILES}/Assimp/${ASSIMP_SEARCH_LIB}"
83
+ "$ENV{${PROGRAMFILESx86}}/Assimp/${ASSIMP_SEARCH_LIB}"
84
+ "$ENV{ProgramW6432}/Assimp/${ASSIMP_SEARCH_LIB}"
85
+ "$ENV{PROGRAMFILES}/Assimp/lib"
86
+ "$ENV{${PROGRAMFILESx86}}/Assimp/lib"
87
+ "$ENV{ProgramW6432}/Assimp/lib"
88
+ PATH_SUFFIXES ${ASSIMP_SEARCH_LIB_PATHSUFFIXE}
89
+ )
90
+ set(ASSIMP_LIBRARIES ${ASSIMP_LIBRARY})
91
+
92
+
93
+ if(ASSIMP_LIBRARY)
94
+ get_filename_component(ASSIMP_LIBRARY_DIR ${ASSIMP_LIBRARY} PATH)
95
+ if(WIN32)
96
+ file(GLOB ASSIMP_DYNAMIC_LIB "${ASSIMP_LIBRARY_DIR}/assimp*.dll")
97
+ if(NOT ASSIMP_DYNAMIC_LIB)
98
+ message("ASSIMP_DYNAMIC_LIB is missing... at ${ASSIMP_LIBRARY_DIR}")
99
+ endif()
100
+ endif()
101
+ set(ASSIMP_DYNAMIC_LIB ${ASSIMP_DYNAMIC_LIB} CACHE PATH "Windows dll location")
102
+ endif()
103
+
104
+ MARK_AS_ADVANCED(ASSIMP_DYNAMIC_LIB ASSIMP_INCLUDE_DIR ASSIMP_LIBRARIES)
105
+
106
+ INCLUDE(FindPackageHandleStandardArgs)
107
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASSIMP
108
+ REQUIRED_VARS ASSIMP_INCLUDE_DIR ASSIMP_LIBRARIES
109
+ FAIL_MESSAGE "ASSIMP wasn't found correctly. Set ASSIMP_DIR to the root SDK installation directory."
110
+ )
111
+
112
+ if(NOT ASSIMP_FOUND)
113
+ set(ASSIMP_DIR "" CACHE STRING "Path to ASSIMP install directory")
114
+ endif()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindEGL.cmake ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #.rst:
2
+ # FindEGL
3
+ # -------
4
+ #
5
+ # Try to find EGL.
6
+ #
7
+ # This will define the following variables:
8
+ #
9
+ # ``EGL_FOUND``
10
+ # True if (the requested version of) EGL is available
11
+ # ``EGL_VERSION``
12
+ # The version of EGL; note that this is the API version defined in the
13
+ # headers, rather than the version of the implementation (eg: Mesa)
14
+ # ``EGL_LIBRARIES``
15
+ # This can be passed to target_link_libraries() instead of the ``EGL::EGL``
16
+ # target
17
+ # ``EGL_INCLUDE_DIRS``
18
+ # This should be passed to target_include_directories() if the target is not
19
+ # used for linking
20
+ # ``EGL_DEFINITIONS``
21
+ # This should be passed to target_compile_options() if the target is not
22
+ # used for linking
23
+ #
24
+ # If ``EGL_FOUND`` is TRUE, it will also define the following imported target:
25
+ #
26
+ # ``EGL::EGL``
27
+ # The EGL library
28
+ #
29
+ # In general we recommend using the imported target, as it is easier to use.
30
+ # Bear in mind, however, that if the target is in the link interface of an
31
+ # exported library, it must be made available by the package config file.
32
+ #
33
+ # Since pre-1.0.0.
34
+
35
+ #=============================================================================
36
+ # Copyright 2014 Alex Merry <[email protected]>
37
+ # Copyright 2014 Martin Gräßlin <[email protected]>
38
+ #
39
+ # Redistribution and use in source and binary forms, with or without
40
+ # modification, are permitted provided that the following conditions
41
+ # are met:
42
+ #
43
+ # 1. Redistributions of source code must retain the copyright
44
+ # notice, this list of conditions and the following disclaimer.
45
+ # 2. Redistributions in binary form must reproduce the copyright
46
+ # notice, this list of conditions and the following disclaimer in the
47
+ # documentation and/or other materials provided with the distribution.
48
+ # 3. The name of the author may not be used to endorse or promote products
49
+ # derived from this software without specific prior written permission.
50
+ #
51
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
52
+ # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53
+ # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54
+ # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
55
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56
+ # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61
+ #=============================================================================
62
+
63
+ include(CheckCXXSourceCompiles)
64
+ include(CMakePushCheckState)
65
+
66
+ # Use pkg-config to get the directories and then use these values
67
+ # in the FIND_PATH() and FIND_LIBRARY() calls
68
+ find_package(PkgConfig)
69
+ pkg_check_modules(PKG_EGL QUIET egl)
70
+
71
+ set(EGL_DEFINITIONS ${PKG_EGL_CFLAGS_OTHER})
72
+
73
+ find_path(EGL_INCLUDE_DIR
74
+ NAMES
75
+ EGL/egl.h
76
+ HINTS
77
+ ${PKG_EGL_INCLUDE_DIRS}
78
+ )
79
+ find_library(EGL_LIBRARY
80
+ NAMES
81
+ EGL
82
+ HINTS
83
+ ${PKG_EGL_LIBRARY_DIRS}
84
+ )
85
+
86
+ # NB: We do *not* use the version information from pkg-config, as that
87
+ # is the implementation version (eg: the Mesa version)
88
+ if(EGL_INCLUDE_DIR)
89
+ # egl.h has defines of the form EGL_VERSION_x_y for each supported
90
+ # version; so the header for EGL 1.1 will define EGL_VERSION_1_0 and
91
+ # EGL_VERSION_1_1. Finding the highest supported version involves
92
+ # finding all these defines and selecting the highest numbered.
93
+ file(READ "${EGL_INCLUDE_DIR}/EGL/egl.h" _EGL_header_contents)
94
+ string(REGEX MATCHALL
95
+ "[ \t]EGL_VERSION_[0-9_]+"
96
+ _EGL_version_lines
97
+ "${_EGL_header_contents}"
98
+ )
99
+ unset(_EGL_header_contents)
100
+ foreach(_EGL_version_line ${_EGL_version_lines})
101
+ string(REGEX REPLACE
102
+ "[ \t]EGL_VERSION_([0-9_]+)"
103
+ "\\1"
104
+ _version_candidate
105
+ "${_EGL_version_line}"
106
+ )
107
+ string(REPLACE "_" "." _version_candidate "${_version_candidate}")
108
+ if(NOT DEFINED EGL_VERSION OR EGL_VERSION VERSION_LESS _version_candidate)
109
+ set(EGL_VERSION "${_version_candidate}")
110
+ endif()
111
+ endforeach()
112
+ unset(_EGL_version_lines)
113
+ endif()
114
+
115
+ cmake_push_check_state(RESET)
116
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}")
117
+ list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}")
118
+
119
+ check_cxx_source_compiles("
120
+ #include <EGL/egl.h>
121
+
122
+ int main(int argc, char *argv[]) {
123
+ EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0;
124
+ eglDestroyContext(dpy, ctx);
125
+ }" HAVE_EGL)
126
+
127
+ cmake_pop_check_state()
128
+
129
+ include(FindPackageHandleStandardArgs)
130
+ find_package_handle_standard_args(EGL
131
+ FOUND_VAR
132
+ EGL_FOUND
133
+ REQUIRED_VARS
134
+ EGL_LIBRARY
135
+ EGL_INCLUDE_DIR
136
+ HAVE_EGL
137
+ VERSION_VAR
138
+ EGL_VERSION
139
+ )
140
+
141
+ if(EGL_FOUND AND NOT TARGET EGL::EGL)
142
+ add_library(EGL::EGL UNKNOWN IMPORTED)
143
+ set_target_properties(EGL::EGL PROPERTIES
144
+ IMPORTED_LOCATION "${EGL_LIBRARY}"
145
+ INTERFACE_COMPILE_OPTIONS "${EGL_DEFINITIONS}"
146
+ INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}"
147
+ )
148
+ endif()
149
+
150
+ mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR HAVE_EGL)
151
+
152
+ # compatibility variables
153
+ set(EGL_LIBRARIES ${EGL_LIBRARY})
154
+ set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
155
+ set(EGL_VERSION_STRING ${EGL_VERSION})
156
+
157
+ include(FeatureSummary)
158
+ set_package_properties(EGL PROPERTIES
159
+ URL "https://www.khronos.org/egl/"
160
+ DESCRIPTION "A platform-agnostic mechanism for creating rendering surfaces for use with other graphics libraries, such as OpenGL|ES and OpenVG."
161
+ )
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindEmbree.cmake ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+ ## Important Note:
11
+ ## This is not an official Find*cmake. It has been written for searching through
12
+ ## a custom path (EMBREE_DIR) before checking elsewhere.
13
+ ##
14
+ ## FindEMBREE.cmake
15
+ ## Find EMBREE's includes and library
16
+ ##
17
+ ## This module defines :
18
+ ## [in] EMBREE_DIR, The base directory to search for EMBREE (as cmake var or env var)
19
+ ## [out] EMBREE_INCLUDE_DIR where to find EMBREE.h
20
+ ## [out] EMBREE_LIBRARIES, EMBREE_LIBRARY, libraries to link against to use EMBREE
21
+ ## [out] EMBREE_FOUND, If false, do not try to use EMBREE.
22
+ ##
23
+
24
+
25
+ if(NOT EMBREE_DIR)
26
+ set(EMBREE_DIR "$ENV{EMBREE_DIR}" CACHE PATH "EMBREE root directory")
27
+ endif()
28
+ if(EMBREE_DIR)
29
+ file(TO_CMAKE_PATH ${EMBREE_DIR} EMBREE_DIR)
30
+ endif()
31
+
32
+
33
+ ## set the LIB POSTFIX to find in a right directory according to what kind of compiler we use (32/64bits)
34
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
35
+ set(EMBREE_SEARCH_LIB "lib64")
36
+ set(EMBREE_SEARCH_BIN "bin64")
37
+ set(EMBREE_SEARCH_LIB_PATHSUFFIXE "x64")
38
+ else()
39
+ set(EMBREE_SEARCH_LIB "lib32")
40
+ set(EMBREE_SEARCH_BIN "bin32")
41
+ set(EMBREE_SEARCH_LIB_PATHSUFFIXE "x86")
42
+ endif()
43
+
44
+ set(PROGRAMFILESx86 "PROGRAMFILES(x86)")
45
+
46
+ FIND_PATH(EMBREE_INCLUDE_DIR
47
+ NAMES embree3/rtcore_geometry.h
48
+ PATHS
49
+ ${EMBREE_DIR}
50
+ ## linux
51
+ /usr
52
+ /usr/local
53
+ /opt/local
54
+ ## windows
55
+ "$ENV{PROGRAMFILES}/EMBREE"
56
+ "$ENV{${PROGRAMFILESx86}}/EMBREE"
57
+ "$ENV{ProgramW6432}/EMBREE"
58
+ PATH_SUFFIXES include
59
+ )
60
+
61
+ FIND_LIBRARY(EMBREE_LIBRARY
62
+ NAMES embree3
63
+ PATHS
64
+ ${EMBREE_DIR}/${EMBREE_SEARCH_LIB}
65
+ ${EMBREE_DIR}/lib
66
+ ## linux
67
+ /usr/${EMBREE_SEARCH_LIB}
68
+ /usr/local/${EMBREE_SEARCH_LIB}
69
+ /opt/local/${EMBREE_SEARCH_LIB}
70
+ /usr/lib
71
+ /usr/local/lib
72
+ /opt/local/lib
73
+ ## windows
74
+ "$ENV{PROGRAMFILES}/EMBREE/${EMBREE_SEARCH_LIB}"
75
+ "$ENV{${PROGRAMFILESx86}}/EMBREE/${EMBREE_SEARCH_LIB}"
76
+ "$ENV{ProgramW6432}/EMBREE/${EMBREE_SEARCH_LIB}"
77
+ "$ENV{PROGRAMFILES}/EMBREE/lib"
78
+ "$ENV{${PROGRAMFILESx86}}/EMBREE/lib"
79
+ "$ENV{ProgramW6432}/EMBREE/lib"
80
+ PATH_SUFFIXES ${EMBREE_SEARCH_LIB_PATHSUFFIXE}
81
+ )
82
+ set(EMBREE_LIBRARIES ${EMBREE_LIBRARY})
83
+
84
+ MARK_AS_ADVANCED(EMBREE_INCLUDE_DIR EMBREE_LIBRARIES)
85
+
86
+ INCLUDE(FindPackageHandleStandardArgs)
87
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(EMBREE
88
+ REQUIRED_VARS EMBREE_INCLUDE_DIR EMBREE_LIBRARIES
89
+ FAIL_MESSAGE "EMBREE wasn't found correctly. Set EMBREE_DIR to the root SDK installation directory."
90
+ )
91
+
92
+ if(NOT EMBREE_FOUND)
93
+ set(EMBREE_DIR "" CACHE STRING "Path to EMBREE install directory")
94
+ endif()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindFFMPEG.cmake ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## Try to find the FFMPEG library
12
+ ## Once done this will define
13
+ ##
14
+ ## FFMPEG_FOUND - system has FFmpeg
15
+ ## FFMPEG_INCLUDE_DIR - The FFmpeg include directory
16
+ ## FFMPEG_LIBRARIES - The libraries needed to use FFmpeg
17
+ ## FFMPEG_DYNAMIC_LIBS - DLLs for windows
18
+
19
+
20
+ if(NOT FFMPEG_DIR)
21
+ set(FFMPEG_DIR "$ENV{FFMPEG_DIR}" CACHE PATH "FFMPEG_DIR root directory")
22
+ endif()
23
+
24
+ if(FFMPEG_DIR)
25
+ file(TO_CMAKE_PATH ${FFMPEG_DIR} FFMPEG_DIR)
26
+ endif()
27
+
28
+ MACRO(FFMPEG_FIND varname shortname headername)
29
+
30
+ # Path to include dirs
31
+ FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS
32
+ NAMES "lib${shortname}/${headername}"
33
+ PATHS
34
+ "${FFMPEG_DIR}/include" # modify this to adapt according to OS/compiler
35
+ "/usr/include"
36
+ "/usr/include/ffmpeg"
37
+ )
38
+
39
+ #Add libraries
40
+ IF(${FFMPEG_${varname}_INCLUDE_DIRS} STREQUAL "FFMPEG_${varname}_INCLUDE_DIR-NOTFOUND")
41
+ MESSAGE(STATUS "Can't find includes for ${shortname}...")
42
+ ELSE()
43
+ FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
44
+ NAMES ${shortname}
45
+ PATHS
46
+ ${FFMPEG_DIR}/lib
47
+ "/usr/lib"
48
+ "/usr/lib64"
49
+ "/usr/local/lib"
50
+ "/usr/local/lib64"
51
+ )
52
+
53
+ # set libraries and other variables
54
+ SET(FFMPEG_${varname}_FOUND 1)
55
+ SET(FFMPEG_${varname}_INCLUDE_DIRS ${FFMPEG_${varname}_INCLUDE_DIR})
56
+ SET(FFMPEG_${varname}_LIBS ${FFMPEG_${varname}_LIBRARIES})
57
+ ENDIF()
58
+ ENDMACRO(FFMPEG_FIND)
59
+
60
+ #Calls to ffmpeg_find to get librarires ------------------------------
61
+ FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
62
+ FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
63
+ FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
64
+ FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
65
+ FFMPEG_FIND(LIBSWSCALE swscale swscale.h)
66
+
67
+ # check if libs are found and set FFMPEG related variables
68
+ #SET(FFMPEG_FOUND "NO")
69
+ IF(FFMPEG_LIBAVFORMAT_FOUND
70
+ AND FFMPEG_LIBAVDEVICE_FOUND
71
+ AND FFMPEG_LIBAVCODEC_FOUND
72
+ AND FFMPEG_LIBAVUTIL_FOUND
73
+ AND FFMPEG_LIBSWSCALE_FOUND)
74
+
75
+ # All ffmpeg libs are here
76
+ SET(FFMPEG_FOUND "YES")
77
+ SET(FFMPEG_INCLUDE_DIR ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
78
+ SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
79
+ SET(FFMPEG_LIBRARIES
80
+ ${FFMPEG_LIBAVFORMAT_LIBS}
81
+ ${FFMPEG_LIBAVDEVICE_LIBS}
82
+ ${FFMPEG_LIBAVCODEC_LIBS}
83
+ ${FFMPEG_LIBAVUTIL_LIBS}
84
+ ${FFMPEG_LIBSWSCALE_LIBS} )
85
+
86
+ # add dynamic libraries
87
+ if(WIN32)
88
+ file(GLOB FFMPEG_DYNAMIC_LIBS "${FFMPEG_DIR}/bin/*.dll")
89
+ if(NOT FFMPEG_DYNAMIC_LIBS)
90
+ message("FFMPEG_DYNAMIC_LIBS is missing...")
91
+ endif()
92
+ set(FFMPEG_DYNAMIC_LIBS ${FFMPEG_DYNAMIC_LIBS} CACHE PATH "Windows dll location")
93
+ endif()
94
+
95
+ mark_as_advanced(FFMPEG_INCLUDE_DIR FFMPEG_LIBRARY_DIRS FFMPEG_LIBRARIES FFMPEG_DYNAMIC_LIBS)
96
+ ELSE ()
97
+ MESSAGE(STATUS "Could not find FFMPEG")
98
+ ENDIF()
99
+
100
+
101
+ INCLUDE(FindPackageHandleStandardArgs)
102
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFMPEG
103
+ REQUIRED_VARS FFMPEG_INCLUDE_DIR FFMPEG_LIBRARIES
104
+ FAIL_MESSAGE "FFmpeg wasn't found correctly. Set FFMPEG_DIR to the root SDK installation directory."
105
+ )
106
+
107
+ if(NOT FFMPEG_FOUND)
108
+ set(FFMPEG_DIR "" CACHE STRING "Path to FFmpeg install directory")
109
+ endif()
110
+
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Modules/FindGLFW.cmake ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##=============================================================================
2
+ ##
3
+ ## Copyright (c) Kitware, Inc.
4
+ ## All rights reserved.
5
+ ## See LICENSE.txt for details.
6
+ ##
7
+ ## This software is distributed WITHOUT ANY WARRANTY; without even
8
+ ## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9
+ ## PURPOSE. See the above copyright notice for more information.
10
+ ##
11
+ ## Copyright 2016 Sandia Corporation.
12
+ ## Copyright 2016 UT-Battelle, LLC.
13
+ ## Copyright 2016 Los Alamos National Security.
14
+ ##
15
+ ## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
16
+ ## the U.S. Government retains certain rights in this software.
17
+ ## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
18
+ ## Laboratory (LANL), the U.S. Government retains certain rights in
19
+ ## this software.
20
+ ##
21
+ ##=============================================================================
22
+ # Try to find EGL library and include dir.
23
+ # Once done this will define
24
+ #
25
+ # GLFW_FOUND
26
+ # GLFW_INCLUDE_DIR
27
+ # GLFW_LIBRARY
28
+ #
29
+
30
+ include(FindPackageHandleStandardArgs)
31
+
32
+ if (WIN32)
33
+ find_path( GLFW_INCLUDE_DIR
34
+ NAMES
35
+ GLFW/glfw3.h
36
+ PATHS
37
+ ${PROJECT_SOURCE_DIR}/shared_external/glfw/include
38
+ ${PROJECT_SOURCE_DIR}/../shared_external/glfw/include
39
+ ${GLFW_LOCATION}/include
40
+ $ENV{GLFW_LOCATION}/include
41
+ $ENV{PROGRAMFILES}/GLFW/include
42
+ ${GLFW_LOCATION}
43
+ $ENV{GLFW_LOCATION}
44
+ DOC "The directory where GLFW/glfw3.h resides" )
45
+ if(ARCH STREQUAL "x86")
46
+ find_library( GLFW_LIBRARY
47
+ NAMES
48
+ glfw3
49
+ PATHS
50
+ ${GLFW_LOCATION}/lib
51
+ $ENV{GLFW_LOCATION}/lib
52
+ $ENV{PROGRAMFILES}/GLFW/lib
53
+ DOC "The GLFW library")
54
+ else()
55
+ find_library( GLFW_LIBRARY
56
+ NAMES
57
+ glfw3
58
+ PATHS
59
+ ${GLFW_LOCATION}/lib
60
+ $ENV{GLFW_LOCATION}/lib
61
+ $ENV{PROGRAMFILES}/GLFW/lib
62
+ DOC "The GLFW library")
63
+ endif()
64
+ endif ()
65
+
66
+ if (${CMAKE_HOST_UNIX})
67
+ message("GFLW LOCATION " $ENV{GLFW_LOCATION} )
68
+ find_path( GLFW_INCLUDE_DIR
69
+ NAMES
70
+ GLFW/glfw3.h
71
+ PATHS
72
+ # ${GLFW_LOCATION}/include
73
+ $ENV{GLFW_LOCATION}/include
74
+ # /usr/include
75
+ # /usr/local/include
76
+ # /sw/include
77
+ # /opt/local/include
78
+ # NO_DEFAULT_PATH
79
+ DOC "The directory where GLFW/glfw3.h resides"
80
+ )
81
+ find_library( GLFW_LIBRARY
82
+ NAMES
83
+ glfw3 glfw
84
+ PATHS
85
+ # ${GLFW_LOCATION}/lib
86
+ $ENV{GLFW_LOCATION}/lib
87
+ $ENV{GLFW_LOCATION}/lib64
88
+ # /usr/lib64
89
+ # /usr/lib
90
+ # /usr/local/lib64
91
+ # /usr/local/lib
92
+ # /sw/lib
93
+ # /opt/local/lib
94
+ # /usr/lib/x86_64-linux-gnu
95
+ # NO_DEFAULT_PATH
96
+ DOC "The GLFW library")
97
+
98
+ set( GLFW_INCLUDE_DIR $ENV{GLFW_LOCATION}/include )
99
+ set( GLFW_LIBRARY $ENV{GLFW_LOCATION}/lib64/libglfw3.a )
100
+ message("*************==========> FindGLFW .cmake " ${GLFW_INCLUDE_DIR} " LIB " ${GLFW_LIBRARY} )
101
+ endif ()
102
+
103
+ find_package_handle_standard_args(GLFW DEFAULT_MSG
104
+ GLFW_INCLUDE_DIR
105
+ GLFW_LIBRARY
106
+ )
107
+
108
+ mark_as_advanced( GLFW_FOUND )
109
+
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/Win3rdParty.cmake ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## This file should be include and use only on WIN32 OS and once
12
+ ## It allow to auto check/download and use a preconfigured 3rdParty binaries for cmake usage
13
+ ## It use the downloadAndExtractZipFile cmake module to work.
14
+ ##
15
+ if(__Win3rdParty_cmake_INCLUDED__)
16
+ return()
17
+ else()
18
+ set(__Win3rdParty_cmake_INCLUDED__ ON)
19
+ endif()
20
+
21
+
22
+ ##
23
+ ## To be sure to reset an empty cached variable but keep any other kind of variables
24
+ ##
25
+ ## Usage:
26
+ ## check_cached_var(<var> <resetedCachedValue> <cacheType> <cacheDoc> [FORCE])
27
+ ##
28
+ ## <var> is the cached cmake variable you need to reset
29
+ ## <resetedCachedValue> is the new default value of the reseted cached cmake variable
30
+ ## <cacheType> is the kind of GUI cache input can be : FILEPATH; PATH; STRING or BOOL
31
+ ## <cacheDoc> is the associated GUI cache input documentation display in the GUI
32
+ ## FORCE option could be use to reset a cached variable even if it is not empty.
33
+ ##
34
+ macro(check_cached_var var resetedCachedValue cacheType cacheDoc)
35
+ # message(STATUS "inside check_cached_var macro. argn=${ARGN}")
36
+ cmake_parse_arguments(ccv "FORCE" "" "" ${ARGN})
37
+
38
+ if(ccv_FORCE)
39
+ set(FORCE FORCE)
40
+ else()
41
+ set(FORCE )
42
+ endif()
43
+
44
+ if(NOT ${var} OR ccv_FORCE)
45
+ unset(${var} CACHE)
46
+ # message(STATUS "setting new cache value. var ${var} = ${resetedCachedValue}")
47
+ set(${var} "${resetedCachedValue}" CACHE ${cacheType} "${cacheDoc}" ${FORCE})
48
+ endif()
49
+ endmacro()
50
+
51
+
52
+ ##
53
+ ## Win3rdParty function allow to specify a directory which contain all necessary windows dependenties.
54
+ ## By uploading 3rdParty directory (which contain dependencies, *.lib, *.dll... for a specific version of compiler) onto Gforge file tab,
55
+ ## you get back an URL of download you can give to this function with a directory name. So you can provide multiple 3rdParty version of same dependencies (MSVC11, MSVC12...).
56
+ ## By providing a prefix to this function, you allow to use different kind of 3rdParty which can be handled by CMAKE OPTIONS depending on what your framework need for example.
57
+ ##
58
+ ## Usage 1:
59
+ ## Win3rdParty(<prefix> MSVC<XX> <DirName> <URL>
60
+ ## [MSVC<XX> <DirName> <URL>] [...]
61
+ ## [VCID] [DEFAULT_USE] [VERBOSE] )
62
+ ##
63
+ ## * <prefix> allow to identify which 3rdParty you process (prefix name)
64
+ ## * MSVC<XX> flag could be MSVC11 or MSVC12 (any element of the MSVC_VERSIONS_LIST) and refer to a 3rdParty compiler with :
65
+ ## * <DirName> which will be the local pathName of the downloaded 3rdParty : relative to CMAKE_BINARY_DIR
66
+ ## * <URL> which is the link location of the 3rdParty zip
67
+ ## * VCID flag will make available a cache variable ${prefix}_WIN3RDPARTY_VCID
68
+ ## * DEFAULT_USE flag [ON|OFF] may be used to set default value of cmake cached variable : <prefix>_WIN3RDPARTY_USE [default to ON]
69
+ ##
70
+ ## WARNING:
71
+ ## This function define CACHE variables you can use after :
72
+ ## * ${prefix}_WIN3RDPARTY_USE : allow to check/downloaded win3rdParty dir (it will force the cached variables for this dependency folder generally <prefix>_DIR>)
73
+ ## * ${prefix}_WIN3RDPARTY_DIR : where is your local win3rdParty dir (the PATH)
74
+ ## * ${prefix}_WIN3RDPARTY_VCID : [if VCID flag is used] the MSVC id (commonly used to prefix/suffix library name, see boost or CGAL)
75
+ ##
76
+ ## If you want to add a win3rdParty version, please:
77
+ ## 1- build dependencies on your local side with the compiler you want
78
+ ## 2- build your own zip with your built dependencies
79
+ ## 3- upload it (onto the forge where the project is stored) and copy the link location in order to use it for this function
80
+ ## 4- if you just introduced a new MSVC version, add it to the MSVC_VERSIONS_LIST bellow
81
+ ##
82
+ ## In a second pass, you can also use this function to set necessary cmake cached variables in order to let cmake find packages of these 3rdParty.
83
+ ##
84
+ ## Usage 2:
85
+ ## win3rdParty(<prefix> [VERBOSE] MULTI_SET|SET
86
+ ## CHECK_CACHED_VAR <cmakeVar> <cmakeCacheType> [LIST] <cmakeValue> [DOC <stringToolTips>]
87
+ ## [ CHECK_CACHED_VAR <cmakeVar> <cmakeCacheType> [LIST] <cmakeValue> [DOC <stringToolTips>] ] [...]
88
+ ##
89
+ ## * MULTI_SET or SET flags are used to tell cmake that all next arguments will use repeated flags with differents entries (SET mean we will provide only one set of arguments, without repetition)
90
+ ## * CHECK_CACHED_VAR are the repeated flag which contain differents entries
91
+ ## * <cmakeVar> is the cmake variable you want to be cached for the project
92
+ ## * <cmakeCacheType> is the kind of cmake variable (couble be: FILEPATH; PATH; STRING or BOOL) => see check_cached_var.
93
+ ## * LIST optional flag could be used with CHECK_CACHED_VAR when <cmakeCacheType> = STRING. It allow to handle multiple STRINGS value list.
94
+ ## * <cmakeValue> is the value of the variable (if FILEPATH, PATH or STRING: use quotes, if BOOL : use ON/OFF)
95
+ ## * DOC optional flag is used to have a tooltips info about this new cmake variable entry into the GUI (use quotes).
96
+ ##
97
+ ## Full example 1 :
98
+ ## win3rdParty(COMMON MSVC11 "win3rdParty-MSVC11" "https://path.to/an.archive.7z"
99
+ ## SET CHECK_CACHED_VAR SuiteSparse_DIR PATH "SuiteSparse-4.2.1" DOC "default empty doc"
100
+ ## )
101
+ ##
102
+ ## WARNING:
103
+ ## For the 2nd usage (with MULTI_SET), if you planned to set some CACHED_VAR using/composed by ${prefix}_WIN3RDPARTY_* just set in this macro (usage 1),
104
+ ## then (due to the not yet existing var) you will need to call this function 2 times :
105
+ ## One for the 1st usage (downloading of the current compiler 3rdParty).
106
+ ## One for the MLUTI_SET flag which will use existsing ${prefix}_WIN3RDPARTY_* cached var.
107
+ ##
108
+ ## Full example 2 :
109
+ ## win3rdParty(COMMON MSVC11 "win3rdParty-MSVC11" "https://path.to/an.archive.7z")
110
+ ## win3rdParty(COMMON MULTI_SET
111
+ ## CHECK_CACHED_VAR CGAL_INCLUDE_DIR PATH "CGAL-4.3/include" DOC "default empty doc"
112
+ ## CHECK_CACHED_VAR CGAL_LIBRARIES STRING LIST "debug;CGAL-4.3/lib${LIB_POSTFIX}/CGAL-${WIN3RDPARTY_COMMON_VCID}-mt-gd-4.3.lib;optimized;CGAL-4.3/lib${LIB_POSTFIX}/CGAL-${WIN3RDPARTY_COMMON_VCID}-mt-4.3.lib"
113
+ ##
114
+ ##
115
+ ## WARNING: This function use internaly :
116
+ ## * downloadAndExtractZipFile.cmake
117
+ ## * parse_arguments_multi.cmake
118
+ ## * check_cached_var macro
119
+ ##
120
+ function(win3rdParty prefix )
121
+
122
+ # ARGV: list of all arguments given to the macro/function
123
+ # ARGN: list of remaining arguments
124
+
125
+ if(NOT WIN32)
126
+ return()
127
+ endif()
128
+
129
+ ## set the handled version of MSVC
130
+ ## if you plan to add a win3rdParty dir to download with a new MSVC version: build the win3rdParty dir and add the MSCV entry here.
131
+ set(MSVC_VERSIONS_LIST "MSVC17;MSVC11;MSVC12;MSVC14")
132
+
133
+ #include(CMakeParseArguments) # CMakeParseArguments is obsolete since cmake 3.5
134
+ # cmake_parse_arguments (<prefix> <options> <one_value_keywords> <multi_value_keywords> args)
135
+ # <options> : options (flags) pass to the macro
136
+ # <one_value_keywords> : options that neeed a value
137
+ # <multi_value_keywords> : options that neeed more than one value
138
+ cmake_parse_arguments(w3p "VCID" "VERBOSE;TIMEOUT;DEFAULT_USE" "${MSVC_VERSIONS_LIST};MULTI_SET;SET" ${ARGN})
139
+
140
+ # message(STATUS "value of w3p_VCID = ${w3p_VCID}")
141
+ # message(STATUS "value of w3p_VERBOSE = ${w3p_VERBOSE}")
142
+ # message(STATUS "value of w3p_TIMEOUT = ${w3p_TIMEOUT}")
143
+ # message(STATUS "value of w3p_DEFAULT_USE = ${w3p_DEFAULT_USE}")
144
+
145
+ # foreach (loop_var ${MSVC_VERSIONS_LIST})
146
+ # message(STATUS "value of w3p_${loop_var} = ${w3p_${loop_var}}")
147
+ # endforeach(loop_var)
148
+
149
+ # message(STATUS "value of w3p_MULTI_SET = ${w3p_MULTI_SET}")
150
+ # message(STATUS "value of w3p_SET = ${w3p_SET}")
151
+
152
+ # message("values for MSVC = ${w3p_MSVC14}")
153
+
154
+ if(NOT w3p_TIMEOUT)
155
+ set(w3p_TIMEOUT 300)
156
+ endif()
157
+
158
+ if(NOT DEFINED w3p_DEFAULT_USE)
159
+ set(w3p_DEFAULT_USE ON)
160
+ endif()
161
+
162
+
163
+ ## 1st use (check/update|download) :
164
+ set(${prefix}_WIN3RDPARTY_USE ${w3p_DEFAULT_USE} CACHE BOOL "Use required 3rdParty binaries from ${prefix}_WIN3RDPARTY_DIR or download it if not exist")
165
+
166
+
167
+ ## We want to test if each version of MSVC was filled by the function (see associated parameters)
168
+ ## As CMake is running only for one version of MSVC, if that MSVC version was filled, we get back associated parameters,
169
+ ## otherwise we can't use the downloadAndExtractZipFile with win3rdParty.
170
+ set(enableWin3rdParty OFF)
171
+
172
+ foreach(MSVC_VER ${MSVC_VERSIONS_LIST})
173
+ if(${MSVC_VER} AND w3p_${MSVC_VER} OR ${MSVC_TOOLSET_VERSION} EQUAL 143 AND ${MSVC_VER} STREQUAL "MSVC17")
174
+ list(LENGTH w3p_${MSVC_VER} count)
175
+ if("${count}" LESS "2")
176
+ #message(WARNING "You are using ${MSVC_VER} with ${prefix}_WIN3RDPARTY_USE=${${prefix}_WIN3RDPARTY_USE}, but win3rdParty function isn't filled for ${MSVC_VER}!")
177
+ else()
178
+ list(GET w3p_${MSVC_VER} 0 Win3rdPartyName)
179
+ list(GET w3p_${MSVC_VER} 1 Win3rdPartyUrl)
180
+ if(w3p_VCID)
181
+ ## try to get the VcId of MSVC. See also MSVC_VERSION cmake var in the doc.
182
+ string(REGEX REPLACE "MS([A-Za-z_0-9-]+)" "\\1" vcId ${MSVC_VER})
183
+ string(TOLOWER ${vcId} vcId)
184
+ set(${prefix}_WIN3RDPARTY_VCID "${vcId}0" CACHE STRING "the MSVC id (commonly used to prefix/suffix library name, see boost or CGAL)")
185
+ mark_as_advanced(${prefix}_WIN3RDPARTY_VCID)
186
+ endif()
187
+ set(enableWin3rdParty ON)
188
+ set(suffixCompilerID ${MSVC_VER})
189
+ break()
190
+ endif()
191
+ endif()
192
+ endforeach()
193
+ ## If previous step succeed to get MSVC dirname and URL of the current MSVC version, use it to auto download/update the win3rdParty dir
194
+ if(enableWin3rdParty AND ${prefix}_WIN3RDPARTY_USE)
195
+
196
+ if(IS_ABSOLUTE "${Win3rdPartyName}")
197
+ else()
198
+ set(Win3rdPartyName "${CMAKE_BINARY_DIR}/${Win3rdPartyName}")
199
+ endif()
200
+
201
+ if(NOT EXISTS "${Win3rdPartyName}")
202
+ file(MAKE_DIRECTORY ${Win3rdPartyName})
203
+ endif()
204
+
205
+ include(downloadAndExtractZipFile)
206
+ downloadAndExtractZipFile( "${Win3rdPartyUrl}" ## URL link location
207
+ "Win3rdParty-${prefix}-${suffixCompilerID}.7z" ## where download it: relative path, so default to CMAKE_BINARY_DIR
208
+ "${Win3rdPartyName}" ## where extract it : fullPath (default relative to CMAKE_BINARY_DIR)
209
+ CHECK_DIRTY_URL "${Win3rdPartyName}/Win3rdPartyUrl" ## last downloaded url file : fullPath (default relative to CMAKE_BINARY_DIR)
210
+ TIMEOUT ${w3p_TIMEOUT}
211
+ VERBOSE ${w3p_VERBOSE}
212
+ )
213
+ file(GLOB checkDl "${Win3rdPartyName}/*")
214
+ list(LENGTH checkDl checkDlCount)
215
+ if("${checkDlCount}" GREATER "1")
216
+ else()
217
+ message("The downloadAndExtractZipFile didn't work...?")
218
+ set(enableWin3rdParty OFF)
219
+ endif()
220
+ endif()
221
+
222
+ ## Try to auto set ${prefix}_WIN3RDPARTY_DIR or let user set it manually
223
+ set(${prefix}_WIN3RDPARTY_DIR "" CACHE PATH "windows ${Win3rdPartyName} dir to ${prefix} dependencies of the project")
224
+
225
+ if(NOT ${prefix}_WIN3RDPARTY_DIR AND ${prefix}_WIN3RDPARTY_USE)
226
+ if(EXISTS "${Win3rdPartyName}")
227
+ unset(${prefix}_WIN3RDPARTY_DIR CACHE)
228
+ set(${prefix}_WIN3RDPARTY_DIR "${Win3rdPartyName}" CACHE PATH "dir to ${prefix} dependencies of the project")
229
+ endif()
230
+ endif()
231
+
232
+ if(EXISTS ${${prefix}_WIN3RDPARTY_DIR})
233
+ message(STATUS "Found a 3rdParty ${prefix} dir : ${${prefix}_WIN3RDPARTY_DIR}.")
234
+ set(enableWin3rdParty ON)
235
+ elseif(${prefix}_WIN3RDPARTY_USE)
236
+ message(WARNING "${prefix}_WIN3RDPARTY_USE=${${prefix}_WIN3RDPARTY_USE} but ${prefix}_WIN3RDPARTY_DIR=${${prefix}_WIN3RDPARTY_DIR}.")
237
+ set(enableWin3rdParty OFF)
238
+ endif()
239
+
240
+ ## Final check
241
+ if(NOT enableWin3rdParty)
242
+ message("Disable ${prefix}_WIN3RDPARTY_USE (cmake cached var will be not set), due to a win3rdParty problem.")
243
+ message("You still can set ${prefix}_WIN3RDPARTY_DIR to an already downloaded Win3rdParty directory location.")
244
+ set(${prefix}_WIN3RDPARTY_USE OFF CACHE BOOL "Use required 3rdParty binaries from ${prefix}_WIN3RDPARTY_DIR or download it if not exist" FORCE)
245
+ endif()
246
+
247
+ ## 2nd use : handle multi values args to set cached cmake variables in order to ease the next find_package call
248
+ if(${prefix}_WIN3RDPARTY_USE AND ${prefix}_WIN3RDPARTY_DIR)
249
+ if(w3p_VERBOSE)
250
+ message(STATUS "Try to set cmake cached variables for ${prefix} required libraries directly from : ${${prefix}_WIN3RDPARTY_DIR}.")
251
+ endif()
252
+
253
+ include(parse_arguments_multi)
254
+ # message (STATUS "before defining an override of parse_arguments_multi_function")
255
+ function(parse_arguments_multi_function ) ## overloaded function to handle all CHECK_CACHED_VAR values list (see: parse_arguments_multi)
256
+ # message(STATUS "inside overloaded parse_arguments_multi_function defined in Win3rdParty.cmake")
257
+ # message(STATUS ${ARGN})
258
+ ## we know the function take 3 args : var cacheType resetedCachedValue (see check_cached_var)
259
+ cmake_parse_arguments(pamf "" "DOC" "LIST" ${ARGN})
260
+
261
+ ## var and cacheType are mandatory (with the resetedCachedValue)
262
+ set(var ${ARGV0})
263
+ set(cacheType ${ARGV1})
264
+ # message(STATUS "var=${var} and cacheType=${cacheType} list=${pamf_LIST}")
265
+ if(pamf_DOC)
266
+ set(cacheDoc ${pamf_DOC})
267
+ else()
268
+ set(cacheDoc "")
269
+ endif()
270
+ if(pamf_LIST)
271
+ set(value ${pamf_LIST})
272
+ else()
273
+ # message("USING ARGV2 with value ${ARGV2}")
274
+ set(value ${ARGV2})
275
+ endif()
276
+ # message("inside override function in Win3rdparty.cmake value+ ${value}")
277
+ if("${cacheType}" MATCHES "PATH" AND EXISTS "${${prefix}_WIN3RDPARTY_DIR}/${value}")
278
+ # message("math with path")
279
+ set(resetedCachedValue "${${prefix}_WIN3RDPARTY_DIR}/${value}") ## path relative to ${prefix}_WIN3RDPARTY_DIR
280
+ elseif ("${cacheType}" MATCHES "PATH" AND EXISTS "${${prefix}_WIN3RDPARTY_DIR}")
281
+ set(resetedCachedValue "${${prefix}_WIN3RDPARTY_DIR}") ## path relative to ${prefix}_WIN3RDPARTY_DIR
282
+ elseif("${cacheType}" MATCHES "STRING")
283
+ foreach(var IN LISTS value)
284
+ if(EXISTS "${${prefix}_WIN3RDPARTY_DIR}/${var}")
285
+ list(APPEND resetedCachedValue "${${prefix}_WIN3RDPARTY_DIR}/${var}") ## string item of the string list is a path => make relative to ${prefix}_WIN3RDPARTY_DIR
286
+ else()
287
+ list(APPEND resetedCachedValue ${var}) ## string item of the string list is not an existing path => simply use the item
288
+ endif()
289
+ endforeach()
290
+ else()
291
+ set(resetedCachedValue "${value}") ## could be a BOOL or a STRING
292
+ endif()
293
+
294
+ ## call our macro to reset cmake cache variable if empty
295
+ check_cached_var(${var} "${resetedCachedValue}" ${cacheType} "${cacheDoc}" FORCE)
296
+
297
+ endfunction()
298
+ # message (STATUS "after defining an override of parse_arguments_multi_function")
299
+
300
+ if(w3p_MULTI_SET)
301
+ parse_arguments_multi(CHECK_CACHED_VAR w3p_MULTI_SET ${w3p_MULTI_SET}) ## internaly will call our overloaded parse_arguments_multi_function
302
+ elseif(w3p_SET)
303
+ # message("calling set version of parse_arguments_multi with w3p_set = ${w3p_SET}")
304
+ parse_arguments_multi(CHECK_CACHED_VAR w3p_SET ${w3p_SET})
305
+ endif()
306
+
307
+ endif()
308
+
309
+ endfunction()
310
+
311
+ ## cmake variables introspection to globally activate/deactivate ${prefix}_WIN3RDPARTY_USE
312
+ ## This "one shot" call (only one for the next cmake configure) will automatically then reset the global variable WIN3RDPARTY_USE to UserDefined (do nothing).
313
+ ## use (call it) before and after the call of all your win3rdParty functions
314
+ function(Win3rdPartyGlobalCacheAction )
315
+ set(WIN3RDPARTY_USE "UserDefined" CACHE STRING "Choose how to handle all cmake cached *_WIN3RDPARTY_USE for the next configure.\nCould be:\nUserDefined [default]\nActivateAll\nDesactivateAll" )
316
+ set_property(CACHE WIN3RDPARTY_USE PROPERTY STRINGS "UserDefined;ActivateAll;DesactivateAll" )
317
+ if(${WIN3RDPARTY_USE} MATCHES "UserDefined")
318
+ else()
319
+ if(${WIN3RDPARTY_USE} MATCHES "ActivateAll")
320
+ set(win3rdPvalue ON)
321
+ elseif(${WIN3RDPARTY_USE} MATCHES "DesactivateAll")
322
+ set(win3rdPvalue OFF)
323
+ endif()
324
+ get_cmake_property(_variableNames CACHE_VARIABLES)
325
+ foreach (_variableName ${_variableNames})
326
+ string(REGEX MATCH "[A-Za-z_0-9-]+_WIN3RDPARTY_USE" win3rdpartyUseCacheVar ${_variableName})
327
+ if(win3rdpartyUseCacheVar)
328
+ string(REGEX REPLACE "([A-Za-z_0-9-]+_WIN3RDPARTY_USE)" "\\1" win3rdpartyUseCacheVar ${_variableName})
329
+ set(${win3rdpartyUseCacheVar} ${win3rdPvalue} CACHE BOOL "Use required 3rdParty binaries from ${prefix}_WIN3RDPARTY_DIR or download it if not exist" FORCE)
330
+ message(STATUS "${win3rdpartyUseCacheVar} cached variable set to ${win3rdPvalue}.")
331
+ endif()
332
+ endforeach()
333
+ set(WIN3RDPARTY_USE "UserDefined" CACHE STRING "Choose how to handle all cmake cached *_WIN3RDPARTY_USE for the next configure.\nCould be:\nUserDefined [default]\nActivateAll\nDesactivateAll" FORCE)
334
+ message(STATUS "reset WIN3RDPARTY_USE to UserDefined.")
335
+ endif()
336
+ mark_as_advanced(WIN3RDPARTY_USE)
337
+ endfunction()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/cmake_policies.cmake ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ if(__set_policies_INCLUDED__)
12
+ return()
13
+ else()
14
+ set(__set_policies_INCLUDED__ ON)
15
+ endif()
16
+
17
+ macro(setPolicies)
18
+ # No more policies to enforce
19
+ endmacro()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/dependencies.cmake ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## Included once for all sub project.
12
+ ## It contain the whole cmake instructions to find necessary common dependencies.
13
+ ## 3rdParty (provided by sibr_addlibrary win3rdParty or from external packages) are then available in cmake sub projects.
14
+ ##
15
+ ## Do not include this file more than once but you can modify it to fit to your own project.
16
+ ## So please, read it carefully because you can use on of these dependencies for your project or appen new one.
17
+ ##
18
+ ## As it is included after camke options, you can use conditional if(<CMAKE_PROJ_OPT>)/endif() to encapsulate your 3rdParty.
19
+ ##
20
+
21
+ ## win3rdParty function allowing to auto check/download/update binaries dependencies for current windows compiler
22
+ ## Please open this file in order to get more documentation and usage examples.
23
+ include(Win3rdParty)
24
+
25
+ include(sibr_library)
26
+
27
+ Win3rdPartyGlobalCacheAction()
28
+
29
+ find_package(OpenGL REQUIRED)
30
+
31
+ set(OpenGL_GL_PREFERENCE "GLVND")
32
+
33
+ ############
34
+ ## Find GLEW
35
+ ############
36
+ ##for headless rendering
37
+ find_package(EGL QUIET)
38
+
39
+ if(EGL_FOUND)
40
+ add_definitions(-DGLEW_EGL)
41
+ message("Activating EGL support for headless GLFW/GLEW")
42
+ else()
43
+ message("EGL not found : EGL support for headless GLFW/GLEW is disabled")
44
+ endif()
45
+
46
+ if (MSVC11 OR MSVC12)
47
+ set(glew_multiset_arguments
48
+ CHECK_CACHED_VAR GLEW_INCLUDE_DIR PATH "glew-1.10.0/include" DOC "default empty doc"
49
+ CHECK_CACHED_VAR GLEW_LIBRARIES STRING LIST "debug;glew-1.10.0/${LIB_BUILT_DIR}/glew32d.lib;optimized;glew-1.10.0/${LIB_BUILT_DIR}/glew32.lib" DOC "default empty doc"
50
+ )
51
+ elseif (MSVC14)
52
+ set(glew_multiset_arguments
53
+ CHECK_CACHED_VAR GLEW_INCLUDE_DIR PATH "glew-2.0.0/include" DOC "default empty doc"
54
+ CHECK_CACHED_VAR GLEW_SHARED_LIBRARY_RELEASE PATH "glew-2.0.0/${LIB_BUILT_DIR}/glew32.lib"
55
+ CHECK_CACHED_VAR GLEW_STATIC_LIBRARY_RELEASE PATH "glew-2.0.0/${LIB_BUILT_DIR}/glew32s.lib"
56
+ CHECK_CACHED_VAR GLEW_SHARED_LIBRARY_DEBUG PATH "glew-2.0.0/${LIB_BUILT_DIR}/glew32d.lib"
57
+ CHECK_CACHED_VAR GLEW_STATIC_LIBRARY_DEBUG PATH "glew-2.0.0/${LIB_BUILT_DIR}/glew32sd.lib"
58
+ )
59
+ else ()
60
+ message("There is no provided GLEW library for your compiler, relying on find_package to find it")
61
+ endif()
62
+ sibr_addlibrary(NAME GLEW #VERBOSE ON
63
+ MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/glew-1.10.0.7z"
64
+ MSVC12 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/glew-1.10.0.7z"
65
+ MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/glew-2.0.0.7z" # using recompiled version of glew
66
+ MULTI_SET ${glew_multiset_arguments}
67
+ )
68
+ set(GLEW_VERBOSE ON)
69
+ FIND_PACKAGE(GLEW REQUIRED)
70
+ IF(GLEW_FOUND)
71
+ INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIR})
72
+ ELSE(GLEW_FOUND)
73
+ MESSAGE("GLEW not found. Set GLEW_DIR to base directory of GLEW.")
74
+ ENDIF(GLEW_FOUND)
75
+
76
+
77
+ ##############
78
+ ## Find ASSIMP
79
+ ##############
80
+ if (MSVC11 OR MSVC12)
81
+ set(assimp_set_arguments
82
+ CHECK_CACHED_VAR ASSIMP_DIR PATH "Assimp_3.1_fix"
83
+ )
84
+ elseif (MSVC14)
85
+ set(assimp_set_arguments
86
+ CHECK_CACHED_VAR ASSIMP_DIR PATH "Assimp-4.1.0"
87
+ )
88
+ else ()
89
+ message("There is no provided ASSIMP library for your compiler, relying on find_package to find it")
90
+ endif()
91
+
92
+ sibr_addlibrary(NAME ASSIMP #VERBOSE ON
93
+ MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/Assimp_3.1_fix.7z"
94
+ MSVC12 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/Assimp_3.1_fix.7z"
95
+ MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/Assimp-4.1.0.7z"
96
+ MULTI_SET
97
+ ${assimp_set_arguments}
98
+ )
99
+
100
+ find_package(ASSIMP REQUIRED)
101
+ include_directories(${ASSIMP_INCLUDE_DIR})
102
+
103
+ ################
104
+ ## Find FFMPEG
105
+ ################
106
+ sibr_addlibrary(NAME FFMPEG
107
+ MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/ffmpeg.zip"
108
+ MSVC12 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/ffmpeg.zip"
109
+ MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/ffmpeg-4.0.2-win64-win3rdParty.7z"
110
+ SET CHECK_CACHED_VAR FFMPEG_DIR PATH ${FFMPEG_WIN3RDPARTY_DIR}
111
+ )
112
+ find_package(FFMPEG)
113
+ include_directories(${FFMPEG_INCLUDE_DIR})
114
+ ## COMMENT OUT ALL FFMPEG FOR CLUSTER
115
+
116
+ ###################
117
+ ## Find embree3
118
+ ###################
119
+ sibr_addlibrary(
120
+ NAME embree3
121
+ MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/embree2.7.0.x64.windows.7z"
122
+ MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/embree-3.6.1.x64.vc14.windows.7z" # TODO SV: provide a valid version if required
123
+ )
124
+
125
+ # CLUSTER
126
+ #find_package(embree 3.0 REQUIRED PATHS "/data/graphdeco/share/embree/usr/local/lib64/cmake/" )
127
+ find_package(embree 3.0 )
128
+
129
+ ###################
130
+ ## Find eigen3
131
+ ###################
132
+ sibr_addlibrary(
133
+ NAME eigen3
134
+ #MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/eigen-eigen-dc6cfdf9bcec.7z"
135
+ #MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/eigen-eigen-dc6cfdf9bcec.7z" # TODO SV: provide a valid version if required
136
+ MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/eigen3.7z"
137
+ MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/eigen3.7z"
138
+ SET CHECK_CACHED_VAR eigen3_DIR PATH "eigen/share/eigen3/cmake"
139
+ )
140
+ include_directories(/usr/include/eigen3)
141
+ add_definitions(-DEIGEN_INITIALIZE_MATRICES_BY_ZERO)
142
+
143
+ #############
144
+ ## Find Boost
145
+ #############
146
+ set(Boost_REQUIRED_COMPONENTS "system;chrono;filesystem;date_time" CACHE INTERNAL "Boost Required Components")
147
+
148
+ if (WIN32)
149
+ # boost multiset arguments
150
+ if (MSVC11 OR MSVC12)
151
+ set(boost_multiset_arguments
152
+ CHECK_CACHED_VAR BOOST_ROOT PATH "boost_1_55_0"
153
+ CHECK_CACHED_VAR BOOST_INCLUDEDIR PATH "boost_1_55_0"
154
+ CHECK_CACHED_VAR BOOST_LIBRARYDIR PATH "boost_1_55_0/${LIB_BUILT_DIR}"
155
+ #CHECK_CACHED_VAR Boost_COMPILER STRING "-${Boost_WIN3RDPARTY_VCID}" DOC "vcid (eg: -vc110 for MSVC11)"
156
+ CHECK_CACHED_VAR Boost_COMPILER STRING "-vc110" DOC "vcid (eg: -vc110 for MSVC11)" # NOTE: if it doesnt work, uncomment this option and set the right value for VisualC id
157
+ )
158
+ elseif (MSVC14)
159
+ set(boost_multiset_arguments
160
+ CHECK_CACHED_VAR BOOST_ROOT PATH "boost-1.71"
161
+ CHECK_CACHED_VAR BOOST_INCLUDEDIR PATH "boost-1.71"
162
+ CHECK_CACHED_VAR BOOST_LIBRARYDIR PATH "boost-1.71/${LIB_BUILT_DIR}"
163
+ CHECK_CACHED_VAR Boost_COMPILER STRING "-vc141" DOC "vcid (eg: -vc110 for MSVC11)" # NOTE: if it doesnt work, uncomment this option and set the right value for VisualC id
164
+ )
165
+
166
+ option(BOOST_MINIMAL_VERSION "Only get minimal Boost dependencies" ON)
167
+
168
+ if(${BOOST_MINIMAL_VERSION})
169
+ set(BOOST_MSVC14_ZIP "boost-1.71-ibr-minimal.7z")
170
+ else()
171
+ set(BOOST_MSVC14_ZIP "boost-1.71.7z")
172
+ endif()
173
+ else ()
174
+ message("There is no provided Boost library for your compiler, relying on find_package to find it")
175
+ endif()
176
+
177
+ sibr_addlibrary(NAME Boost VCID TIMEOUT 600 #VERBOSE ON
178
+ MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/boost_1_55_0.7z"
179
+ MSVC12 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC11-splitted%20version/boost_1_55_0.7z"
180
+ MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/${BOOST_MSVC14_ZIP}" # boost compatible with msvc14
181
+ MULTI_SET ${boost_multiset_arguments}
182
+ CHECK_CACHED_VAR Boost_NO_SYSTEM_PATHS BOOL ON DOC "Set to ON to disable searching in locations not specified by these boost cached hint variables"
183
+ CHECK_CACHED_VAR Boost_NO_BOOST_CMAKE BOOL ON DOC "Set to ON to disable the search for boost-cmake (package cmake config file if boost was built with cmake)"
184
+ )
185
+ if(NOT Boost_COMPILER AND Boost_WIN3RDPARTY_USE)
186
+ message(WARNING "Boost_COMPILER is not set and it's needed.")
187
+ endif()
188
+ endif()
189
+
190
+ find_package(Boost 1.65.0 REQUIRED COMPONENTS ${Boost_REQUIRED_COMPONENTS})
191
+ # for CLUSTER
192
+ ##find_package(Boost 1.58.0 REQUIRED COMPONENTS ${Boost_REQUIRED_COMPONENTS})
193
+
194
+
195
+ if(WIN32)
196
+ add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/EHsc>")
197
+ #add_definitions(/EHsc)
198
+ endif()
199
+
200
+ if(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
201
+ add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
202
+ endif()
203
+
204
+ #if(WIN32)
205
+ add_definitions(-DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB)
206
+ #endif()
207
+
208
+ include_directories(${BOOST_INCLUDEDIR} ${Boost_INCLUDE_DIRS})
209
+ link_directories(${BOOST_LIBRARYDIR} ${Boost_LIBRARY_DIRS})
210
+
211
+
212
+ ##############
213
+ ## Find OpenMP
214
+ ##############
215
+ find_package(OpenMP)
216
+
217
+ ##############
218
+ ## Find OpenCV
219
+ ##############
220
+ if (WIN32)
221
+ if (${MSVC_TOOLSET_VERSION} EQUAL 143)
222
+ MESSAGE("SPECIAL OPENCV HANDLING")
223
+ set(opencv_set_arguments
224
+ CHECK_CACHED_VAR OpenCV_DIR PATH "install" ## see OpenCVConfig.cmake
225
+ )
226
+ elseif (MSVC11 OR MSVC12)
227
+ set(opencv_set_arguments
228
+ CHECK_CACHED_VAR OpenCV_DIR PATH "opencv/build" ## see OpenCVConfig.cmake
229
+ )
230
+ elseif (MSVC14)
231
+ set(opencv_set_arguments
232
+ CHECK_CACHED_VAR OpenCV_DIR PATH "opencv-4.5.0/build" ## see OpenCVConfig.cmake
233
+ )
234
+ else ()
235
+ message("There is no provided OpenCV library for your compiler, relying on find_package to find it")
236
+ endif()
237
+ else()
238
+ message("There is no provided OpenCV library for your compiler, relying on find_package to find it")
239
+ endif()
240
+
241
+ sibr_addlibrary(NAME OpenCV #VERBOSE ON
242
+ MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/sibr/~0.9/opencv.7z"
243
+ MSVC12 "https://repo-sam.inria.fr/fungraph/dependencies/sibr/~0.9/opencv.7z"
244
+ MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/sibr/~0.9/opencv-4.5.0.7z" # opencv compatible with msvc14 and with contribs
245
+ MSVC17 "https://repo-sam.inria.fr/fungraph/dependencies/sibr/~0.9/opencv4-8.7z"
246
+ SET ${opencv_set_arguments}
247
+ )
248
+ find_package(OpenCV 4.5 REQUIRED) ## Use directly the OpenCVConfig.cmake provided
249
+ ## FOR CLUSTER
250
+ ###find_package(OpenCV 4.5 REQUIRED PATHS "/data/graphdeco/share/opencv/usr/local/lib64/cmake/opencv4/" ) ## Use directly the OpenCVConfig.cmake provided
251
+
252
+ ##https://stackoverflow.com/questions/24262081/cmake-relwithdebinfo-links-to-debug-libs
253
+ set_target_properties(${OpenCV_LIBS} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE)
254
+
255
+ add_definitions(-DOPENCV_TRAITS_ENABLE_DEPRECATED)
256
+
257
+ if(OpenCV_INCLUDE_DIRS)
258
+ foreach(inc ${OpenCV_INCLUDE_DIRS})
259
+ if(NOT EXISTS ${inc})
260
+ set(OpenCV_INCLUDE_DIR "" CACHE PATH "additional custom include DIR (in case of trouble to find it (fedora 17 opencv package))")
261
+ endif()
262
+ endforeach()
263
+ if(OpenCV_INCLUDE_DIR)
264
+ list(APPEND OpenCV_INCLUDE_DIRS ${OpenCV_INCLUDE_DIR})
265
+ include_directories(${OpenCV_INCLUDE_DIRS})
266
+ endif()
267
+ endif()
268
+
269
+ ###################
270
+ ## Find GLFW
271
+ ###################
272
+ sibr_addlibrary(
273
+ NAME glfw3
274
+ MSVC11 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/glfw-3.2.1.7z"
275
+ MSVC14 "https://repo-sam.inria.fr/fungraph/dependencies/ibr-common/win3rdParty-MSVC15-splitted%20version/glfw-3.2.1.7z" # TODO SV: provide a valid version if required
276
+ SET CHECK_CACHED_VAR glfw3_DIR PATH "glfw-3.2.1"
277
+ )
278
+
279
+ ### FOR CLUSTER COMMENT OUT lines above, uncomment lines below
280
+ ##find_package(GLFW REQUIRED 3.3 )
281
+ ##message("***********=============> GLFW IS " ${GLFW_LIBRARY})
282
+ ##message("***********=============> GLFW IS " ${GLFW_LIBRARIES})
283
+
284
+ find_package(glfw3 REQUIRED)
285
+
286
+ sibr_gitlibrary(TARGET imgui
287
+ GIT_REPOSITORY "https://gitlab.inria.fr/sibr/libs/imgui.git"
288
+ GIT_TAG "741fb3ab6c7e1f7cef23ad0501a06b7c2b354944"
289
+ )
290
+
291
+ ## FOR CLUSTER COMMENT OUT nativefiledialog
292
+ sibr_gitlibrary(TARGET nativefiledialog
293
+ GIT_REPOSITORY "https://gitlab.inria.fr/sibr/libs/nativefiledialog.git"
294
+ GIT_TAG "ae2fab73cf44bebdc08d997e307c8df30bb9acec"
295
+ )
296
+
297
+
298
+ sibr_gitlibrary(TARGET mrf
299
+ GIT_REPOSITORY "https://gitlab.inria.fr/sibr/libs/mrf.git"
300
+ GIT_TAG "30c3c9494a00b6346d72a9e37761824c6f2b7207"
301
+ )
302
+
303
+ sibr_gitlibrary(TARGET nanoflann
304
+ GIT_REPOSITORY "https://gitlab.inria.fr/sibr/libs/nanoflann.git"
305
+ GIT_TAG "7a20a9ac0a1d34850fc3a9e398fc4a7618e8a69a"
306
+ )
307
+
308
+ sibr_gitlibrary(TARGET picojson
309
+ GIT_REPOSITORY "https://gitlab.inria.fr/sibr/libs/picojson.git"
310
+ GIT_TAG "7cf8feee93c8383dddbcb6b64cf40b04e007c49f"
311
+ )
312
+
313
+ sibr_gitlibrary(TARGET rapidxml
314
+ GIT_REPOSITORY "https://gitlab.inria.fr/sibr/libs/rapidxml.git"
315
+ GIT_TAG "069e87f5ec5ce1745253bd64d89644d6b894e516"
316
+ )
317
+
318
+ sibr_gitlibrary(TARGET xatlas
319
+ GIT_REPOSITORY "https://gitlab.inria.fr/sibr/libs/xatlas.git"
320
+ GIT_TAG "0fbe06a5368da13fcdc3ee48d4bdb2919ed2a249"
321
+ INCLUDE_DIRS "source/xatlas"
322
+ )
323
+
324
+ Win3rdPartyGlobalCacheAction()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/downloadAndExtractZipFile.cmake ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## downloadAndExtractZipFile cmake function
12
+ ## Provide a way to download zip file from public internet ZIP_URL host
13
+ ## and to extract it in a specific EXCTRATED_ZIP_PATH destination.
14
+ ## This function use 7-Zip external tool to maximize the compatibles formats.
15
+ ## This will be not download again if the EXCTRATED_ZIP_PATH already exist and DL_FORCE is set to OFF.
16
+ ## This will try to unzip file if already exist in the ZIP_DL_PATH.
17
+ ##
18
+ ## If EXCTRATED_ZIP_PATH and/or ZIP_DL_PATH are not full path,
19
+ ## it will be interpreted relative to CMAKE_BINARY_DIR
20
+ ##
21
+ ## Usage example :
22
+ ## include(downloadAndExtractZipFile)
23
+ ## downloadAndExtractZipFile(
24
+ ## http://www.cs.cornell.edu/~snavely/bundler/distr/bundler-v0.4-source.zip
25
+ ## ${CMAKE_BINARY_DIR}/Bundler/bundler-v0.4-source.zip
26
+ ## ${CMAKE_BINARY_DIR}/Bundler
27
+ ## [DL_FORCE ON|OFF]
28
+ ## [TIMEOUT]
29
+ ## [CHECK_DIRTY_URL]
30
+ ## )
31
+ ##
32
+ ## option DL_FORCE will redownload the zip file [deafult to OFF]
33
+ ## option TIMEOUT will end the unzip process after this period of time [default to 600s]
34
+ ## option CHECK_DIRTY_URL will write into the given file the downloaded URL and then,
35
+ ## next time, if the URL was updated, it detect it with this file
36
+ ## and will download the last version. This prevent to alway set manually DL_FORCE to ON...
37
+ ##
38
+ if(__downloadAndExtractZipFile_cmake_INCLUDED__)
39
+ return()
40
+ else()
41
+ set(__downloadAndExtractZipFile_cmake_INCLUDED__ ON)
42
+ endif()
43
+
44
+ function(downloadAndExtractZipFile ZIP_URL ZIP_DL_PATH EXCTRATED_ZIP_PATH)
45
+
46
+ # message(STATUS "zipUrl=${ZIP_URL} zipDlPath=${ZIP_DL_PATH} extractedZipPath=${EXCTRATED_ZIP_PATH}")
47
+ cmake_parse_arguments(dwnlezf "" "VERBOSE;DL_FORCE;TIMEOUT;CHECK_DIRTY_URL" "" ${ARGN})
48
+
49
+ set(PROGRAMFILESx86 "PROGRAMFILES(x86)")
50
+
51
+ ## Check entries mandatory args
52
+ if(IS_ABSOLUTE "${ZIP_DL_PATH}")
53
+ else()
54
+ set(ZIP_DL_PATH "${CMAKE_BINARY_DIR}/${ZIP_DL_PATH}")
55
+ endif()
56
+ if(IS_ABSOLUTE "${EXCTRATED_ZIP_PATH}")
57
+ else()
58
+ set(EXCTRATED_ZIP_PATH "${CMAKE_BINARY_DIR}/${EXCTRATED_ZIP_PATH}")
59
+ endif()
60
+ if(NOT EXISTS "${EXCTRATED_ZIP_PATH}")
61
+ file(MAKE_DIRECTORY ${EXCTRATED_ZIP_PATH})
62
+ endif()
63
+
64
+ # SB: Once, one of downloaded zip was corrupted by an error message coming from the server.
65
+ if(EXISTS "${ZIP_DL_PATH}")
66
+ # So I check for removing such corrupted files
67
+ message("Removing previous ${ZIP_DL_PATH} (might be corrupted)")
68
+ file(REMOVE "${ZIP_DL_PATH}")
69
+ if(EXISTS "${dwnlezf_CHECK_DIRTY_URL}")
70
+ # and remove the previous (corrupted) made 'Win3rdPartyUrl' file
71
+ file(REMOVE "${dwnlezf_CHECK_DIRTY_URL}")
72
+ endif()
73
+ endif()
74
+
75
+ ## Check entries optional args
76
+ macro(readDirtyUrl )
77
+ if(dwnlezf_CHECK_DIRTY_URL)
78
+ if(IS_ABSOLUTE "${dwnlezf_CHECK_DIRTY_URL}")
79
+ else()
80
+ set(dwnlezf_CHECK_DIRTY_URL "${CMAKE_BINARY_DIR}/${dwnlezf_CHECK_DIRTY_URL}")
81
+ endif()
82
+ get_filename_component(unzipDir ${EXCTRATED_ZIP_PATH} NAME)
83
+ get_filename_component(unzipPath ${EXCTRATED_ZIP_PATH} PATH)
84
+ message(STATUS "Checking ${unzipDir} [from ${unzipPath}]...")
85
+ if(EXISTS "${dwnlezf_CHECK_DIRTY_URL}")
86
+ get_filename_component(CHECK_DIRTY_URL_FILENAME ${dwnlezf_CHECK_DIRTY_URL} NAME)
87
+ file(STRINGS "${dwnlezf_CHECK_DIRTY_URL}" contents)
88
+ list(GET contents 0 downloadURL)
89
+ list(REMOVE_AT contents 0)
90
+ if("${downloadURL}" MATCHES "${ZIP_URL}")
91
+ if(dwnlezf_VERBOSE)
92
+ message(STATUS "Your downloaded version (URL) seems to be up to date. Let me check if nothing is missing... (see ${dwnlezf_CHECK_DIRTY_URL}).")
93
+ endif()
94
+ file(GLOB PATHNAME_PATTERN_LIST "${EXCTRATED_ZIP_PATH}/*") ## is there something inside the downloaded destination ?
95
+ unset(NAME_PATTERN_LIST)
96
+ foreach(realPathPattern ${PATHNAME_PATTERN_LIST})
97
+ get_filename_component(itemName ${realPathPattern} NAME)
98
+ list(APPEND NAME_PATTERN_LIST ${itemName})
99
+ endforeach()
100
+ if(NAME_PATTERN_LIST)
101
+ foreach(item ${contents})
102
+ list(FIND NAME_PATTERN_LIST ${item} id)
103
+ if(${id} MATCHES "-1")
104
+ message(STATUS "${item} is missing, your downloaded version content changed, need to redownload it.")
105
+ set(ZIP_DL_FORCE ON)
106
+ break()
107
+ else()
108
+ list(REMOVE_AT NAME_PATTERN_LIST ${id})
109
+ set(ZIP_DL_FORCE OFF)
110
+ endif()
111
+ endforeach()
112
+ if(NOT ZIP_DL_FORCE AND NAME_PATTERN_LIST)
113
+ message("Yours seems to be up to date (regarding to ${CHECK_DIRTY_URL_FILENAME})!\nBut there are additional files/folders into your downloaded destination (feel free to clean it if you want).")
114
+ foreach(item ${NAME_PATTERN_LIST})
115
+ if(item)
116
+ message("${item}")
117
+ endif()
118
+ endforeach()
119
+ endif()
120
+ endif()
121
+ else()
122
+ set(ZIP_DL_FORCE ON)
123
+ message(STATUS "Your downloaded version is dirty (too old).")
124
+ endif()
125
+ else()
126
+ file(GLOB PATHNAME_PATTERN_LIST "${EXCTRATED_ZIP_PATH}/*") ## is there something inside the downloaded destination ?
127
+ if(NOT PATHNAME_PATTERN_LIST)
128
+ message("We found nothing into ${EXCTRATED_ZIP_PATH}, we will try to download it for you now.")
129
+ endif()
130
+ set(ZIP_DL_FORCE ON)
131
+ endif()
132
+ endif()
133
+ endmacro()
134
+ readDirtyUrl()
135
+ if(NOT ZIP_DL_FORCE)
136
+ return() ## do not need to further (as we are up to date, just exit the function
137
+ endif()
138
+
139
+ macro(writeDirtyUrl )
140
+ if(dwnlezf_CHECK_DIRTY_URL)
141
+ file(WRITE "${dwnlezf_CHECK_DIRTY_URL}" "${ZIP_URL}\n")
142
+ file(GLOB PATHNAME_PATTERN_LIST "${EXCTRATED_ZIP_PATH}/*") ## is there something inside the downloaded destination ?
143
+ unset(NAME_PATTERN_LIST)
144
+ foreach(realPathPattern ${PATHNAME_PATTERN_LIST})
145
+ get_filename_component(itemName ${realPathPattern} NAME)
146
+ list(APPEND NAME_PATTERN_LIST ${itemName})
147
+ endforeach()
148
+ if(NAME_PATTERN_LIST)
149
+ foreach(item ${NAME_PATTERN_LIST})
150
+ file(APPEND "${dwnlezf_CHECK_DIRTY_URL}" "${item}\n")
151
+ endforeach()
152
+ endif()
153
+ endif()
154
+ endmacro()
155
+
156
+ if(dwnlezf_DL_FORCE)
157
+ set(ZIP_DL_FORCE ON)
158
+ endif()
159
+
160
+ if(NOT dwnlezf_TIMEOUT)
161
+ set(dwnlezf_TIMEOUT 600)
162
+ endif()
163
+ math(EXPR dwnlezf_TIMEOUT_MIN "${dwnlezf_TIMEOUT}/60")
164
+
165
+ macro(unzip whichZipFile)
166
+ if(NOT SEVEN_ZIP_CMD)
167
+ find_program(SEVEN_ZIP_CMD NAMES 7z 7za p7zip DOC "7-zip executable" PATHS "$ENV{PROGRAMFILES}/7-Zip" "$ENV{${PROGRAMFILESx86}}/7-Zip" "$ENV{ProgramW6432}/7-Zip")
168
+ endif()
169
+ if(SEVEN_ZIP_CMD)
170
+ if(dwnlezf_VERBOSE)
171
+ message(STATUS "UNZIP: please, WAIT UNTIL ${SEVEN_ZIP_CMD} finished...\n(no more than ${dwnlezf_TIMEOUT_MIN} min)")
172
+ else()
173
+ message(STATUS "UNZIP...wait...")
174
+ endif()
175
+ execute_process( COMMAND ${SEVEN_ZIP_CMD} x ${whichZipFile} -y
176
+ WORKING_DIRECTORY ${EXCTRATED_ZIP_PATH} TIMEOUT ${dwnlezf_TIMEOUT}
177
+ RESULT_VARIABLE resVar OUTPUT_VARIABLE outVar ERROR_VARIABLE errVar
178
+ )
179
+ if(${resVar} MATCHES "0")
180
+ if(dwnlezf_VERBOSE)
181
+ message(STATUS "SUCESS to unzip in ${EXCTRATED_ZIP_PATH}. Now we can remove the downloaded zip file.")
182
+ endif()
183
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${whichZipFile})
184
+ mark_as_advanced(SEVEN_ZIP_CMD)
185
+ else()
186
+ message(WARNING "something wrong in ${EXCTRATED_ZIP_PATH}\n with \"${SEVEN_ZIP_CMD} x ${whichZipFile} -y\", redo or try to unzip by yourself...")
187
+ message("unzip: resVar=${resVar}")
188
+ message("unzip: outVar=${outVar}")
189
+ message("unzip: errVar=${errVar}")
190
+ message("unzip: failed or canceled or timeout")
191
+ endif()
192
+ else()
193
+ message(WARNING "You need 7zip (http://www.7-zip.org/download.html) to unzip the downloaded dir.")
194
+ set(SEVEN_ZIP_CMD "" CACHE FILEPATH "7-zip executable")
195
+ mark_as_advanced(CLEAR SEVEN_ZIP_CMD)
196
+ endif()
197
+ endmacro()
198
+
199
+ if(dwnlezf_VERBOSE)
200
+ message(STATUS "Trying to look ${ZIP_DL_PATH} if a zip file exist...")
201
+ endif()
202
+ if(EXISTS "${ZIP_DL_PATH}")
203
+
204
+ ## already downloaded, so just unzip it
205
+ unzip(${ZIP_DL_PATH})
206
+ writeDirtyUrl()
207
+
208
+ elseif(ZIP_DL_FORCE)
209
+
210
+ ## the download part (+ unzip)
211
+ message(STATUS "Let me try to download package for you : ${ZIP_URL}")
212
+ if(dwnlezf_VERBOSE)
213
+ message(STATUS "Downloading...\n SRC=${ZIP_URL}\n DEST=${ZIP_DL_PATH}.tmp\n INACTIVITY_TIMEOUT=180s")
214
+ endif()
215
+ file(DOWNLOAD ${ZIP_URL} ${ZIP_DL_PATH}.tmp INACTIVITY_TIMEOUT 360 STATUS status SHOW_PROGRESS)
216
+
217
+ list(GET status 0 numResult)
218
+ if(${numResult} MATCHES "0")
219
+
220
+ if(dwnlezf_VERBOSE)
221
+ message(STATUS "Download succeed, so let me rename the tmp file to unzip it")
222
+ endif()
223
+ execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${ZIP_DL_PATH}.tmp ${ZIP_DL_PATH})
224
+ unzip(${ZIP_DL_PATH})
225
+ writeDirtyUrl()
226
+
227
+ else()
228
+
229
+ list(GET status 1 errMsg)
230
+ message(WARNING "DOWNLOAD ${ZIP_URL} to ${ZIP_DL_PATH} failed\n:${errMsg}")
231
+ message(WARNING "OK, you need to download the ${ZIP_URL} manually and put it into ${ZIP_DL_PATH}")
232
+ message("Take a look at the project website page to check available URL.")
233
+
234
+ endif()
235
+
236
+ endif()
237
+
238
+ ## clean up the tmp downloaded file
239
+ if(EXISTS "${ZIP_DL_PATH}.tmp")
240
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${ZIP_DL_PATH}.tmp)
241
+ endif()
242
+
243
+ endfunction()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/git_describe.cmake ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ if(__git_describe_INCLUDED__)
12
+ return()
13
+ else()
14
+ set(__git_describe_INCLUDED__ ON)
15
+ endif()
16
+
17
+ find_package(Git)
18
+ if(Git_FOUND)
19
+ message(STATUS "Git found: ${GIT_EXECUTABLE}")
20
+ else()
21
+ message(FATAL_ERROR "Git not found. Aborting")
22
+ endif()
23
+
24
+ macro(git_describe)
25
+ cmake_parse_arguments(GIT_DESCRIBE "" "GIT_URL;GIT_BRANCH;GIT_COMMIT_HASH;GIT_TAG;GIT_VERSION;PATH" "" ${ARGN})
26
+
27
+ if(NOT GIT_DESCRIBE_PATH)
28
+ set(GIT_DESCRIBE_PATH ${CMAKE_SOURCE_DIR})
29
+ endif()
30
+
31
+ if(GIT_DESCRIBE_GIT_URL)
32
+ # Get the current remote
33
+ execute_process(
34
+ COMMAND git remote
35
+ WORKING_DIRECTORY ${GIT_DESCRIBE_PATH}
36
+ OUTPUT_VARIABLE GIT_DESCRIBE_GIT_REMOTE
37
+ OUTPUT_STRIP_TRAILING_WHITESPACE
38
+ ERROR_QUIET
39
+ )
40
+
41
+ # Get the current remote
42
+ execute_process(
43
+ COMMAND git remote get-url ${GIT_DESCRIBE_GIT_REMOTE}
44
+ WORKING_DIRECTORY ${GIT_DESCRIBE_PATH}
45
+ OUTPUT_VARIABLE ${GIT_DESCRIBE_GIT_URL}
46
+ OUTPUT_STRIP_TRAILING_WHITESPACE
47
+ ERROR_QUIET
48
+ )
49
+ endif()
50
+
51
+ if(GIT_DESCRIBE_GIT_BRANCH)
52
+ # Get the current working branch
53
+ execute_process(
54
+ COMMAND git rev-parse --abbrev-ref HEAD
55
+ WORKING_DIRECTORY ${GIT_DESCRIBE_PATH}
56
+ OUTPUT_VARIABLE ${GIT_DESCRIBE_GIT_BRANCH}
57
+ OUTPUT_STRIP_TRAILING_WHITESPACE
58
+ ERROR_QUIET
59
+ )
60
+ endif()
61
+
62
+ if(GIT_DESCRIBE_GIT_COMMIT_HASH)
63
+ # Get the latest abbreviated commit hash of the working branch
64
+ execute_process(
65
+ COMMAND git rev-parse HEAD
66
+ WORKING_DIRECTORY ${GIT_DESCRIBE_PATH}
67
+ OUTPUT_VARIABLE ${GIT_DESCRIBE_GIT_COMMIT_HASH}
68
+ OUTPUT_STRIP_TRAILING_WHITESPACE
69
+ ERROR_QUIET
70
+ )
71
+ endif()
72
+
73
+ if(GIT_DESCRIBE_GIT_TAG)
74
+ # Get the tag
75
+ execute_process(
76
+ COMMAND git describe --tags --exact-match
77
+ WORKING_DIRECTORY ${GIT_DESCRIBE_PATH}
78
+ OUTPUT_VARIABLE ${GIT_DESCRIBE_GIT_TAG}
79
+ OUTPUT_STRIP_TRAILING_WHITESPACE
80
+ ERROR_QUIET
81
+ )
82
+ endif()
83
+
84
+ if(GIT_DESCRIBE_GIT_VERSION)
85
+ # Get the version from git describe
86
+ execute_process(
87
+ COMMAND git describe
88
+ WORKING_DIRECTORY ${GIT_DESCRIBE_PATH}
89
+ OUTPUT_VARIABLE ${GIT_DESCRIBE_GIT_VERSION}
90
+ OUTPUT_STRIP_TRAILING_WHITESPACE
91
+ ERROR_QUIET
92
+ )
93
+
94
+ if(${GIT_DESCRIBE_GIT_VERSION} STREQUAL "")
95
+ execute_process(
96
+ COMMAND git rev-parse --abbrev-ref HEAD
97
+ WORKING_DIRECTORY ${GIT_DESCRIBE_PATH}
98
+ OUTPUT_VARIABLE GIT_DESCRIBE_GIT_VERSION_BRANCH
99
+ OUTPUT_STRIP_TRAILING_WHITESPACE
100
+ ERROR_QUIET
101
+ )
102
+ execute_process(
103
+ COMMAND git log -1 --format=%h
104
+ WORKING_DIRECTORY ${GIT_DESCRIBE_PATH}
105
+ OUTPUT_VARIABLE GIT_DESCRIBE_GIT_VERSION_COMMIT
106
+ OUTPUT_STRIP_TRAILING_WHITESPACE
107
+ ERROR_QUIET
108
+ )
109
+
110
+ set(${GIT_DESCRIBE_GIT_VERSION} "${GIT_DESCRIBE_GIT_VERSION_BRANCH}-${GIT_DESCRIBE_GIT_VERSION_COMMIT}")
111
+ endif()
112
+ endif()
113
+
114
+ endmacro()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/include_once.cmake ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ macro(include_once file)
12
+ get_filename_component(INCLUDE_ONCE_FILEPATH ${file} REALPATH)
13
+ string(REGEX REPLACE "(\\.|\\/+|\\:|\\\\+)" "_" INCLUDE_ONCE_FILEPATH ${INCLUDE_ONCE_FILEPATH})
14
+ get_property(INCLUDED_${INCLUDE_ONCE_FILEPATH}_LOCAL GLOBAL PROPERTY INCLUDED_${INCLUDE_ONCE_FILEPATH})
15
+ if (INCLUDED_${INCLUDE_ONCE_FILEPATH}_LOCAL)
16
+ return()
17
+ else()
18
+ set_property(GLOBAL PROPERTY INCLUDED_${INCLUDE_ONCE_FILEPATH} true)
19
+
20
+ include(${file})
21
+ endif()
22
+ endmacro()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/install_runtime.cmake ADDED
@@ -0,0 +1,887 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## This file is mainly used to allow runtime installation
12
+ ## There are some utilities cmake functions to ease the generic deployement (abstract common usage of cmake)...
13
+ ##
14
+ ## You cannot run your programm automaticaly from your CNAKE_BINARY_DIR when you build
15
+ ## as it will miss all dependencies and ressources files...
16
+ ## You have to run install target in order to test your programm.
17
+ ##
18
+ ## The only one function/macros you may use inside your sub-CMakeLists.txt (sub-project) is :
19
+ ## ******************
20
+ ## ibr_install_target macro => see documentation at the end of this file
21
+ ## ******************
22
+ ## It use these utilities cmake functions to abstract the installation in an uniform way for all sub-projects.
23
+ ##
24
+ if(__install_runtime_cmake_INCLUDED__)
25
+ return()
26
+ else()
27
+ set(__install_runtime_cmake_INCLUDED__ ON)
28
+ endif()
29
+
30
+
31
+ ##
32
+ ## Allow to write a resource config file which contain additional ressource paths
33
+ ## (used by IBR_Common Resource system to load shaders and potentialy images, plugins and so on)
34
+ ##
35
+ ## ADD option list all the paths to add in the file (relative paths are interpreted relative to working dir of the executable)
36
+ ## INSTALL option to specify where we want to install this file
37
+ ##
38
+ ## Example usage:
39
+ ## resourceFile(ADD "shaders" "${PROJECT_NAME}_rsc" INSTALL bin)
40
+ ##
41
+ macro(resourceFile)
42
+ cmake_parse_arguments(rsc "" "INSTALL;FILE_PATH;CONFIG_TYPE" "ADD" ${ARGN}) ## both args are directory path
43
+
44
+ if(rsc_ADD)
45
+ unset(IBR_RSC_FILE_CONTENT_LIST)
46
+ if(EXISTS "${rsc_FILE_PATH}")
47
+ file(READ "${rsc_FILE_PATH}" IBR_RSC_FILE_CONTENT)
48
+ string(REGEX REPLACE "\n" ";" IBR_RSC_FILE_CONTENT_LIST "${IBR_RSC_FILE_CONTENT}")
49
+ endif()
50
+ list(APPEND IBR_RSC_FILE_CONTENT_LIST "${rsc_ADD}")
51
+ list(REMOVE_DUPLICATES IBR_RSC_FILE_CONTENT_LIST)
52
+ file(WRITE "${rsc_FILE_PATH}" "")
53
+ foreach(rscDir ${IBR_RSC_FILE_CONTENT_LIST})
54
+ file(APPEND "${rsc_FILE_PATH}" "${rscDir}\n")
55
+ endforeach()
56
+ unset(rsc_ADD)
57
+ endif()
58
+
59
+ if(rsc_INSTALL)
60
+ install(FILES ${rsc_FILE_PATH} CONFIGURATIONS ${rsc_CONFIG_TYPE} DESTINATION ${rsc_INSTALL})
61
+ unset(rsc_INSTALL)
62
+ endif()
63
+ endmacro()
64
+
65
+
66
+ ##
67
+ ## Install *.pdb generated file for the current cmake project
68
+ ## assuming the output target name is the cmake project name.
69
+ ## This macro is useful for crossplateform multi config mode.
70
+ ##
71
+ ## Usage Example:
72
+ ##
73
+ ## if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
74
+ ## installPDB(${PROJECT_NAME} ${CMAKE_BUILD_TYPE} RUNTIME_DEST bin ARCHIVE_DEST lib LIBRARY_DEST lib)
75
+ ## endif()
76
+ ## foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
77
+ ## installPDB(${PROJECT_NAME} ${CONFIG_TYPES} RUNTIME_DEST bin ARCHIVE_DEST lib LIBRARY_DEST lib)
78
+ ## endforeach()
79
+ ##
80
+ macro(installPDB targetName configType)
81
+ cmake_parse_arguments(instpdb "" "COMPONENT" "ARCHIVE_DEST;LIBRARY_DEST;RUNTIME_DEST" ${ARGN}) ## both args are directory path
82
+
83
+ if(NOT MSVC)
84
+ return()
85
+ endif()
86
+
87
+ ## Check if DESTINATION are provided according to the TYPE of the given target (see install command doc to see correspodances)
88
+ get_target_property(type ${targetName} TYPE)
89
+ if(${type} MATCHES "EXECUTABLE" AND instpdb_RUNTIME_DEST)
90
+ set(pdb_DESTINATION ${instpdb_RUNTIME_DEST})
91
+ elseif(${type} MATCHES "STATIC_LIBRARY" AND instpdb_ARCHIVE_DEST)
92
+ set(pdb_DESTINATION ${instpdb_ARCHIVE_DEST})
93
+ elseif(${type} MATCHES "MODULE_LIBRARY" AND instpdb_LIBRARY_DEST)
94
+ set(pdb_DESTINATION ${instpdb_LIBRARY_DEST})
95
+ elseif(${type} MATCHES "SHARED_LIBRARY")
96
+ if(WIN32 AND instpdb_RUNTIME_DEST)
97
+ set(pdb_DESTINATION ${instpdb_RUNTIME_DEST})
98
+ else()
99
+ set(pdb_DESTINATION ${instpdb_LIBRARY_DEST})
100
+ endif()
101
+ endif()
102
+
103
+ if(NOT pdb_DESTINATION)
104
+ set(pdb_DESTINATION bin) ## default destination of the pdb file
105
+ endif()
106
+
107
+ if(NOT instpdb_COMPONENT)
108
+ set(instpdb_COMPONENT )
109
+ else()
110
+ set(instpdb_COMPONENT COMPONENT ${instpdb_COMPONENT})
111
+ endif()
112
+
113
+ string(TOUPPER ${configType} CONFIG_TYPES_UC)
114
+ get_target_property(PDB_PATH ${targetName} PDB_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC})
115
+
116
+ get_target_property(confModePostfix ${targetName} ${CONFIG_TYPES_UC}_POSTFIX)
117
+ if(NOT confModePostfix)
118
+ set(confModePostfix "")
119
+ endif()
120
+ set_target_properties(${targetName} PROPERTIES PDB_NAME_${CONFIG_TYPES_UC} ${targetName}${confModePostfix})
121
+ get_target_property(PDB_NAME ${targetName} PDB_NAME_${CONFIG_TYPES_UC})# if not set, this is empty
122
+
123
+ if(EXISTS "${PDB_PATH}/${PDB_NAME}.pdb")
124
+ install(FILES "${PDB_PATH}/${PDB_NAME}.pdb" CONFIGURATIONS ${configType} DESTINATION ${pdb_DESTINATION} ${instpdb_COMPONENT} OPTIONAL)
125
+ endif()
126
+ endmacro()
127
+
128
+
129
+ ##
130
+ ## Add additional target to install a project independently and based on its component
131
+ ## configMode is used to prevent default Release installation (we want also to install in other build/config type)
132
+ ##
133
+ macro(installTargetProject targetOfProject targetOfInstallProject)
134
+ if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
135
+ set(configMode ${CMAKE_BUILD_TYPE})
136
+ elseif(MSVC)
137
+ ## $(Configuration) will be one of the following : Debug, Release, MinSizeRel, RelWithDebInfo
138
+ set(configMode $(Configuration))
139
+ endif()
140
+ if(configMode)
141
+ get_target_property(srcFiles ${targetOfProject} SOURCES)
142
+ add_custom_target( ${targetOfInstallProject} #ALL
143
+ ${CMAKE_COMMAND} -DBUILD_TYPE=${configMode} -DCOMPONENT=${targetOfInstallProject} -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
144
+ DEPENDS ${srcFiles}
145
+ COMMENT "run the installation only for ${targetOfProject}" VERBATIM
146
+ )
147
+ add_dependencies(${targetOfInstallProject} ${targetOfProject})
148
+
149
+ get_target_property(INSTALL_BUILD_FOLDER ${targetOfProject} FOLDER)
150
+ set_target_properties(${targetOfInstallProject} PROPERTIES FOLDER ${INSTALL_BUILD_FOLDER})
151
+ endif()
152
+ endmacro()
153
+
154
+ # Collect all currently added targets in all subdirectories
155
+ #
156
+ # Parameters:
157
+ # - _result the list containing all found targets
158
+ # - _dir root directory to start looking from
159
+ function(get_all_targets _result _dir)
160
+ get_property(_subdirs DIRECTORY "${_dir}" PROPERTY SUBDIRECTORIES)
161
+ foreach(_subdir IN LISTS _subdirs)
162
+ get_all_targets(${_result} "${_subdir}")
163
+ endforeach()
164
+
165
+ get_directory_property(_sub_targets DIRECTORY "${_dir}" BUILDSYSTEM_TARGETS)
166
+ set(${_result} ${${_result}} ${_sub_targets} PARENT_SCOPE)
167
+ endfunction()
168
+
169
+ ##
170
+ ## Add targets for building and installing subdirectories
171
+ macro(subdirectory_target target directory build_folder)
172
+ add_custom_target(${target}
173
+ COMMENT "run build for all projects in this directory" VERBATIM
174
+ )
175
+ get_all_targets(ALL_TARGETS ${directory})
176
+ add_dependencies(${target} ${ALL_TARGETS})
177
+ add_custom_target(${target}_install
178
+ ${CMAKE_COMMAND} -DBUILD_TYPE=$<CONFIG> -DCOMPONENT=${target}_install -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
179
+ COMMENT "run install for all projects in this directory" VERBATIM
180
+ )
181
+ add_dependencies(${target}_install ${target})
182
+
183
+ set_target_properties(${target} PROPERTIES FOLDER ${build_folder})
184
+ set_target_properties(${target}_install PROPERTIES FOLDER ${build_folder})
185
+ endmacro()
186
+
187
+
188
+ ## CMAKE install all required dependencies for an application (included system OS files like msvc*.dll for example)
189
+ ##
190
+ ## install_runtime(<installedFilePathTargetAppToResolve>
191
+ ## [TARGET name]
192
+ ## [PLUGINS name [nameN ...] [PLUGIN_PATH_NAME currentPathName [FROM_REL_PATH matchDirFromCurrentPathName] [PLUGIN_PATH_DEST installDir] ]
193
+ ## [PLUGINS ...]
194
+ ## [DIRS path [pathN ...] ]
195
+ ## [TARGET_LIBRARIES filePath [filePathN ...] ]
196
+ ## [TARGET_PACKAGES packageName [packageNameN ...] ]
197
+ ## [COMPONENT installComponentName]
198
+ ## [PLAUSIBLES_POSTFIX Debug_postfix [MinSizeRel_postfix relWithDebInfo_postfix ...] ]
199
+ ## [VERBOSE]
200
+ ## )
201
+ ##
202
+ ## installedFilePathTargetAppToResolve : the final installed targetApp absolute full file path name you want to resolve
203
+ ##
204
+ ## TARGET : The target app we want to install. If given, it's used to look for link libraries paths (best choice to use, strongly advised to use it)
205
+ ##
206
+ ## PLUGINS : Some application built use/load some plugins which can't be detect inside its binary,
207
+ ## so, here you can specify which plugins the application use/load in order to install them
208
+ ## and resolve also there dependencies.
209
+ ## With PLUGINS multi FLAGS :
210
+ ## PLUGIN_PATH_NAME : The current plugin full file path we want to install
211
+ ## FROM_REL_PATH : [optional: default only the file is kept] From which matching dir of the plugin path we want to install (keep the directories structure)
212
+ ## PLUGIN_PATH_DEST : [optional: default relative to executable directory] Where (full path to the install directory) we will install the plugin file (or file path)
213
+ ##
214
+ ## DIRS : A list of directories to looking for dependencies
215
+ ## TARGET_LIBRARIES : DEPRECATED (use TARGET flag instead) : The cmake content variables used for the target_link_libraries(<targetApp> ...)
216
+ ## TARGET_PACKAGES : DEPRECATED (use TARGET flag instead) : The cmake package names used for the findPackage(...) for your targetApp
217
+ ## ADVICE: This flag add entries in cache (like: <packageName>_DIR), it could be useful to fill these variable!
218
+ ## COMPONENT : (default to runtime) Is the component name associated to the installation
219
+ ## It is used when you want to install separatly some part of your projets (see install cmake doc)
220
+ ## VERBOSE : For debug or to get more informations in the output console
221
+ ##
222
+ ## Usage:
223
+ ## install_runtime(${CMAKE_INSTALL_PREFIX}/${EXECUTABLE_NAME}${CMAKE_EXECUTABLE_SUFFIX}
224
+ ## VERBOSE
225
+ ## TARGET ${PROJECT_NAME}
226
+ ## PLAUSIBLES_POSTFIX _d
227
+ ## PLUGINS
228
+ ## PLUGIN_PATH_NAME ${PLUGIN_PATH_NAME}${CMAKE_SHARED_MODULE_SUFFIX} ## will be installed (default exec path if no PLUGINS_DEST) and then will be resolved
229
+ ## FROM_REL_PATH plugins ## optional, used especially for keeping qt plugins tree structure
230
+ ## PLUGIN_PATH_DEST ${CMAKE_INSTALL_PREFIX}/plugins ## (or relative path 'plugins' will be interpreted relative to installed executable)
231
+ ## DIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}
232
+ ## TARGET_LIBRARIES ${OPENGL_LIBRARIES} ## DEPRECATED (use TARGET flag instead)
233
+ ## ${GLEW_LIBRARIES}
234
+ ## ${GLUT_LIBRARIES}
235
+ ## ${Boost_LIBRARIES}
236
+ ## ${SuiteSparse_LIBRARIES}
237
+ ## ${CGAL_LIBRARIES}
238
+ ## TARGET_PACKAGES OPENGL ## DEPRECATED (use TARGET flag instead)
239
+ ## GLEW
240
+ ## GLUT
241
+ ## CGAL
242
+ ## Boost
243
+ ## SuiteSparse
244
+ ## )
245
+ ##
246
+ ## For plugins part, it use our internal parse_arguments_multi.cmake
247
+ ##
248
+ function(install_runtime installedFilePathTargetAppToResolve)
249
+ set(optionsArgs "VERBOSE")
250
+ set(oneValueArgs "COMPONENT;INSTALL_FOLDER;CONFIG_TYPE")
251
+ set(multiValueArgs "DIRS;PLUGINS;TARGET_LIBRARIES;TARGET_PACKAGES;TARGET;PLAUSIBLES_POSTFIX")
252
+ cmake_parse_arguments(inst_run "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
253
+
254
+ if(IS_ABSOLUTE ${installedFilePathTargetAppToResolve})
255
+ else()
256
+ set(installedFilePathTargetAppToResolve ${inst_run_INSTALL_FOLDER}/${installedFilePathTargetAppToResolve})
257
+ endif()
258
+
259
+ get_filename_component(EXEC_NAME ${installedFilePathTargetAppToResolve} NAME_WE)
260
+ get_filename_component(EXEC_PATH ${installedFilePathTargetAppToResolve} PATH)
261
+
262
+ if(NOT inst_run_COMPONENT)
263
+ set(inst_run_COMPONENT runtime)
264
+ endif()
265
+
266
+
267
+ ## Try to append as more possible as possible paths to find dependencies (deprecated since we can use target_properties to get back paths)
268
+ set(libPaths )
269
+ foreach(libraryFileName ${inst_run_TARGET_LIBRARIES})
270
+ if(IS_DIRECTORY "${libraryFileName}")
271
+ list(APPEND libPaths "${libraryFileName}")
272
+ else()
273
+ get_filename_component(libpath "${libraryFileName}" PATH)
274
+ if(EXISTS "${libpath}")
275
+ list(APPEND libPaths "${libpath}")
276
+ endif()
277
+ endif()
278
+ endforeach()
279
+
280
+ ## This macro is used internaly here to recursilvely get path of LINK_LIBRARIES of each non imported target
281
+ ## Typically if you have 2 internal dependencies between cmake targets, we want cmake to be able to get back path where are these dependencies
282
+ macro(recurseDepList target)
283
+ get_target_property(linkLibs ${target} LINK_LIBRARIES)
284
+ foreach(lib ${linkLibs})
285
+ string(FIND ${lib} ">" strId) ## cmake is using generator-expression?
286
+ if(TARGET ${lib})
287
+ ## Skipping interface libraries as they're system ones
288
+ get_target_property(type ${lib} TYPE)
289
+ get_target_property(imported ${lib} IMPORTED)
290
+ if(type STREQUAL "INTERFACE_LIBRARY")
291
+ get_target_property(imp_loc ${lib} INTERFACE_IMPORTED_LOCATION)
292
+ if(imp_loc)
293
+ get_filename_component(imp_loc ${imp_loc} PATH)
294
+ list(APPEND targetLibPath ${imp_loc})
295
+ endif()
296
+ get_target_property(loc ${lib} INTERFACE_LOCATION)
297
+ if(loc)
298
+ get_filename_component(loc ${loc} PATH)
299
+ list(APPEND targetLibPath ${loc})
300
+ endif()
301
+ ## it's not a path but a single target name
302
+ ## for build-target which are part of the current cmake configuration : nothing to do as cmake already know the output path
303
+ ## for imported target, we need to look for theire imported location
304
+ elseif(imported)
305
+ get_target_property(imp_loc ${lib} IMPORTED_LOCATION)
306
+ if(imp_loc)
307
+ get_filename_component(imp_loc ${imp_loc} PATH)
308
+ list(APPEND targetLibPath ${imp_loc})
309
+ endif()
310
+ get_target_property(loc ${lib} LOCATION)
311
+ if(loc)
312
+ get_filename_component(loc ${loc} PATH)
313
+ list(APPEND targetLibPath ${loc})
314
+ endif()
315
+ else()
316
+ recurseDepList(${lib})
317
+ endif()
318
+ elseif(NOT ${strId} MATCHES -1) ## mean cmake use generator-expression (CMAKE VERSION > 3.0)
319
+ string(REGEX MATCH ">:[@A-Za-z_:/.0-9-]+" targetLibPath ${lib})
320
+ string(REGEX REPLACE ">:([@A-Za-z_:/.0-9-]+)" "\\1" targetLibPath ${targetLibPath})
321
+ get_filename_component(targetLibPath ${targetLibPath} PATH)
322
+ elseif(EXISTS ${lib})
323
+ set(targetLibPath ${lib})
324
+ get_filename_component(targetLibPath ${targetLibPath} PATH)
325
+ else()
326
+ #message(STATUS "[install_runtime] skip link library : ${lib} , of target ${target}")
327
+ endif()
328
+ if(targetLibPath)
329
+ list(APPEND targetLinkLibsPathList ${targetLibPath})
330
+ endif()
331
+ endforeach()
332
+ if(targetLinkLibsPathList)
333
+ list(REMOVE_DUPLICATES targetLinkLibsPathList)
334
+ endif()
335
+ endmacro()
336
+ if(inst_run_TARGET)
337
+ recurseDepList(${inst_run_TARGET})
338
+ if(targetLinkLibsPathList)
339
+ list(APPEND libPaths ${targetLinkLibsPathList})
340
+ endif()
341
+ endif()
342
+
343
+ if(libPaths)
344
+ list(REMOVE_DUPLICATES libPaths)
345
+ foreach(libPath ${libPaths})
346
+ get_filename_component(path ${libPath} PATH)
347
+ list(APPEND libPaths ${path})
348
+ endforeach()
349
+ endif()
350
+
351
+
352
+ ## possible speciale dir(s) according to the build system and OS
353
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
354
+ set(BUILD_TYPES_FOR_DLL "x64")
355
+ if(WIN32)
356
+ list(APPEND BUILD_TYPES_FOR_DLL "Win64")
357
+ endif()
358
+ else()
359
+ set(BUILD_TYPES_FOR_DLL "x86")
360
+ if(WIN32)
361
+ list(APPEND BUILD_TYPES_FOR_DLL "Win32")
362
+ endif()
363
+ endif()
364
+
365
+
366
+ ## Try to append as more as possible paths to find dependencies (here, mainly for *.dll)
367
+ foreach(dir ${inst_run_DIRS} ${libPaths})
368
+ if(EXISTS "${dir}/bin")
369
+ list(APPEND inst_run_DIRS "${dir}/bin")
370
+ elseif(EXISTS "${dir}")
371
+ list(APPEND inst_run_DIRS "${dir}")
372
+ endif()
373
+ endforeach()
374
+ list(REMOVE_DUPLICATES inst_run_DIRS)
375
+ foreach(dir ${inst_run_DIRS})
376
+ if(EXISTS "${dir}")
377
+ list(APPEND argDirs ${dir})
378
+ foreach(BUILD_TYPE_FOR_DLL ${BUILD_TYPES_FOR_DLL})
379
+ if(EXISTS "${dir}/${BUILD_TYPE_FOR_DLL}")
380
+ list(APPEND argDirs "${dir}/${BUILD_TYPE_FOR_DLL}")
381
+ endif()
382
+ foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) ## for windows multi-generator (MSVC)
383
+ if(EXISTS "${dir}/${BUILD_TYPE_FOR_DLL}/${OUTPUTCONFIG}")
384
+ list(APPEND argDirs "${dir}/${BUILD_TYPE_FOR_DLL}/${OUTPUTCONFIG}")
385
+ endif()
386
+ endforeach()
387
+ if(CMAKE_BUILD_TYPE) ## for single generator (makefiles)
388
+ if(EXISTS "${dir}/${BUILD_TYPE_FOR_DLL}/${CMAKE_BUILD_TYPE}")
389
+ list(APPEND argDirs "${dir}/${BUILD_TYPE_FOR_DLL}/${CMAKE_BUILD_TYPE}")
390
+ endif()
391
+ endif()
392
+ endforeach()
393
+ foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) ## for windows multi-generator (MSVC)
394
+ if(EXISTS "${dir}/${OUTPUTCONFIG}")
395
+ list(APPEND argDirs "${dir}/${OUTPUTCONFIG}")
396
+ endif()
397
+ foreach(BUILD_TYPE_FOR_DLL ${BUILD_TYPES_FOR_DLL})
398
+ if(EXISTS "${dir}/${OUTPUTCONFIG}/${BUILD_TYPE_FOR_DLL}")
399
+ list(APPEND argDirs "${dir}/${OUTPUTCONFIG}/${BUILD_TYPE_FOR_DLL}")
400
+ endif()
401
+ endforeach()
402
+ endforeach()
403
+ if(CMAKE_BUILD_TYPE) ## for single generator (makefiles)
404
+ if(EXISTS "${dir}/${CMAKE_BUILD_TYPE}")
405
+ list(APPEND argDirs "${dir}/${CMAKE_BUILD_TYPE}")
406
+ endif()
407
+ foreach(BUILD_TYPE_FOR_DLL ${BUILD_TYPES_FOR_DLL})
408
+ if(EXISTS "${dir}/${CMAKE_BUILD_TYPE}/${BUILD_TYPE_FOR_DLL}")
409
+ list(APPEND argDirs "${dir}/${CMAKE_BUILD_TYPE}/${BUILD_TYPE_FOR_DLL}")
410
+ endif()
411
+ endforeach()
412
+ endif()
413
+ endif()
414
+ endforeach()
415
+ if(argDirs)
416
+ list(REMOVE_DUPLICATES argDirs)
417
+ endif()
418
+
419
+
420
+ ## Try to append as more possible paths to find dependencies (here, mainly for *.dll)
421
+ foreach(packageName ${inst_run_TARGET_PACKAGES})
422
+ if(EXISTS "${${packageName}_DIR}")
423
+ list(APPEND packageDirs ${${packageName}_DIR})
424
+ list(APPEND packageDirs ${${packageName}_DIR}/bin)
425
+ foreach(BUILD_TYPE_FOR_DLL ${BUILD_TYPES_FOR_DLL})
426
+ if(EXISTS "${${packageName}_DIR}/bin/${BUILD_TYPE_FOR_DLL}")
427
+ list(APPEND packageDirs "${${packageName}_DIR}/bin/${BUILD_TYPE_FOR_DLL}")
428
+ endif()
429
+ foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) ## for windows multi-generator (MSVC)
430
+ if(EXISTS "${${packageName}_DIR}/bin/${BUILD_TYPE_FOR_DLL}/${OUTPUTCONFIG}")
431
+ list(APPEND packageDirs "${${packageName}_DIR}/bin/${BUILD_TYPE_FOR_DLL}/${OUTPUTCONFIG}")
432
+ endif()
433
+ endforeach()
434
+ if(CMAKE_BUILD_TYPE) ## for single generator (makefiles)
435
+ if(EXISTS "${${packageName}_DIR}/bin/${BUILD_TYPE_FOR_DLL}/${CMAKE_BUILD_TYPE}")
436
+ list(APPEND packageDirs "${${packageName}_DIR}/bin/${BUILD_TYPE_FOR_DLL}/${CMAKE_BUILD_TYPE}")
437
+ endif()
438
+ endif()
439
+ endforeach()
440
+ foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) ## for windows multi-generator (MSVC)
441
+ if(EXISTS "${${packageName}_DIR}/bin/${OUTPUTCONFIG}")
442
+ list(APPEND packageDirs "${${packageName}_DIR}/bin/${OUTPUTCONFIG}")
443
+ endif()
444
+ foreach(BUILD_TYPE_FOR_DLL ${BUILD_TYPES_FOR_DLL})
445
+ if(EXISTS "${${packageName}_DIR}/bin/${OUTPUTCONFIG}/${BUILD_TYPE_FOR_DLL}")
446
+ list(APPEND packageDirs "${${packageName}_DIR}/bin/${OUTPUTCONFIG}/${BUILD_TYPE_FOR_DLL}")
447
+ endif()
448
+ endforeach()
449
+ endforeach()
450
+ if(CMAKE_BUILD_TYPE) ## for single generator (makefiles)
451
+ if(EXISTS "${${packageName}_DIR}/bin/${CMAKE_BUILD_TYPE}")
452
+ list(APPEND packageDirs "${${packageName}_DIR}/bin/${CMAKE_BUILD_TYPE}")
453
+ endif()
454
+ foreach(BUILD_TYPE_FOR_DLL ${BUILD_TYPES_FOR_DLL})
455
+ if(EXISTS "${${packageName}_DIR}/bin/${CMAKE_BUILD_TYPE}/${BUILD_TYPE_FOR_DLL}")
456
+ list(APPEND packageDirs "${${packageName}_DIR}/bin/${CMAKE_BUILD_TYPE}/${BUILD_TYPE_FOR_DLL}")
457
+ endif()
458
+ endforeach()
459
+ endif()
460
+ else()
461
+ set(${packageName}_DIR "$ENV{${packageName}_DIR}" CACHE PATH "${packageName}_DIR root directory for looking for dirs containning *.dll")
462
+ endif()
463
+ endforeach()
464
+ if(packageDirs)
465
+ list(REMOVE_DUPLICATES packageDirs)
466
+ endif()
467
+
468
+
469
+ set(dirsToLookFor "${EXEC_PATH}")
470
+ if(packageDirs)
471
+ list(APPEND dirsToLookFor ${packageDirs})
472
+ endif()
473
+ if(argDirs)
474
+ list(APPEND dirsToLookFor ${argDirs})
475
+ endif()
476
+ get_property(used_LINK_DIRECTORIES DIRECTORY PROPERTY LINK_DIRECTORIES)
477
+ if (used_LINK_DIRECTORIES)
478
+ list(APPEND dirsToLookFor ${used_LINK_DIRECTORIES})
479
+ list(REMOVE_DUPLICATES dirsToLookFor)
480
+ endif()
481
+
482
+
483
+ ## handle plugins
484
+ set(pluginsList "")
485
+ include(parse_arguments_multi) ## this function will process recursively items of the sub-list [default print messages]
486
+ function(parse_arguments_multi_function results)
487
+ cmake_parse_arguments(pamf "VERBOSE" "PLUGIN_PATH_DEST;FROM_REL_PATH;EXEC_PATH;COMPONENT" "" ${ARGN}) ## EXEC_PATH and COMPONENT are for exclusive internal use
488
+ list(REMOVE_DUPLICATES pamf_UNPARSED_ARGUMENTS)
489
+ foreach(PLUGIN_PATH_NAME ${pamf_UNPARSED_ARGUMENTS})
490
+ if(EXISTS ${PLUGIN_PATH_NAME})
491
+ if(IS_DIRECTORY ${PLUGIN_PATH_NAME})
492
+ if(pamf_VERBOSE)
493
+ message(WARNING "${PLUGIN_PATH_NAME} IS_DIRECTORY, cannot installed a directory, please give a path filename")
494
+ endif()
495
+ else()
496
+ if(NOT pamf_PLUGIN_PATH_DEST)
497
+ set(PLUGIN_PATH_DEST ${pamf_EXEC_PATH}) ## the default dest value
498
+ else()
499
+ set(PLUGIN_PATH_DEST ${pamf_PLUGIN_PATH_DEST})
500
+ endif()
501
+
502
+ if(pamf_FROM_REL_PATH)
503
+ file(TO_CMAKE_PATH ${PLUGIN_PATH_NAME} PLUGIN_PATH_NAME)
504
+ get_filename_component(PLUGIN_PATH ${PLUGIN_PATH_NAME} PATH)
505
+ unset(PLUGIN_PATH_LIST)
506
+ unset(PLUGIN_PATH_LIST_COUNT)
507
+ unset(PLUGIN_REL_PATH_LIST)
508
+ unset(PLUGIN_REL_PATH)
509
+ string(REPLACE "/" ";" PLUGIN_PATH_LIST ${PLUGIN_PATH}) ## create a list of dir
510
+ list(FIND PLUGIN_PATH_LIST ${pamf_FROM_REL_PATH} id)
511
+ list(LENGTH PLUGIN_PATH_LIST PLUGIN_PATH_LIST_COUNT)
512
+ if(${id} GREATER 0)
513
+ math(EXPR id "${id}+1") ## matches relative path not include
514
+ math(EXPR PLUGIN_PATH_LIST_COUNT "${PLUGIN_PATH_LIST_COUNT}-1") ## the end of the list
515
+ foreach(i RANGE ${id} ${PLUGIN_PATH_LIST_COUNT})
516
+ list(GET PLUGIN_PATH_LIST ${i} out)
517
+ list(APPEND PLUGIN_REL_PATH_LIST ${out})
518
+ endforeach()
519
+ foreach(dir ${PLUGIN_REL_PATH_LIST})
520
+ set(PLUGIN_REL_PATH "${PLUGIN_REL_PATH}/${dir}")
521
+ endforeach()
522
+ endif()
523
+ set(PLUGIN_PATH_DEST ${PLUGIN_PATH_DEST}${PLUGIN_REL_PATH})
524
+ endif()
525
+
526
+ install(FILES ${PLUGIN_PATH_NAME} CONFIGURATIONS ${inst_run_CONFIG_TYPE} DESTINATION ${PLUGIN_PATH_DEST} COMPONENT ${pamf_COMPONENT})
527
+ get_filename_component(pluginName ${PLUGIN_PATH_NAME} NAME)
528
+ if(IS_ABSOLUTE ${PLUGIN_PATH_DEST})
529
+ else()
530
+ set(PLUGIN_PATH_DEST ${inst_run_INSTALL_FOLDER}/${PLUGIN_PATH_DEST})
531
+ endif()
532
+ list(APPEND pluginsList ${PLUGIN_PATH_DEST}/${pluginName})
533
+ endif()
534
+ else()
535
+ message(WARNING "You need to provide a valid PLUGIN_PATH_NAME")
536
+ set(pluginsList )
537
+ endif()
538
+ endforeach()
539
+ set(${results} ${pluginsList} PARENT_SCOPE)
540
+ endfunction()
541
+
542
+ if(inst_run_VERBOSE)
543
+ list(APPEND extra_flags_to_add VERBOSE)
544
+ endif()
545
+ list(APPEND extra_flags_to_add EXEC_PATH ${EXEC_PATH} COMPONENT ${inst_run_COMPONENT}) ## for internal use inside overloaded function
546
+ list(LENGTH inst_run_PLUGINS inst_run_PLUGINS_count)
547
+ if(${inst_run_PLUGINS_count} GREATER 0)
548
+ parse_arguments_multi(PLUGIN_PATH_NAME inst_run_PLUGINS ${inst_run_PLUGINS} ## see internal overload parse_arguments_multi_function for processing each sub-list
549
+ NEED_RESULTS ${inst_run_PLUGINS_count} ## this is used to check when we are in the first loop (in order to reset parse_arguments_multi_results)
550
+ EXTRAS_FLAGS ${extra_flags_to_add} ## this is used to allow catching additional internal flags of our overloaded function
551
+ )
552
+ endif()
553
+
554
+ #message(parse_arguments_multi_results = ${parse_arguments_multi_results})
555
+ list(APPEND pluginsList ${parse_arguments_multi_results})
556
+
557
+
558
+
559
+ ## Install rules for required system runtimes such as MSVCRxx.dll
560
+ set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP ON)
561
+ include(InstallRequiredSystemLibraries)
562
+ if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
563
+ install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
564
+ CONFIGURATIONS ${inst_run_CONFIG_TYPE}
565
+ DESTINATION ${EXEC_PATH}
566
+ COMPONENT ${inst_run_COMPONENT}
567
+ )
568
+ endif()
569
+
570
+ ## print what we are doing to do
571
+ if(inst_run_VERBOSE)
572
+ message(STATUS "[install_runtime] On install target call, cmake will try to resolve dependencies for given app:\n ${installedFilePathTargetAppToResolve} (with plausible postfix: ${inst_run_PLAUSIBLES_POSTFIX})")
573
+ if(pluginsList)
574
+ message(STATUS " and also for plugins :")
575
+ foreach(plugin ${pluginsList})
576
+ message(STATUS " ${plugin}")
577
+ endforeach()
578
+ endif()
579
+ message(STATUS " Looking for dependencies into:")
580
+ foreach(dir ${dirsToLookFor})
581
+ message(STATUS " ${dir}")
582
+ endforeach()
583
+ endif()
584
+
585
+ ## Install rules for required dependencies libs/plugins for the target app
586
+ ## will resolve all installed target files with config modes postfixes
587
+ string(TOUPPER ${inst_run_CONFIG_TYPE} inst_run_CONFIG_TYPE_UC)
588
+ get_target_property(postfix ${inst_run_TARGET} "${inst_run_CONFIG_TYPE_UC}_POSTFIX")
589
+ install(CODE "set(target \"${inst_run_TARGET}\")" COMPONENT ${inst_run_COMPONENT} CONFIGURATIONS ${CONFIG_TYPE})
590
+ install(CODE "set(inst_run_CONFIG_TYPE \"${inst_run_CONFIG_TYPE}\")" COMPONENT ${inst_run_COMPONENT} CONFIGURATIONS ${CONFIG_TYPE})
591
+ install(CODE "set(inst_run_INSTALL_FOLDER \"${inst_run_INSTALL_FOLDER}\")" COMPONENT ${inst_run_COMPONENT} CONFIGURATIONS ${CONFIG_TYPE})
592
+ install(CODE "set(app \"${EXEC_PATH}/${EXEC_NAME}${postfix}${CMAKE_EXECUTABLE_SUFFIX}\")" COMPONENT ${inst_run_COMPONENT} CONFIGURATIONS ${CONFIG_TYPE})
593
+ install(CODE "set(dirsToLookFor \"${dirsToLookFor}\")" COMPONENT ${inst_run_COMPONENT} CONFIGURATIONS ${CONFIG_TYPE})
594
+ install(CODE
595
+ [[
596
+ if("${CMAKE_INSTALL_CONFIG_NAME}" STREQUAL "${inst_run_CONFIG_TYPE}")
597
+ message(STATUS "Installing ${target} dependencies...")
598
+
599
+ file(GET_RUNTIME_DEPENDENCIES
600
+ EXECUTABLES ${app}
601
+ RESOLVED_DEPENDENCIES_VAR _r_deps
602
+ UNRESOLVED_DEPENDENCIES_VAR _u_deps
603
+ CONFLICTING_DEPENDENCIES_PREFIX _c_deps
604
+ DIRECTORIES ${dirsToLookFor}
605
+ PRE_EXCLUDE_REGEXES "api-ms-*"
606
+ POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" ".*SysWOW64/.*\\.dll"
607
+ )
608
+
609
+ if(_u_deps)
610
+ message(WARNING "There were unresolved dependencies for executable ${EXEC_FILE}: \"${_u_deps}\"!")
611
+ endif()
612
+ if(_c_deps_FILENAMES)
613
+ message(WARNING "There were conflicting dependencies for executable ${EXEC_FILE}: \"${_c_deps_FILENAMES}\"!")
614
+ endif()
615
+
616
+ foreach(_file ${_r_deps})
617
+ file(INSTALL
618
+ DESTINATION "${inst_run_INSTALL_FOLDER}/bin"
619
+ TYPE SHARED_LIBRARY
620
+ FOLLOW_SYMLINK_CHAIN
621
+ FILES "${_file}"
622
+ )
623
+ endforeach()
624
+ endif()
625
+ ]]
626
+ COMPONENT ${inst_run_COMPONENT} CONFIGURATIONS ${CONFIG_TYPE}
627
+ )
628
+
629
+ endfunction()
630
+
631
+ ## High level macro to install resources in the correct folder
632
+ ##
633
+ ## EXECUTABLE: [opt] option to copy files as programs
634
+ ## RELATIVE : [opt] copy files relatively to current folder
635
+ ## TYPE : [opt] type and folder where to store the files
636
+ ## FOLDER : [opt] subfolder to use
637
+ ## FILES : [opt] contains a list of resources files to copy to install folder
638
+ macro(ibr_install_rsc target)
639
+ cmake_parse_arguments(install_rsc_${target} "EXECUTABLE;RELATIVE" "TYPE;FOLDER" "FILES" ${ARGN})
640
+ set(rsc_target "${target}_${install_rsc_${target}_TYPE}")
641
+
642
+ if(install_rsc_${target}_FOLDER)
643
+ set(rsc_folder "${install_rsc_${target}_TYPE}/${install_rsc_${target}_FOLDER}")
644
+ else()
645
+ set(rsc_folder "${install_rsc_${target}_TYPE}")
646
+ endif()
647
+
648
+ add_custom_target(${rsc_target}
649
+ COMMENT "run the ${install_rsc_${target}_TYPE} installation only for ${target} (component ${rsc_target})"
650
+ VERBATIM)
651
+ foreach(scriptFile ${install_rsc_${target}_FILES})
652
+ if(install_rsc_${target}_RELATIVE)
653
+ file(RELATIVE_PATH relativeFilename ${CMAKE_CURRENT_SOURCE_DIR} ${scriptFile})
654
+ else()
655
+ get_filename_component(relativeFilename ${scriptFile} NAME)
656
+ endif()
657
+
658
+ if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
659
+ add_custom_command(TARGET ${rsc_target} POST_BUILD
660
+ COMMAND ${CMAKE_COMMAND} -E
661
+ copy_if_different ${scriptFile} ${CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE}}/${rsc_folder}/${relativeFilename})
662
+ endif()
663
+ foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
664
+ string(TOUPPER ${CONFIG_TYPES} CONFIG_TYPES_UC)
665
+ add_custom_command(TARGET ${rsc_target} POST_BUILD
666
+ COMMAND ${CMAKE_COMMAND} -E
667
+ copy_if_different ${scriptFile} ${CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC}}/${rsc_folder}/${relativeFilename})
668
+ endforeach()
669
+ endforeach()
670
+
671
+ get_target_property(INSTALL_RSC_BUILD_FOLDER ${target} FOLDER)
672
+ set_target_properties(${rsc_target} PROPERTIES FOLDER ${INSTALL_RSC_BUILD_FOLDER})
673
+
674
+ add_dependencies(${target} ${rsc_target})
675
+ add_dependencies(PREBUILD ${rsc_target})
676
+
677
+ if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
678
+ resourceFile(ADD ${rsc_folder} CONFIG_TYPE ${CMAKE_BUILD_TYPE} FILE_PATH "${CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE}}/ibr_resources.ini")
679
+
680
+ if(install_rsc_${target}_EXECUTABLE)
681
+ install(
682
+ PROGRAMS ${install_rsc_${target}_FILES}
683
+ CONFIGURATIONS ${CMAKE_BUILD_TYPE}
684
+ DESTINATION "${CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE}}/${rsc_folder}"
685
+ )
686
+ else()
687
+ install(
688
+ FILES ${install_rsc_${target}_FILES}
689
+ CONFIGURATIONS ${CMAKE_BUILD_TYPE}
690
+ DESTINATION "${CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE}}/${rsc_folder}"
691
+ )
692
+ endif()
693
+ endif()
694
+ foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
695
+ string(TOUPPER ${CONFIG_TYPES} CONFIG_TYPES_UC)
696
+ resourceFile(ADD ${rsc_folder} CONFIG_TYPE ${CONFIG_TYPES} FILE_PATH "${CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC}}/ibr_resources.ini")
697
+
698
+ if(install_rsc_${target}_EXECUTABLE)
699
+ install(
700
+ PROGRAMS ${install_rsc_${target}_FILES}
701
+ CONFIGURATIONS ${CONFIG_TYPES}
702
+ DESTINATION "${CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC}}/${rsc_folder}"
703
+ )
704
+ else()
705
+ install(
706
+ FILES ${install_rsc_${target}_FILES}
707
+ CONFIGURATIONS ${CONFIG_TYPES}
708
+ DESTINATION "${CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC}}/${rsc_folder}"
709
+ )
710
+ endif()
711
+ endforeach()
712
+ endmacro()
713
+
714
+
715
+ ## High level macro to install in an homogen way all our ibr targets (it use some functions inside this file)
716
+ ##
717
+ ## RSC_FILE_ADD : [opt] is used to auto write/append relative paths of target resources into a common file
718
+ ## INSTALL_PDB : [opt] is used to auto install PDB file (when using MSVC according to the target type)
719
+ ## STANDALONE : [opt] bool ON/OFF var to call install_runtime or not (for bundle resolution)
720
+ ## DIRS : [opt] used if STANDALONE set to ON, see install_runtime doc
721
+ ## PLUGINS: [opt] used if STANDALONE set to ON, see install_runtime doc
722
+ ## MSVC_CMD : [opt] used to specify an absolute filePathName application to launch with the MSVC IDE Debugger associated to this target (project file)
723
+ ## MSVC_ARGS : [opt] load the MSVC debugger with correct settings (app path, args, working dir)
724
+ ##
725
+ macro(ibr_install_target target)
726
+ cmake_parse_arguments(ibrInst${target} "VERBOSE;INSTALL_PDB" "COMPONENT;MSVC_ARGS;STANDALONE;RSC_FOLDER" "SHADERS;RESOURCES;SCRIPTS;DIRS;PLUGINS" ${ARGN})
727
+
728
+ if(ibrInst${target}_RSC_FOLDER)
729
+ set(rsc_folder "${ibrInst${target}_RSC_FOLDER}")
730
+ else()
731
+ set(rsc_folder "${target}")
732
+ endif()
733
+
734
+ if(ibrInst${target}_SHADERS)
735
+ ibr_install_rsc(${target} EXECUTABLE TYPE "shaders" FOLDER ${rsc_folder} FILES "${ibrInst${target}_SHADERS}")
736
+ endif()
737
+
738
+ if(ibrInst${target}_RESOURCES)
739
+ ibr_install_rsc(${target} TYPE "resources" FOLDER ${rsc_folder} FILES "${ibrInst${target}_RESOURCES}")
740
+ endif()
741
+
742
+ if(ibrInst${target}_SCRIPTS)
743
+ ibr_install_rsc(${target} EXECUTABLE TYPE "scripts" FOLDER ${rsc_folder} FILES "${ibrInst${target}_SCRIPTS}")
744
+ endif()
745
+
746
+ if(ibrInst${target}_COMPONENT)
747
+ set(installCompArg COMPONENT ${ibrInst${target}_COMPONENT})
748
+ ## Create a custom install target based on COMPONENT
749
+ installTargetProject(${target} ${ibrInst${target}_COMPONENT})
750
+ endif()
751
+
752
+ if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
753
+ set_target_properties(${target} PROPERTIES ${CMAKE_BUILD_TYPE}_POSTFIX "${CMAKE_${CMAKE_BUILD_TYPE}_POSTFIX}")
754
+ get_target_property(CURRENT_TARGET_BUILD_TYPE_POSTFIX ${target} ${CMAKE_BUILD_TYPE}_POSTFIX)
755
+ endif()
756
+ foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
757
+ string(TOUPPER ${CONFIG_TYPES} CONFIG_TYPES_UC)
758
+ set_target_properties(${target} PROPERTIES ${CONFIG_TYPES_UC}_POSTFIX "${CMAKE_${CONFIG_TYPES_UC}_POSTFIX}")
759
+ get_target_property(CURRENT_TARGET_BUILD_TYPE_POSTFIX ${target} ${CONFIG_TYPES_UC}_POSTFIX)
760
+ endforeach()
761
+
762
+ ## Specify default installation rules
763
+ if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
764
+ install(TARGETS ${target}
765
+ CONFIGURATIONS ${CMAKE_BUILD_TYPE}
766
+ LIBRARY DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}} ${installCompArg}
767
+ ARCHIVE DESTINATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}} ${installCompArg}
768
+ RUNTIME DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}} ${installCompArg}
769
+ )
770
+ install(TARGETS ${target}
771
+ CONFIGURATIONS ${CMAKE_BUILD_TYPE}
772
+ LIBRARY DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}} ${installCompArg}
773
+ ARCHIVE DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}} ${installCompArg}
774
+ )
775
+ endif()
776
+ foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
777
+ string(TOUPPER ${CONFIG_TYPES} CONFIG_TYPES_UC)
778
+ install(TARGETS ${target}
779
+ CONFIGURATIONS ${CONFIG_TYPES}
780
+ LIBRARY DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}} ${installCompArg}
781
+ ARCHIVE DESTINATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}} ${installCompArg}
782
+ RUNTIME DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}} ${installCompArg}
783
+ )
784
+ install(TARGETS ${target}
785
+ CONFIGURATIONS ${CONFIG_TYPES}
786
+ LIBRARY DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}} ${installCompArg}
787
+ ARCHIVE DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}} ${installCompArg}
788
+ )
789
+ endforeach()
790
+
791
+ if(ibrInst${target}_INSTALL_PDB)
792
+ if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
793
+ installPDB(${target} ${CMAKE_BUILD_TYPE}
794
+ LIBRARY_DEST ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}}
795
+ ARCHIVE_DEST ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}}
796
+ RUNTIME_DEST ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}}
797
+ )
798
+ endif()
799
+ foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
800
+ string(TOUPPER ${CONFIG_TYPES} CONFIG_TYPES_UC)
801
+ installPDB(${target} ${CONFIG_TYPES}
802
+ LIBRARY_DEST ${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}}
803
+ ARCHIVE_DEST ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}}
804
+ RUNTIME_DEST ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}}
805
+ )
806
+ endforeach()
807
+ endif()
808
+
809
+ ## install dynamic necessary dependencies
810
+ if(ibrInst${target}_STANDALONE)
811
+ get_target_property(type ${target} TYPE)
812
+ if(${type} MATCHES "EXECUTABLE")
813
+
814
+ if(ibrInst${target}_VERBOSE)
815
+ set(VERBOSE VERBOSE)
816
+ else()
817
+ set(VERBOSE )
818
+ endif()
819
+
820
+ if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
821
+ install_runtime(bin/${target}${CMAKE_EXECUTABLE_SUFFIX} ## default relative to CMAKE_INSTALL_PREFIX
822
+ INSTALL_FOLDER "${CMAKE_INSTALL_PREFIX_${CMAKE_BUILD_TYPE}}"
823
+ CONFIG_TYPE ${CMAKE_BUILD_TYPE}
824
+ ${VERBOSE}
825
+ TARGET ${target}
826
+ ${installCompArg}
827
+ PLUGINS ## will be installed
828
+ ${ibrInst${target}_PLUGINS}
829
+ DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}}
830
+ ${ibrInst${target}_DIRS}
831
+ )
832
+ endif()
833
+ foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
834
+ string(TOUPPER ${CONFIG_TYPES} CONFIG_TYPES_UC)
835
+ install_runtime(bin/${target}${CMAKE_EXECUTABLE_SUFFIX} ## default relative to CMAKE_INSTALL_PREFIX
836
+ INSTALL_FOLDER "${CMAKE_INSTALL_PREFIX_${CONFIG_TYPES_UC}}"
837
+ CONFIG_TYPE ${CONFIG_TYPES}
838
+ ${VERBOSE}
839
+ TARGET ${target}
840
+ ${installCompArg}
841
+ PLUGINS ## will be installed
842
+ ${ibrInst${target}_PLUGINS}
843
+ DIRS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG_TYPES_UC}}
844
+ ${ibrInst${target}_DIRS}
845
+ )
846
+ endforeach()
847
+ else()
848
+ message(WARNING "STANDALONE option is only compatible with EXECUTABLES target type. Skip the STANDALONE installation process.")
849
+ endif()
850
+ endif()
851
+
852
+ ## Provide a way to directly load the MSVC debugger with correct settings
853
+ if(MSVC)
854
+ if(ibrInst${target}_MSVC_CMD) ## command absolute filePathName is optional as the default is to use the installed target file application
855
+ set(msvcCmdArg COMMAND ${ibrInst${target}_MSVC_CMD}) ## flag following by the value (both to pass to the MSVCsetUserCommand function)
856
+ endif()
857
+ if(ibrInst${target}_MSVC_ARGS) ## args (between quotes) are optional
858
+ set(msvcArgsArg ARGS ${ibrInst${target}_MSVC_ARGS}) ## flag following by the value (both to pass to the MSVCsetUserCommand function)
859
+ endif()
860
+ get_target_property(type ${target} TYPE)
861
+ if( (ibrInst${target}_MSVC_CMD OR ibrInst${target}_MSVC_ARGS) OR (${type} MATCHES "EXECUTABLE") )
862
+ include(MSVCsetUserCommand)
863
+ if(DEFINED CMAKE_BUILD_TYPE) ## for make/nmake based
864
+ MSVCsetUserCommand( ${target}
865
+ PATH ${CMAKE_OUTPUT_BIN_${CMAKE_BUILD_TYPE}} ##FILE option not necessary since it deduced from targetName
866
+ ARGS "${SIBR_PROGRAMARGS}"
867
+ ${msvcCmdArg}
868
+ #${msvcArgsArg}
869
+ WORKING_DIR ${CMAKE_OUTPUT_BIN_${CMAKE_BUILD_TYPE}}
870
+ )
871
+ endif()
872
+ foreach(CONFIG_TYPES ${CMAKE_CONFIGURATION_TYPES}) ## for multi config types (MSVC based)
873
+ string(TOUPPER ${CONFIG_TYPES} CONFIG_TYPES_UC)
874
+ MSVCsetUserCommand( ${target}
875
+ PATH ${CMAKE_OUTPUT_BIN_${CONFIG_TYPES_UC}} ##FILE option not necessary since it deduced from targetName
876
+ ARGS "${SIBR_PROGRAMARGS}"
877
+ ${msvcCmdArg}
878
+ #${msvcArgsArg}
879
+ WORKING_DIR ${CMAKE_OUTPUT_BIN_${CONFIG_TYPES_UC}}
880
+ )
881
+ endforeach()
882
+ elseif(NOT ${type} MATCHES "EXECUTABLE")
883
+ #message("Cannot set MSVCsetUserCommand with target ${target} without COMMAND parameter as it is not an executable (skip it)")
884
+ endif()
885
+ endif()
886
+
887
+ endmacro()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/parse_arguments_multi.cmake ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ if(NOT WIN32 OR __parse_arguments_multi_cmake_INCLUDED__)
12
+ return()
13
+ else()
14
+ set(__parse_arguments_multi_cmake_INCLUDED__ ON)
15
+ endif()
16
+
17
+ ## This macro allow to process repeating multi value args from a given function which use cmake_parse_arguments module.
18
+ ##
19
+ ## cmake_parse_arguments multi args standard behavior:
20
+ ## function(foo)
21
+ ## cmake_parse_arguments(arg "" "" "MULTI" ${ARGN})
22
+ ## foreach(item IN LISTS arg_MULTI)
23
+ ## message(STATUS "${item}")
24
+ ## endforeach()
25
+ ## endfunction()
26
+ ## foo(MULTI x y MULTI z w)
27
+ ## The above code outputs 'z' and 'w'. It originally expected it to output all of 'x' 'y' 'z' 'w'.
28
+ ##
29
+ ## Using this macro inside a function which want to handle repeating multi args values
30
+ ## will recursively iterate onto the multi tags list to process each sub list.
31
+ ## It take as 1st argument the subTag flag to separate sub list from the main multi list.
32
+ ## It take as 2nd argument the nameList of the main multi list (the multiValuesArgs from cmake_parse_arguments: here it is MULTI in the example)
33
+ ## and that's why it is important that it should be a macro and not a function (to get access to external variable).
34
+ ## Then you give the content of this list allowing to be processed by the macro.
35
+ ##
36
+ ## parse_arguments_multi macro call a parse_arguments_multi_function which do actually the process from the given sub-list.
37
+ ## By default this function only print infos about what variables you are trying to pass/process (only verbose messages),
38
+ ## but, by overloading this cmake function, you will be able to externalize the process of your multi argument list.
39
+ ##
40
+ ## Usage (into a function) :
41
+ ## parse_arguments_multi(<multiArgsSubTag> <multiArgsList> <multiArgsListContent>
42
+ ## [NEED_RESULTS <multiArgsListSize>] [EXTRAS_FLAGS <...> <...> ...]
43
+ ## )
44
+ ##
45
+ ## Simple usage example [user point of view]:
46
+ ## foo(MULTI
47
+ ## SUB_MULTI x y
48
+ ## SUB_MULTI z w
49
+ ## )
50
+ ##
51
+ ## Simple usage example [inside a function]:
52
+ ## function(foo)
53
+ ## cmake_parse_arguments(arg "" "" "MULTI" ${ARGN})
54
+ ## include(parse_arguments_multi)
55
+ ## function(parse_arguments_multi_function )
56
+ ## #message("I'm an overloaded cmake function used by parse_arguments_multi")
57
+ ## #message("I'm processing first part of my sub list: ${ARGN}")
58
+ ## message("ARGV0=${ARGV0}")
59
+ ## message("ARGV1=${ARGV1}")
60
+ ## endfunction()
61
+ ## parse_arguments_multi(SUB_MULTI arg_MULTI ${arg_MULTI}) ## this function will process recusively items of the sub-list [default print messages]
62
+ ## endfunction()
63
+ ##
64
+ ## Will print:
65
+ ## ARGV0=z
66
+ ## ARGV1=w
67
+ ## ARGV0=x
68
+ ## ARGV1=y
69
+ ##
70
+ ## WARNING : DO NEVER ADD EXTRA THINGS TO parse_arguments_multi MACRO :
71
+ ## parse_arguments_multi(SUB_MULTI arg_MULTI ${arg_MULTI} EXTRAS foo bar SOMTHING) => will failed !!
72
+ ## use EXTRAS_FLAGS instead !!
73
+ ##
74
+ ## Advanced usage example [user point of view]:
75
+ ## bar(C:/prout/test.exe VERBOSE
76
+ ## PLUGINS
77
+ ## PLUGIN_PATH_NAME x PLUGIN_PATH_DEST w
78
+ ## PLUGIN_PATH_NAME a b PLUGIN_PATH_DEST y
79
+ ## PLUGIN_PATH_NAME c
80
+ ## )
81
+ ##
82
+ ## Advanced usage example [inside a function]:
83
+ ## function(bar execFilePathName)
84
+ ## cmake_parse_arguments(arg "VERBOSE" "" "PLUGINS" ${ARGN})
85
+ ##
86
+ ## include(parse_arguments_multi)
87
+ ## function(parse_arguments_multi_function results)
88
+ ## cmake_parse_arguments(pamf "VERBOSE" "PLUGIN_PATH_DEST;EXEC_PATH" "" ${ARGN}) ## EXEC_PATH is for internal use
89
+ ## message("")
90
+ ## message("I'm an overloaded cmake function used by parse_arguments_multi from install_runtime function")
91
+ ## message("I'm processing first part of my sub list: ${ARGN}")
92
+ ## message("PLUGIN_PATH_NAME = ${pamf_UNPARSED_ARGUMENTS}")
93
+ ## message(pamf_VERBOSE = ${pamf_VERBOSE})
94
+ ## message("pamf_PLUGIN_PATH_DEST = ${pamf_PLUGIN_PATH_DEST}")
95
+ ## message(pamf_EXEC_PATH = ${pamf_EXEC_PATH})
96
+ ## if(NOT ${pamf_PLUGIN_PATH_DEST})
97
+ ## set(pamf_PLUGIN_PATH_DEST ${pamf_EXEC_PATH})
98
+ ## endif()
99
+ ## foreach(plugin ${pamf_UNPARSED_ARGUMENTS})
100
+ ## get_filename_component(pluginName ${plugin} NAME)
101
+ ## list(APPEND pluginsList ${pamf_PLUGIN_PATH_DEST}/${pluginName})
102
+ ## endforeach()
103
+ ## set(${results} ${pluginsList} PARENT_SCOPE)
104
+ ## endfunction()
105
+ ##
106
+ ## if(arg_VERBOSE)
107
+ ## list(APPEND extra_flags_to_add VERBOSE) ## here we transmit the VERNOSE flag
108
+ ## endif()
109
+ ## get_filename_component(EXEC_PATH ${execFilePathName} PATH) ## will be the default value if PLUGIN_PATH_DEST option is not provided
110
+ ## list(APPEND extra_flags_to_add EXEC_PATH ${EXEC_PATH})
111
+ ## list(LENGTH arg_PLUGINS arg_PLUGINS_count)
112
+ ## parse_arguments_multi(PLUGIN_PATH_NAME arg_PLUGINS ${arg_PLUGINS}
113
+ ## NEED_RESULTS ${arg_PLUGINS_count} ## this is used to check when we are in the first loop (in order to reset parse_arguments_multi_results)
114
+ ## EXTRAS_FLAGS ${extra_flags_to_add} ## this is used to allow catching VERBOSE and PLUGIN_PATH_DEST flags of our overloaded function
115
+ ## )
116
+ ## endfunction()
117
+ ## message(parse_arguments_multi_results = ${parse_arguments_multi_results}) ## list of the whole pluginsList
118
+ ## #Will print w/x;a/y;b/y;C:/prout/c
119
+ ##
120
+ ## NOTE that here, since our overloaded function need to provide a result list, we use the other parse_arguments_multi_function signature (the which one with a results arg)
121
+ ##
122
+
123
+ function(parse_arguments_multi_function_default) ## used in case of you want to reset the default behavior of this function process
124
+ message("[default function] parse_arguments_multi_function(ARGC=${ARGC} ARGV=${ARGV} ARGN=${ARGN})")
125
+ message("This function is used by parse_arguments_multi and have to be overloaded to process sub list of multi values args")
126
+ endfunction()
127
+
128
+ function(parse_arguments_multi_function ) ## => the function to overload
129
+ parse_arguments_multi_function_default(${ARGN})
130
+ endfunction()
131
+
132
+ ## first default signature above
133
+ ##------------------------------
134
+ ## second results signature behind
135
+
136
+ function(parse_arguments_multi_function_default result) ## used in case of you want to reset the default behavior of this function process
137
+ message("[default function] parse_arguments_multi_function(ARGC=${ARGC} ARGV=${ARGV} ARGN=${ARGN})")
138
+ message("This function is used by parse_arguments_multi and have to be overloaded to process sub list of muluti values args")
139
+ endfunction()
140
+
141
+ function(parse_arguments_multi_function result) ## => the function to overload
142
+ parse_arguments_multi_function_default(result ${ARGN})
143
+ endfunction()
144
+
145
+ ## => the macro to use inside your function which use cmake_parse_arguments
146
+ # NOTE: entry point of parse_arguments_multi, which is called from win3rdPart)
147
+ macro(parse_arguments_multi multiArgsSubTag multiArgsList #<${multiArgsList}> the content of the list
148
+ )
149
+ # message (STATUS "")
150
+ # message(STATUS "calling parse_arguemnts_multi defined in parse_arguments_multi.cmake:141")
151
+ # message(STATUS "multiArgsSubTag = ${multiArgsSubTag}") # CHECK_CACHED_VAR
152
+ # message(STATUS "multiArgsList = ${multiArgsList}") # it contains the name of the variable which is holding the list i.e w3p_MULTI_SET
153
+ # message(STATUS "value of ${multiArgsList} = ${${multiArgsList}}") # a semicolon separated list of values passed to SET or MULTISET keyword in win3rdParty
154
+ # message(STATUS "actual values ARGN = ${ARGN}") # the same as ${${multiArgsList}}
155
+
156
+ ## INFO
157
+ ## starting from CMake 3.5 cmake_parse_arguments is not a module anymore and now is a native CMake command.
158
+ ## the behaviour is different though
159
+ ## In CMake 3.4, if you pass multiple times a multi_value_keyword, CMake returns the values of the LAST match
160
+ ## In CMake 3.5 and above, CMake returns the whole list of values that were following that multi_value_keyword
161
+ ## example:
162
+ ## cmake_parse_arguments(
163
+ ## <prefix>
164
+ ## "" # options
165
+ ## "" # one value keywords
166
+ ## "MY_MULTI_VALUE_TAG"
167
+ ## MY_MULTI_VALUE_TAG value1 value2
168
+ ## MY_MULTI_VALUE_TAG value3 value4
169
+ ## MY_MULTI_VALUE_TAG value5 value6
170
+ ## )
171
+ ## result in CMake 3.4
172
+ ## <prefix>_MY_MULTI_VALUE_TAG = "value5;value6"
173
+ ##
174
+ ## result in CMake 3.8
175
+ ## <prefix>_MY_MULTI_VALUE_TAG = "value5;value6"
176
+
177
+ #include(CMakeParseArguments) #module CMakeParseArguments is obsolete since cmake 3.5
178
+ # cmake_parse_arguments (<prefix> <options> <one_value_keywords> <multi_value_keywords> args)
179
+ # <options> : options (flags) pass to the macro
180
+ # <one_value_keywords> : options that neeed a value
181
+ # <multi_value_keywords> : options that neeed more than one value
182
+ cmake_parse_arguments(_pam "" "NEED_RESULTS" "${multiArgsSubTag};EXTRAS_FLAGS" ${ARGN})
183
+
184
+ ## multiArgsList is the name of the list used by the multiValuesOption flag from the cmake_parse_arguments of the user function
185
+ ## that's why we absolutly need to use MACRO here (and also for passing parse_arguments_multi_results when NEED_RESULTS flag is set)
186
+
187
+ ## for debugging
188
+ #message("")
189
+ #message("[parse_arguments_multi] => ARGN = ${ARGN}")
190
+ #message("_pam_NEED_RESULTS=${_pam_NEED_RESULTS}")
191
+ #message("_pam_EXTRAS_FLAGS=${_pam_EXTRAS_FLAGS}")
192
+ # foreach(var ${_pam_${multiArgsSubTag}})
193
+ # message("arg=${var}")
194
+ # endforeach()
195
+
196
+ if (${CMAKE_VERSION} VERSION_GREATER "3.5")
197
+ # lets make ${_pam_${multiArgsSubTag}} behave as it is in version 3.4
198
+ # that means, cmake_parse_arguments should have only the last values of a multi set for a given keyword
199
+
200
+ # message("")
201
+ # message("values in multiArgsList")
202
+ # foreach(val ${${multiArgsList}})
203
+ # message(STATUS ${val})
204
+ # endforeach()
205
+ # message("end values in multiArgsList")
206
+
207
+
208
+ set(lastIndexFound OFF)
209
+ list(LENGTH ${multiArgsList} argnLength)
210
+ # message(${argnLength})
211
+ math(EXPR argnLength "${argnLength}-1") # make last index a valid one
212
+ set(recordIndex 0)
213
+ set(records "") # clear records list
214
+ set(record0 "") # clear first record list
215
+ foreach(iter RANGE ${argnLength})
216
+ list(GET ${multiArgsList} ${iter} value)
217
+ # message(STATUS "index=${iter} value=${value}")
218
+ if (${value} STREQUAL ${multiArgsSubTag})
219
+ if (lastIndexFound)
220
+ list(APPEND records ${recordIndex}) # records store the list NAMES
221
+ math(EXPR recordIndex "${recordIndex}+1")
222
+ set(record${recordIndex} "") # clear record list
223
+ else ()
224
+ set(lastIndexFound ON)
225
+ endif()
226
+
227
+ set(lastIndex ${iter})
228
+ else ()
229
+ if (lastIndexFound)
230
+ # message(${value})
231
+ list(APPEND record${recordIndex} ${value})
232
+ endif()
233
+ endif()
234
+ endforeach()
235
+
236
+ # save the last list of values
237
+ if (lastIndexFound)
238
+ list(APPEND records ${recordIndex}) # records store the list NAMES
239
+ endif()
240
+
241
+ # set multiArgsList to make it behave like CMake 3.4
242
+ # message("")
243
+ # message("using my records")
244
+ foreach(recordName ${records})
245
+ # message(${recordName})
246
+ # foreach(value ${record${recordName}})
247
+ # message(${value})
248
+ # endforeach()
249
+ # message("")
250
+ set(_pam_${multiArgsSubTag} ${record${recordName}})
251
+ endforeach()
252
+ # message(${_pam_${multiArgsSubTag}})
253
+
254
+ # message("")
255
+ # message("using argn")
256
+ # foreach(value ${ARGN})
257
+ # message(${value})
258
+ # endforeach()
259
+ endif() # end if cmake > 3.5
260
+
261
+ # message("values with pam ${_pam_${multiArgsSubTag}}")
262
+
263
+ ## check and init
264
+ list(LENGTH ${multiArgsList} globalListCount) # GLUT_TRACE: globalListCound=16 in CMake3.4 and CMake3.8
265
+ # message(STATUS "nr items in multiArgsList: ${globalListCount}")
266
+ math(EXPR globalListCount "${globalListCount}-1") ## because it will contain [multiArgsSubTag + ${multiArgsList}]
267
+ if(_pam_NEED_RESULTS)
268
+ if(${globalListCount} EQUAL ${_pam_NEED_RESULTS})
269
+ ## first time we enter into this macro (because we call it recursively)
270
+ unset(parse_arguments_multi_results)
271
+ endif()
272
+ endif()
273
+
274
+ ## process the part of the multi agrs list
275
+ ## ${ARGN} shouldn't be passed to the function in order to avoid missmatch size list ${multiArgsList} and _pam_${multiArgsSubTag}
276
+ ## if you want to pass extra internal flags from your function to this callback, use EXTRAS_FLAGS
277
+ if(_pam_NEED_RESULTS)
278
+ parse_arguments_multi_function(parse_arguments_multi_function_result ${_pam_${multiArgsSubTag}} ${_pam_EXTRAS_FLAGS})
279
+ list(APPEND parse_arguments_multi_results ${parse_arguments_multi_function_result})
280
+ else()
281
+ # message(STATUS "about to call parse_arguments_multi_function in parse_arguments_multi.cmake:177 ${_pam_${multiArgsSubTag}} and extra flags ${_pam_EXTRAS_FLAGS}")
282
+ parse_arguments_multi_function(${_pam_${multiArgsSubTag}} ${_pam_EXTRAS_FLAGS})
283
+ endif()
284
+
285
+ ## remove just processed items from the main list to process (multiArgsList)
286
+ list(REVERSE ${multiArgsList})
287
+ list(LENGTH _pam_${multiArgsSubTag} subTagListCount)
288
+ unset(ids)
289
+ foreach(id RANGE ${subTagListCount})
290
+ list(APPEND ids ${id})
291
+ endforeach()
292
+ list(REMOVE_AT ${multiArgsList} ${ids})
293
+ list(REVERSE ${multiArgsList})
294
+
295
+ ## test if remain sub multi list to process (recursive call) or finish the process
296
+ list(LENGTH ${multiArgsList} mainTagListCount)
297
+ if(${mainTagListCount} GREATER 1)
298
+ ## do not pass ${ARGN} just because it will re pass the initial 2 inputs args and we wont as they was consumed (in order to avoir conflicts)
299
+ # message(STATUS "about to call a parse_arguments_multi but without knowing where the definition is going to be taken from")
300
+ parse_arguments_multi(${multiArgsSubTag} ${multiArgsList} ${${multiArgsList}}
301
+ NEED_RESULTS ${_pam_NEED_RESULTS} EXTRAS_FLAGS ${_pam_EXTRAS_FLAGS}
302
+ )
303
+ endif()
304
+ endmacro()
sugar/gaussian_splatting/SIBR_viewers/cmake/linux/sibr_library.cmake ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ # NOTE
12
+ # This feature is used to easily download, store and link external dependencies. This
13
+ # requires to prepare pre-compiled libraries (to download). For now, packages have
14
+ # only be prepare for Windows 64-bit with Visual Studio 2012. (You should re-build
15
+ # everything if you want to use another version of Visual Studio/ another compiler).
16
+
17
+ # NOTE ABOUT UNIX SYSTEMS
18
+ # There is no need for "searching mechanism". This function is discard and your
19
+ # libraries should be installed is the standard folders that are:
20
+ #
21
+ # /usr/include/
22
+ # /usr/lib/
23
+ # /usr/lib64/
24
+ # for packages downloaded using apt-get/yum
25
+ #
26
+ # /usr/local/include/
27
+ # /usr/local/lib/
28
+ # /usr/local/lib64/
29
+ # for packages manually installed ("make install")
30
+ #
31
+ # if you encounter problems when linking (e.g. lib not found even if it is installed),
32
+ # please check these folders are in your search PATH environment variables.
33
+
34
+ set(EXTLIBS_PACKAGE_FOLDER "${CMAKE_SOURCE_DIR}/extlibs")
35
+
36
+ function(sibr_addlibrary)
37
+ if(NOT WIN32)
38
+ return()
39
+ endif()
40
+
41
+ file(MAKE_DIRECTORY ${EXTLIBS_PACKAGE_FOLDER})
42
+ cmake_parse_arguments(args "VCID" "VERBOSE;TIMEOUT;DEFAULT_USE;NAME;VERSION;MSVC11;MSVC12;MSVC14;MSVC17" "MULTI_SET;SET" ${ARGN})
43
+
44
+
45
+ if (NOT "${args_VERSION}" MATCHES "")
46
+ message(WARNING "VERSION is not implemented yet")
47
+ endif()
48
+
49
+ set(lcname "")
50
+ set(ucname "")
51
+ string(TOLOWER "${args_NAME}" lcname)
52
+ string(TOUPPER "${args_NAME}" ucname)
53
+
54
+ set(LIB_PACKAGE_FOLDER "${EXTLIBS_PACKAGE_FOLDER}/${lcname}")
55
+ win3rdParty(${ucname}
56
+ $<args_VCID:VCID>
57
+ VERBOSE ${args_VERBOSE}
58
+ TIMEOUT ${args_TIMEOUT}
59
+ DEFAULT_USE ${args_DEFAULT_USE}
60
+ MSVC11 "${LIB_PACKAGE_FOLDER}" "${args_MSVC11}"
61
+ MSVC12 "${LIB_PACKAGE_FOLDER}" "${args_MSVC12}"
62
+ MSVC14 "${LIB_PACKAGE_FOLDER}" "${args_MSVC14}" # TODO SV: make sure to build this library if required
63
+ MSVC17 "${LIB_PACKAGE_FOLDER}" "${args_MSVC17}"
64
+ SET ${args_SET}
65
+ MULTI_SET ${args_MULTI_SET}
66
+ )
67
+
68
+ # Add include/ directory
69
+ # and lib/ directories
70
+
71
+ # TODO SV: paths not matching with current hierarchy. example: libraw/libraw-0.17.1/include
72
+ # SR: The link directories will also be used to lookup for dependency DLLs to copy in the install directory.
73
+ # Some libraries put the DLLs in the bin/ directory, so we include those.
74
+ file(GLOB subdirs RELATIVE ${LIB_PACKAGE_FOLDER} ${LIB_PACKAGE_FOLDER}/*)
75
+ set(dirlist "")
76
+ foreach(dir ${subdirs})
77
+ if(IS_DIRECTORY ${LIB_PACKAGE_FOLDER}/${dir})
78
+ # message("adding ${LIB_PACKAGE_FOLDER}/${dir}/include/ to the include directories")
79
+ include_directories("${LIB_PACKAGE_FOLDER}/${dir}/include/")
80
+ # message("adding ${LIB_PACKAGE_FOLDER}/${dir}/lib[64] to the link directories")
81
+ link_directories("${LIB_PACKAGE_FOLDER}/${dir}/")
82
+ link_directories("${LIB_PACKAGE_FOLDER}/${dir}/lib/")
83
+ link_directories("${LIB_PACKAGE_FOLDER}/${dir}/lib64/")
84
+ link_directories("${LIB_PACKAGE_FOLDER}/${dir}/bin/")
85
+ endif()
86
+ endforeach()
87
+
88
+ endfunction()
89
+
90
+ include(FetchContent)
91
+ include(git_describe)
92
+ include(install_runtime)
93
+
94
+ function(sibr_gitlibrary)
95
+ cmake_parse_arguments(args "" "TARGET;GIT_REPOSITORY;GIT_TAG;ROOT_DIR;SOURCE_DIR" "INCLUDE_DIRS" ${ARGN})
96
+ if(NOT args_TARGET)
97
+ message(FATAL "Error on sibr_gitlibrary : please define your target name.")
98
+ return()
99
+ endif()
100
+
101
+ if(NOT args_ROOT_DIR)
102
+ set(args_ROOT_DIR ${args_TARGET})
103
+ endif()
104
+
105
+ if(NOT args_SOURCE_DIR)
106
+ set(args_SOURCE_DIR ${args_TARGET})
107
+ endif()
108
+
109
+ if(args_GIT_REPOSITORY AND args_GIT_TAG)
110
+ if(EXISTS ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/${args_SOURCE_DIR}/.git)
111
+ git_describe(
112
+ PATH ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/${args_SOURCE_DIR}
113
+ GIT_URL SIBR_GITLIBRARY_URL
114
+ GIT_BRANCH SIBR_GITLIBRARY_BRANCH
115
+ GIT_COMMIT_HASH SIBR_GITLIBRARY_COMMIT_HASH
116
+ GIT_TAG SIBR_GITLIBRARY_TAG
117
+ )
118
+
119
+ if((SIBR_GITLIBRARY_URL STREQUAL args_GIT_REPOSITORY) AND
120
+ ((SIBR_GITLIBRARY_BRANCH STREQUAL args_GIT_TAG) OR
121
+ (SIBR_GITLIBRARY_TAG STREQUAL args_GIT_TAG) OR
122
+ (SIBR_GITLIBRARY_COMMIT_HASH STREQUAL args_GIT_TAG)))
123
+ message(STATUS "Library ${args_TARGET} already available, skipping.")
124
+ set(SIBR_GITLIBRARY_DECLARED ON)
125
+ else()
126
+ message(STATUS "Adding library ${args_TARGET} from git...")
127
+ endif()
128
+ endif()
129
+
130
+ FetchContent_Declare(${args_TARGET}
131
+ GIT_REPOSITORY ${args_GIT_REPOSITORY}
132
+ GIT_TAG ${args_GIT_TAG}
133
+ GIT_SHALLOW ON
134
+ SOURCE_DIR ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/${args_SOURCE_DIR}
135
+ SUBBUILD_DIR ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/subbuild
136
+ BINARY_DIR ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/build
137
+ )
138
+ FetchContent_GetProperties(${args_TARGET})
139
+ string(TOLOWER "<name>" lcTargetName)
140
+
141
+ if((NOT SIBR_GITLIBRARY_DECLARED) AND (NOT ${lcTargetName}_POPULATED))
142
+ message(STATUS "Populating library ${args_TARGET}...")
143
+ FetchContent_Populate(${args_TARGET} QUIET
144
+ GIT_REPOSITORY ${args_GIT_REPOSITORY}
145
+ GIT_TAG ${args_GIT_TAG}
146
+ SOURCE_DIR ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/${args_SOURCE_DIR}
147
+ SUBBUILD_DIR ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/subbuild
148
+ BINARY_DIR ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/build
149
+ )
150
+ endif()
151
+
152
+ add_subdirectory(${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/${args_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/extlibs/${args_ROOT_DIR}/build)
153
+
154
+ get_target_property(type ${args_TARGET} TYPE)
155
+ if(NOT (type STREQUAL "INTERFACE_LIBRARY"))
156
+ set_target_properties(${args_TARGET} PROPERTIES FOLDER "extlibs")
157
+
158
+ ibr_install_target(${args_TARGET}
159
+ COMPONENT ${args_TARGET}_install ## will create custom target to install only this project
160
+ )
161
+ endif()
162
+
163
+ list(APPEND ${args_TARGET}_INCLUDE_DIRS ${EXTLIBS_PACKAGE_FOLDER}/${args_ROOT_DIR})
164
+ list(APPEND ${args_TARGET}_INCLUDE_DIRS ${EXTLIBS_PACKAGE_FOLDER}/${args_ROOT_DIR}/${args_SOURCE_DIR})
165
+
166
+ foreach(args_INCLUDE_DIR ${args_INCLUDE_DIRS})
167
+ list(APPEND ${args_TARGET}_INCLUDE_DIRS ${EXTLIBS_PACKAGE_FOLDER}/${args_ROOT_DIR}/${args_SOURCE_DIR}/${args_INCLUDE_DIR})
168
+ endforeach()
169
+
170
+ include_directories(${${args_TARGET}_INCLUDE_DIRS})
171
+ else()
172
+ message(FATAL "Error on sibr_gitlibrary for target ${args_TARGET}: missing git tag or git url.")
173
+ endif()
174
+ endfunction()
sugar/gaussian_splatting/SIBR_viewers/cmake/windows/MSVCsetUserCommand.cmake ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ if(__MSVCsetUserCommand_cmake_INCLUDED__)
12
+ return()
13
+ else()
14
+ set(__MSVCsetUserCommand_cmake_INCLUDED__ ON)
15
+ endif()
16
+
17
+ ## Allow to configure the Debugger settings of visual studio
18
+ ## Note: Using this command under linux doesn't affect anything
19
+ ## On run Debug Windows local : visual will try to load a specific COMMAND with ARGS in the provided WORKING_DIR
20
+ ##
21
+ ## usage:
22
+ ## MSVCsetUserCommand( <targetName>
23
+ ## [COMMAND <myCustomAppToLaunch> | [ PATH <myCustomDirWhereIsDefaultTargetFileNameToLaunch> [FILE <myCustomExecFileToLaunch>] ] ]
24
+ ## ARGS <associatedArguments>
25
+ ## WORKING_DIR <whereStartTheProgram>
26
+ ## )
27
+ ##
28
+ ## Warning 1 : All arugments () must be passed under quotes
29
+ ## Warning 2 : WORKING_DIR path arg have to finish with remain slah '/'
30
+ ## Warning 3 : use COMMAND for external app OR PATH (optionaly with FILE) option(s) to set your built/installed/moved target
31
+ ##
32
+ ## Example 1:
33
+ ## include(MSVCsetUserCommand)
34
+ ## MSVCsetUserCommand( UnityRenderingPlugin
35
+ ## COMMAND "C:/Program Files (x86)/Unity/Editor/Unity.exe"
36
+ ## ARGS "-force-opengl -projectPath \"${CMAKE_HOME_DIRECTORY}/UnityPlugins/RenderingPluginExample/UnityProject\""
37
+ ## WORKING_DIR "${CMAKE_HOME_DIRECTORY}/UnityPlugins/RenderingPluginExample/UnityProject"
38
+ ## VERBOSE
39
+ ## )
40
+ ##
41
+ ## Example 2:
42
+ ## include(MSVCsetUserCommand)
43
+ ## MSVCsetUserCommand( ibrApp
44
+ ## PATH "C:/Program Files (x86)/workspace/IBR/install"
45
+ ## FILE "ibrApp${CMAKE_EXECUTABLE_SUFFIX}" ## this option line is optional since the target name didn't change between build and install step
46
+ ## ARGS "-path \"${CMAKE_HOME_DIRECTORY}/dataset\""
47
+ ## WORKING_DIR "${CMAKE_HOME_DIRECTORY}"
48
+ ## VERBOSE
49
+ ## )
50
+ ##
51
+ function(MSVCsetUserCommand targetName)
52
+ cmake_parse_arguments(MSVCsuc "VERBOSE" "PATH;FILE;COMMAND;ARGS;WORKING_DIR" "" ${ARGN} )
53
+
54
+ ## If no arguments are given, do not create an unecessary .vcxproj.user file
55
+ set(MSVCsuc_DEFAULT OFF)
56
+
57
+ if(MSVCsuc_PATH AND MSVCsuc_DEFAULT)
58
+ set(MSVCsuc_DEFAULT OFF)
59
+ endif()
60
+
61
+ if(MSVCsuc_FILE AND MSVCsuc_DEFAULT)
62
+ set(MSVCsuc_DEFAULT OFF)
63
+ endif()
64
+
65
+ if(NOT MSVCsuc_COMMAND)
66
+ if(MSVCsuc_PATH AND MSVCsuc_FILE)
67
+ set(MSVCsuc_COMMAND "${MSVCsuc_PATH}\\${MSVCsuc_FILE}")
68
+ elseif(MSVCsuc_PATH)
69
+ set(MSVCsuc_COMMAND "${MSVCsuc_PATH}\\$(TargetFileName)")
70
+ else()
71
+ set(MSVCsuc_COMMAND "$(TargetPath)") ## => $(TargetDir)\$(TargetName)$(TargetExt)
72
+ endif()
73
+ elseif(MSVCsuc_DEFAULT)
74
+ set(MSVCsuc_DEFAULT OFF)
75
+ endif()
76
+
77
+ # NOTE: there was a typo here. there is an else if written after else statement
78
+ # changing the order of the else if statement
79
+ if(MSVCsuc_WORKING_DIR)
80
+ file(TO_NATIVE_PATH ${MSVCsuc_WORKING_DIR} MSVCsuc_WORKING_DIR)
81
+ elseif(MSVCsuc_DEFAULT)
82
+ set(MSVCsuc_DEFAULT OFF)
83
+ else()
84
+ set(MSVCsuc_WORKING_DIR "$(ProjectDir)")
85
+ endif()
86
+
87
+ if(NOT MSVCsuc_ARGS)
88
+ set(MSVCsuc_ARGS "")
89
+ elseif(MSVCsuc_DEFAULT)
90
+ set(MSVCsuc_DEFAULT OFF)
91
+ endif()
92
+
93
+ if(MSVC10 OR (MSVC AND MSVC_VERSION GREATER 1600)) # 2010 or newer
94
+
95
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
96
+ set(PLATEFORM_BITS x64)
97
+ else()
98
+ set(PLATEFORM_BITS Win32)
99
+ endif()
100
+
101
+ if(NOT MSVCsuc_DEFAULT AND PLATEFORM_BITS)
102
+
103
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${targetName}.vcxproj.user"
104
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>
105
+ <Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
106
+ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|${PLATEFORM_BITS}'\">
107
+ <LocalDebuggerCommand>${MSVCsuc_COMMAND}</LocalDebuggerCommand>
108
+ <LocalDebuggerCommandArguments>${MSVCsuc_ARGS}</LocalDebuggerCommandArguments>
109
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
110
+ <LocalDebuggerWorkingDirectory>${MSVCsuc_WORKING_DIR}</LocalDebuggerWorkingDirectory>
111
+ </PropertyGroup>
112
+ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|${PLATEFORM_BITS}'\">
113
+ <LocalDebuggerCommand>${MSVCsuc_COMMAND}</LocalDebuggerCommand>
114
+ <LocalDebuggerCommandArguments>${MSVCsuc_ARGS}</LocalDebuggerCommandArguments>
115
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
116
+ <LocalDebuggerWorkingDirectory>${MSVCsuc_WORKING_DIR}</LocalDebuggerWorkingDirectory>
117
+ </PropertyGroup>
118
+ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='MinSizeRel|${PLATEFORM_BITS}'\">
119
+ <LocalDebuggerCommand>${MSVCsuc_COMMAND}</LocalDebuggerCommand>
120
+ <LocalDebuggerCommandArguments>${MSVCsuc_ARGS}</LocalDebuggerCommandArguments>
121
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
122
+ <LocalDebuggerWorkingDirectory>${MSVCsuc_WORKING_DIR}</LocalDebuggerWorkingDirectory>
123
+ </PropertyGroup>
124
+ <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='RelWithDebInfo|${PLATEFORM_BITS}'\">
125
+ <LocalDebuggerCommand>${MSVCsuc_COMMAND}</LocalDebuggerCommand>
126
+ <LocalDebuggerCommandArguments>${MSVCsuc_ARGS}</LocalDebuggerCommandArguments>
127
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
128
+ <LocalDebuggerWorkingDirectory>${MSVCsuc_WORKING_DIR}</LocalDebuggerWorkingDirectory>
129
+ </PropertyGroup>
130
+ </Project>"
131
+ )
132
+ if(MSVCsuc_VERBOSE)
133
+ message(STATUS "[MSVCsetUserCommand] Write ${CMAKE_CURRENT_BINARY_DIR}/${targetName}.vcxproj.user file")
134
+ message(STATUS " to execute ${MSVCsuc_COMMAND} ${MSVCsuc_ARGS}")
135
+ message(STATUS " from derectory ${MSVCsuc_WORKING_DIR}")
136
+ message(STATUS " on visual studio run debugger button")
137
+ endif()
138
+
139
+ else()
140
+ message(WARNING "PLATEFORM_BITS is undefined...")
141
+ endif()
142
+
143
+ else()
144
+ if(MSVCsuc_VERBOSE)
145
+ message(WARNING "MSVCsetUserCommand is disable because too old MSVC is used (need MSVC10 2010 or newer)")
146
+ endif()
147
+ endif()
148
+
149
+ endfunction()
sugar/gaussian_splatting/SIBR_viewers/cmake/windows/Modules/FindASSIMP.cmake ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## Try to find the ASSIMP library
12
+ ## Once done this will define
13
+ ##
14
+ ## ASSIMP_FOUND - system has ASSIMP
15
+ ## ASSIMP_INCLUDE_DIR - The ASSIMP include directory
16
+ ## ASSIMP_LIBRARIES - The libraries needed to use ASSIMP
17
+ ## ASSIMP_CMD - the full path of ASSIMP executable
18
+ ## ASSIMP_DYNAMIC_LIB - the Assimp dynamic lib (available only on windows as .dll file for the moment)
19
+ ##
20
+ ## Edited for using a bugfixed version of Assimp
21
+
22
+ if(NOT ASSIMP_DIR)
23
+ set(ASSIMP_DIR "$ENV{ASSIMP_DIR}" CACHE PATH "ASSIMP root directory")
24
+ endif()
25
+ if(ASSIMP_DIR)
26
+ file(TO_CMAKE_PATH ${ASSIMP_DIR} ASSIMP_DIR)
27
+ endif()
28
+
29
+
30
+ ## set the LIB POSTFIX to find in a right directory according to what kind of compiler we use (32/64bits)
31
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
32
+ set(ASSIMP_SEARCH_LIB "lib64")
33
+ set(ASSIMP_SEARCH_BIN "bin64")
34
+ set(ASSIMP_SEARCH_LIB_PATHSUFFIXE "x64")
35
+ else()
36
+ set(ASSIMP_SEARCH_LIB "lib32")
37
+ set(ASSIMP_SEARCH_BIN "bin32")
38
+ set(ASSIMP_SEARCH_LIB_PATHSUFFIXE "x86")
39
+ endif()
40
+
41
+ set(PROGRAMFILESx86 "PROGRAMFILES(x86)")
42
+
43
+
44
+ FIND_PATH(ASSIMP_INCLUDE_DIR
45
+ NAMES assimp/config.h
46
+ PATHS
47
+ ${ASSIMP_DIR}
48
+ ## linux
49
+ /usr
50
+ /usr/local
51
+ /opt/local
52
+ ## windows
53
+ "$ENV{PROGRAMFILES}/Assimp"
54
+ "$ENV{${PROGRAMFILESx86}}/Assimp"
55
+ "$ENV{ProgramW6432}/Assimp"
56
+ PATH_SUFFIXES include
57
+ )
58
+
59
+
60
+ FIND_LIBRARY(ASSIMP_LIBRARY
61
+ NAMES assimp-vc140-mt
62
+ PATHS
63
+ ${ASSIMP_DIR}/${ASSIMP_SEARCH_LIB}
64
+ ${ASSIMP_DIR}/lib
65
+ ${ASSIMP_DIR}/lib64
66
+ ## linux
67
+ /usr/${ASSIMP_SEARCH_LIB}
68
+ /usr/local/${ASSIMP_SEARCH_LIB}
69
+ /opt/local/${ASSIMP_SEARCH_LIB}
70
+ /usr/lib
71
+ /usr/local/lib
72
+ /opt/local/lib
73
+ ## windows
74
+ "$ENV{PROGRAMFILES}/Assimp/${ASSIMP_SEARCH_LIB}"
75
+ "$ENV{${PROGRAMFILESx86}}/Assimp/${ASSIMP_SEARCH_LIB}"
76
+ "$ENV{ProgramW6432}/Assimp/${ASSIMP_SEARCH_LIB}"
77
+ "$ENV{PROGRAMFILES}/Assimp/lib"
78
+ "$ENV{${PROGRAMFILESx86}}/Assimp/lib"
79
+ "$ENV{ProgramW6432}/Assimp/lib"
80
+ PATH_SUFFIXES ${ASSIMP_SEARCH_LIB_PATHSUFFIXE}
81
+ )
82
+ set(ASSIMP_LIBRARIES ${ASSIMP_LIBRARY})
83
+
84
+
85
+ if(ASSIMP_LIBRARY)
86
+ get_filename_component(ASSIMP_LIBRARY_DIR ${ASSIMP_LIBRARY} PATH)
87
+ file(GLOB ASSIMP_DYNAMIC_LIB "${ASSIMP_LIBRARY_DIR}/assimp*.dll")
88
+ if(NOT ASSIMP_DYNAMIC_LIB)
89
+ message("ASSIMP_DYNAMIC_LIB is missing... at ${ASSIMP_LIBRARY_DIR}")
90
+ endif()
91
+ set(ASSIMP_DYNAMIC_LIB ${ASSIMP_DYNAMIC_LIB} CACHE PATH "Windows dll location")
92
+ endif()
93
+
94
+ MARK_AS_ADVANCED(ASSIMP_DYNAMIC_LIB ASSIMP_INCLUDE_DIR ASSIMP_LIBRARIES)
95
+
96
+ INCLUDE(FindPackageHandleStandardArgs)
97
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASSIMP
98
+ REQUIRED_VARS ASSIMP_INCLUDE_DIR ASSIMP_LIBRARIES
99
+ FAIL_MESSAGE "ASSIMP wasn't found correctly. Set ASSIMP_DIR to the root SDK installation directory."
100
+ )
101
+
102
+ if(NOT ASSIMP_FOUND)
103
+ set(ASSIMP_DIR "" CACHE STRING "Path to ASSIMP install directory")
104
+ endif()
sugar/gaussian_splatting/SIBR_viewers/cmake/windows/Modules/FindEmbree.cmake ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## Important Note:
12
+ ## This is not an official Find*cmake. It has been written for searching through
13
+ ## a custom path (EMBREE_DIR) before checking elsewhere.
14
+ ##
15
+ ## FindEMBREE.cmake
16
+ ## Find EMBREE's includes and library
17
+ ##
18
+ ## This module defines :
19
+ ## [in] EMBREE_DIR, The base directory to search for EMBREE (as cmake var or env var)
20
+ ## [out] EMBREE_INCLUDE_DIR where to find EMBREE.h
21
+ ## [out] EMBREE_LIBRARIES, EMBREE_LIBRARY, libraries to link against to use EMBREE
22
+ ## [out] EMBREE_FOUND, If false, do not try to use EMBREE.
23
+ ##
24
+
25
+
26
+ if(NOT EMBREE_DIR)
27
+ set(EMBREE_DIR "$ENV{EMBREE_DIR}" CACHE PATH "EMBREE root directory")
28
+ endif()
29
+ if(EMBREE_DIR)
30
+ file(TO_CMAKE_PATH ${EMBREE_DIR} EMBREE_DIR)
31
+ endif()
32
+
33
+
34
+ ## set the LIB POSTFIX to find in a right directory according to what kind of compiler we use (32/64bits)
35
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
36
+ set(EMBREE_SEARCH_LIB "lib64")
37
+ set(EMBREE_SEARCH_BIN "bin64")
38
+ set(EMBREE_SEARCH_LIB_PATHSUFFIXE "x64")
39
+ else()
40
+ set(EMBREE_SEARCH_LIB "lib32")
41
+ set(EMBREE_SEARCH_BIN "bin32")
42
+ set(EMBREE_SEARCH_LIB_PATHSUFFIXE "x86")
43
+ endif()
44
+
45
+ set(PROGRAMFILESx86 "PROGRAMFILES(x86)")
46
+
47
+ FIND_PATH(EMBREE_INCLUDE_DIR
48
+ NAMES embree3/rtcore_geometry.h
49
+ PATHS
50
+ ${EMBREE_DIR}
51
+ ## linux
52
+ /usr
53
+ /usr/local
54
+ /opt/local
55
+ ## windows
56
+ "$ENV{PROGRAMFILES}/EMBREE"
57
+ "$ENV{${PROGRAMFILESx86}}/EMBREE"
58
+ "$ENV{ProgramW6432}/EMBREE"
59
+ PATH_SUFFIXES include
60
+ )
61
+
62
+ FIND_LIBRARY(EMBREE_LIBRARY
63
+ NAMES embree3
64
+ PATHS
65
+ ${EMBREE_DIR}/${EMBREE_SEARCH_LIB}
66
+ ${EMBREE_DIR}/lib
67
+ ## linux
68
+ /usr/${EMBREE_SEARCH_LIB}
69
+ /usr/local/${EMBREE_SEARCH_LIB}
70
+ /opt/local/${EMBREE_SEARCH_LIB}
71
+ /usr/lib
72
+ /usr/local/lib
73
+ /opt/local/lib
74
+ ## windows
75
+ "$ENV{PROGRAMFILES}/EMBREE/${EMBREE_SEARCH_LIB}"
76
+ "$ENV{${PROGRAMFILESx86}}/EMBREE/${EMBREE_SEARCH_LIB}"
77
+ "$ENV{ProgramW6432}/EMBREE/${EMBREE_SEARCH_LIB}"
78
+ "$ENV{PROGRAMFILES}/EMBREE/lib"
79
+ "$ENV{${PROGRAMFILESx86}}/EMBREE/lib"
80
+ "$ENV{ProgramW6432}/EMBREE/lib"
81
+ PATH_SUFFIXES ${EMBREE_SEARCH_LIB_PATHSUFFIXE}
82
+ )
83
+ set(EMBREE_LIBRARIES ${EMBREE_LIBRARY})
84
+
85
+ MARK_AS_ADVANCED(EMBREE_INCLUDE_DIR EMBREE_LIBRARIES)
86
+
87
+ INCLUDE(FindPackageHandleStandardArgs)
88
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(EMBREE
89
+ REQUIRED_VARS EMBREE_INCLUDE_DIR EMBREE_LIBRARIES
90
+ FAIL_MESSAGE "EMBREE wasn't found correctly. Set EMBREE_DIR to the root SDK installation directory."
91
+ )
92
+
93
+ if(NOT EMBREE_FOUND)
94
+ set(EMBREE_DIR "" CACHE STRING "Path to EMBREE install directory")
95
+ endif()
sugar/gaussian_splatting/SIBR_viewers/cmake/windows/Modules/FindFFmpeg.cmake ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2020, Inria
2
+ # GRAPHDECO research group, https://team.inria.fr/graphdeco
3
+ # All rights reserved.
4
+ #
5
+ # This software is free for non-commercial, research and evaluation use
6
+ # under the terms of the LICENSE.md file.
7
+ #
8
+ # For inquiries contact [email protected] and/or [email protected]
9
+
10
+
11
+ ## Try to find the FFMPEG library
12
+ ## Once done this will define
13
+ ##
14
+ ## FFMPEG_FOUND - system has FFmpeg
15
+ ## FFMPEG_INCLUDE_DIR - The FFmpeg include directory
16
+ ## FFMPEG_LIBRARIES - The libraries needed to use FFmpeg
17
+ ## FFMPEG_DYNAMIC_LIBS - DLLs for windows
18
+
19
+
20
+ if(NOT FFMPEG_DIR)
21
+ set(FFMPEG_DIR "$ENV{FFMPEG_DIR}" CACHE PATH "FFMPEG_DIR root directory")
22
+ endif()
23
+
24
+ if(FFMPEG_DIR)
25
+ file(TO_CMAKE_PATH ${FFMPEG_DIR} FFMPEG_DIR)
26
+ endif()
27
+
28
+ MACRO(FFMPEG_FIND varname shortname headername)
29
+
30
+ # Path to include dirs
31
+ FIND_PATH(FFMPEG_${varname}_INCLUDE_DIRS
32
+ NAMES "lib${shortname}/${headername}"
33
+ PATHS
34
+ "${FFMPEG_DIR}/include" # modify this to adapt according to OS/compiler
35
+ )
36
+
37
+ #Add libraries
38
+ IF(${FFMPEG_${varname}_INCLUDE_DIRS} STREQUAL "FFMPEG_${varname}_INCLUDE_DIR-NOTFOUND")
39
+ MESSAGE(STATUS "Can't find includes for ${shortname}...")
40
+ ELSE()
41
+ FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
42
+ NAMES ${shortname}
43
+ PATHS
44
+ ${FFMPEG_DIR}/lib
45
+ )
46
+
47
+ # set libraries and other variables
48
+ SET(FFMPEG_${varname}_FOUND 1)
49
+ SET(FFMPEG_${varname}_INCLUDE_DIRS ${FFMPEG_${varname}_INCLUDE_DIR})
50
+ SET(FFMPEG_${varname}_LIBS ${FFMPEG_${varname}_LIBRARIES})
51
+ ENDIF()
52
+ ENDMACRO(FFMPEG_FIND)
53
+
54
+ #Calls to ffmpeg_find to get librarires ------------------------------
55
+ FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
56
+ FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
57
+ FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
58
+ FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
59
+ FFMPEG_FIND(LIBSWSCALE swscale swscale.h)
60
+
61
+ # check if libs are found and set FFMPEG related variables
62
+ #SET(FFMPEG_FOUND "NO")
63
+ IF(FFMPEG_LIBAVFORMAT_FOUND
64
+ AND FFMPEG_LIBAVDEVICE_FOUND
65
+ AND FFMPEG_LIBAVCODEC_FOUND
66
+ AND FFMPEG_LIBAVUTIL_FOUND
67
+ AND FFMPEG_LIBSWSCALE_FOUND)
68
+
69
+ # All ffmpeg libs are here
70
+ SET(FFMPEG_FOUND "YES")
71
+ SET(FFMPEG_INCLUDE_DIR ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS})
72
+ SET(FFMPEG_LIBRARY_DIRS ${FFMPEG_LIBAVFORMAT_LIBRARY_DIRS})
73
+ SET(FFMPEG_LIBRARIES
74
+ ${FFMPEG_LIBAVFORMAT_LIBS}
75
+ ${FFMPEG_LIBAVDEVICE_LIBS}
76
+ ${FFMPEG_LIBAVCODEC_LIBS}
77
+ ${FFMPEG_LIBAVUTIL_LIBS}
78
+ ${FFMPEG_LIBSWSCALE_LIBS} )
79
+
80
+ # add dynamic libraries
81
+ if(WIN32)
82
+ file(GLOB FFMPEG_DYNAMIC_LIBS "${FFMPEG_DIR}/bin/*.dll")
83
+ if(NOT FFMPEG_DYNAMIC_LIBS)
84
+ message("FFMPEG_DYNAMIC_LIBS is missing...")
85
+ endif()
86
+ set(FFMPEG_DYNAMIC_LIBS ${FFMPEG_DYNAMIC_LIBS} CACHE PATH "Windows dll location")
87
+ endif()
88
+
89
+ mark_as_advanced(FFMPEG_INCLUDE_DIR FFMPEG_LIBRARY_DIRS FFMPEG_LIBRARIES FFMPEG_DYNAMIC_LIBS)
90
+ ELSE ()
91
+ MESSAGE(STATUS "Could not find FFMPEG")
92
+ ENDIF()
93
+
94
+
95
+ INCLUDE(FindPackageHandleStandardArgs)
96
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFMPEG
97
+ REQUIRED_VARS FFMPEG_INCLUDE_DIR FFMPEG_LIBRARIES
98
+ FAIL_MESSAGE "FFmpeg wasn't found correctly. Set FFMPEG_DIR to the root SDK installation directory."
99
+ )
100
+
101
+ if(NOT FFMPEG_FOUND)
102
+ set(FFMPEG_DIR "" CACHE STRING "Path to FFmpeg install directory")
103
+ endif()
104
+