Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Conflicts:
	CMakeLists.txt
	eu.skribisto.skribisto.yml
	src/app/src/CMakeLists.txt
	src/libskribisto-data/src/CMakeLists.txt
	src/translations/skribisto_de_DE.ts
	src/translations/skribisto_fr_FR.ts
	src/translations/skribisto_it_IT.ts
	src/translations/skribisto_pt_BR.ts
	src/translations/skribisto_ru_RU.ts
	src/translations/skribisto_sp_SP.ts
  • Loading branch information
jacquetc committed Oct 9, 2020
2 parents 4bb00c0 + dd0861a commit a0d730e
Show file tree
Hide file tree
Showing 13 changed files with 277 additions and 117 deletions.
25 changes: 17 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,22 @@ cmake_minimum_required(VERSION 3.5.0)
#endif()
set(QT_MIN_VERSION "5.15.0")

project(skribisto LANGUAGES CXX)

find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/ ${CMAKE_SOURCE_DIR}/cmake/3rdparty/ ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})

# git tag for version :
include(MunkeyVersionFromGit)
version_from_git(
LOG ON
TIMESTAMP "%Y%m%d%H%M%S"
)

add_definitions(-DSKR_VERSION_STR=${VERSION})
add_definitions(-DSKR_SEMANTICVERSION_STR=${SEMVER})
add_definitions(-DSKR_GITTAG_STR=${GIT_TAG})

project(skribisto LANGUAGES CXX VERSION ${VERSION})

# Include GNUInstallDirs, which sets sensible defaults for install directories.
# See https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html for further information.
Expand All @@ -25,16 +37,13 @@ include(ECMInstallIcons)
include(CMakePackageConfigHelpers)
include(ECMOptionalAddSubdirectory)

include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS})


include_directories(${Qt5Core_PRIVATE_INCLUDE_DIRS})

# forbid some old things
add_definitions(-DQT_NO_FOREACH)

#add_compile_definitions(VERSIONSTR=1.6 FORCEQML=1)
add_definitions(-DVERSIONSTR=1.8)

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed
Expand All @@ -59,8 +68,8 @@ add_subdirectory(src/app/src)


if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_subdirectory(src/libskribisto-data/tests)
add_subdirectory(src/app/tests)
add_subdirectory(src/libskribisto-data/tests)
add_subdirectory(src/app/tests)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")

install(PROGRAMS resources/unix/applications/eu.skribisto.skribisto.desktop DESTINATION ${KDE_INSTALL_APPDIR})
Expand Down
167 changes: 167 additions & 0 deletions cmake/3rdparty/MunkeyVersionFromGit.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# The MIT License (MIT)
#
# Copyright (c) 2016-2017 Theo Willows
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

cmake_minimum_required( VERSION 3.0.0 )

include( CMakeParseArguments )

function( version_from_git )
# Parse arguments
set( options OPTIONAL FAST )
set( oneValueArgs
GIT_EXECUTABLE
INCLUDE_HASH
LOG
TIMESTAMP
)
set( multiValueArgs )
cmake_parse_arguments( ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )

# Defaults
if( NOT DEFINED ARG_INCLUDE_HASH )
set( ARG_INCLUDE_HASH ON )
endif()

if( DEFINED ARG_GIT_EXECUTABLE )
set( GIT_EXECUTABLE "${ARG_GIT_EXECUTABLE}" )
else ()
# Find Git or bail out
find_package( Git )
if( NOT GIT_FOUND )
message( FATAL_ERROR "[MunkeiVersionFromGit] Git not found" )
endif( NOT GIT_FOUND )
endif()

# Git describe
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --tags
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_describe
ERROR_VARIABLE git_error
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if( NOT git_result EQUAL 0 )
message( FATAL_ERROR
"[MunkeiVersionFromGit] Failed to execute Git: ${git_error}"
)
endif()

# Get Git tag
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --tags --abbrev=0
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_tag
ERROR_VARIABLE git_error
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if( NOT git_result EQUAL 0 )
message( FATAL_ERROR
"[MunkeiVersionFromGit] Failed to execute Git: ${git_error}"
)
endif()

