Conversion to CMake build system.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 2 years ago
parent a24f135509
commit 175f6eab4b
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -0,0 +1,66 @@
#################################################
#
# (C) 2020-2022 Slávek Banko
# slavek.banko (AT) axis.cz
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
cmake_minimum_required( VERSION 3.1 )
##### general package setup #####################
project( koffice-i18n )
##### include essential cmake modules ###########
include( FindPkgConfig ) # required for find_package( TDE )
##### include our cmake modules #################
include( TDEMacros )
##### set version number ########################
tde_set_project_version( )
##### find required stuff #######################
find_package( TDE )
include( TDESetupPaths )
tde_setup_paths( )
##### process languages #########################
file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * )
list( SORT _dirs )
string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" )
foreach( _dir IN LISTS _dirs )
string( REGEX REPLACE "^${PROJECT_NAME}-" "" _lang "${_dir}" )
if( "${_dir}" MATCHES "^${PROJECT_NAME}-"
AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}
AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_dir}/CMakeLists.txt
AND ( "${_lang}" STREQUAL "en" OR
"${_linguas}" MATCHES "^;*$" OR
";${_linguas};" MATCHES ";${_lang};" ))
add_subdirectory( ${_dir} )
string( REGEX REPLACE "@" "_" _lang_target "${_lang}" )
add_custom_target( install-${_lang_target}
COMMAND ${CMAKE_COMMAND}
-DCOMPONENT=${_lang}
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
endif()
endforeach()

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = bg
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1,6 @@
##### other data
install(
FILES ca.xml
DESTINATION ${DATA_INSTALL_DIR}/koffice/autocorrect
)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1,6 @@
##### other data
install(
FILES cs.xml
DESTINATION ${DATA_INSTALL_DIR}/koffice/autocorrect
)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = da
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1,6 @@
##### other data
install(
FILES de.xml
DESTINATION ${DATA_INSTALL_DIR}/koffice/autocorrect
)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = en_GB
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1,6 @@
##### other data
install(
FILES es.xml
DESTINATION ${DATA_INSTALL_DIR}/koffice/autocorrect
)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = et
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = fi
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1,6 @@
##### other data
install(
FILES fr.xml
DESTINATION ${DATA_INSTALL_DIR}/koffice/autocorrect
)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = ga
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1,6 @@
##### other data
install(
FILES hu.xml
DESTINATION ${DATA_INSTALL_DIR}/koffice/autocorrect
)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1,6 @@
##### other data
install(
FILES it.xml
DESTINATION ${DATA_INSTALL_DIR}/koffice/autocorrect
)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = nb
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = nds
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
SUBDIRS = $(AUTODIRS)
KDE_LANG=nl
KDE_DOCS=AUTO

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = pl
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = pt
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = pt_BR
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = ru
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1 @@
tde_auto_add_subdirectories( )

@ -0,0 +1,6 @@
##### other data
install(
FILES sk.xml
DESTINATION ${DATA_INSTALL_DIR}/koffice/autocorrect
)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = sl
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = sr
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = sr
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = sv
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -1,4 +0,0 @@
TOPLEVEL_LANG = tr
SUBDIRS = $(AUTODIRS)

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1 @@
../template/commonCMakeLists.txt

@ -0,0 +1,140 @@
#################################################
#
# (C) 2013 Alexander Golubev (Fat-Zer)
# fatzer2 (AT) gmail.com
#
# (C) 2020-2022 Slávek Banko
# slavek.banko (AT) axis.cz
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
cmake_minimum_required( VERSION 3.1 )
##### general package setup #####################
string( REGEX REPLACE ".*-([^-]*)$" "\\1" _lang ${CMAKE_CURRENT_SOURCE_DIR} )
message( STATUS "Configure for language ${_lang}" )
project( koffice-i18n-${_lang} )
##### include essential cmake modules ###########
include( FindPkgConfig ) # required for find_package( TDE )
##### include our cmake modules #################
include( TDEMacros )
##### find required stuff #######################
find_package( TDE )
##### setup install paths #######################
tde_save_and_set( CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "${_lang}" )
include( TDESetupPaths )
tde_setup_paths( )
##### user requested modules ####################
option( BUILD_ALL "Build all" OFF )
option( BUILD_DOC "Build documentation" ${BUILD_ALL} )
option( BUILD_DATA "Build data" ${BUILD_ALL} )
option( BUILD_MESSAGES "Build message and GUI translation" ${BUILD_ALL} )
###### subdirectories ###########################
# build data files
if( BUILD_DATA AND
EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/data/CMakeLists.txt )
add_subdirectory( data )
endif()
# build documentation
if( BUILD_DOC )
# search directories with documentation
file( GLOB_RECURSE _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} docs/* )
foreach( _doc_file IN LISTS _doc_files )
get_filename_component( _doc_dir ${_doc_file} PATH )
list( APPEND _doc_dirs ${_doc_dir} )
endforeach()
if( _doc_dirs )
# sort and clear the list of directories
list( SORT _doc_dirs )
list( REMOVE_DUPLICATES _doc_dirs )
list( REMOVE_ITEM _doc_dirs "docs/common" )
# create handbooks or install other files
foreach( _doc_dir IN LISTS _doc_dirs )
file( GLOB _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${_doc_dir} ${_doc_dir}/*.docbook )
string( REGEX REPLACE "^[^/]*/[^/]*/" "" _doc_dest ${_doc_dir} )
if( _doc_files )
list( FIND _doc_files "index.docbook" _find_index )
if( -1 EQUAL _find_index )
set( _noindex "NOINDEX" )
else()
unset( _noindex )
endif()
tde_create_handbook(
SOURCE_BASEDIR ${_doc_dir}
${_noindex}
LANG ${_lang}
DESTINATION ${_doc_dest}
)
else()
file( GLOB _doc_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
${_doc_dir}/*.css ${_doc_dir}/*.png )
install(
FILES ${_doc_files}
DESTINATION ${HTML_INSTALL_DIR}/${_lang}/${_doc_dest}
)
endif()
endforeach()
endif()
endif()
# build messages
if( BUILD_MESSAGES )
# install base files for locale
file( GLOB locale_base_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
messages/flag.png messages/charset )
if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/messages/entry.desktop )
tde_create_translated_desktop(
SOURCE messages/entry.desktop
DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}
PO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../translations/desktop_files/entry.desktop
)
endif()
if( locale_base_files )
install(
FILES ${locale_base_files}
DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}
)
endif()
# create translations
file( GLOB_RECURSE _messages RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} messages/*.po )
if( _messages )
tde_create_translation( FILES ${_messages} LANG ${_lang} )
endif()
endif()
# restore default install component name
tde_restore( CMAKE_INSTALL_DEFAULT_COMPONENT_NAME )
Loading…
Cancel
Save