Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit a3c0c80

Browse files
committed
Sphinxad moved to a separate library
1 parent ca61dee commit a3c0c80

File tree

6 files changed

+34
-127
lines changed

6 files changed

+34
-127
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ __pycache__
1010
*.lat
1111
*.pyc
1212
*.log
13+
sphinxbase/ad.py
1314
sphinxbase/sphinxbase.py
1415
pocketsphinx/pocketsphinx.py
1516
*_wrap.c

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ test_py3_x64: clean
196196

197197
clean:
198198
rm -rf build *.egg-info tests/*.{htk,lat}
199-
rm -rf sphinxbase/sphinxbase.py
199+
rm -rf sphinxbase/{ad,sphinxbase}.py
200200
rm -rf pocketsphinx/pocketsphinx.py
201201
rm -rf {sphinxbase,pocketsphinx}/*.{so,pyd}
202202
rm -rf {sphinxbase,pocketsphinx,tests}/*.pyc

setup.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323

2424
libpocketsphinx = glob('deps/pocketsphinx/src/libpocketsphinx/*.c')
2525

26+
ad_sources = ['swig/sphinxbase/ad.i']
27+
2628
sb_sources = (
2729
libsphinxbase +
28-
['swig/sphinxbase/sphinxbase.i']
30+
['deps/sphinxbase/swig/sphinxbase.i']
2931
)
3032

3133
ps_sources = (
@@ -49,7 +51,7 @@
4951
]
5052

5153
if sys.platform.startswith('win'):
52-
sb_sources.append('deps/sphinxbase/src/libsphinxad/ad_win32.c')
54+
ad_sources.append('deps/sphinxbase/src/libsphinxad/ad_win32.c')
5355
sb_include_dirs.append('deps/sphinxbase/include/win32')
5456
libraries.append('winmm')
5557
extra_compile_args.extend([
@@ -66,7 +68,7 @@
6668
])
6769
extra_link_args.append('/ignore:4197')
6870
elif sys.platform.startswith('darwin'):
69-
sb_sources.append('deps/sphinxbase/src/libsphinxad/ad_openal.c')
71+
ad_sources.append('deps/sphinxbase/src/libsphinxad/ad_openal.c')
7072
sb_include_dirs.extend([
7173
'/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers',
7274
'deps/sphinxbase/include/android'
@@ -80,7 +82,7 @@
8082
'-Wno-logical-op-parentheses'
8183
])
8284
elif sys.platform.startswith('linux'):
83-
sb_sources.append('deps/sphinxbase/src/libsphinxad/ad_pulse.c')
85+
ad_sources.append('deps/sphinxbase/src/libsphinxad/ad_pulse.c')
8486
sb_include_dirs.append('deps/sphinxbase/include/android')
8587
libraries.extend(['pulse', 'pulse-simple'])
8688
extra_compile_args.extend([
@@ -130,13 +132,23 @@
130132
download_url='https://pypi.python.org/pypi/pocketsphinx',
131133
packages=['sphinxbase', 'pocketsphinx'],
132134
ext_modules=[
135+
Extension(
136+
name='sphinxbase._ad',
137+
sources=ad_sources,
138+
swig_opts=sb_swig_opts,
139+
include_dirs=sb_include_dirs,
140+
extra_objects=extra_objects,
141+
libraries=libraries,
142+
define_macros=define_macros,
143+
extra_compile_args=extra_compile_args,
144+
extra_link_args=extra_link_args,
145+
),
133146
Extension(
134147
name='sphinxbase._sphinxbase',
135148
sources=sb_sources,
136149
swig_opts=sb_swig_opts,
137150
include_dirs=sb_include_dirs,
138151
extra_objects=extra_objects,
139-
libraries=libraries,
140152
define_macros=define_macros,
141153
extra_compile_args=extra_compile_args,
142154
extra_link_args=extra_link_args,
@@ -147,7 +159,6 @@
147159
swig_opts=ps_swig_opts,
148160
include_dirs=sb_include_dirs + ps_include_dirs,
149161
extra_objects=extra_objects,
150-
libraries=libraries,
151162
define_macros=define_macros,
152163
extra_compile_args=extra_compile_args,
153164
extra_link_args=extra_link_args

sphinxbase/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@
2929
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3030
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131

32+
from .ad import *
3233
from .sphinxbase import *

swig/sphinxbase/ad.i

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,20 @@
3535
*
3636
*/
3737

38+
%module ad
39+
40+
%include pybuffer.i
41+
%include typemaps.i
42+
43+
%begin %{
44+
#include <Python.h>
45+
#include <sphinxbase/ad.h>
46+
47+
typedef ad_rec_t Ad;
48+
%}
49+
50+
typedef struct {} Ad;
51+
3852
%extend Ad {
3953
Ad(int *errcode) {
4054
Ad *ad = ad_open();

swig/sphinxbase/sphinxbase.i

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)