if( git_tag MATCHES "^v(0|[1-9][0-9]*)[.](0|[1-9][0-9]*)[.](0|[1-9][0-9]*)(-[.0-9A-Za-z-]+)?([+][.0-9A-Za-z-]+)?$" )
set( version_major "${CMAKE_MATCH_1}" )
set( version_minor "${CMAKE_MATCH_2}" )
set( version_patch "${CMAKE_MATCH_3}" )
set( identifiers "${CMAKE_MATCH_4}" )
set( metadata "${CMAKE_MATCH_5}" )
else()
message( FATAL_ERROR
"[MunkeiVersionFromGit] Git tag isn't valid semantic version: [${git_tag}]"
)
endif()

if( "${git_tag}" STREQUAL "${git_describe}" )
set( git_at_a_tag ON )
endif()

if( NOT git_at_a_tag )
# Extract the Git hash (if one exists)
string( REGEX MATCH "g[0-9a-f]+$" git_hash "${git_describe}" )
endif()

# Construct the version variables
set( version ${version_major}.${version_minor}.${version_patch} )
set( semver ${version} )

# Identifiers
if( identifiers MATCHES ".+" )
string( SUBSTRING "${identifiers}" 1 -1 identifiers )
set( semver "${semver}-${identifiers}")
endif()

# Metadata
# TODO Split and join (add Git hash inbetween)
if( metadata MATCHES ".+" )
string( SUBSTRING "${metadata}" 1 -1 metadata )
# Split
string( REPLACE "." ";" metadata "${metadata}" )
endif()

if( NOT git_at_a_tag )

if( ARG_INCLUDE_HASH )
list( APPEND metadata "${git_hash}" )
endif( ARG_INCLUDE_HASH )

# Timestamp
if( DEFINED ARG_TIMESTAMP )
string( TIMESTAMP timestamp "${ARG_TIMESTAMP}" ${ARG_UTC} )
list( APPEND metadata "${timestamp}" )
endif( DEFINED ARG_TIMESTAMP )

endif()

# Join
string( REPLACE ";" "." metadata "${metadata}" )

if( metadata MATCHES ".+" )
set( semver "${semver}+${metadata}")
endif()

# Log the results
if( ARG_LOG )
message( STATUS
"[MunkeiVersionFromGit] Version: ${version}
Git tag: [${git_tag}]
Git hash: [${git_hash}]
Decorated: [${git_describe}]
Identifiers: [${identifiers}]
Metadata: [${metadata}]
SemVer: [${semver}]"
)
endif( ARG_LOG )

# Set parent scope variables
set( GIT_TAG ${git_tag} PARENT_SCOPE )
set( SEMVER ${semver} PARENT_SCOPE )
set( VERSION ${version} PARENT_SCOPE )
set( VERSION_MAJOR ${version_major} PARENT_SCOPE )
set( VERSION_MINOR ${version_minor} PARENT_SCOPE )
set( VERSION_PATCH ${version_patch} PARENT_SCOPE )

endfunction( version_from_git )
17 changes: 17 additions & 0 deletions cmake/Findhunspell.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

find_library(HUNSPELL_LIBRARIES NAMES ${PKG_HUNSPELL_LIBRARIES} "libhunspell" "hunspell" "hunspell-1.7" "hunspell-1.8" "hunspell/lib/x86_64-linux-gnu"
PATHS "/usr/local/lib" ${SYSTEM_LIB_DIRS} "/usr/lib64" "/lib/x86_64-linux-gnu"
HINTS ${PKG_HUNSPELL_LIBRARY_DIRS})

find_path(HUNSPELL_INCLUDE_DIRS
NAMES "hunspell.hxx"
PATH_SUFFIXES hunspell
HINTS ${PKG_HUNSPELL_INCLUDE_DIRS}
)

# handle the QUIETLY and REQUIRED arguments and
# set HUNSPELL_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(hunspell DEFAULT_MSG HUNSPELL_LIBRARIES HUNSPELL_INCLUDE_DIRS)

