Commit 43004d6f authored by Yuanle Song's avatar Yuanle Song
Browse files

add meson.build for libpyzy project.

updated meson.build for pinyin_parser/ sub project.
it integrates swig build step in meson now.
parent f6eaead1
Loading
Loading
Loading
Loading

src/.gitignore

0 → 100644
+3 −0
Original line number Diff line number Diff line
build/
debug/
release/
+2 −5
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
 *
 * libpyzy - The Chinese PinYin and Bopomofo conversion library.
 *
 * Copyright (c) 2019 Yuanle Song <sylecn@gmail.com>
 * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
@@ -21,10 +22,6 @@
 */
#include "SpecialPhrase.h"

namespace PY {

SpecialPhrase::~SpecialPhrase (void)
{
}
namespace PyZy {

};

src/meson.build

0 → 100644
+48 −0
Original line number Diff line number Diff line
# -*- mode: conf -*-
project('pyzy', 'cpp',
  version: '1.0.1-6',
  license: 'GPL',
  default_options: [
    'warning_level=2',
    'werror=true',
    'prefix=/usr',
    'buildtype=release',
    'strip=true',
    'b_ndebug=if-release'])

pkgdatadir = join_paths(get_option('datadir'), 'pyzy')
add_project_arguments(
  '-Wno-unused-parameter',
  '-Wno-missing-field-initializers',
  '-DHAVE_LIBUUID',
  '-std=c++0x',
  '-DPKGDATADIR="' + pkgdatadir + '"',
  language: 'cpp')

glib = dependency('glib-2.0')
sqlite3 = dependency('sqlite3')
uuid = dependency('uuid')
shared_dep = [glib, sqlite3, uuid]

lib_src = [
  'BopomofoContext.cc',
  'Database.cc',
  'DoublePinyinContext.cc',
  'DynamicSpecialPhrase.cc',
  'FullPinyinContext.cc',
  'InputContext.cc',
  'PhoneticContext.cc',
  'PhraseEditor.cc',
  'PinyinContext.cc',
  'PinyinParser.cc',
  'SimpTradConverter.cc',
  'SpecialPhrase.cc',
  'SpecialPhraseTable.cc',
  'Variant.cc',
]
shared_library('pyzy-1.0',
  lib_src,
  soversion: '0',
  version: '0.100.0',
  dependencies: shared_dep,
  install: true)
+19 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ project('pinyin_parser', ['cpp', 'c'],
  default_options: [
    'warning_level=2',
    'werror=true',
    'strip=true',
    'buildtype=release'])

add_project_arguments(
@@ -14,6 +15,23 @@ add_project_arguments(
  '-std=c++11',
  language: 'cpp')

# generate pinyin_parser_wrap.c using swig.
# but swig has a bug, the PyInit function name has an extra _ in it. so I use
# sed to do a simple replace.

swig = find_program('swig')
pinyin_parser_wrap_swig = custom_target('pinyin_parser_swig.c',
  input: 'pinyin_parser.i',
  output: 'pinyin_parser_swig.c',
  command: [swig, '-python', '-o', '@OUTPUT@', '@INPUT@'])

sed = find_program('sed')
pinyin_parser_wrap = custom_target('pinyin_parser_wrap.c',
  input: pinyin_parser_wrap_swig,
  output: 'pinyin_parser_wrap.c',
  capture: true,
  command: [sed, 's/PyInit__libpinyin_parser/PyInit_libpinyin_parser/', '@INPUT@'])

glib = dependency('glib-2.0')
uuid = dependency('uuid')
shared_dep = [glib, uuid]
@@ -21,7 +39,7 @@ shared_dep = [glib, uuid]
lib_src = [
  '../PinyinParser.cc',
  'pinyin_parser.cpp',
  'pinyin_parser_wrap.c']
  pinyin_parser_wrap]
shared_library('pinyin_parser',
  lib_src,
  dependencies: [shared_dep, dependency('python3')],