Repository navigation
Expand file tree
/
Copy pathAppImage.cmake
More file actions
142 lines (134 loc) · 7.86 KB
/
Copy pathAppImage.cmake
File metadata and controls
142 lines (134 loc) · 7.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# SPDX-License-Identifier: MIT
# Linux AppImage (mitcad#18): install rules and the target appimage. After a
# build (a release build for a release),
# cmake --build --preset dev --target appimage
# makes Mitcad-<version>-x86_64.AppImage in the build directory: one
# executable file with Mitcad, mitcad-cli, the Qt and OCCT libraries, Qt's
# plugins, the icon, a desktop file and the render worker mitcad-render
# with its libraries, which runs on a Linux desktop
# without anything else installed (packaging/linux/make-appimage.sh, with
# the tools of tools/dev-env/install-appimage-tools.sh).
# docs/development.md#linux-appimage describes it, tools/appimage-test.sh
# tests the result, and docs/updates.md#signing-a-release signs it for the
# automatic updates (the asset linux-x64).
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
return()
endif()
# A build with a user's own OptiX worker (mitcad#1332, cmake/RenderOptix.cmake)
# makes no AppImage: MitCad never ships OptiX.
get_property(mitcad_render_optix GLOBAL PROPERTY MITCAD_RENDER_OPTIX)
if(mitcad_render_optix)
return()
endif()
include(GNUInstallDirs)
# --- Files ---------------------------------------------------------------
install(TARGETS mitcad mitcad-cli RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS mitcad-mcp-launcher RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# Insert > Component from Web's web browser component (mitcad#1579) is not in
# the AppImage: a package of its own, downloaded on first use
# (app/webbrowser/CMakeLists.txt).
# The render worker (docs/rendering.md) next to mitcad, which offers View >
# Rendered when it is there; make-appimage.sh adds its libraries.
install(TARGETS mitcad-render RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
# The GPU devices' kernels (mitcad#50) where the worker looks for them:
# lib/mitcad/cycles/lib beside its bin folder (RenderWorker.cpp).
get_property(mitcad_cycles_kernels GLOBAL PROPERTY MITCAD_CYCLES_KERNELS)
if(mitcad_cycles_kernels)
install(FILES ${mitcad_cycles_kernels} DESTINATION lib/mitcad/cycles/lib)
endif()
install(FILES "${PROJECT_SOURCE_DIR}/packaging/linux/mitcad.desktop"
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
foreach(size 16 24 32 48 64 96 128 256)
install(FILES "${PROJECT_SOURCE_DIR}/app/branding/png/mitcad-${size}.png"
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${size}x${size}/apps
RENAME mitcad.png)
endforeach()
# File managers' thumbnails of designs (mitcad#1539): the thumbnailer (Rust,
# no Qt, no OCCT), its freedesktop entry and the .mitcad MIME type. MitCad
# started as the AppImage copies them into the user's data folder
# (app/framework/DesktopEntry.cpp), where file managers look.
install(PROGRAMS "$<TARGET_FILE:mitcad-thumbnailer>" DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES "${PROJECT_SOURCE_DIR}/packaging/linux/mitcad.thumbnailer"
DESTINATION ${CMAKE_INSTALL_DATADIR}/thumbnailers)
install(FILES "${PROJECT_SOURCE_DIR}/packaging/linux/mitcad-mime.xml"
DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages
RENAME mitcad.xml)
# Mitcad's licence, the notices of what the AppImage bundles, the bundled
# font's licence and the licence text of every vcpkg port.
set(mitcad_doc_dir ${CMAKE_INSTALL_DATADIR}/doc/mitcad)
install(FILES "${PROJECT_SOURCE_DIR}/LICENSE"
"${PROJECT_SOURCE_DIR}/packaging/linux/THIRD-PARTY-NOTICES.txt"
DESTINATION ${mitcad_doc_dir})
install(FILES "${PROJECT_SOURCE_DIR}/third_party/fonts/droid-sans/LICENSE.txt"
DESTINATION ${mitcad_doc_dir}/licenses/droid-sans)
# The annotations' technical lettering (mitcad#902): a file of its own in
# share/mitcad/fonts, loaded at run time (LGPL-3.0 with the font exception).
if(EXISTS "${PROJECT_SOURCE_DIR}/third_party/fonts/iso-lettering/lettering.ttf")
install(FILES "${PROJECT_SOURCE_DIR}/third_party/fonts/iso-lettering/lettering.ttf"
DESTINATION ${CMAKE_INSTALL_DATADIR}/mitcad/fonts)
install(FILES "${PROJECT_SOURCE_DIR}/third_party/fonts/iso-lettering/LICENSE.txt"
DESTINATION ${mitcad_doc_dir}/licenses/iso-lettering)
endif()
# The interface languages (mitcad#1460, cmake/Translations.cmake): MitCad's
# catalogues and Qt's own (qtbase_<code>.qm, BSD-3-Clause) in
# share/mitcad/translations, where Language.cpp looks; never the tests'
# pseudo-language.
get_property(mitcad_translation_files GLOBAL PROPERTY MITCAD_TRANSLATION_FILES)
if(mitcad_translation_files)
install(FILES ${mitcad_translation_files} DESTINATION ${CMAKE_INSTALL_DATADIR}/mitcad/translations)
endif()
# three.js, embedded for the web viewer (app/web/viewer).
install(FILES "${PROJECT_SOURCE_DIR}/third_party/three/LICENSE" DESTINATION ${mitcad_doc_dir}/licenses/three)
# The bundled material dataset (mitcad#1213), compiled into the model as data.
install(FILES "${PROJECT_SOURCE_DIR}/third_party/material-properties/LICENSE"
"${PROJECT_SOURCE_DIR}/third_party/material-properties/NOTICE"
DESTINATION ${mitcad_doc_dir}/licenses/material-properties)
# SolidCraft's format upgrade steps, adapted for the .solidcraft import (third_party/solidcraft).
install(FILES "${PROJECT_SOURCE_DIR}/third_party/solidcraft/LICENSE-MIT"
DESTINATION ${mitcad_doc_dir}/licenses/solidcraft)
# QtKeychain, linked statically (cmake/Keychain.cmake).
install(FILES "${MITCAD_QTKEYCHAIN_LICENSE}" DESTINATION ${mitcad_doc_dir}/licenses/qtkeychain)
set(mitcad_vcpkg_share "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share")
file(GLOB mitcad_vcpkg_copyrights RELATIVE "${mitcad_vcpkg_share}" "${mitcad_vcpkg_share}/*/copyright")
foreach(copyright IN LISTS mitcad_vcpkg_copyrights)
get_filename_component(port "${copyright}" DIRECTORY)
install(FILES "${mitcad_vcpkg_share}/${copyright}" DESTINATION ${mitcad_doc_dir}/licenses/vcpkg/${port})
endforeach()
# The licences of the render worker's libraries that do not come from
# vcpkg (tools/dev-env/build-cycles.sh's prefix): Cycles with the licence
# texts of the code it bundles, and Open Image Denoise.
set(mitcad_render_install "${MITCAD_RENDER_DEPS}/install")
install(FILES "${mitcad_render_install}/cycles/LICENSE" DESTINATION ${mitcad_doc_dir}/licenses/cycles)
if(EXISTS "${mitcad_render_install}/cycles/licenses")
install(DIRECTORY "${mitcad_render_install}/cycles/licenses/" DESTINATION ${mitcad_doc_dir}/licenses/cycles)
endif()
install(FILES "${mitcad_render_install}/oidn/share/doc/OpenImageDenoise/LICENSE.txt"
"${mitcad_render_install}/oidn/share/doc/OpenImageDenoise/third-party-programs.txt"
DESTINATION ${mitcad_doc_dir}/licenses/openimagedenoise)
# --- AppImage ------------------------------------------------------------
set(MITCAD_APPIMAGE_TOOLS "$ENV{HOME}/appimage-tools" CACHE PATH
"linuxdeploy, its Qt plugin, appimagetool and the AppImage runtime (tools/dev-env/install-appimage-tools.sh)")
set(mitcad_appimage "Mitcad-${PROJECT_VERSION}-x86_64.AppImage")
add_custom_target(appimage
COMMAND "${CMAKE_COMMAND}" -E env
"CMAKE=${CMAKE_COMMAND}"
"QMAKE=$<TARGET_FILE:Qt6::qmake>"
"MITCAD_APPIMAGE_TOOLS=${MITCAD_APPIMAGE_TOOLS}"
bash "${PROJECT_SOURCE_DIR}/packaging/linux/make-appimage.sh"
"${CMAKE_BINARY_DIR}" "$<TARGET_FILE:mitcad>" "${CMAKE_BINARY_DIR}/${mitcad_appimage}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Making ${mitcad_appimage}"
VERBATIM
USES_TERMINAL)
add_dependencies(appimage mitcad mitcad-cli mitcad-render mitcad-thumbnailer)
# The AppImage as a user runs it, in ctest: tools/appimage-test.sh checks
# what it bundles, runs it with a clean environment on a hidden display and
# updates it from a local manifest signed with a key made for the test. It
# runs once the appimage target has made this build's AppImage; skipped
# otherwise.
if(BUILD_TESTING)
add_test(NAME app.appimage
COMMAND bash "${PROJECT_SOURCE_DIR}/tools/appimage-test.sh" --skip-stale
"${CMAKE_BINARY_DIR}/${mitcad_appimage}" "$<TARGET_FILE:mitcad>" "$<TARGET_FILE:mitcad-release>")
set_tests_properties(app.appimage PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 600)
endif()