2021-01-16 18:09:59 +00:00
|
|
|
#################################################
|
|
|
|
# Generate platform metadata files
|
|
|
|
#################################################
|
|
|
|
if( APPLE )
|
|
|
|
#TODO Generate this at runtime as well
|
2023-01-04 00:12:56 +00:00
|
|
|
include( ${KICAD_CMAKE_MODULE_PATH}/WritePlatformMetadata_macos.cmake )
|
2021-01-16 18:09:59 +00:00
|
|
|
elseif( UNIX )
|
2023-08-02 22:14:25 +00:00
|
|
|
# Default values for regular builds
|
|
|
|
set( KICAD_REVERSE_DOMAIN "org.kicad" )
|
|
|
|
set( KICAD_APP_NAME "${KICAD_REVERSE_DOMAIN}.kicad" )
|
|
|
|
set( KICAD_APP_PREFIX "${KICAD_REVERSE_DOMAIN}" )
|
|
|
|
set( KICAD_ICON_PREFIX "" )
|
|
|
|
set( KICAD_DESKTOP_FILE_ICON_PREFIX "" )
|
|
|
|
set( KICAD_DESKTOP_FILE_ICON_KICAD "kicad" )
|
|
|
|
set( KICAD_MIME_FILE_PREFIX "kicad" )
|
|
|
|
set( KICAD_MIME_ICON_PREFIX "" )
|
|
|
|
|
|
|
|
# Override default values from above if we are building a flatpak
|
|
|
|
if( KICAD_BUILD_FLATPAK )
|
|
|
|
set( KICAD_APP_NAME "${KICAD_REVERSE_DOMAIN}.KiCad" )
|
|
|
|
if( KICAD_BUILD_NIGHTLY_FLATPAK )
|
|
|
|
set( KICAD_APP_NAME "${KICAD_APP_NAME}.Nightly" )
|
|
|
|
endif()
|
|
|
|
set( KICAD_APP_PREFIX "${KICAD_APP_NAME}" )
|
|
|
|
set( KICAD_ICON_PREFIX "${KICAD_APP_NAME}" )
|
|
|
|
set( KICAD_DESKTOP_FILE_ICON_PREFIX "${KICAD_APP_PREFIX}." )
|
|
|
|
set( KICAD_DESKTOP_FILE_ICON_KICAD "${KICAD_APP_NAME}" )
|
|
|
|
set( KICAD_MIME_FILE_PREFIX "${KICAD_APP_PREFIX}" )
|
|
|
|
set( KICAD_MIME_ICON_PREFIX "${KICAD_APP_PREFIX}." )
|
|
|
|
endif()
|
|
|
|
|
2021-03-21 14:26:05 +00:00
|
|
|
# Add the command to configure the linux metainfo file with the version information
|
2021-01-16 18:09:59 +00:00
|
|
|
add_custom_command(
|
2021-03-21 14:26:05 +00:00
|
|
|
OUTPUT ${PROJECT_BINARY_DIR}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml.in
|
2021-01-16 18:09:59 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DSRC_PATH=${PROJECT_SOURCE_DIR}
|
|
|
|
-DBUILD_PATH=${PROJECT_BINARY_DIR}
|
2023-01-04 01:23:39 +00:00
|
|
|
-DKICAD_CMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake
|
2023-08-02 22:14:25 +00:00
|
|
|
-DKICAD_APP_NAME=${KICAD_APP_NAME}
|
2023-01-04 00:12:56 +00:00
|
|
|
-P ${KICAD_CMAKE_MODULE_PATH}/BuildSteps/WritePlatformMetadata_linux.cmake
|
|
|
|
DEPENDS ${KICAD_CMAKE_MODULE_PATH}/BuildSteps/WritePlatformMetadata_linux.cmake
|
2021-03-21 14:26:05 +00:00
|
|
|
COMMENT "Configuring Linux metainfo"
|
2021-01-16 18:09:59 +00:00
|
|
|
)
|
|
|
|
|
2021-03-21 14:26:05 +00:00
|
|
|
# Read the metainfo from the binary directory because it has been configured by Cmake already
|
2021-01-16 18:09:59 +00:00
|
|
|
# to have the version string in it
|
2021-03-21 14:26:05 +00:00
|
|
|
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/metainfo/org.kicad.kicad.metainfo.xml.in
|
2023-08-02 22:14:25 +00:00
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/metainfo/${KICAD_APP_NAME}.metainfo.xml
|
2021-01-16 18:09:59 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
# All the desktop files take two passes: First they are configured to replace the variables,
|
|
|
|
# then they are translated from the binary directory
|
|
|
|
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.bitmap2component.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.bitmap2component.desktop.in
|
|
|
|
@ONLY )
|
|
|
|
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.bitmap2component.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.bitmap2component.desktop
|
2021-01-16 18:09:59 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.eeschema.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.eeschema.desktop.in
|
|
|
|
@ONLY )
|
|
|
|
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.eeschema.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.eeschema.desktop
|
2021-01-16 18:09:59 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.gerbview.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.gerbview.desktop.in
|
|
|
|
@ONLY )
|
|
|
|
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.gerbview.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.gerbview.desktop
|
2021-01-16 18:09:59 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.kicad.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.kicad.desktop.in
|
|
|
|
@ONLY )
|
|
|
|
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.kicad.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_NAME}.desktop
|
2021-01-16 18:09:59 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.pcbcalculator.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.pcbcalculator.desktop.in
|
|
|
|
@ONLY )
|
|
|
|
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.pcbcalculator.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.pcbcalculator.desktop
|
2021-01-16 18:09:59 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/launchers/org.kicad.pcbnew.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.pcbnew.desktop.in
|
|
|
|
@ONLY )
|
|
|
|
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/launchers/org.kicad.pcbnew.desktop.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.pcbnew.desktop
|
2021-01-16 18:09:59 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
# Translate the MIME info, which are read from the source directory...
|
2021-01-16 19:15:12 +00:00
|
|
|
linux_metadata_translation( ${PROJECT_SOURCE_DIR}/resources/linux/mime/kicad-gerbers.xml.in
|
2023-08-02 22:14:25 +00:00
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/mime/${KICAD_MIME_FILE_PREFIX}-gerbers.xml
|
2021-01-16 19:15:12 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
# ...except for the KiCad MIME info, which is also configured first to replace variables
|
|
|
|
configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/mime/kicad-kicad.xml.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/mime/kicad-kicad.xml.in
|
|
|
|
@ONLY )
|
|
|
|
linux_metadata_translation( ${PROJECT_BINARY_DIR}/resources/linux/mime/kicad-kicad.xml.in
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/mime/${KICAD_MIME_FILE_PREFIX}-kicad.xml
|
2021-01-16 19:15:12 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/translation/pofiles )
|
|
|
|
|
2021-01-16 18:09:59 +00:00
|
|
|
add_custom_target( metadata ALL
|
2023-08-02 22:14:25 +00:00
|
|
|
DEPENDS ${PROJECT_BINARY_DIR}/resources/linux/metainfo/${KICAD_APP_NAME}.metainfo.xml
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.bitmap2component.desktop
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.eeschema.desktop
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.gerbview.desktop
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_NAME}.desktop
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.pcbcalculator.desktop
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/launchers/${KICAD_APP_PREFIX}.pcbnew.desktop
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/mime/${KICAD_MIME_FILE_PREFIX}-gerbers.xml
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/mime/${KICAD_MIME_FILE_PREFIX}-kicad.xml
|
2021-01-16 18:09:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-08-02 22:14:25 +00:00
|
|
|
# Copy icons to binary dir, where they can be renamed for flatpak, if needed
|
|
|
|
file( COPY ${PROJECT_SOURCE_DIR}/resources/linux/icons/
|
|
|
|
DESTINATION ${PROJECT_BINARY_DIR}/resources/linux/icons
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.png"
|
|
|
|
PATTERN "*.svg"
|
|
|
|
)
|
|
|
|
|
|
|
|
if( KICAD_BUILD_FLATPAK )
|
|
|
|
# Rename all icons to start with KICAD_ICON_PREFIX
|
|
|
|
file( GLOB_RECURSE _ALL_ICONS
|
|
|
|
LIST_DIRECTORIES false
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/icons/*.png
|
|
|
|
${PROJECT_BINARY_DIR}/resources/linux/icons/*.svg
|
|
|
|
)
|
|
|
|
foreach( _ICON ${_ALL_ICONS} )
|
|
|
|
get_filename_component( _ICON_PATH ${_ICON} DIRECTORY )
|
|
|
|
get_filename_component( _ICON_NAME ${_ICON} NAME_WE )
|
|
|
|
get_filename_component( _ICON_EXT ${_ICON} EXT )
|
|
|
|
if( _ICON_NAME STREQUAL "kicad" )
|
|
|
|
set( _RENAMED_ICON "${_ICON_PATH}/${KICAD_APP_NAME}${_ICON_EXT}" )
|
|
|
|
else()
|
|
|
|
set( _RENAMED_ICON "${_ICON_PATH}/${KICAD_ICON_PREFIX}.${_ICON_NAME}${_ICON_EXT}" )
|
|
|
|
endif()
|
|
|
|
file( RENAME ${_ICON} ${_RENAMED_ICON} )
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Install icons from binary dir, as they might have been renamed above
|
|
|
|
install( DIRECTORY ${PROJECT_BINARY_DIR}/resources/linux/icons/
|
2021-01-19 15:49:58 +00:00
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons
|
2021-01-16 18:09:59 +00:00
|
|
|
COMPONENT resources
|
2023-08-02 22:14:25 +00:00
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "${KICAD_ICON_PREFIX}*.png"
|
|
|
|
PATTERN "${KICAD_ICON_PREFIX}*.svg"
|
2021-01-16 18:09:59 +00:00
|
|
|
)
|
|
|
|
|
2021-01-16 19:15:12 +00:00
|
|
|
# Install MIME type files
|
|
|
|
install( DIRECTORY ${PROJECT_BINARY_DIR}/resources/linux/mime/
|
2021-01-16 18:09:59 +00:00
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages
|
|
|
|
COMPONENT resources
|
2021-01-18 22:50:10 +00:00
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.xml"
|
|
|
|
PATTERN "*.in" EXCLUDE
|
2021-01-16 18:09:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Install application launchers (.desktop files)
|
|
|
|
install( DIRECTORY ${PROJECT_BINARY_DIR}/resources/linux/launchers/
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
|
|
|
|
COMPONENT resources
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.desktop"
|
|
|
|
PATTERN "*.in" EXCLUDE
|
|
|
|
)
|
|
|
|
|
|
|
|
# Install appstream metadata (app store entry)
|
2021-03-21 14:26:05 +00:00
|
|
|
install( DIRECTORY ${PROJECT_BINARY_DIR}/resources/linux/metainfo/
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo
|
2021-01-16 18:09:59 +00:00
|
|
|
COMPONENT resources
|
|
|
|
FILES_MATCHING
|
2021-03-21 14:26:05 +00:00
|
|
|
PATTERN "*metainfo.xml"
|
2021-01-16 18:09:59 +00:00
|
|
|
PATTERN "*.in" EXCLUDE
|
|
|
|
)
|
|
|
|
endif()
|
2022-07-21 23:32:44 +00:00
|
|
|
|
|
|
|
add_subdirectory(bitmaps_png)
|
|
|
|
add_subdirectory(project_template)
|