Merge branch '#95_cmake_backbone' into develop

This commit is contained in:
Kolan Sh 2014-10-26 18:18:44 +03:00
commit bbb7451d96
54 changed files with 625 additions and 1026 deletions

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "cmake/backbone"]
path = cmake/backbone
url = git@git.backbone.ws:cmake/backbone.git
[submodule "util/backbone"]
path = util/backbone
url = git@git.backbone.ws:cmake/backbone-utils.git

View File

@ -2,130 +2,20 @@ PROJECT (LAviewLatexStruct C)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8) CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
SET (PROJECT_LOWERCASE_NAME "laview-latex-struct")
SET (PROJECT_DESCRIPTION "LaTeX representation in the memory.")
SET (MAJOR 0) SET (MAJOR 0)
SET (MINOR 0) SET (MINOR 1)
SET (PATCH 1) SET (PATCH 0)
SET (VERSION ${MAJOR}.${MINOR}.${PATCH})
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone)
INCLUDE (MacroOptionalAddSubdirectory)
INCLUDE (CPackDetectArch)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w") # supress Gcc warnings
SET (PROJ_LCASE "laview-latex-struct")
# configure a header file for Gettext
SET (GETTEXT_PACKAGE "${PROJ_LCASE}")
ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
IF (WIN32)
SET (LOCALEDIR "")
ELSE ()
SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
ENDIF ()
SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into")
IF (NOT CUSTOM_LOCALEDIR STREQUAL "")
SET (LOCALEDIR "${CUSTOM_LOCALEDIR}")
MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
ENDIF ()
ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}")
SET (LOCALE_INSTALL_DIR "share/locale")
MACRO_OPTIONAL_ADD_SUBDIRECTORY (po)
# Avoid of "dll not found" messages
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/run")
# configure a header file for Gettext
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/src/gettext-config.h.in"
"${PROJECT_BINARY_DIR}/src/gettext-config.h"
)
IF ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
SET (VALA_DEBUG "-g")
ENDIF ()
# configure pkg-config file
IF (WIN32)
SET (prefix "")
ELSE ()
SET (prefix ${CMAKE_INSTALL_PREFIX})
ENDIF ()
SET (exec_prefix "\${prefix}")
SET (libdir "\${exec_prefix}/lib")
SET (prefincludedir "\${prefix}/include")
SET (link_lib1 "\${libdir}")
SET (link_lib2 "laview-latex-struct")
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/laview-latex-struct.pc.in"
"${PROJECT_BINARY_DIR}/laview-latex-struct-${MAJOR}.pc"
)
SET (CMAKE_C_FLAGS_DEBUG "-ggdb3 -O0 -ftest-coverage -Wcoverage-mismatch ${CMAKE_C_FLAGS_DEBUG}")
SET (CMAKE_C_FLAGS_RELEASE "-O2 ${CMAKE_C_FLAGS_RELEASE}")
ADD_SUBDIRECTORY (src) ADD_SUBDIRECTORY (src)
ADD_SUBDIRECTORY (po)
ADD_SUBDIRECTORY (pkg-config)
ADD_SUBDIRECTORY (test) ADD_SUBDIRECTORY (test)
ADD_SUBDIRECTORY (cpack)
## CPack configuration ## # enable testing
SET (CPACK_PACKAGE_CONTACT "backbone@backbone.ws") ENABLE_TESTING ()
SET (CPACK_PACKAGE_VENDOR "backbone@backbone.ws")
SET (CPACK_NSIS_MODIFY_PATH ON)
SET (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
INCLUDE (InstallRequiredSystemLibraries)
SET (CPACK_RESOURCE_FILE_LICENSE
"${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
SET (CPACK_PACKAGE_DESCRIPTION_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/README")
INSTALL (FILES "${PROJECT_BINARY_DIR}/laview-latex-struct-${MAJOR}.pc"
DESTINATION lib/pkgconfig)
INSTALL (FILES "${PROJECT_BINARY_DIR}/src/laview-latex-struct-${MAJOR}.vapi"
DESTINATION share/vala/vapi)
#SET (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME}")
#SET (CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME}")
SET (CPACK_PACKAGE_VERSION_MAJOR "${MAJOR}")
SET (CPACK_PACKAGE_VERSION_MINOR "${MINOR}")
SET (CPACK_PACKAGE_VERSION_PATCH "${PATCH}")
SET (CPACK_PACKAGE_VERSION "${VERSION}")
IF (UNIX)
SET (CPACK_GENERATOR "DEB;RPM;STGZ;TBZ2;TGZ;TZ;ZIP")
SET (CPACK_SOURCE_GENERATOR "DEB;RPM;STGZ;TBZ2;TGZ;TZ;ZIP")
SET (CPACK_PACKAGE_NAME "laview-latex-struct")
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "LaTeX representation in the memory")
SET (CPACK_PACKAGE_DESCRIPTION "LaTeX representation in the memory "
"Scanner + Generator + Operations on document objects.")
# Debian specific options
SET (CPACK_DEBIAN_PACKAGE_DEPENDS "valac (>= 0.24), libglib2.0-bin (>= 2.33)")
SET (CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
# SET (CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${ARCHITECTURE}")
# SET (CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET (CPACK_DEBIAN_PACKAGE_RECOMMENDS "")
SET (CPACK_DEBIAN_PACKAGE_SUGGESTS "")
# RPM specific options
# SET (CPACK_RPM_PACKAGE_ARCHITECTURE "${ARCHITECTURE}")
SET (CPACK_RPM_PACKAGE_LICENSE "LGPLv3+")
SET (CPACK_RPM_PACKAGE_GROUP "Applications/Text")
SET (CPACK_RPM_PACKAGE_REQUIRES "vala >= 0.24, glib >= 2.33")
SET (CPACK_RPM_PACKAGE_PROVIDES "laview-latex-struct")
# http://public.kitware.com/Bug/view.php?id=12997
SET(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${ARCHITECTURE}")
ELSEIF (WIN32)
SET (CPACK_GENERATOR "NSIS")
SET (CPACK_SOURCE_GENERATOR "NSIS")
SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CMAKE_PROJECT_NAME}-${MAJOR}")
#SET (CPACK_NSIS_MENU_LINKS "${EWS_WEBSITE}" "Homepage for ${EWS_APP_NAME}")
#SET (CPACK_NSIS_INSTALLED_ICON_NAME bin\\\\${EXE_TARGET_NAME}.exe)
#SET (CPACK_NSIS_URL_INFO_ABOUT "${EWS_WEBSITE}")
#SET (CPACK_NSIS_HELP_LINK "${EWS_WEBSITE}")
SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}-${MAJOR}")
SET (CPACK_UNINSTALL_NAME "LVLatStr-${MAJOR}") # <=10 symbols: https://redmine.backbone.ws/issues/83
ENDIF ()
INCLUDE (CPack)
INCLUDE (CTest)

27
INSTALL
View File

@ -6,7 +6,7 @@
Vala: https://wiki.gnome.org/Projects/Vala Vala: https://wiki.gnome.org/Projects/Vala
Gee: https://wiki.gnome.org/Projects/Libgee Gee: https://wiki.gnome.org/Projects/Libgee
CMake: http://www.cmake.org CMake: http://www.cmake.org
NSIS (Win-only): http://nsis.sourceforge.net NSIS (W32): http://nsis.sourceforge.net
Run-Time Dependencies Run-Time Dependencies
@ -29,18 +29,15 @@ pull-requests to the mainstream.
$ mkdir build-gcc && cd build-gcc $ mkdir build-gcc && cd build-gcc
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr $ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
$ make $ make -j$((`getconf _NPROCESSORS_ONLN`+1))
Compilation under MS Windows Compilation under MS Windows
$ mkdir build-mingw && cd build-mingw $ mkdir build-mingw && cd build-mingw
$ LANG=en
$ PKG_CONFIG_PATH=
$ PATH=/c/MinGW/lib:/c/MinGW/bin:$PATH
$ cmake -G "MSYS Makefiles" .. -DCMAKE_BUILD_TYPE=Release $ cmake -G "MSYS Makefiles" .. -DCMAKE_BUILD_TYPE=Release
$ make $ make -j$((NUMBER_OF_PROCESSORS + 1))
Compilation under BSD-based. Compilation under BSD-based Systems.
TODO: add description here. TODO: add description here.
@ -51,17 +48,17 @@ TODO: add description here.
Packing/Installation under GNU/Linux Packing/Installation under GNU/Linux
$ cpack $ cpack
Install using your favourite package manager. Install using System Package Manager.
Packing/Installation under MS Windows Packing/Installation under MS Windows
$ cpack $ cpack
Install using an executable generated by NSIS. Install using generated by NSIS executable.
Packing/Installation under BSD-based Packing/Installation under BSD-based
$ cpack $ cpack
Install using your favourite package manager. Install using System Package Manager.
Testing Testing
@ -69,17 +66,19 @@ Install using your favourite package manager.
Testing under GNU/Linux Testing under GNU/Linux
$ LANG=en ctest $ ctest -j$((`getconf _NPROCESSORS_ONLN`+1))
Automated tests for memory leaks: Automated tests for memory leaks:
$ LANG=en ctest -D NightlyMemCheck && grep definitely Testing/Temporary/LastDynamicAnalysis_*.log $ ctest -j$((NUMBER_OF_PROCESSORS + 1)) -D NightlyMemCheck && grep definitely Testing/Temporary/LastDynamicAnalysis_*.log
Testing under MS Windows Testing under MS Windows
$ LANG=en ctest $ ctest -j$((NUMBER_OF_PROCESSORS + 1))
Automated tests for memory leaks are not available as far as Valgrind not Automated tests for memory leaks are not available as far as Valgrind not
present on this platform. present on this platform.
Testing under BSD-based Testing under BSD-based
$ LANG=en ctest $ ctest
Automated tests for memory leaks are not available as far as Valgrind not
present on this platform.

View File

@ -1,20 +0,0 @@
# Kernel of Operation System
EXECUTE_PROCESS (COMMAND uname -s COMMAND tr -d '\n' OUTPUT_VARIABLE OSKERNEL)
MESSAGE ("OSKERNEL = ${OSKERNEL}")
STRING (TOLOWER "${OSKERNEL}" OSKERNEL)
# CPU Architecture
SET (CUSTOM_ARCHITECTURE "" CACHE STRING "Specify custom target architecutre")
SET (ARCHITECTURE "${CUSTOM_ARCHITECTURE}")
IF (ARCHITECTURE STREQUAL "")
# SET (ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
# SET (ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}")
EXECUTE_PROCESS(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
# Replacements
STRING (REGEX REPLACE "^x86_64$" "amd64" ARCHITECTURE "${ARCHITECTURE}")
STRING (REGEX REPLACE "^i.86$" "i386" ARCHITECTURE "${ARCHITECTURE}")
STRING (REGEX REPLACE "^armv7l$" "armel" ARCHITECTURE "${ARCHITECTURE}")
ENDIF ()
MESSAGE ("ARCHITECTURE = ${ARCHITECTURE}")

View File

@ -1,69 +0,0 @@
##
# Find module for the Vala compiler (valac)
#
# This module determines wheter a Vala compiler is installed on the current
# system and where its executable is.
#
# Call the module using "find_package(Vala) from within your CMakeLists.txt.
#
# The following variables will be set after an invocation:
#
# VALA_FOUND Whether the vala compiler has been found or not
# VALA_EXECUTABLE Full path to the valac executable if it has been found
# VALA_VERSION Version number of the available valac
# VALA_USE_FILE Include this file to define the vala_precompile function
##
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
# Copyright 2010-2011 Daniel Pfeifer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of Jakob Westhoff
##
# Search for the valac executable in the usual system paths.
find_program(VALA_EXECUTABLE valac)
mark_as_advanced(VALA_EXECUTABLE)
# Determine the valac version
if(VALA_EXECUTABLE)
execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
OUTPUT_VARIABLE VALA_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "Vala " "" VALA_VERSION "${VALA_VERSION}")
endif(VALA_EXECUTABLE)
# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
# VALA_EXECUTABLE is set)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vala
REQUIRED_VARS VALA_EXECUTABLE
VERSION_VAR VALA_VERSION)
set(VALA_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseVala.cmake")

View File

@ -1,31 +0,0 @@
# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()
# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )
# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(),
# this will have two effects
# 1 - CMake will not complain if the directory doesn't exist
# This makes sense if you want to distribute just one of the subdirs
# in a source package, e.g. just one of the subdirs in kdeextragear.
# 2 - If the directory exists, it will offer an option to skip the
# subdirectory.
# This is useful if you want to compile only a subset of all
# directories.
# Copyright (c) 2007, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)
IF(EXISTS ${_fullPath})
IF(${ARGC} EQUAL 2)
OPTION(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1})
ELSE(${ARGC} EQUAL 2)
OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE)
ENDIF(${ARGC} EQUAL 2)
IF(BUILD_${_dir})
ADD_SUBDIRECTORY(${_dir})
ENDIF(BUILD_${_dir})
ENDIF(EXISTS ${_fullPath})
ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY)

