local_settings:
    #use_shared_libs: true
    #short_local_names: true
    #use_cache: false
    #generator: Visual Studio 14 2015 Win64
    silent: false
    #copy_import_libs: true
    #build:
        #c_flags: /W0
        #cxx_flags: /W0
    builds:
        vs2017:
            generator: Visual Studio 15 2017
        vs2017_64:
            generator: Visual Studio 15 2017 Win64

    dependencies:
        pvt.cppan.demo.danbloomberg.leptonica: 1
        pvt.cppan.demo.libarchive.libarchive: 3
        pvt.cppan.demo.unicode.icu.i18n: "*"

root_project: pvt.cppan.demo.google.tesseract

common_settings:
    c++: 11

    options:
        any:
            compile_options:
                msvc:
                    private:
                        - /openmp

projects:
    libtesseract:
        type: lib
        export_all_symbols: true
        files:
          - src/api/tess_version.h.in
          - src/api/.*\.cpp
          - src/arch/.*\.cpp
          - src/ccmain/.*\.cpp
          - src/ccstruct/.*\.cpp
          - src/ccutil/.*\.cpp
          - src/classify/.*\.cpp
          - src/cutil/.*\.cpp
          - src/dict/.*\.cpp
          - src/lstm/.*\.cpp
          - src/opencl/.*\.cpp
          - src/textord/.*\.cpp
          - src/viewer/.*\.cpp
          - src/wordrec/.*\.cpp

          - src/api/.*\.h
          - src/arch/.*\.h
          - src/ccmain/.*\.h
          - src/ccstruct/.*\.h
          - src/ccutil/.*\.h
          - src/classify/.*\.h
          - src/cutil/.*\.h
          - src/dict/.*\.h
          - src/lstm/.*\.h
          - src/opencl/.*\.h
          - src/textord/.*\.h
          - src/viewer/.*\.h
          - src/wordrec/.*\.h

        exclude_from_build:
          - src/api/tesseractmain.cpp
          - src/viewer/svpaint.cpp

        include_directories:
          public:
          #private:
            - src/arch
            - src/classify
            - src/cutil
            - src/ccutil
            - src/dict
            - src/lstm
            - src/opencl
            - src/textord
            - src/viewer
            - src/wordrec
          #public:
            - src/api
            - src/ccmain
            - src/ccstruct
            - src/ccutil

        check_include_exists:
          - dlfcn.h
          - inttypes.h
          - limits.h
          - malloc.h
          - memory.h
          - stdbool.h
          - stdint.h
          - stdlib.h
          - string.h
          - sys/ipc.h
          - sys/shm.h
          - sys/stat.h
          - sys/types.h
          - sys/wait.h
          - tiffio.h
          - unistd.h

        check_type_size:
          - long long int
          - off_t
          - mbstate_t
          - wchar_t
          - _Bool

        pre_sources: |
            file_write_once(${BDIR}/config_auto.h "")

        post_sources: |
            configure_file(
                ${SDIR}/src/api/tess_version.h.in
                ${BDIR}/tess_version.h @ONLY)
            if (WIN32)
                if (MSVC)
                    set_source_files_properties(
                        ${SDIR}/src/arch/dotproductsse.cpp
                        PROPERTIES COMPILE_DEFINITIONS __SSE4_1__)
                    set_source_files_properties(
                        ${SDIR}/src/arch/intsimdmatrixsse.cpp
                        PROPERTIES COMPILE_DEFINITIONS __SSE4_1__)
                    set_source_files_properties(
                        ${SDIR}/src/arch/dotproductavx.cpp
                        PROPERTIES COMPILE_FLAGS "/arch:AVX")
                    set_source_files_properties(
                        ${SDIR}/src/arch/intsimdmatrixavx2.cpp
                        PROPERTIES COMPILE_FLAGS "/arch:AVX2")
                endif()
            endif()

        options:
            any:
                definitions:
                    public:
                      - HAVE_CONFIG_H
                      - HAVE_LIBARCHIVE
                      - _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1
            shared:
                definitions:
                    private:
                        - TESS_EXPORTS
                    interface:
                        - TESS_IMPORTS

        dependencies:
            pvt.cppan.demo.danbloomberg.leptonica: 1
            pvt.cppan.demo.libarchive.libarchive: 3

    tesseract:
        files: src/api/tesseractmain.cpp
        dependencies:
            - libtesseract

    tessopt:
        type: lib
        static_only: true
        files: src/training/tessopt.*
        include_directories: training
        dependencies: libtesseract

    common_training:
        type: lib
        static_only: true
        files:
            - src/training/commandlineflags.cpp
            - src/training/commandlineflags.h
            - src/training/commontraining.cpp
            - src/training/commontraining.h
        include_directories: training
        dependencies:
            - tessopt

    ambiguous_words:
        files: src/training/ambiguous_words.cpp
        dependencies:
            - libtesseract

    classifier_tester:
        files: src/training/classifier_tester.cpp
        dependencies: common_training

    combine_lang_model:
        files: src/training/combine_lang_model.cpp
        dependencies: unicharset_training

    combine_tessdata:
        files: src/training/combine_tessdata.cpp
        dependencies: libtesseract

    cntraining:
        files: src/training/cntraining.cpp
        dependencies: common_training

    dawg2wordlist:
        files: src/training/dawg2wordlist.cpp
        dependencies: libtesseract

    mftraining:
        files:
            - src/training/mftraining.cpp
            - src/training/mergenf.*
        dependencies: common_training

    shapeclustering:
        files: src/training/shapeclustering.cpp
        dependencies: common_training

    unicharset_extractor:
        files: src/training/unicharset_extractor.cpp
        dependencies: unicharset_training

    wordlist2dawg:
        files: src/training/wordlist2dawg.cpp
        dependencies: libtesseract

    unicharset_training:
        type: lib
        static_only: true
        files:
            - src/training/fileio.*
            - src/training/icuerrorcode.*
            - src/training/lang_model_helpers.*
            - src/training/lstmtester.*
            - src/training/normstrngs.*
            - src/training/unicharset_training_utils.*
            - src/training/validat.*
        include_directories: training
        dependencies:
            - common_training
            - pvt.cppan.demo.unicode.icu.i18n

    lstmeval:
        files: src/training/lstmeval.cpp
        dependencies: unicharset_training

    lstmtraining:
        files: src/training/lstmtraining.cpp
        dependencies: unicharset_training

    set_unicharset_properties:
        files: src/training/set_unicharset_properties.cpp
        dependencies: unicharset_training

    text2image:
        files:
            - src/training/text2image.cpp
            - src/training/boxchar.cpp
            - src/training/boxchar.h
            - src/training/degradeimage.cpp
            - src/training/degradeimage.h
            - src/training/ligature_table.cpp
            - src/training/ligature_table.h
            - src/training/normstrngs.cpp
            - src/training/normstrngs.h
            - src/training/pango_font_info.cpp
            - src/training/pango_font_info.h
            - src/training/stringrenderer.cpp
            - src/training/stringrenderer.h
            - src/training/tlog.cpp
            - src/training/tlog.h
            - src/training/util.h

        dependencies:
            - unicharset_training
            - pvt.cppan.demo.gnome.pango.pangocairo: 1
