### Install Snapcraft Source: https://gitlab.com/inkscape/inkscape/-/blob/master/snap/README.md Initial setup command to install the snapcraft tool. ```bash sudo snap install --classic snapcraft ``` -------------------------------- ### Install Inkscape Example Files Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/examples/CMakeLists.txt Installs SVG, SVGZ, and POV files as examples. The destination component differs between Windows and other platforms. ```cmake file(GLOB _FILES "*.svg" "*.svgz" "*.pov") if(WIN32) install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/examples COMPONENT examples) else() install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/examples COMPONENT inkscape) endif() ``` -------------------------------- ### Define Installation Targets Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/CMakeLists.txt Installs the Inkscape and Inkview executables to the binary directory. Includes conditional installation of COM components on Windows. ```cmake install(TARGETS inkscape inkview RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) if(WIN32) install(TARGETS inkscape_com) install(TARGETS inkview_com) endif() ``` -------------------------------- ### Download and Install Dependencies Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/linux.md Use this bash script to download and install the recommended libraries for compiling Inkscape. Ensure you have wget installed. ```bash wget -v https://gitlab.com/inkscape/inkscape-ci-docker/-/raw/master/install_dependencies.sh -O install_dependencies.sh bash install_dependencies.sh --recommended ``` -------------------------------- ### Install Theme Files and Icons Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/icons/Dash/CMakeLists.txt Defines the theme directory and installs core theme files and icon assets using CMake install commands. ```cmake set(THEME Dash) install(FILES "index.theme" DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME} COMPONENT themes) install(FILES "highlights.css" DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME} COMPONENT themes) set(PIXMAP_SIZES "symbolic") set(CONTENT "actions") foreach(pixmap_size ${PIXMAP_SIZES}) foreach(content ${CONTENT}) FILE(GLOB PIXMAP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/${content}/*.png ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/${content}/*.svg) install(FILES ${PIXMAP_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME}/${pixmap_size}/${content} COMPONENT themes) endforeach(content) endforeach(pixmap_size) ``` -------------------------------- ### Include and Get Library for Unit Tests Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/CMakeLists.txt This shows how to include a CMake unit configuration file and then retrieve the resulting library for use in subsequent tests. This is a common pattern for modularizing test setups. ```cmake include("${CMAKE_SOURCE_DIR}/src/libnrtype/CMakeUnit.txt") get_libnrtype_unit_lib() ``` -------------------------------- ### Install Local Snap Source: https://gitlab.com/inkscape/inkscape/-/blob/master/snap/README.md Commands to remove existing apt versions and install the locally built snap file. ```bash sudo apt remove inkscape sudo snap install --dangerous inkscape_XXX.snap sudo snap connect inkscape:dot-config-inkscape ``` -------------------------------- ### Glob and Install Translated Content Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/tutorials/CMakeLists.txt Finds SVG, JPG, and PNG files and installs them along with translated content. Installation destination varies based on the Windows platform. ```cmake file(GLOB _FILES "*.svg" "*.jpg" "*.png") filter_and_install_translated_content(_FILES ${INKSCAPE_SHARE_INSTALL}/tutorials) if(WIN32) install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/tutorials COMPONENT tutorials) else() install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/tutorials COMPONENT inkscape) endif() ``` -------------------------------- ### Install Extensions Directory Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/CMakeLists.txt Configures the installation of the extensions directory while excluding development and configuration files. ```cmake install(DIRECTORY extensions DESTINATION ${INKSCAPE_SHARE_INSTALL} COMPONENT extensions PATTERN ".git*" EXCLUDE PATTERN ".pylintrc" EXCLUDE PATTERN ".darglint" EXCLUDE PATTERN ".pre-commit-config.yaml" EXCLUDE PATTERN "tests" EXCLUDE PATTERN "MANIFEST.in" EXCLUDE PATTERN "pyproject.toml" EXCLUDE PATTERN "Makefile" EXCLUDE PATTERN "__pycache__" EXCLUDE PATTERN "tox.ini" EXCLUDE PATTERN "setup.cfg" EXCLUDE PATTERN "requirements.txt" EXCLUDE PATTERN "poetry.lock" EXCLUDE PATTERN "*.dox" EXCLUDE PATTERN "*.pyc" EXCLUDE PATTERN "*.sh" EXCLUDE PATTERN "*.bat" EXCLUDE PATTERN "*.md" EXCLUDE PATTERN "print_win32_vector.*" EXCLUDE PATTERN "other/inkman" EXCLUDE ) ``` -------------------------------- ### Install Theme Assets via CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/icons/multicolor/CMakeLists.txt Configures the installation paths for theme files, icons, and cursors using CMake's install and file globbing commands. ```cmake set(THEME multicolor) install(FILES "index.theme" DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME} COMPONENT themes) install(FILES "highlights.css" DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME} COMPONENT themes) set(PIXMAP_SIZES "symbolic") set(CONTENT "actions") foreach(pixmap_size ${PIXMAP_SIZES}) foreach(content ${CONTENT}) FILE(GLOB PIXMAP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/${content}/*.png ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/${content}/*.svg) install(FILES ${PIXMAP_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME}/${pixmap_size}/${content} COMPONENT themes) endforeach(content) endforeach(pixmap_size) FILE(GLOB CURSOR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/cursors/*.svg) install(FILES ${CURSOR_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME}/cursors) FILE(GLOB CURSOR_CSS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/cursors/*.css) install(FILES ${CURSOR_CSS_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME}/cursors) if(WIN32) install(CODE "execute_process(COMMAND gtk-update-icon-cache \${CMAKE_INSTALL_PREFIX}/${INKSCAPE_SHARE_INSTALL}/icons/${THEME})") endif() ``` -------------------------------- ### Install Icon Theme and Pixmaps Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/icons/hicolor/CMakeLists.txt Configures the installation of the hicolor icon theme and iterates through pixmap sizes and content types to install associated image files. ```cmake set(THEME hicolor) install(FILES "index.theme" DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME}) set(PIXMAP_SIZES "scalable" "symbolic") set(CONTENT "actions") foreach(pixmap_size ${PIXMAP_SIZES}) foreach(content ${CONTENT}) FILE(GLOB PIXMAP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/${content}/*.png ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/${content}/*.svg) install(FILES ${PIXMAP_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME}/${pixmap_size}/${content}) endforeach(content) endforeach(pixmap_size) ``` -------------------------------- ### Install Default Keymap Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/keys/CMakeLists.txt Installs inkscape.xml as default.xml, which Inkscape uses by default after installation. This can be overridden by a custom keymap. ```cmake install(FILES inkscape.xml DESTINATION ${INKSCAPE_SHARE_INSTALL}/keys RENAME default.xml) ``` -------------------------------- ### Install Application Icons via CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/icons/application/CMakeLists.txt Iterates through a list of icon sizes and installs matching image files to the system icon directory. ```cmake # SPDX-License-Identifier: GPL-2.0-or-later # install application icons into system-wide hicolor icon theme "apps" folder # it's also the fallback for all other themes that do not include a customized Inkscape icon. set(PIXMAP_SIZES "16x16" "22x22" "24x24" "32x32" "48x48" "256x256" "scalable" "symbolic") foreach(pixmap_size ${PIXMAP_SIZES}) FILE(GLOB PIXMAP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/*.png ${CMAKE_CURRENT_SOURCE_DIR}/${pixmap_size}/*.svg) install(FILES ${PIXMAP_FILES} DESTINATION ${SHARE_INSTALL}/icons/hicolor/${pixmap_size}/apps) endforeach(pixmap_size) ``` -------------------------------- ### Set up development share directory Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/general_advanced.md Create symbolic links to share and locale directories to enable faster builds without running full installation. ```sh cd build mkdir -p dev_share ln -s ../../share dev_share/inkscape ln -s ../po/locale dev_share/locale ``` -------------------------------- ### Install Build Dependencies via Script Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/windows.md Downloads and executes the dependency installation script directly from the Inkscape repository. ```bash curl https://gitlab.com/inkscape/inkscape/-/raw/master/buildtools/msys2installdeps.sh | bash ``` -------------------------------- ### Include and Get Color Unit Library Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/CMakeLists.txt Similar to the libnrtype example, this includes a CMake unit configuration for colors and retrieves the associated unit library. This is used to link color-related tests. ```cmake include("${CMAKE_SOURCE_DIR}/src/colors/CMakeUnit.txt") get_color_unit_lib() ``` -------------------------------- ### Install LICENSES directory Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/doc/CMakeLists.txt Installs all files from the LICENSES subdirectory to the Inkscape share directory. ```cmake install(DIRECTORY ${CMAKE_SOURCE_DIR}/LICENSES/ DESTINATION ${INKSCAPE_SHARE_INSTALL}/doc) ``` -------------------------------- ### Install LICENSE file Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/doc/CMakeLists.txt Installs the main LICENSE file to the Inkscape share directory for documentation purposes. ```cmake install(FILES LICENSE DESTINATION ${INKSCAPE_SHARE_INSTALL}/doc) ``` -------------------------------- ### Install XML Keymap Files Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/keys/CMakeLists.txt Installs all XML files found in the current directory to the Inkscape share directory for keys. Ensure the INKSCAPE_SHARE_INSTALL variable is correctly set. ```cmake file(GLOB _FILES "*.xml") install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/keys) ``` -------------------------------- ### Glob and Install UI Files Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/ui/CMakeLists.txt This snippet uses file(GLOB ...) to find all XML, RC, CSS, UI, Glade, SVG, INI, and LANG files in the current directory and then installs them to the Inkscape share directory's UI subfolder. ```cmake file(GLOB _FILES "*.xml" "*.rc" "*.css" "*.ui" "*.glade" "*.svg" "*.ini" "*.lang") install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/ui) ``` -------------------------------- ### Install Cursor Assets Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/icons/Dash/CMakeLists.txt Locates and installs SVG and CSS files for cursors into the theme directory. ```cmake FILE(GLOB CURSOR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/cursors/*.svg) install(FILES ${CURSOR_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME}/cursors) FILE(GLOB CURSOR_CSS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/cursors/*.css) install(FILES ${CURSOR_CSS_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/icons/${THEME}/cursors) ``` -------------------------------- ### Install Homebrew dependencies Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/mac.md Installs the necessary libraries and tools for building Inkscape via Homebrew. ```bash brew install \ adwaita-icon-theme \ bdw-gc \ boost \ cairomm \ ccache \ cmake \ double-conversion \ gettext \ gsl \ gtkmm4 \ gtksourceview5 \ icu4c \ imagemagick \ intltool \ lcms2 \ libxslt \ ninja \ pkg-config \ poppler \ potrace ``` -------------------------------- ### Generate and Install Palette Files with CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/palettes/CMakeLists.txt Uses a custom command to execute a Python script for header generation and defines an installation rule for palette files. ```cmake # SPDX-License-Identifier: GPL-2.0-or-later set(I18N_FILES "inkscape.gpl" "svg.gpl" "Tango-Palette.gpl") add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/palettes.h COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${I18N_FILES} > ${CMAKE_CURRENT_BINARY_DIR}/palettes.h WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${I18N_FILES} ) set_source_files_properties(${CMAKE_BINARY_DIR}/palettes.h PROPERTIES GENERATED TRUE) add_custom_target(palettes_h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/palettes.h) file(GLOB _FILES "*.gpl") install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/palettes) ``` -------------------------------- ### Install Inkscape Base Library Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/CMakeLists.txt Installs the inkscape_base library as a shared library if BUILD_SHARED_LIBS is enabled, placing it in the Inkscape subdirectory of the installation library path. ```cmake if(BUILD_SHARED_LIBS) install(TARGETS inkscape_base LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/inkscape") endif() ``` -------------------------------- ### Windows MSYS2 Installation Source: https://gitlab.com/inkscape/inkscape/-/blob/master/CMakeLists.txt Includes MSYS2 installation scripts on Windows. ```cmake if(WIN32) include(CMakeScripts/InstallMSYS2.cmake) endif() ``` -------------------------------- ### Install Localized Templates Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/templates/CMakeLists.txt Installs localized versions of the default SVG template for each supported language. Installation is optional and component-based, especially for Windows. ```cmake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/default.${language_code}.svg DESTINATION ${INKSCAPE_SHARE_INSTALL}/templates COMPONENT ${COMP} OPTIONAL) endforeach() ``` -------------------------------- ### Package Inkscape Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/mac.md Commands to install files and launch the application from the build directory. ```bash ninja install ``` ```bash ./install_dir/bin/inkscape ``` -------------------------------- ### Configure and Build Inkscape Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/windows.md This sequence of commands navigates to the source directory, creates a build directory, configures the build using CMake with Ninja, and then compiles and installs Inkscape. Ensure you are in the MSYS2 UCRT64 shell. ```bash # change to the directory containing your Inkscape source checkout (has to be # adjusted to match your system) cd master # create a directory for the build (could also be another folder, but we'll # assume 'build' being used for the rest of the article) mkdir build cd build # create build files with CMake (we generate rules for "Ninja" as it's # significantly faster then "MinGW Makefiles" which uses mingw32-make) # note the source path '..' (which in this case is the parent directory) and # should always point to the root folder of your copy of the Inkscape source. # ( For details on these build flags, see below "Build Flags" ) cmake -G Ninja -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. # start the compilation and # install compiled files and all dependencies required to run Inkscape into the # folder 'build/inkscape/': ninja install # Run Inkscape ./install_dir/bin/inkscape.exe ``` -------------------------------- ### Glob and Install Resources Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/ui/CMakeLists.txt This snippet uses file(GLOB ...) to find PNG, SVG, and TXT files within the 'resources' subdirectory and installs them to the Inkscape share directory's UI/resources subfolder. ```cmake file(GLOB _RESOURCES "resources/*.png" "resources/*.svg" "resources/*.txt") install(FILES ${_RESOURCES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/ui/resources) ``` -------------------------------- ### Install attribute files using CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/attributes/CMakeLists.txt Configures the installation of specific attribute files into the designated Inkscape share directory. ```cmake # SPDX-License-Identifier: GPL-2.0-or-later set(_FILES "svgprops" "cssprops" "css_defaults") install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/attributes) ``` -------------------------------- ### Glob and Install Syntax Themes Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/ui/CMakeLists.txt This snippet uses file(GLOB ...) to find XML files within the 'syntax-themes' subdirectory and installs them to the Inkscape share directory's UI/syntax-themes subfolder. ```cmake file(GLOB _SYNTAX_THEMES "syntax-themes/*.xml") install(FILES ${_SYNTAX_THEMES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/ui/syntax-themes) ``` -------------------------------- ### Compile Inkscape with CMake and Ninja Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/linux.md This sequence of commands sets up the build environment using CMake, configures the installation prefix, enables ccache for faster compilation, and then builds the project with Ninja. Ensure you are in the root of the Inkscape source directory before running these commands. ```sh # Create build subdirectory mkdir build # Change to it cd build # run CMake for initial setup cmake -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -DWITH_INTERNAL_2GEOM=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja .. # compile ninja install # run ./install_dir/bin/inkscape ``` -------------------------------- ### Install SVG and PNG assets using CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/screens/CMakeLists.txt Uses file globbing to collect assets and installs them to the Inkscape share directory. ```cmake # SPDX-License-Identifier: GPL-2.0-or-later file(GLOB _FILES "*.svg" "*.png") filter_and_install_translated_content(_FILES ${INKSCAPE_SHARE_INSTALL}/screens) install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/screens) file(GLOB _ABOUT "about/*.svgz" "about/*.svg") install(FILES ${_ABOUT} DESTINATION ${INKSCAPE_SHARE_INSTALL}/screens/about) ``` -------------------------------- ### Install Inkman Extension Manager Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/CMakeLists.txt Installs the inkman extension manager component with specific exclusions. ```cmake install(DIRECTORY extensions/other/inkman DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions/inkman/ COMPONENT extension_manager PATTERN "tests" EXCLUDE PATTERN ".git*" EXCLUDE PATTERN "MANIFEST.in" EXCLUDE PATTERN "requirements.txt" EXCLUDE PATTERN "pyproject.toml" EXCLUDE ) ``` -------------------------------- ### Windows-Specific Extension Installation Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/CMakeLists.txt Handles Windows-specific installation of print vector scripts and triggers Python byte-code compilation. ```cmake if(WIN32) install( FILES extensions/print_win32_vector.py extensions/print_win32_vector.inx DESTINATION ${INKSCAPE_SHARE_INSTALL}/extensions COMPONENT extensions ) install(CODE "MESSAGE(\"Pre-compiling Python extensions to byte-code (.pyc files)\") execute_process(COMMAND \${CMAKE_INSTALL_PREFIX}/bin/python -m compileall -qq \${CMAKE_INSTALL_PREFIX}/${INKSCAPE_SHARE_INSTALL})" COMPONENT extensions) endif() ``` -------------------------------- ### Glob and Install Icons Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/templates/CMakeLists.txt Finds all SVG icon files in the 'icons' directory and installs them to the Inkscape share directory's templates/icons path. ```cmake FILE(GLOB ICON_FILES "${CMAKE_CURRENT_SOURCE_DIR}/icons/*.svg") install(FILES ${ICON_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/templates/icons) ``` -------------------------------- ### Install SVG Templates Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/templates/CMakeLists.txt Installs all found SVG files to the Inkscape share directory's templates path. ```cmake install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/templates) ``` -------------------------------- ### GitLab Push Notification Example Source: https://gitlab.com/inkscape/inkscape/-/blob/master/CONTRIBUTING.md This is an example of the notification output from GitLab after pushing a new branch, which includes a direct link to create a merge request. ```text remote: To create a merge request for fix-for-bug-xyz, visit: remote: https://gitlab.com/userxxx/inkscape/-/merge_requests/new?merge_request%5Bsource_branch%5D=fix-for-bug-xyz ``` -------------------------------- ### Validate Snap Package Source: https://gitlab.com/inkscape/inkscape/-/blob/master/snap/README.md Commands to install review-tools and validate the generated snap file. ```bash sudo snap install review-tools review-tools.snap-review inkscape_XXX.snap ``` -------------------------------- ### Add Unit Tests with Environment Variables Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/CMakeLists.txt This example defines unit tests that require specific environment variables to be set during their execution. It also lists the necessary extra libraries for these tests. ```cmake add_unit_tests(TEST_SOURCES "libnrtype/font-factory-test.cpp" "libnrtype/font-instance-test.cpp" ENVIRONMENT "INKSCAPE_FONTCONFIG=${CMAKE_CURRENT_SOURCE_DIR}/rendering_tests/fonts/isolated.conf" "LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/lsan.suppression" EXTRA_LIBS libnrtype_unit_lib) ``` -------------------------------- ### Install Marker SVG Files Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/markers/CMakeLists.txt Installs all SVG files found in the current directory to the Inkscape share directory under the 'markers' subdirectory. This command uses file globbing. ```cmake file(GLOB _FILES "*.svg") install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/markers) ``` -------------------------------- ### Add CLI Test for WMF Export Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Defines a CLI test case for exporting a file to WMF format. This is a basic export setup. ```cmake add_cli_test(export-with-filters_wmf PARAMETERS --export-type=wmf INPUT_FILENAME offset.svg OUTPUT_FILENAME export-with-filters.wmf REFERENCE_FILENAME export-with-filters_expected.wmf) ``` -------------------------------- ### Configure build with specific flags Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/general_advanced.md Example of overriding default CMake settings, such as disabling SVG 2 support. ```sh cmake .. -DWITH_SVG2=OFF ``` -------------------------------- ### Configure Dependencies and Include Directories Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/3rdparty/autotrace/CMakeLists.txt Sets up PkgConfig for GLIB, links required libraries, and defines public and private include paths. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) target_link_libraries(autotrace_LIB PUBLIC PkgConfig::GLIB Intl::Intl) target_include_directories(autotrace_LIB PUBLIC SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/include) target_include_directories(autotrace_LIB PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/autotrace) ``` -------------------------------- ### Install SVG Files Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/paint/CMakeLists.txt Installs SVG files to the specified destination directory within the Inkscape share installation path. ```cmake install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/paint) ``` -------------------------------- ### Configuration Summary Output Source: https://gitlab.com/inkscape/inkscape/-/blob/master/CMakeLists.txt Prints a summary of the build configuration to the console during CMake configuration. ```cmake message("------------------------------------------------------------------------") message("Configuration Summary") message("------------------------------------------------------------------------") # project info message("PROJECT_NAME: ${PROJECT_NAME}") message("INKSCAPE_VERSION: ${INKSCAPE_VERSION}") message("INKSCAPE_DIST_PREFIX: ${INKSCAPE_DIST_PREFIX}") message("") # cmake info message("CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") message("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") message("CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}") message("PACKAGE_LOCALE_DIR ${PACKAGE_LOCALE_DIR}") message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}") message("CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}") message("CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") message("CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}") message("CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") message("") if(WIN32) message("CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}") message("CMAKE_FIND_LIBRARY_PREFIXES: ${CMAKE_FIND_LIBRARY_PREFIXES}") message("CMAKE_FIND_LIBRARY_SUFFIXES: ${CMAKE_FIND_LIBRARY_SUFFIXES}") message("") endif() # dependency info message("ENABLE_LCMS: ${ENABLE_LCMS}") message("WITH_POPPLER: ${WITH_POPPLER}") message("WITH_CAPYPDF: ${WITH_CAPYPDF}") message("ENABLE_POPPLER_CAIRO: ${ENABLE_POPPLER_CAIRO}") message("WITH_GNU_READLINE: ${WITH_GNU_READLINE}") message("WITH_LIBSPELLING: ${WITH_LIBSPELLING}") message("WITH_GSOURCEVIEW: ${WITH_GSOURCEVIEW}") message("WITH_IMAGE_MAGICK: ${WITH_IMAGE_MAGICK}") message("WITH_GRAPHICS_MAGICK: ${WITH_GRAPHICS_MAGICK}") message("WITH_LIBCDR: ${WITH_LIBCDR}") message("WITH_LIBVISIO: ${WITH_LIBVISIO}") message("WITH_LIBWPG: ${WITH_LIBWPG}") message("WITH_NLS: ${WITH_NLS}") message("WITH_JEMALLOC: ${WITH_JEMALLOC}") message("WITH_ASAN: ${WITH_ASAN}") message("WITH_INTERNAL_2GEOM: ${WITH_INTERNAL_2GEOM}") message("WITH_INTERNAL_UEMF: ${WITH_INTERNAL_UEMF}") message("WITH_INTERNAL_DEPIXELIZE: ${WITH_INTERNAL_DEPIXELIZE}") message("WITH_INTERNAL_AUTOTRACE: ${WITH_INTERNAL_AUTOTRACE}") message("WITH_INTERNAL_ADAPTAGRAMS: ${WITH_INTERNAL_ADAPTAGRAMS}") message("WITH_PROFILING: ${WITH_PROFILING}") message("BUILD_TESTING: ${BUILD_TESTING}") message("TESTS_WITH_ASAN: ${TESTS_WITH_ASAN}") if(WIN32) message("") message("HAVE_MINGW64: ${HAVE_MINGW64}") message("MINGW_PATH: ${MINGW_PATH}") message("MINGW_ARCH: ${MINGW_ARCH}") endif() message("------------------------------------------------------------------------") ``` -------------------------------- ### Install Collected SVG Files Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/symbols/CMakeLists.txt Installs the collected SVG files to the 'symbols' directory within the Inkscape share installation path. This makes them available at runtime. ```cmake install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/symbols) ``` -------------------------------- ### Install SVG Files in Inkscape Build Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/branding/CMakeLists.txt Installs all SVG files from the current directory to the Inkscape share installation directory. Ensure the destination path is correctly defined. ```cmake file(GLOB _FILES "*.svg") install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/branding) ``` -------------------------------- ### Execute action: list actions Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Tests the --actions=action-list parameter to execute the action listing. ```bash add_cli_test(actions-action-list PARAMETERS --actions=action-list PASS_FOR_OUTPUT "file-new") ``` -------------------------------- ### Initialize and Update Submodules Source: https://gitlab.com/inkscape/inkscape/-/blob/master/CONTRIBUTING.md Ensure all submodules are correctly initialized and updated. This is crucial when fetching code to avoid missing folders. ```bash git submodule init && git submodule update --recursive ``` -------------------------------- ### Convert DPI method: scale-viewbox Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Tests the 'convert-dpi-method:scale-viewbox' action. Note that convert-dpi-method must be set before file-open. ```bash add_cli_test(action-convert-dpi-method-scale-viewbox PARAMETERS --export-area-page --actions=convert-dpi-method:scale-viewbox$file-open:${CMAKE_CURRENT_SOURCE_DIR}/testcases/shapes_pre_0.92.svg$export-filename:action-convert-dpi-method-scale-viewbox.png$export-do OUTPUT_FILENAME action-convert-dpi-method-scale-viewbox.png EXPECTED_FILES "${CMAKE_CURRENT_SOURCE_DIR}/testcases/shapes_pre_0.92_backup.svg" REFERENCE_FILENAME shapes_pre_0.92_scaled_expected.png) ``` -------------------------------- ### Basic CLI Export with Margin, Use Hints, and ID Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt This snippet demonstrates a basic CLI test case for exporting an SVG file. It utilizes options for setting export margins, enabling the use of hints for export, and specifying an export ID for a particular element. The test includes input file, expected output message, and reference files. ```bash add_cli_test(export-margin_export-use-hints_export-id PARAMETERS --export-margin=50 --export-use-hints --export-id=rect1 INPUT_FILENAME export_hints.svg PASS_FOR_OUTPUT "Area 10:10:90:70 exported to 203 x 177 pixels \(123 dpi\)" EXPECTED_FILES "${CMAKE_CURRENT_SOURCE_DIR}/testcases/export_hints_rectangle.png") ``` -------------------------------- ### Build Inkscape Snap Source: https://gitlab.com/inkscape/inkscape/-/blob/master/snap/README.md Commands to clean the build environment and package the snap. ```bash snapcraft clean snapcraft pack ``` -------------------------------- ### Install copyright related files Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/doc/CMakeLists.txt Installs additional copyright-related files such as AUTHORS, TRANSLATORS, and COPYING from the root directory to the Inkscape share directory. ```cmake install(FILES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/TRANSLATORS ${CMAKE_SOURCE_DIR}/COPYING DESTINATION ${INKSCAPE_SHARE_INSTALL}/doc) ``` -------------------------------- ### List CMake configuration options Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/general_advanced.md View available build configuration settings for the Inkscape project. ```sh cmake -L ``` ```sh cmake --help ``` -------------------------------- ### Install TTF fonts using CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/fonts/CMakeLists.txt Uses file globbing to collect all .ttf files in the current directory and installs them to the Inkscape fonts share path. ```cmake # SPDX-License-Identifier: GPL-2.0-or-later file(GLOB _FILES "*.ttf") install(FILES ${_FILES} DESTINATION ${INKSCAPE_SHARE_INSTALL}/fonts) ``` -------------------------------- ### List available actions Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Tests the --action-list parameter to retrieve a list of available actions. ```bash add_cli_test(action-list PARAMETERS --action-list PASS_FOR_OUTPUT "file-new") ``` -------------------------------- ### Create Static Library for Test Utilities Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/CMakeLists.txt Builds a static library that bundles common test code and utilities, linking against Google Test and Inkscape's base library. ```cmake add_library(cpp_test_static_library SHARED inkscape-test.cpp doc-per-case-test.cpp compare-paths-test.h lpespaths-test.h store-integrity-test.h test-with-svg-object-pairs.cpp) target_link_libraries(cpp_test_static_library PUBLIC ${GTEST_LIBRARIES} inkscape_base) ``` -------------------------------- ### Configure Adaptagrams Subdirectories and Interface Library Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/3rdparty/adaptagrams/CMakeLists.txt Adds the necessary subdirectories and creates an interface library to group the Adaptagrams dependencies. ```cmake add_subdirectory(libavoid) add_subdirectory(libcola) add_subdirectory(libvpsc) add_library(adaptagrams_LIB INTERFACE) target_link_libraries(adaptagrams_LIB INTERFACE avoid_LIB cola_LIB vpsc_LIB) ``` -------------------------------- ### Define Autotrace Library and Sources Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/3rdparty/autotrace/CMakeLists.txt Initializes the static library target and lists all private source and header files. ```cmake add_library(autotrace_LIB STATIC) set(INC include/autotrace) set(SRC src/autotrace) target_sources(autotrace_LIB PRIVATE ${SRC}/config.h ${SRC}/autotrace.c ${INC}/autotrace.h ${SRC}/bitmap.c ${SRC}/bitmap.h ${SRC}/color.c ${INC}/color.h ${SRC}/curve.c ${SRC}/curve.h ${SRC}/despeckle.c ${SRC}/despeckle.h ${SRC}/epsilon-equal.c ${SRC}/epsilon-equal.h ${SRC}/exception.c ${INC}/exception.h ${SRC}/filename.c ${SRC}/filename.h ${SRC}/fit.c ${SRC}/fit.h ${SRC}/image-header.h ${SRC}/image-proc.c ${SRC}/image-proc.h ${SRC}/input.c ${INC}/input.h ${SRC}/intl.h ${SRC}/logreport.c ${SRC}/logreport.h ${SRC}/median.c ${SRC}/module.c ${SRC}/output.c ${INC}/output.h ${SRC}/private.h ${SRC}/pxl-outline.c ${SRC}/pxl-outline.h ${SRC}/quantize.h ${SRC}/spline.c ${INC}/spline.h ${SRC}/thin-image.c ${SRC}/thin-image.h ${INC}/types.h ${SRC}/vector.c ${SRC}/vector.h ${SRC}/xstd.h ) ``` -------------------------------- ### Implement custom widget constructors Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/ui/widget/generic/README.md Implement the bare and builder constructors, ensuring Glib::ObjectBase is initialized to create a unique GType. ```cpp // First the bare constructor, it must be EXACTLY the same as the builder constructor. MyNewWidget::MyNewWidget() // This allows the new widget to be correctly registered and for gobject properties of the parent // to be accessible to this class too. , Glib::ObjectBase("MyNewWidget") // The parent constructor must omit the cobject entirely because the chain of construction generates // a new cobject only if there is no argument, and not if that argument is nullptr. // : ParentWidget() // This isn't required, just noted here for explicit symmetry // More construction here { construct(); // optional } // This constructor means we already have a gobject, and the builder is passing it // to us so we can bind it to our C++ code correctly. MyNewWidget::MyNewWidget(GtkWidget *cobject, const Glib::RefPtr& builder) , Glib::ObjectBase("MyNewWidget") // As above the cobject must be passed into the base widget. builder can be omitted // if the base is a Gtk widget and not a custom widget. : BaseWidget(cobject, builder) // The same construction here, you may want to use a define to reduce duplication { construct(); // optional } ``` -------------------------------- ### Generate and Install SVG Filters with CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/filters/CMakeLists.txt Uses add_custom_command to process SVG files with a Python script and add_custom_target to ensure the generated header is built. The install command handles placing the source SVG in the appropriate share directory. ```cmake # SPDX-License-Identifier: GPL-2.0-or-later add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/filters.svg.h COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ${CMAKE_CURRENT_SOURCE_DIR}/filters.svg > ${CMAKE_CURRENT_BINARY_DIR}/filters.svg.h MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/filters.svg DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/i18n.py ) set_source_files_properties(${CMAKE_BINARY_DIR}/filters.svg.h PROPERTIES GENERATED TRUE) add_custom_target(filters_svg_h ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/filters.svg.h) install(FILES "filters.svg" DESTINATION ${INKSCAPE_SHARE_INSTALL}/filters) ``` -------------------------------- ### Configure and Build Colors Unit Library Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/colors/CMakeUnit.txt Defines a CMake function to set up the colors unit library. It prepends source directories, adds the library, checks for dependencies, links libraries, and makes the target unit testable. ```cmake function(get_color_unit_lib) list(TRANSFORM colors_unit_SRC PREPEND "colors/") list(PREPEND colors_unit_SRC "util-string/string-convert.cpp") list(TRANSFORM colors_unit_SRC PREPEND "${CMAKE_SOURCE_DIR}/src/") add_library(colors_unit_lib SHARED "${colors_unit_SRC}") pkg_check_modules(COLOR_UNIT_DEPS REQUIRED IMPORTED_TARGET lcms2 cairomm-1.16) target_link_libraries(colors_unit_lib 2Geom::2geom GLibmm::GLibmm PkgConfig::COLOR_UNIT_DEPS) make_target_unit_testable(colors_unit_lib) endfunction(get_color_unit_lib) ``` -------------------------------- ### Convert DPI method: scale-document Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Tests the 'convert-dpi-method:scale-document' action. Note that convert-dpi-method must be set before file-open. ```bash add_cli_test(action-convert-dpi-method-scale-document PARAMETERS --export-area-page --actions=convert-dpi-method:scale-document$file-open:${CMAKE_CURRENT_SOURCE_DIR}/testcases/shapes_pre_0.92.svg$export-filename:action-convert-dpi-method-scale-document.png$export-do OUTPUT_FILENAME action-convert-dpi-method-scale-document.png EXPECTED_FILES "${CMAKE_CURRENT_SOURCE_DIR}/testcases/shapes_pre_0.92_backup.svg" REFERENCE_FILENAME shapes_pre_0.92_scaled_expected.png) ``` -------------------------------- ### Packaging with CPack Source: https://gitlab.com/inkscape/inkscape/-/blob/master/CMakeLists.txt Includes CMake scripts for configuring packaging using CPack. ```cmake include(CMakeScripts/ConfigCPack.cmake) ``` -------------------------------- ### Uninstall Target for Windows Source: https://gitlab.com/inkscape/inkscape/-/blob/master/CMakeLists.txt Defines a custom 'uninstall' target for Windows that removes the installation directory. ```cmake if(WIN32) add_custom_target(uninstall "${CMAKE_COMMAND}" -E remove_directory "${CMAKE_INSTALL_PREFIX}") else() configure_file( "${CMAKE_SOURCE_DIR}/CMakeScripts/cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") endif() ``` -------------------------------- ### Update Icon Cache on Windows Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/icons/Dash/CMakeLists.txt Executes the gtk-update-icon-cache command during installation specifically for Windows environments. ```cmake if(WIN32) install(CODE "execute_process(COMMAND gtk-update-icon-cache \${CMAKE_INSTALL_PREFIX}/${INKSCAPE_SHARE_INSTALL}/icons/${THEME})") endif() ``` -------------------------------- ### Build Inkscape with CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/mac.md Configures the build environment and compiles Inkscape using Ninja. ```bash # use a clean Homebrew environment (optional) LIBPREFIX="/opt/homebrew" export PATH="$LIBPREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin" # Some keg-only libraries need to be added to PKG_CONFIG_PATH # Note: icu4c path is version specific (here: @77) export PKG_CONFIG_PATH="$LIBPREFIX/opt/icu4c@77/lib/pkgconfig" export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libsoup@2/lib/pkgconfig" # prevent picking up libxslt and libxml2 from the (wrong) SDK export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libxslt/lib/pkgconfig" export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libxml2/lib/pkgconfig" mkdir -p build cd build cmake \ -G Ninja \ -DCMAKE_SHARED_LINKER_FLAGS="-L$LIBPREFIX/lib" \ -DCMAKE_EXE_LINKER_FLAGS="-L$LIBPREFIX/lib" \ -DCMAKE_INSTALL_PREFIX="${PWD}/install_dir" \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_BUILD_TYPE=Debug \ -DWITH_INTERNAL_2GEOM=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DWITH_DBUS=OFF \ .. ninja install # Start Inkscape ./install_dir/bin/inkscape ``` -------------------------------- ### SVG 1.1 Attribute Index Overview Source: https://gitlab.com/inkscape/inkscape/-/blob/master/share/attributes/attindex.html A reference guide for SVG 1.1 attributes and their applicable elements. ```APIDOC ## SVG 1.1 Attribute Index ### Description This index lists the regular attributes defined in the SVG 1.1 specification and the elements on which they may be specified. ### Attributes Summary - **accent-height**: font-face - **accumulate**: animate, animateColor, animateMotion, animateTransform - **additive**: animate, animateColor, animateMotion, animateTransform - **alphabetic**: font-face - **amplitude**: feFuncA, feFuncB, feFuncG, feFuncR - **arabic-form**: glyph - **ascent**: font-face - **attributeName**: animate, animateColor, animateTransform, set - **attributeType**: animate, animateColor, animateTransform, set - **azimuth**: feDistantLight - **baseFrequency**: feTurbulence - **baseProfile**: svg - **bbox**: font-face - **begin**: animate, animateColor, animateMotion, animateTransform, set - **bias**: feConvolveMatrix - **by**: animate, animateColor, animateMotion, animateTransform - **calcMode**: animate, animateColor, animateMotion, animateTransform - **cap-height**: font-face - **class**: All elements ``` -------------------------------- ### Set INSTALL_RPATH for inkscape_base Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/CMakeLists.txt Configures the installation runtime path (RPATH) for the inkscape_base library, ensuring it can be found at runtime. ```cmake set_target_properties(inkscape_base PROPERTIES INSTALL_RPATH "${LIBINKSCAPE_INSTALL_RPATH}") ``` -------------------------------- ### Configure grid2 library with CMake Source: https://gitlab.com/inkscape/inkscape/-/blob/master/src/extension/plugins/grid2/CMakeLists.txt Defines the grid2 shared library and sets up its dependencies and include paths. ```cmake add_library(grid2 SHARED EXCLUDE_FROM_ALL grid.cpp) target_link_libraries(grid2 inkscape_base) target_include_directories(grid2 PRIVATE ${CMAKE_BINARY_DIR}/src) ``` -------------------------------- ### Execute action: debug-info Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Tests the --actions=debug-info parameter to retrieve debug information. ```bash add_cli_test(actions-debug-info PARAMETERS --actions=debug-info PASS_FOR_OUTPUT "OS version:") ``` -------------------------------- ### Recompile Inkscape Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/linux.md After making changes to the source code, re-run the 'ninja install' command from the build directory to recompile Inkscape. ```sh ninja install ``` -------------------------------- ### Convert DPI method: none Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Tests the 'convert-dpi-method:none' action. Note that convert-dpi-method must be set before file-open. ```bash add_cli_test(action-convert-dpi-method-none PARAMETERS --export-area-page --actions=convert-dpi-method:none$file-open:${CMAKE_CURRENT_SOURCE_DIR}/testcases/shapes_pre_0.92.svg$export-filename:action-convert-dpi-method-none.png$export-do OUTPUT_FILENAME action-convert-dpi-method-none.png REFERENCE_FILENAME shapes_expected.png) ``` -------------------------------- ### Configure VS Code for MSYS2 Terminals Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/vscode/readme.md Add these profiles to your VS Code `settings.json` to easily launch MSYS2 terminals. Ensure the MSYS2 path is correct for your installation. ```json { "terminal.integrated.profiles.windows": { "UCRT": { "path": "cmd.exe", "args": [ "/c", "C:/msys64/msys2_shell.cmd -defterm -here -no-start -ucrt64" ], "overrideName": true }, "MSYS": { "path": "cmd.exe", "args": [ "/c", "C:/msys64/msys2_shell.cmd -defterm -here -no-start -msys" ], "overrideName": true } } } ``` -------------------------------- ### Clone Inkscape Source Code Source: https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/linux.md Clone the Inkscape Git repository to get the latest source code. The --recurse-submodules flag ensures all submodules are also downloaded. ```bash git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git ``` -------------------------------- ### Add Unit Tests with Sources and Libraries Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/CMakeLists.txt This snippet demonstrates how to define a set of unit tests, specifying their source files and any additional libraries they depend on. It's used for grouping related tests. ```cmake add_unit_tests(TEST_SOURCES "svg-length-test.cpp" "svg-stringstream-test.cpp" "util-units-test.cpp" SOURCES "svg/css-ostringstream.cpp" "svg/svg-length.cpp" "svg/stringstream.cpp" "svg/strip-trailing-zeros.cpp" "util/units.cpp" # MOCK object files to unitise these tests "mocks/util-units-filename.cpp" "mocks/util-numeric-precision.cpp" EXTRA_LIBS GLibmm::GLibmm 2Geom::2geom) ``` -------------------------------- ### Debug Build Environment Source: https://gitlab.com/inkscape/inkscape/-/blob/master/snap/README.md Commands to navigate to the build directory and re-run CMake within the snapcraft debug shell. ```bash cd /root/parts/inkscape/build/ rm CMakeCache.txt cmake /root/parts/inkscape/src -G Ninja -DCMAKE_INSTALL_PREFIX= cmake --build . ``` -------------------------------- ### Add CLI Test for Exporting Drawing Area using Hints Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Sets up a CLI test to export the entire drawing area using export hints. This is useful for capturing the full canvas. ```cmake add_cli_test(export-use-hints_export-area-drawing PARAMETERS --export-use-hints --export-area-drawing INPUT_FILENAME export_hints.svg EXPECTED_FILES "${CMAKE_CURRENT_SOURCE_DIR}/testcases/export_hints_drawing.png") ``` -------------------------------- ### Query all object IDs and properties Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Tests the --query-all parameter to retrieve properties for specified object IDs. ```bash string(CONCAT query_all_expected "rect1,10,10,80,80\n" "rect2,110,20,80,70\n" "rect3,210,30,80,60") add_cli_test(query-all PARAMETERS --query-id=rect2 --query-all INPUT_FILENAME rects.svg PASS_FOR_OUTPUT ${query_all_expected}) ``` -------------------------------- ### Apply Transform-Grow (Scale) Action Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/cli_tests/CMakeLists.txt Scales an object by a specified factor using select-by-id and transform-grow. ```cmake add_cli_test(actions-transform-grow INPUT_FILENAME pyramids.svg PARAMETERS --actions=select-by-id:quad_snapped_1$transform-grow:10 OUTPUT_FILENAME actions-transform-grow.png REFERENCE_FILENAME actions-transform-grow_expected.png) ``` -------------------------------- ### Generate and Configure Integration Test Executables Source: https://gitlab.com/inkscape/inkscape/-/blob/master/testfiles/CMakeLists.txt Iterates through the defined test sources, creating an executable for each, setting up include directories, linking necessary libraries, and registering them as CTest tests. ```cmake add_custom_target(tests) foreach(test_source ${TEST_SOURCES}) string(REPLACE "-test" "" testname "test_${test_source}") string(REPLACE "/" "_" testname "${testname}") add_executable(${testname} src/${test_source}.cpp) target_include_directories(${testname} SYSTEM PRIVATE ${GTEST_INCLUDE_DIRS}) target_link_libraries(${testname} cpp_test_static_library 2Geom::2geom) add_test(NAME ${testname} COMMAND ${testname}) set_tests_properties(${testname} PROPERTIES ENVIRONMENT "${INKSCAPE_TEST_PROFILE_DIR_ENV}/${testname};${CMAKE_CTEST_ENV}") add_dependencies(tests ${testname}) endforeach() ```