View File

@ -1,180 +0,0 @@
##
# Compile vala files to their c equivalents for further processing.
#
# The "vala_precompile" function takes care of calling the valac executable on
# the given source to produce c files which can then be processed further using
# default cmake functions.
#
# The first parameter provided is a variable, which will be filled with a list
# of c files outputted by the vala compiler. This list can than be used in
# conjuction with functions like "add_executable" or others to create the
# neccessary compile rules with CMake.
#
# The following sections may be specified afterwards to provide certain options
# to the vala compiler:
#
# SOURCES
# A list of .vala files to be compiled. Please take care to add every vala
# file belonging to the currently compiled project or library as Vala will
# otherwise not be able to resolve all dependencies.
#
# PACKAGES
# A list of vala packages/libraries to be used during the compile cycle. The
# package names are exactly the same, as they would be passed to the valac
# "--pkg=" option.
#
# OPTIONS
# A list of optional options to be passed to the valac executable. This can be
# used to pass "--thread" for example to enable multi-threading support.
#
# CUSTOM_VAPIS
# A list of custom vapi files to be included for compilation. This can be
# useful to include freshly created vala libraries without having to install
# them in the system.
#
# GENERATE_VAPI
# Pass all the needed flags to the compiler to create an internal vapi for
# the compiled library. The provided name will be used for this and a
# <provided_name>.vapi file will be created.
#
# GENERATE_HEADER
# Let the compiler generate a header file for the compiled code. There will
# be a header file as well as an internal header file being generated called
# <provided_name>.h and <provided_name>_internal.h
#
# The following call is a simple example to the vala_precompile macro showing
# an example to every of the optional sections:
#
# find_package(Vala "0.12" REQUIRED)
# inlcude(${VALA_USE_FILE})
#
# vala_precompile(VALA_C
# SOURCES
# source1.vala
# source2.vala
# source3.vala
# PACKAGES
# gtk+-2.0
# gio-1.0
# posix
# DIRECTORY
# gen
# OPTIONS
# --thread
# CUSTOM_VAPIS
# some_vapi.vapi
# GENERATE_VAPI
# myvapi
# GENERATE_HEADER
# myheader
# )
#
# Most important is the variable VALA_C which will contain all the generated c
# file names after the call.
##
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
# Copyright 2010-2011 Daniel Pfeifer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of Jakob Westhoff
##
include(CMakeParseArguments)
function(vala_precompile output)
cmake_parse_arguments(ARGS "" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI"
"SOURCES;PACKAGES;OPTIONS;CUSTOM_VAPIS" ${ARGN})
if(ARGS_DIRECTORY)
set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
else(ARGS_DIRECTORY)
set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(ARGS_DIRECTORY)
include_directories(${DIRECTORY})
set(vala_pkg_opts "")
foreach(pkg ${ARGS_PACKAGES})
list(APPEND vala_pkg_opts "--pkg=${pkg}")
endforeach(pkg ${ARGS_PACKAGES})
set(in_files "")
set(out_files "")
foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
string(REPLACE ".vala" ".c" src ${src})
string(REPLACE ".gs" ".c" src ${src})
set(out_file "${DIRECTORY}/${src}")
list(APPEND out_files "${DIRECTORY}/${src}")
endforeach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
set(custom_vapi_arguments "")
if(ARGS_CUSTOM_VAPIS)
foreach(vapi ${ARGS_CUSTOM_VAPIS})
if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
list(APPEND custom_vapi_arguments ${vapi})
else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi})
endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
endforeach(vapi ${ARGS_CUSTOM_VAPIS})
endif(ARGS_CUSTOM_VAPIS)
set(vapi_arguments "")
if(ARGS_GENERATE_VAPI)
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
# Header and internal header is needed to generate internal vapi
if (NOT ARGS_GENERATE_HEADER)
set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
endif(NOT ARGS_GENERATE_HEADER)
endif(ARGS_GENERATE_VAPI)
set(header_arguments "")
if(ARGS_GENERATE_HEADER)
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
endif(ARGS_GENERATE_HEADER)
add_custom_command(OUTPUT ${out_files}
COMMAND
${VALA_EXECUTABLE}
ARGS
"-C"
${header_arguments}
${vapi_arguments}
"-b" ${CMAKE_CURRENT_SOURCE_DIR}
"-d" ${DIRECTORY}
${vala_pkg_opts}
${ARGS_OPTIONS}
${in_files}
${custom_vapi_arguments}
DEPENDS
${in_files}
${ARGS_CUSTOM_VAPIS}
)
set(${output} ${out_files} PARENT_SCOPE)
endfunction(vala_precompile)

