Skip to content

Commit

Permalink
Merge pull request #5 from Microsoft/macos
Browse files Browse the repository at this point in the history
Add support for MacOS
  • Loading branch information
Mmdixon authored Jul 27, 2018
2 parents 7c1c861 + f5259c7 commit 64c1cbd
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 50 deletions.
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
dist: trusty
sudo: false
language: node_js

node_js:
- "8"
- "9"
- "10"

dist: trusty
sudo: false
osx_image: xcode9.4
os:
- linux
- osx

# Need to support c++17
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env:
- CXX=g++-7

branches:
only:
- master
# For tags
- /^[0-9]+\.[0-9]+\.[0-9]+$/

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX=g++-7 CC=gcc-7; fi

# Install scripts (runs after repo cloning).
install:
- npm install --build-from-source
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ Supported Languages

Current pre-built binaries offered to save the trouble of compiling the source locally.
* node-v{64,59,57}-{win32}-{x64,x86}
* node-v{64,59,57}-{linux}-{x64}
* node-v{64,59,57}-{linux,darwin}-{x64}

(Run `node -p "process.versions.modules"` to see which Node-ABI in use.)
# Getting Started
This repository consists of TypeScript and native dependencies built with `node-gyp`. See `package.json` for various scripts for the developement process.

For first time building remember to `npm install`

This repository uses git submodules. If paths are outdated or non-existent run `git submodule update --init --recursive`