mark_as_advanced(HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIRS)
12 changes: 1 addition & 11 deletions eu.skribisto.skribisto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@ finish-args:
separate-locales: false
modules:

- name: hunspell
sources:
- type: git
url: https://github.com/hunspell/hunspell.git
- type: script
dest-filename: autogen.sh
commands:
- AUTOMAKE="automake --foreign" autoreconf -vfi

- name: openjpeg2
buildsystem: cmake-ninja
config-opts:
Expand Down Expand Up @@ -60,8 +51,7 @@ modules:
builddir: true
config-opts:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DCMAKE_BUILD_TYPE=Release
sources:
- type: git
url: https://github.com/jacquetc/skribisto.git
branch: develop
branch: master
56 changes: 56 additions & 0 deletions package/flatpak/local/eu.skribisto.skribisto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
app-id: eu.skribisto.skribisto
runtime: org.kde.Platform
runtime-version: '5.15'
sdk: org.kde.Sdk
command: skribisto
finish-args:
- --share=ipc
- --socket=x11
- --socket=wayland
- --filesystem=host
- --device=dri
separate-locales: false
modules:

- name: openjpeg2
buildsystem: cmake-ninja
config-opts:
- -DCMAKE_INSTALL_LIBDIR=lib
sources:
- type: archive
url: https://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz
sha256: 3dc787c1bb6023ba846c2a0d9b1f6e179f1cd255172bde9eb75b01f1e6c7d71a

- name: sqlite3
cmake: false
config-opts:
- --enable-threadsafe
- --enable-threads-override-locks
build-options:
cflags: -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_ENABLE_COLUMN_METADATA=1
sources:
- type: archive
url: https://sqlite.org/2020/sqlite-autoconf-3330000.tar.gz
sha256: 106a2c48c7f75a298a7557bcc0d5f4f454e5b43811cc738b7ca294d6956bbb15

- name: quazip
buildsystem: cmake-ninja
builddir: true
config-opts:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
sources:
- type: archive
url: https://github.com/stachenov/quazip/archive/0.7.6.tar.gz
sha256: 4118a830a375a81211956611cc34b1b5b4ddc108c126287b91b40c2493046b70
- type: shell
commands:
- sed -i 's|${CMAKE_ROOT}/Modules|share/cmake|' CMakeLists.txt

- name: skribisto
buildsystem: cmake
builddir: true
config-opts:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
sources:
- type: dir
path: /home/cyril/Devel/skribisto
10 changes: 5 additions & 5 deletions src/app/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 3.1.0)

# Populate a CMake variable with the sources

project(app LANGUAGES CXX)
project(app LANGUAGES CXX VERSION ${VERSION})

# Find the QtWidgets library
find_package(Qt5 COMPONENTS Core Quick Network Gui Widgets LinguistTools Svg Xml QuickControls2 CONFIG REQUIRED)
#find_package(KF5Kirigami2)
find_library(HUNSPELL hunspell)

find_package(hunspell REQUIRED)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

Expand Down Expand Up @@ -118,9 +118,9 @@ target_compile_definitions(skribisto
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)

target_link_libraries(skribisto skribisto-data Qt5::Core Qt5::Quick Qt5::Network Qt5::Gui Qt5::Widgets Qt5::Svg Qt5::QuickControls2
${HUNSPELL})
${HUNSPELL_LIBRARIES})
include_directories("${CMAKE_SOURCE_DIR}/src/libskribisto-data/src/")

target_include_directories(skribisto SYSTEM PUBLIC ${HUNSPELL_INCLUDE_DIRS})

install(TARGETS skribisto RUNTIME DESTINATION ${KDE_INSTALL_BINDIR})

Expand Down
2 changes: 1 addition & 1 deletion src/libskribisto-data/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
#
# Populate a CMake variable with the sources

project(skribisto-data)
project(skribisto-data LANGUAGES CXX VERSION ${VERSION} )
add_definitions(-DSKRIBISTO_DATA_LIBRARY)
# Find the QtWidgets library
find_package(Qt5 COMPONENTS Core Network Sql CONFIG REQUIRED)
Expand Down
Loading

0 comments on commit a0d730e

Please sign in to comment.