1
cmake/backbone Submodule

@ -0,0 +1 @@
Subproject commit 7041f32ce90e745a7084ac4c5369dfb82da6685b

11
cpack/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
SET (CONTACT "backbone@backbone.ws")
SET (DEBIAN_DEPENDENCIES "valac (>= 0.24), libglib2.0-bin (>= 2.33), libgee (>=
0.16)")
SET (DEBIAN_SECTION "Libraries")
SET (REDHAT_DEPENDENCIES "vala >= 0.24, glib >= 2.33, libgee >= 0.16")
SET (REDHAT_SECTION "Applications/Text")
SET (LICENSE "LGPLv3+")
SET (WIN32_UNINSTALL_NAME "LVLatStr") # <= 8 symbols for the name
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
INCLUDE (CPackCommon)

View File

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@prefincludedir@
Name: LaTeX-Struct
Description: LaTeX representation in the memory + Scanner + Generator + Operations on document objects.
Version: @VERSION@
Libs: -L@link_lib1@ -l@link_lib2@
Libs.private:
Cflags:

22
pkg-config/CMakeLists.txt Normal file
View File

@ -0,0 +1,22 @@
# configure pkg-config file
IF (WIN32)
SET (PkgConfigPrefix "")
ELSE ()
SET (PkgConfigPrefix ${CMAKE_INSTALL_PREFIX})
ENDIF ()
SET (PkgConfigExecPrefix "\${prefix}")
SET (PkgConfigLibDir "\${exec_prefix}/lib")
SET (PkgConfigIncludeDir "\${prefix}/include")
SET (PkgConfigName "${CMAKE_PROJECT_NAME}")
SET (PkgConfigDescription "${PROJECT_DESCRIPTION}")
SET (PkgConfigVersion "${MAJOR}.${MINOR}.${PATCH}")
SET (PkgConfigLibs "-L\${libdir}")
SET (PkgConfigLibs "${PkgConfigLibs} -l${PROJECT_LOWERCASE_NAME}-${MAJOR}")
SET (PkgConfigLibsPrivate "")
SET (PkgConfigCflags "")
CONFIGURE_FILE (
"${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc"
)

View File

@ -0,0 +1,11 @@
prefix=@PkgConfigPrefix@
exec_prefix=@PkgConfigExecPrefix@
libdir=@PkgConfigLibDir@
includedir=@PkgConfigIncludeDir@
Name: @PkgConfigName@
Description: @PkgConfigDescription@
Version: @PkgConfigVersion@
Libs: @PkgConfigLibs@
Libs.private: @PkgConfigLibsPrivate@
Cflags: @PkgConfigCflags@

View File

