forked from nvaccess/nvda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsconscript
More file actions
58 lines (49 loc) · 1.53 KB
/
sconscript
File metadata and controls
58 lines (49 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2025 NV Access Limited, Wang Chong
# This file may be used under the terms of the GNU General Public License, version 2 or later, as modified by the NVDA license.
# For full terms and any additional permissions, see the NVDA license file: https://github.com/nvaccess/nvda/blob/master/copying.txt
import typing # noqa: E402
import os
Import(
[
"thirdPartyEnv",
"sourceDir",
]
)
thirdPartyEnv: Environment = thirdPartyEnv
env: Environment = typing.cast(Environment, thirdPartyEnv.Clone())
cppjiebaPath = Dir("#include/cppjieba")
cppjiebaSrcPath = cppjiebaPath.Dir("include/cppjieba")
cppjiebaDictPath = cppjiebaPath.Dir("dict")
outDir = sourceDir.Dir("cppjieba")
unitTestDictsDir = env.Dir("#tests/unit/cppjiebaDicts")
LimonpPath = cppjiebaPath.Dir("deps/limonp") # cppjieba's dependency
LimonpSrcPath = LimonpPath.Dir("include/limonp")
env.Prepend(
CPPPATH=[
cppjiebaSrcPath,
LimonpSrcPath.Dir(".."),
]
)
sourceFiles = [
"cppjieba.cpp",
"cppjieba.def",
]
env.AppendUnique(
CCFLAGS=['/wd4819'],
CXXFLAGS=['/wd4819'],
)
cppjiebaLib = env.SharedLibrary(target="cppjieba", source=sourceFiles)
if not os.path.exists(outDir.Dir("dicts").get_abspath()) or not os.listdir(outDir.Dir("dicts").get_abspath()): # ensure dicts installation happens only once and avoid a scons' warning
env.Install(
outDir.Dir("dicts"),
[
env.Dir(cppjiebaDictPath).File(name)
for name in (
"jieba.dict.utf8",
"user.dict.utf8",
"hmm_model.utf8",
)
]
)
Return("cppjiebaLib")