## Install
To install from NPM
```
Expand Down
34 changes: 32 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"-std=gnu++0x",
"-std=gnu++1y",
"-fno-exceptions",
"-fno-rtti",
],
"cflags!": [
"-Wall",
Expand All @@ -29,7 +30,8 @@
],
},
},
# To disable default flags, windows has to override starting from the configurations
# To disable default flags for macOS, see each target, "target_defaults" didn't seem to override.
# To disable default flags, windows has to override starting from the configurations.
"configurations": {
"Release": {
"msvs_settings": {
Expand Down Expand Up @@ -70,12 +72,21 @@
"src/maluuba/speech/nodejs/phone/phone.cpp",
"src/maluuba/speech/nodejs/stringdistance/stringdistance.cpp",
],
"xcode_settings": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++17", # -std=c++17
"GCC_ENABLE_CPP_EXCEPTIONS": "YES", # remove -fno-exceptions
"GCC_ENABLE_CPP_RTTI": "YES", # remove -fno-rtti
"OTHER_CFLAGS+": [
"-Wall",
"-pedantic",
],
},
},
{
"target_name": "maluubaspeech-source",
"type": "static_library",
"defines": [
"CODECVT_BUG=_MSC_VER >= 1900"
"MALUUBA_CODECVT_BUG=_MSC_VER >= 1900"
],
"dependencies": [
"flite",
Expand All @@ -90,6 +101,15 @@
"src/maluuba/speech/pronunciation/pronunciation.cpp",
"src/maluuba/unicode/unicode.cpp",
],
"xcode_settings": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++17", # -std=c++17
"GCC_ENABLE_CPP_EXCEPTIONS": "YES", # remove -fno-exceptions
"GCC_ENABLE_CPP_RTTI": "YES", # remove -fno-rtti
"OTHER_CFLAGS+": [
"-Wall",
"-pedantic",
],
},
},
{
"target_name": "flite",
Expand Down Expand Up @@ -214,6 +234,16 @@
"src/flite/src/wavesynth/cst_sts.c",
"src/flite/src/wavesynth/cst_units.c",
],
"xcode_settings": {
"WARNING_CFLAGS!": [
"-Wall",
"-Wextra",
],
"OTHER_CFLAGS+": [
"-Wno-sign-compare",
"-Wno-absolute-value",
],
},
"conditions": [
["OS=='win'", {
"defines": [
Expand Down
13 changes: 10 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ <h1> phoneticmatching</h1>
<div class="row">
<div class="col-8 col-content">
<div class="tsd-panel tsd-typography">
<p><a href="https://travis-ci.org/Microsoft/PhoneticMatching"><img src="https://travis-ci.org/Microsoft/PhoneticMatching.svg?branch=master" alt="Build Status"></a>
<a href="https://ci.appveyor.com/projects"><img src="https://ci.appveyor.com/api/projects/status/github/Microsoft/PhoneticMatching?branch=master&amp;svg=true" alt="Build Status"></a></p>
<h1 id="introduction">Introduction</h1>
<p>A phonetic matching library. Includes text utilities to do string comparisons on phonemes (the sound of the string), as opposed to characters.</p>
<p>Docs can be found at: <a href="https://microsoft.github.io/PhoneticMatching/">https://microsoft.github.io/PhoneticMatching/</a></p>
Expand All @@ -76,13 +78,18 @@ <h1 id="introduction">Introduction</h1>
</ul>
<p>Current pre-built binaries offered to save the trouble of compiling the source locally.</p>
<ul>
<li>node-v{64,59,57}-{linux,win32}-{x64}</li>
<li>node-v{64,59,57}-{win32}-{x64,x86}</li>
<li>node-v{64,59,57}-{linux,darwin}-{x64}</li>
</ul>
<p>(Run <code>node -p &quot;process.versions.modules&quot;</code> to see which Node-ABI in use.)</p>
<h1 id="getting-started">Getting Started</h1>
<p>This repository consists of TypeScript and native dependencies built with <code>node-gyp</code>. See <code>package.json</code> for various scripts for the developement process.</p>
<p>For first time building remember to <code>npm install</code></p>
<h2 id="usage">Usage</h2>
<p>This repository uses git submodules. If paths are outdated or non-existent run <code>git submodule update --init --recursive</code></p>
<h2 id="install">Install</h2>
<p>To install from NPM</p>
<pre><code>npm <span class="hljs-keyword">install</span> phoneticmatching
</code></pre><h2 id="usage">Usage</h2>
<p>See the typings for more details. <br> Classes prefixed with <code>En</code> make certain assumptions that are specific to the English language.</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> maluuba, { EnPronouncer, EnPhoneticDistance, FuzzyMatcher, AcceleratedFuzzyMatcher, EnHybridDistance, StringDistance } <span class="hljs-keyword">from</span> <span class="hljs-string">"phoneticmatching"</span>;
</code></pre>
Expand Down Expand Up @@ -158,7 +165,7 @@ <h2 id="deployment-upload">Deployment/Upload</h2>
<pre><code class="lang-py"><span class="hljs-comment"># Pushes pack to npmjs.com or a private registry if a .npmrc exisits.</span>
npm publish
</code></pre>
<pre><code class="lang-py"><span class="hljs-comment"># Packages a ./build/stage/maluubaspeech/v{version}/maluubaspeech-{node_abi}-{platform}-{arch}.tar.gz.</span>
<pre><code class="lang-py"><span class="hljs-comment"># Packages a ./build/stage/{version}/maluubaspeech-{node_abi}-{platform}-{arch}.tar.gz.</span>
<span class="hljs-comment"># See package.json:binary.host on where to put it.</span>
npm run package
</code></pre>
Expand Down
48 changes: 17 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phoneticmatching",
"version": "0.1.2",
"version": "0.1.3",
"description": "A text utility to do string comparisons at a phonetic level.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -34,11 +34,11 @@
"node-pre-gyp"
],
"devDependencies": {
"@types/jest": "^23.1.6",
"@types/node": "^10.5.2",
"@types/jest": "^23.3.1",
"@types/node": "^10.5.3",
"@types/xregexp": "^3.0.29",
"jest": "^23.4.1",
"ts-jest": "^23.0.0",
"ts-jest": "^23.0.1",
"typedoc": "^0.11.1",
"typescript": "^2.9.2"
},
Expand Down
4 changes: 2 additions & 2 deletions src/maluuba/speech/nodejs/fuzzymatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace nodejs
value = arg_extract->Call(v8::Null(isolate), argc, argv);
}
std::string phrase{*v8::String::Utf8Value{isolate, value}};
targets.emplace_back(NodeJsTarget(isolate, obj), phrase, std::move(pronouncer.pronounce(phrase)));
targets.emplace_back(NodeJsTarget(isolate, obj), phrase, pronouncer.pronounce(phrase));
}

// copy out the native distance component.
Expand Down Expand Up @@ -185,7 +185,7 @@ namespace nodejs
value = arg_extract->Call(v8::Null(isolate), argc, argv);
}
std::string phrase{*v8::String::Utf8Value{isolate, value}};
targets.emplace_back(NodeJsTarget(isolate, obj), std::move(pronouncer.pronounce(phrase)));
targets.emplace_back(NodeJsTarget(isolate, obj), pronouncer.pronounce(phrase));
}

// copy out the native distance component.
Expand Down
1 change: 1 addition & 0 deletions src/maluuba/speech/nodejs/performance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define MALUUBA_SPEECH_NODEJS_PERFORMANCE_HPP

#include <node.h>
#include <string>

namespace maluuba
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

#include "maluuba/speech/nodejs/stringdistance.hpp"
#include <string>
#include <utility>

namespace maluuba
Expand Down
Loading

0 comments on commit 64c1cbd

Please sign in to comment.