@ -1,9 +1,41 @@
find_package(Gettext REQUIRED) SET (GETTEXT_PACKAGE "${PROJECT_LOWERCASE_NAME_ABI}")
if (NOT GETTEXT_MSGMERGE_EXECUTABLE) ADD_DEFINITIONS (-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
MESSAGE(FATAL_ERROR "Please install msgmerge binary")
endif (NOT GETTEXT_MSGMERGE_EXECUTABLE) IF (WIN32)
if (NOT GETTEXT_MSGFMT_EXECUTABLE) SET (LOCALEDIR "")
MESSAGE(FATAL_ERROR "Please install msgmerge binary") ELSE ()
endif (NOT GETTEXT_MSGFMT_EXECUTABLE) SET (LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
add_subdirectory(ru) ENDIF ()
#add_subdirectory(de)
SET (CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into")
IF (NOT CUSTOM_LOCALEDIR STREQUAL "")
SET (LOCALEDIR "${CUSTOM_LOCALEDIR}")
MESSAGE(STATUS "Using LOCALEDIR=${LOCALEDIR}")
ENDIF ()
ADD_DEFINITIONS (-DLOCALEDIR="${LOCALEDIR}")
SET (LOCALE_INSTALL_DIR "share/locale")
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
INCLUDE (MacroOptionalAddSubdirectory)
FIND_PACKAGE (Gettext REQUIRED)
MACRO_OPTIONAL_ADD_SUBDIRECTORY (langs)
# configure a header file for Gettext
SET (VERSION ${MAJOR}.${MINOR}.${PATCH})
SET (PROJECT_LOWERCASE_NAME_ABI "${PROJECT_LOWERCASE_NAME}-${MAJOR}")
STRING (TOUPPER "${CMAKE_PROJECT_NAME}" GettextUniqueHeader)
SET (GettextPackageNameAbi "${PROJECT_LOWERCASE_NAME_ABI}")
CONFIGURE_FILE (
"gettext-config.h.in"
"${PROJECT_BINARY_DIR}/po/gettext-config.h"
)
IF (NOT GETTEXT_MSGMERGE_EXECUTABLE)
MESSAGE (FATAL_ERROR "Please install msgmerge binary")
ENDIF (NOT GETTEXT_MSGMERGE_EXECUTABLE)
IF (NOT GETTEXT_MSGFMT_EXECUTABLE)
MESSAGE(FATAL_ERROR "Please install msgmerge binary")
ENDIF (NOT GETTEXT_MSGFMT_EXECUTABLE)

11
po/gettext-config.h.in Normal file
View File

@ -0,0 +1,11 @@
#ifndef @GettextUniqueHeader@_H
#define @GettextUniqueHeader@_H
#define GETTEXT_PACKAGE "@GettextPackageNameAbi@"
#include <glib/gi18n-lib.h>
#ifdef WIN32
#define _(String) dgettext (GETTEXT_PACKAGE, String)
#endif
#endif // @GettextUniqueHeader@_H

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: laview-latex-struct-0\n" "Project-Id-Version: laview-latex-struct-0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-07-31 18:16+0400\n" "POT-Creation-Date: 2014-10-26 17:59+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,57 +17,57 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:58 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:58
#, c-format #, c-format
msgid "Begin tag sequence '%s' without end tag pair." msgid "Begin tag sequence '%s' without end tag pair."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:127 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:127
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:582 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:585
#, c-format #, c-format
msgid ": Unexpected end tag sequence '%s' without begin tag pair." msgid ": Unexpected end tag sequence '%s' without begin tag pair."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:148 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:148
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:148 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:148
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:179 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:179
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:188 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:188
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:205 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:205
msgid "Error parsing subdoc." msgid "Error parsing subdoc."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/LongtableParser.vala:44 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/LongtableParser.vala:44
#, c-format #, c-format
msgid "Incorrect longtable parameters doesn't match '%s' regexp." msgid "Incorrect longtable parameters doesn't match '%s' regexp."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:298 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:298
msgid "2nd param (ATable) isn't a child of the 1st (Glob)." msgid "2nd param (ATable) isn't a child of the 1st (Glob)."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:312 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:312
msgid "3rd param (limits) is incorrect. Read the manual." msgid "3rd param (limits) is incorrect. Read the manual."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:329 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:329
msgid "Cann't split the table. Read the manual." msgid "Cann't split the table. Read the manual."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:413 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:416
#, c-format #, c-format
msgid "Unexpected end external tag sequence '%s' without begin tag pair." msgid "Unexpected end external tag sequence '%s' without begin tag pair."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:449 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:452
#, c-format #, c-format
msgid "Begin tag sequence '%s':%d:%d without end tag pair." msgid "Begin tag sequence '%s':%d:%d without end tag pair."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:612 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:615
msgid "\\cline parameters doesn't match {number-number} regexp." msgid "\\cline parameters doesn't match {number-number} regexp."
msgstr "" msgstr ""
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TabularParser.vala:43 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TabularParser.vala:43
#, c-format #, c-format
msgid "Incorrect tabular parameters doesn't match '%s' regexp." msgid "Incorrect tabular parameters doesn't match '%s' regexp."
msgstr "" msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: laview-latex-struct-0\n" "Project-Id-Version: laview-latex-struct-0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-07-31 18:16+0400\n" "POT-Creation-Date: 2014-10-26 15:56+0300\n"
"PO-Revision-Date: 2014-05-28 10:50+0400\n" "PO-Revision-Date: 2014-05-28 10:50+0400\n"
"Last-Translator: <backbone@backbone.ws>\n" "Last-Translator: <backbone@backbone.ws>\n"
"Language-Team: Russian\n" "Language-Team: Russian\n"
@ -18,62 +18,62 @@ msgstr ""
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:58 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:58
#, c-format #, c-format
msgid "Begin tag sequence '%s' without end tag pair." msgid "Begin tag sequence '%s' without end tag pair."
msgstr "Стартовая последовательность тегов '%s' без соответствующей стоп-пары." msgstr "Стартовая последовательность тегов '%s' без соответствующей стоп-пары."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:127 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:127
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:582 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:585
#, c-format #, c-format
msgid ": Unexpected end tag sequence '%s' without begin tag pair." msgid ": Unexpected end tag sequence '%s' without begin tag pair."
msgstr "" msgstr ""
": Неожиданная завершающая последовательность тегов '%s' без соответствующей " ": Неожиданная завершающая последовательность тегов '%s' без соответствующей "
"старт-пары." "старт-пары."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/GlobParser.vala:148 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/GlobParser.vala:148
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:148 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:148
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:179 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:179
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:188 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:188
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:205 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:205
msgid "Error parsing subdoc." msgid "Error parsing subdoc."
msgstr "Ошибка разбора поддокумента." msgstr "Ошибка разбора поддокумента."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/LongtableParser.vala:44 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/LongtableParser.vala:44
#, c-format #, c-format
msgid "Incorrect longtable parameters doesn't match '%s' regexp." msgid "Incorrect longtable parameters doesn't match '%s' regexp."
msgstr "Неверные параметры longtable не удовлетворяют рег. выражению '%s'." msgstr "Неверные параметры longtable не удовлетворяют рег. выражению '%s'."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:298 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:298
msgid "2nd param (ATable) isn't a child of the 1st (Glob)." msgid "2nd param (ATable) isn't a child of the 1st (Glob)."
msgstr "2-ой параметр (ATable) не является дочерним узлом 1-ого (Glob)." msgstr "2-ой параметр (ATable) не является дочерним узлом 1-ого (Glob)."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:312 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:312
msgid "3rd param (limits) is incorrect. Read the manual." msgid "3rd param (limits) is incorrect. Read the manual."
msgstr "3-ий параметр (limits) не верный. Смотрите документацию." msgstr "3-ий параметр (limits) не верный. Смотрите документацию."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/Table.vala:329 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/Table.vala:329
msgid "Cann't split the table. Read the manual." msgid "Cann't split the table. Read the manual."
msgstr "Невозможно разбить таблицу. Смотрите документацию." msgstr "Невозможно разбить таблицу. Смотрите документацию."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:413 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:416
#, c-format #, c-format
msgid "Unexpected end external tag sequence '%s' without begin tag pair." msgid "Unexpected end external tag sequence '%s' without begin tag pair."
msgstr "" msgstr ""
": Неожиданная завершающая последовательность внешних тегов '%s' без " ": Неожиданная завершающая последовательность внешних тегов '%s' без "
"соответствующей старт-пары." "соответствующей старт-пары."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:449 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:452
#, c-format #, c-format
msgid "Begin tag sequence '%s':%d:%d without end tag pair." msgid "Begin tag sequence '%s':%d:%d without end tag pair."
msgstr "" msgstr ""
"Стартовая последовательность тегов '%s':%d:%d без соответствующей стоп-пары." "Стартовая последовательность тегов '%s':%d:%d без соответствующей стоп-пары."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TableParser.vala:612 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TableParser.vala:615
msgid "\\cline parameters doesn't match {number-number} regexp." msgid "\\cline parameters doesn't match {number-number} regexp."
msgstr "Параметры \\cline не соответствует рег. выражению {число-число}." msgstr "Параметры \\cline не соответствует рег. выражению {число-число}."
#: /home/kolan/projects/LAview/LaTeX-Struct/src/TabularParser.vala:43 #: /home/kolan/projects/LAview/latex-struct/src/latex-struct/TabularParser.vala:43
#, c-format #, c-format
msgid "Incorrect tabular parameters doesn't match '%s' regexp." msgid "Incorrect tabular parameters doesn't match '%s' regexp."
msgstr "Неверные параметры tabular не удовлетворяют рег. выражению '%s'." msgstr "Неверные параметры tabular не удовлетворяют рег. выражению '%s'."

View File

@ -1,36 +1,3 @@
INCLUDE (FindVala) INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/po)
INCLUDE (UseVala)
FIND_PACKAGE (PkgConfig REQUIRED) ADD_SUBDIRECTORY (latex-struct)
PKG_CHECK_MODULES (GEE REQUIRED gee-0.8)
INCLUDE_DIRECTORIES (${GEE_INCLUDE_DIRS})
FILE (GLOB_RECURSE LAviewSources RELATIVE ${CMAKE_SOURCE_DIR}/src *.vala)
VALA_PRECOMPILE (VALA_C ${LAviewSources}
PACKAGES gee-0.8 posix
OPTIONS --thread ${VALA_DEBUG} --vapi=${CMAKE_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi
CUSTOM_VAPIS
GENERATE_VAPI ${PROJ_LCASE}-${MAJOR}_internal
GENERATE_HEADER ${PROJ_LCASE}-${MAJOR}
)
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}")
ADD_LIBRARY (${PROJ_LCASE} SHARED ${VALA_C} ${PROJECT_SOURCE_DIR}/src/vala_unsupported.c)
TARGET_LINK_LIBRARIES (${PROJ_LCASE} ${GEE_LIBRARIES})
SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES SOVERSION ${MAJOR})
IF (WIN32)
SET_TARGET_PROPERTIES (${PROJ_LCASE} PROPERTIES PREFIX "" IMPORT_PREFIX "" SUFFIX "-${MAJOR}.dll")
ENDIF (WIN32)
IF (UNIX)
INSTALL (TARGETS ${PROJ_LCASE} DESTINATION lib)
ELSEIF (WIN32)
INSTALL (TARGETS ${PROJ_LCASE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
ENDIF (UNIX)
INSTALL (FILES ${CMAKE_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.h DESTINATION include)

View File

@ -1,11 +0,0 @@
#ifndef LAVIEW_LATEX_STRUCT_H
#define LAVIEW_LATEX_STRUCT_H
#define GETTEXT_PACKAGE "laview-latex-struct-@LAVIEW_LATEX_STRUCT_VERSION_MAJOR@"
#include <glib/gi18n-lib.h>
#ifdef WIN32
#define _(String) dgettext (GETTEXT_PACKAGE, String)
#endif
#endif // LAVIEW_LATEX_STRUCT_H

View File

@ -0,0 +1,7 @@
SET (LibName ${PROJECT_LOWERCASE_NAME})
FILE (GLOB_RECURSE LibSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala)
SET (LibPackages gee-0.8 posix)
SET (LibPkgModules gee-0.8)
SET (LibExtraSources ${PROJECT_SOURCE_DIR}/src/library_constructor.c)
SET (LibInstall ON)
INCLUDE (ValaLibCommonRules)

View File

@ -1,16 +1,16 @@
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
#include <windows.h> #include <windows.h>
#endif #endif
#include "gettext-config.h" #include "gettext-config.h"
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
#elif defined (__GNUC__) #elif defined(linux) || defined(UNIX) || defined(__unix__)
void __attribute__ ((constructor)) laview_latex_struct_load (void) void __attribute__ ((constructor)) load_library (void)
#endif #endif
{ {
#if defined(_WIN32) #if defined(_WIN32) || defined(_WIN64)
gchar dllPath[FILENAME_MAX], gchar dllPath[FILENAME_MAX],
*dllDir, *dllDir,
*localePath; *localePath;
@ -25,10 +25,11 @@ void __attribute__ ((constructor)) laview_latex_struct_load (void)
#if (!GLIB_CHECK_VERSION (2, 36, 0)) #if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init (); g_type_init ();
#endif
(void) dwReason; #if defined(_WIN32) || defined(_WIN64)
(void) lpReserved; (void) dwReason; // avoid
(void) lpReserved; // warngings
return TRUE; return TRUE;
#endif #endif
} }

View File

@ -1,416 +1,5 @@
INCLUDE (FindVala) ADD_SUBDIRECTORY (ltable-test)
INCLUDE (UseVala) ADD_SUBDIRECTORY (parse-test)
ADD_SUBDIRECTORY (split-test)
FIND_PACKAGE (PkgConfig REQUIRED) INCLUDE (CTest)
PKG_CHECK_MODULES (GEE REQUIRED gee-0.8)
INCLUDE_DIRECTORIES (${GEE_INCLUDE_DIRS})
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}")
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src")
# add parse_test executable
FILE (GLOB_RECURSE ParseTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test ParseTest.vala)
VALA_PRECOMPILE (ParseTest_C ${ParseTestSources}
PACKAGES gee-0.8 posix
OPTIONS --thread ${VALA_DEBUG}
CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi
GENERATE_VAPI
GENERATE_HEADER
)
ADD_EXECUTABLE (ParseTest ${ParseTest_C})
TARGET_LINK_LIBRARIES (ParseTest ${PROJ_LCASE} ${GEE_LIBRARIES})
# add ltable_test executable
FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test LTableTest.vala)
VALA_PRECOMPILE (LTableTest_C ${LTableTestSources}
PACKAGES gee-0.8 posix
OPTIONS --thread ${VALA_DEBUG}
CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi
GENERATE_VAPI
GENERATE_HEADER
)
ADD_EXECUTABLE (LTableTest ${LTableTest_C})
TARGET_LINK_LIBRARIES (LTableTest ${PROJ_LCASE} ${GEE_LIBRARIES})
# add split_test executable
FILE (GLOB_RECURSE LTableTestSources RELATIVE ${CMAKE_SOURCE_DIR}/test SplitTest.vala)
VALA_PRECOMPILE (SplitTest_C ${LTableTestSources}
PACKAGES gee-0.8 posix
OPTIONS --thread ${VALA_DEBUG}
CUSTOM_VAPIS ${PROJECT_BINARY_DIR}/src/${PROJ_LCASE}-${MAJOR}.vapi
GENERATE_VAPI
GENERATE_HEADER
)
ADD_EXECUTABLE (SplitTest ${SplitTest_C})
TARGET_LINK_LIBRARIES (SplitTest ${PROJ_LCASE} ${GEE_LIBRARIES})
# parsing test macro
MACRO (do_parse_test testname table_path etalon_path regexp)
IF ("${etalon_path}" STREQUAL "")
SET (extra_args "")
ELSE ()
SET (extra_args --etalon ${etalon_path})
ENDIF ()
ADD_TEST (ParseTest-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ParseTest --table ${table_path} ${extra_args})
SET_TESTS_PROPERTIES (ParseTest-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
ENDMACRO (do_parse_test)
# test throttle.tex
do_parse_test (throttleList ${PROJECT_SOURCE_DIR}/test/tex/throttle.tex ""
"list all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
# test throttle.tex
do_parse_test (includegraphicsWalk ${PROJECT_SOURCE_DIR}/test/tex/includegraphics.tex ""
"Walk through all objects
LAviewText
LAviewGraphics
width=0.000000. height=3.000000pt. path=174.
gen..=.includegraphics.height=3.000000pt.angle=25.scale=3.{174}
resized gen.. = .includegraphics.width=0.500000pt.height=6.000000dd.angle=25.scale=3.{174}
LAviewText
LAviewGraphics
width=12.000000cm. height=25.000000cm. path=151.
gen..=.includegraphics.width=12.000000cm.height=25.000000cm.{151}
resized gen.. = .includegraphics.width=0.500000pt.height=50.000000dd.{151}
LAviewText
end of objects
")
# test throttle.tex
do_parse_test (throttleCmp ${PROJECT_SOURCE_DIR}/test/tex/throttle.tex ""
"Original and generated text are EQUAL .-.")
# test throttle.tex
do_parse_test (throttleErr1 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err1.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair.
.end{longtable}
.")
# test throttle.tex
do_parse_test (throttleErr2 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err2.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{longtable}' without end tag pair.
.begin{longtable}
.
")
# test throttle.tex
do_parse_test (throttleErr3 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err3.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc.
.begin{longtable}
.
LAviewParsersLongtableParser:55:46: Stop external tag sequence '..end{longtable}' without begin tag pair.
.multicolumn{2}{|l|}{ЗМГ} & & .end{longtable} & & & & .tabularnewline
.
")
# test throttle.tex
do_parse_test (throttleErr4 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err4.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:13: : Unexpected end tag sequence '..end{tabular}' without begin tag pair.
.end{tabular}
.")
# test throttle.tex
do_parse_test (throttleErr5 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err5.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{tabular}' without end tag pair.
.begin{tabular}
.
")
# test throttle.tex
do_parse_test (throttleErr6 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err6.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc.
.begin{tabular}
.
LAviewParsersTabularParser:55:46: Stop external tag sequence '..end{tabular}' without begin tag pair.
.multicolumn{2}{|l|}{ЗМГ} & & .end{tabular} & & & & .tabularnewline
.
")
# test formular.tex
do_parse_test (formularList ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"list all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
# test formular.tex
do_parse_test (formularWalk ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"Walk through all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
# test formular.tex
do_parse_test (formularCmp ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"Original and generated text are EQUAL .-.")
# test formular.tex
do_parse_test (formularErr1 ${PROJECT_SOURCE_DIR}/test/tex/formular_err1.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:192:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair.
.end{longtable}
.")
# test formular.tex
do_parse_test (formularErr2 ${PROJECT_SOURCE_DIR}/test/tex/formular_err2.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:44:1: Begin tag sequence '..begin{longtable}' without end tag pair.
.begin{longtable}
.
")
# test for caption in all_subtables.tex
do_parse_test (captionTest ${PROJECT_SOURCE_DIR}/test/tex/all_subtables.tex ""
".begin{document}
.begin{longtable}{.c.c.}
.caption{Caption of the table}
")
# test all_subtables.tex
do_parse_test (all_subtablesCmp ${PROJECT_SOURCE_DIR}/test/tex/all_subtables.tex ""
"Original and generated text are EQUAL .-.")
# test all_subtables.tex
do_parse_test (linesCmp ${PROJECT_SOURCE_DIR}/test/tex/lines.tex ${PROJECT_SOURCE_DIR}/test/tex/lines.etalon.tex
"Original and generated text are EQUAL .-.")
# test ltable_embedded.tex
do_parse_test (ltable_embedded ${PROJECT_SOURCE_DIR}/test/tex/ltable_embedded.tex ""
"Original and generated text are EQUAL .-.")
# test ltable_double_embedded.tex
do_parse_test (ltable_double_embedded ${PROJECT_SOURCE_DIR}/test/tex/ltable_double_embedded.tex ""
"Original and generated text are EQUAL .-.")
# test throttle_VK2500.tex
do_parse_test (throttle_VK2500Cmp ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500.tex ""
"Original and generated text are EQUAL .-.")
# test throttle_VK2500.tex
do_parse_test (throttle_VK2500PSCmp ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500PS.tex ""
"Original and generated text are EQUAL .-.")
# test throttle_VK2500_dos_newlines_.tex
do_parse_test (throttle_VK2500PS_dos_newlines_ListWalk ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500PS_dos_newlines.tex ""
"list all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
end of objects
Walk through all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
end of objects
")
# test graph_in_ltable.tex
do_parse_test (graph_in_ltable ${PROJECT_SOURCE_DIR}/test/tex/graph_in_ltable.tex ""
"
list all objects
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableLongtable
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewGraphics
LAviewTableLongtable
LAviewText
end of objects
Walk through all objects
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
end of objects
")
# test ltable_square_arg.tex
do_parse_test (ltable_square_arg ${PROJECT_SOURCE_DIR}/test/tex/ltable_square_arg.tex ""
"Original and generated text are EQUAL .-.")
# test table_in_table.tex
do_parse_test (table_in_table ${PROJECT_SOURCE_DIR}/test/tex/table_in_table.tex ""
"
list all objects
")
# test unary_quotes.tex
do_parse_test (unary_quotes ${PROJECT_SOURCE_DIR}/test/tex/unary_quotes.tex ""
"
list all objects
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
Walk through all objects
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
# test back_slashes_in_a_table.tex
do_parse_test (back_slashes_in_a_table ${PROJECT_SOURCE_DIR}/test/tex/back_slashes_in_a_table.tex ${PROJECT_SOURCE_DIR}/test/tex/back_slashes_in_a_table.etalon.tex
"Original and generated text are EQUAL .-.")
# ltable_test macro
macro (ltable_test testname tex_path1 tex_path2 operation regexp)
add_test (ltable_test-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/LTableTest ${tex_path1} ${tex_path2} ${operation})
set_tests_properties (ltable_test-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
endmacro (ltable_test)
# ltable_test rm0row
ltable_test (rm0row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm0row.tex rm0row
"Etalon and generated text are EQUAL .-.")
# ltable_test rm1row
ltable_test (rm1row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm1row.tex rm1row
"Etalon and generated text are EQUAL .-.")
# ltable_test rm1000row
ltable_test (rm1000row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm1000row.tex rm1000row
"Etalon and generated text are EQUAL .-.")
# ltable_test rm_last_row
ltable_test (rm_last_row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm_last_row.tex rm_last_row
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_0
ltable_test (clone_0_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_0.tex clone_0_0
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_1
ltable_test (clone_0_1 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_1.tex clone_0_1
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_1_0
ltable_test (clone_1_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_1_0.tex clone_1_0
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_last
ltable_test (clone_0_last ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_last.tex clone_0_last
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_last_0
ltable_test (clone_last_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_last_0.tex clone_last_0
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_lastp1
ltable_test (clone_0_lastp1 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_lastp1.tex clone_0_lastp1
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_lastp1_0
ltable_test (clone_lastp1_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_lastp1_0.tex clone_lastp1_0
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_0_1000
ltable_test (clone_0_1000 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_1000.tex clone_0_1000
"Etalon and generated text are EQUAL .-.")
# ltable_test clone_1000_0
ltable_test (clone_1000_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_1000_0.tex clone_1000_0
"Etalon and generated text are EQUAL .-.")
# ltable_test append_row0
ltable_test (append_row0 ${PROJECT_SOURCE_DIR}/test/tex/table_rows.tex ${PROJECT_SOURCE_DIR}/test/tex/table_rows.etalon.tex append_row0
"Etalon and generated text are EQUAL .-.")
MACRO (do_split_test testname limits table etalon regexp)
ADD_TEST (split_test-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SplitTest
--limits ${limits} --table ${table} --etalon ${etalon})
SET_TESTS_PROPERTIES (split_test-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
ENDMACRO (do_split_test)
# test TeXReport_splitLongtable () function
do_split_test (split_test ${PROJECT_SOURCE_DIR}/test/tex/limits1.in
${PROJECT_SOURCE_DIR}/test/tex/limits_table1.tex
${PROJECT_SOURCE_DIR}/test/tex/limits_table1.etalon.tex
"Etalon and generated text are EQUAL ...\n")
# enable testing
ENABLE_TESTING ()

View File

@ -0,0 +1,88 @@
SET (BinName ltable_test)
FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} LTableTest.vala)
SET (BinPackages gee-0.8)
SET (BinCustomVapis ${CMAKE_BINARY_DIR}/src/latex-struct/${PROJECT_LOWERCASE_NAME}-${MAJOR}.vapi)
SET (BinLinkLibs ${PROJECT_LOWERCASE_NAME})
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/latex-struct")
INCLUDE (ValaBinCommonRules)
# Longtable tests
MACRO (ltable_test testname tex_path1 tex_path2 operation regexp)
ADD_TEST (ltable_test-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ltable_test ${tex_path1} ${tex_path2} ${operation})
SET_TESTS_PROPERTIES (ltable_test-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
ENDMACRO (ltable_test)
# ltable_test rm0row
ltable_test (rm0row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm0row.tex rm0row
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-rm0row PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test rm1row
ltable_test (rm1row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm1row.tex rm1row
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-rm1row PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test rm1000row
ltable_test (rm1000row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm1000row.tex rm1000row
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-rm1000row PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test rm_last_row
ltable_test (rm_last_row ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_rm_last_row.tex rm_last_row
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-rm_last_row PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_0_0
ltable_test (clone_0_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_0.tex clone_0_0
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_0_0 PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_0_1
ltable_test (clone_0_1 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_1.tex clone_0_1
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_0_1 PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_1_0
ltable_test (clone_1_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_1_0.tex clone_1_0
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_1_0 PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_0_last
ltable_test (clone_0_last ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_last.tex clone_0_last
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_0_last PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_last_0
ltable_test (clone_last_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_last_0.tex clone_last_0
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_last_0 PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_0_lastp1
ltable_test (clone_0_lastp1 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_lastp1.tex clone_0_lastp1
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_0_lastp1 PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_lastp1_0
ltable_test (clone_lastp1_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_lastp1_0.tex clone_lastp1_0
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_lastp1_0 PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_0_1000
ltable_test (clone_0_1000 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_0_1000.tex clone_0_1000
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_0_1000 PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test clone_1000_0
ltable_test (clone_1000_0 ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ${PROJECT_SOURCE_DIR}/test/tex/ltable_clone_1000_0.tex clone_1000_0
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-clone_1000_0 PROPERTIES ENVIRONMENT "LANG=en")
# ltable_test append_row0
ltable_test (append_row0 ${PROJECT_SOURCE_DIR}/test/tex/table_rows.tex ${PROJECT_SOURCE_DIR}/test/tex/table_rows.etalon.tex append_row0
"Etalon and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ltable_test-append_row0 PROPERTIES ENVIRONMENT "LANG=en")
# enable testing
ENABLE_TESTING ()

View File

@ -0,0 +1,326 @@
SET (BinName parse_test)
FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ParseTest.vala)
SET (BinPackages gee-0.8)
SET (BinCustomVapis ${CMAKE_BINARY_DIR}/src/latex-struct/${PROJECT_LOWERCASE_NAME}-${MAJOR}.vapi)
SET (BinLinkLibs ${PROJECT_LOWERCASE_NAME})
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/latex-struct")
INCLUDE (ValaBinCommonRules)
# Parse tests
MACRO (do_parse_test testname table_path etalon_path regexp)
IF ("${etalon_path}" STREQUAL "")
SET (extra_args "")
ELSE ()
SET (extra_args --etalon ${etalon_path})
ENDIF ()
ADD_TEST (ParseTest-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/parse_test --table ${table_path} ${extra_args})
SET_TESTS_PROPERTIES (ParseTest-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
ENDMACRO (do_parse_test)
# test throttle.tex
do_parse_test (throttleList ${PROJECT_SOURCE_DIR}/test/tex/throttle.tex ""
"list all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
SET_TESTS_PROPERTIES(ParseTest-throttleList PROPERTIES ENVIRONMENT "LANG=en")
# test throttle.tex
do_parse_test (includegraphicsWalk ${PROJECT_SOURCE_DIR}/test/tex/includegraphics.tex ""
"Walk through all objects
LAviewText
LAviewGraphics
width=0.000000. height=3.000000pt. path=174.
gen..=.includegraphics.height=3.000000pt.angle=25.scale=3.{174}
resized gen.. = .includegraphics.width=0.500000pt.height=6.000000dd.angle=25.scale=3.{174}
LAviewText
LAviewGraphics
width=12.000000cm. height=25.000000cm. path=151.
gen..=.includegraphics.width=12.000000cm.height=25.000000cm.{151}
resized gen.. = .includegraphics.width=0.500000pt.height=50.000000dd.{151}
LAviewText
end of objects
")
SET_TESTS_PROPERTIES(ParseTest-includegraphicsWalk PROPERTIES ENVIRONMENT "LANG=en")
# test throttle.tex
do_parse_test (throttleCmp ${PROJECT_SOURCE_DIR}/test/tex/throttle.tex ""
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-throttleCmp PROPERTIES ENVIRONMENT "LANG=en")
# test throttle.tex
do_parse_test (throttleErr1 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err1.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair.
.end{longtable}
.")
SET_TESTS_PROPERTIES(ParseTest-throttleErr1 PROPERTIES ENVIRONMENT "LANG=en")
# test throttle.tex
do_parse_test (throttleErr2 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err2.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{longtable}' without end tag pair.
.begin{longtable}
.
")
SET_TESTS_PROPERTIES(ParseTest-throttleErr2 PROPERTIES ENVIRONMENT "LANG=en")
# test throttle.tex
do_parse_test (throttleErr3 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err3.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc.
.begin{longtable}
.
LAviewParsersLongtableParser:55:46: Stop external tag sequence '..end{longtable}' without begin tag pair.
.multicolumn{2}{|l|}{ЗМГ} & & .end{longtable} & & & & .tabularnewline
.
")
SET_TESTS_PROPERTIES(ParseTest-throttleErr3 PROPERTIES ENVIRONMENT "LANG=en")
# test throttle.tex
do_parse_test (throttleErr4 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err4.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:13: : Unexpected end tag sequence '..end{tabular}' without begin tag pair.
.end{tabular}
.")
SET_TESTS_PROPERTIES(ParseTest-throttleErr4 PROPERTIES ENVIRONMENT "LANG=en")
# test throttle.tex
do_parse_test (throttleErr5 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err5.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:33:1: Begin tag sequence '..begin{tabular}' without end tag pair.
.begin{tabular}
.
")
SET_TESTS_PROPERTIES(ParseTest-throttleErr5 PROPERTIES ENVIRONMENT "LANG=en")
# test throttle.tex
do_parse_test (throttleErr6 ${PROJECT_SOURCE_DIR}/test/tex/throttle_err6.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:34:1: Error parsing subdoc.
.begin{tabular}
.
LAviewParsersTabularParser:55:46: Stop external tag sequence '..end{tabular}' without begin tag pair.
.multicolumn{2}{|l|}{ЗМГ} & & .end{tabular} & & & & .tabularnewline
.
")
SET_TESTS_PROPERTIES(ParseTest-throttleErr6 PROPERTIES ENVIRONMENT "LANG=en")
# test formular.tex
do_parse_test (formularList ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"list all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
SET_TESTS_PROPERTIES(ParseTest-formularList PROPERTIES ENVIRONMENT "LANG=en")
# test formular.tex
do_parse_test (formularWalk ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"Walk through all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
SET_TESTS_PROPERTIES(ParseTest-formularWalk PROPERTIES ENVIRONMENT "LANG=en")
# test formular.tex
do_parse_test (formularCmp ${PROJECT_SOURCE_DIR}/test/tex/formular.tex ""
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-formularCmp PROPERTIES ENVIRONMENT "LANG=en")
# test formular.tex
do_parse_test (formularErr1 ${PROJECT_SOURCE_DIR}/test/tex/formular_err1.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:192:15: : Unexpected end tag sequence '..end{longtable}' without begin tag pair.
.end{longtable}
.")
SET_TESTS_PROPERTIES(ParseTest-formularErr1 PROPERTIES ENVIRONMENT "LANG=en")
# test formular.tex
do_parse_test (formularErr2 ${PROJECT_SOURCE_DIR}/test/tex/formular_err2.tex ""
"Error parsing TeX document: LAviewParsersGlobParser:44:1: Begin tag sequence '..begin{longtable}' without end tag pair.
.begin{longtable}
.
")
SET_TESTS_PROPERTIES(ParseTest-formularErr2 PROPERTIES ENVIRONMENT "LANG=en")
# test for caption in all_subtables.tex
do_parse_test (captionTest ${PROJECT_SOURCE_DIR}/test/tex/all_subtables.tex ""
".begin{document}
.begin{longtable}{.c.c.}
.caption{Caption of the table}
")
SET_TESTS_PROPERTIES(ParseTest-captionTest PROPERTIES ENVIRONMENT "LANG=en")
# test all_subtables.tex
do_parse_test (all_subtablesCmp ${PROJECT_SOURCE_DIR}/test/tex/all_subtables.tex ""
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-all_subtablesCmp PROPERTIES ENVIRONMENT "LANG=en")
# test all_subtables.tex
do_parse_test (linesCmp ${PROJECT_SOURCE_DIR}/test/tex/lines.tex ${PROJECT_SOURCE_DIR}/test/tex/lines.etalon.tex
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-linesCmp PROPERTIES ENVIRONMENT "LANG=en")
# test ltable_embedded.tex
do_parse_test (ltable_embedded ${PROJECT_SOURCE_DIR}/test/tex/ltable_embedded.tex ""
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-ltable_embedded PROPERTIES ENVIRONMENT "LANG=en")
# test ltable_double_embedded.tex
do_parse_test (ltable_double_embedded ${PROJECT_SOURCE_DIR}/test/tex/ltable_double_embedded.tex ""
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-ltable_double_embedded PROPERTIES ENVIRONMENT "LANG=en")
# test throttle_VK2500.tex
do_parse_test (throttle_VK2500Cmp ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500.tex ""
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-throttle_VK2500Cmp PROPERTIES ENVIRONMENT "LANG=en")
# test throttle_VK2500.tex
do_parse_test (throttle_VK2500PSCmp ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500PS.tex ""
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-throttle_VK2500PSCmp PROPERTIES ENVIRONMENT "LANG=en")
# test throttle_VK2500_dos_newlines_.tex
do_parse_test (throttle_VK2500PS_dos_newlines_ListWalk ${PROJECT_SOURCE_DIR}/test/tex/throttle_VK2500PS_dos_newlines.tex ""
"list all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
end of objects
Walk through all objects
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
end of objects
")
SET_TESTS_PROPERTIES(ParseTest-throttle_VK2500PS_dos_newlines_ListWalk PROPERTIES ENVIRONMENT "LANG=en")
# test graph_in_ltable.tex
do_parse_test (graph_in_ltable ${PROJECT_SOURCE_DIR}/test/tex/graph_in_ltable.tex ""
"
list all objects
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableLongtable
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewGraphics
LAviewTableLongtable
LAviewText
end of objects
Walk through all objects
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableLongtable
LAviewText
LAviewTableLongtable
LAviewText
end of objects
")
SET_TESTS_PROPERTIES(ParseTest-graph_in_ltable PROPERTIES ENVIRONMENT "LANG=en")
# test ltable_square_arg.tex
do_parse_test (ltable_square_arg ${PROJECT_SOURCE_DIR}/test/tex/ltable_square_arg.tex ""
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-ltable_square_arg PROPERTIES ENVIRONMENT "LANG=en")
# test table_in_table.tex
do_parse_test (table_in_table ${PROJECT_SOURCE_DIR}/test/tex/table_in_table.tex ""
"
list all objects
")
SET_TESTS_PROPERTIES(ParseTest-table_in_table PROPERTIES ENVIRONMENT "LANG=en")
# test unary_quotes.tex
do_parse_test (unary_quotes ${PROJECT_SOURCE_DIR}/test/tex/unary_quotes.tex ""
"
list all objects
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
Walk through all objects
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
LAviewTableTabular
LAviewText
end of objects
")
SET_TESTS_PROPERTIES(ParseTest-unary_quotes PROPERTIES ENVIRONMENT "LANG=en")
# test back_slashes_in_a_table.tex
do_parse_test (back_slashes_in_a_table ${PROJECT_SOURCE_DIR}/test/tex/back_slashes_in_a_table.tex ${PROJECT_SOURCE_DIR}/test/tex/back_slashes_in_a_table.etalon.tex
"Original and generated text are EQUAL .-.")
SET_TESTS_PROPERTIES(ParseTest-back_slashes_in_a_table PROPERTIES ENVIRONMENT "LANG=en")
# enable testing
ENABLE_TESTING ()

View File

@ -0,0 +1,26 @@
SET (BinName split_test)
FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} SplitTest.vala)
SET (BinPackages gee-0.8)
SET (BinCustomVapis ${CMAKE_BINARY_DIR}/src/latex-struct/${PROJECT_LOWERCASE_NAME}-${MAJOR}.vapi)
SET (BinLinkLibs ${PROJECT_LOWERCASE_NAME})
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/src/latex-struct")
INCLUDE (ValaBinCommonRules)
# Split tests
MACRO (do_split_test testname limits table etalon regexp)
ADD_TEST (SplitTest-${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/split_test
--limits ${limits} --table ${table} --etalon ${etalon})
SET_TESTS_PROPERTIES (SplitTest-${testname}
PROPERTIES PASS_REGULAR_EXPRESSION ${regexp}
FAIL_REGULAR_EXPRESSION "CRITICAL;WARNING")
ENDMACRO (do_split_test)
# test TeXReport_splitLongtable () function
do_split_test (split0 ${PROJECT_SOURCE_DIR}/test/tex/limits1.in
${PROJECT_SOURCE_DIR}/test/tex/limits_table1.tex
${PROJECT_SOURCE_DIR}/test/tex/limits_table1.etalon.tex
"Etalon and generated text are EQUAL ...\n")
SET_TESTS_PROPERTIES(SplitTest-split0 PROPERTIES ENVIRONMENT "LANG=en")
# enable testing
ENABLE_TESTING ()

1
util/backbone Submodule

@ -0,0 +1 @@
Subproject commit aa78f6d42c85f7f9a98a1a6273230a9775824fc7

View File

@ -1,48 +0,0 @@
#!/bin/sh
##
# settings
##
PROJECT=laview-latex-struct-0
PO_DIR_NAME=po
SCRIPT_PATH=`readlink -f $0`
SCRIPT_DIR=${SCRIPT_PATH%/*}
PRJDIR=${SCRIPT_DIR%/*}
C_FILELIST="${PRJDIR}/src/*.vala"
UI_FILELIST="${PRJDIR}/ui/*.glade"
##
# code
##
xgettext --language=C --escape --package-name=$PROJECT --default-domain=$PROJECT --add-comments=/// \
-k_ -kQ_ -kC_ -kN_ -kNC_ -kg_dgettext -kg_dcgettext \
-kg_dngettext -kg_dpgettext -kg_dpgettext2 -kg_strip_context -F -n -o \
$PRJDIR/$PO_DIR_NAME/source.pot $C_FILELIST
xgettext --language=C --escape --package-name=$PROJECT --default-domain=$PROJECT --add-comments=/// \
-k_ -kQ_ -kC_ -kN_ -kNC_ -kg_dgettext -kg_dcgettext \
-kg_dngettext -kg_dpgettext -kg_dpgettext2 -kg_strip_context -F -n -o \
$PRJDIR/$PO_DIR_NAME/glade.pot $C_FILELIST
msgcat -o $PRJDIR/$PO_DIR_NAME/$PROJECT.pot --use-first $PRJDIR/$PO_DIR_NAME/source.pot $PRJDIR/$PO_DIR_NAME/glade.pot
rm $PRJDIR/$PO_DIR_NAME/source.pot
rm $PRJDIR/$PO_DIR_NAME/glade.pot
[ 0 != $? ] && echo "xgettext failed ;-(" && exit 1
[ ! -e $PRJDIR/$PO_DIR_NAME/$PROJECT.pot ] && echo "No strings found ;-(" && exit 1
for d in $PRJDIR/$PO_DIR_NAME/*; do
[ ! -d $d ] && continue
if [ -e $d/$PROJECT.po ]; then
echo "Merging '${d##*/}' locale" && msgmerge -F -U $d/$PROJECT.po $PRJDIR/$PO_DIR_NAME/$PROJECT.pot
[ 0 != $? ] && echo "msgmerge failed ;(" && exit 1
else
echo "Creating '${d##*/}' locale" && msginit -l ${d##*/} -o $d/$PROJECT.po -i $PRJDIR/$PO_DIR_NAME/$PROJECT.pot
[ 0 != $? ] && echo "msginit failed ;(" && exit 1
fi
done

View File

@ -1,19 +0,0 @@
#!/bin/bash
EXE_PATH="`readlink -f $0`"
PRJ_PATH="${EXE_PATH%/*/*}"
OUT_PATH="$PRJ_PATH/doc/html/latex-struct"
OUT_INTERNAL_PATH="$PRJ_PATH/doc/html/latex-struct-internals"
echo "Generating documentation..."
rm -rf "$OUT_PATH"
valadoc --no-protected -o "$OUT_PATH" -b "$PRJ_PATH/src" `find "$PRJ_PATH/src" -name "*.vapi" -or -name "*.vala"` \
--pkg=gtk+-3.0 --pkg=gee-0.8 --pkg=gmodule-2.0 --pkg=posix
firefox "$OUT_PATH"/latex-struct/index.htm &>/dev/null
#echo "Generating internal documentation..."
#rm -rf "$OUT_INTERNAL_PATH"
#valadoc -o "$OUT_INTERNAL_PATH" -b "$PRJ_PATH/src" `find "$PRJ_PATH/src" -name "*.vapi" -or -name "*.vala"` \
# --pkg=gtk+-3.0 --pkg=gee-0.8 --pkg=gmodule-2.0 --pkg=posix --internal
#firefox "$OUT_INTERNAL_PATH"/latex-struct-internals/index.htm &>/dev/null

View File

@ -1,2 +1,2 @@
BASEDIR=src BASEDIR=src
PKGS=gtk+-3.0 gee-0.8 gmodule-2.0 posix PKGS=gee-0.8 posix