Skip to content

Commit c10fa04

Browse files
committed
Add experimental meson.build file
1 parent 9a0e2fa commit c10fa04

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

dummy_main.d

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Add a dummy main so that there are not any linking issue when building
2+
// unittest for dstep
3+
void main() {}

meson.build

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
project('dstep', 'd', version: '1.0.1')
2+
3+
if get_option('buildtype') == 'release'
4+
add_project_arguments('-O3', language: 'd')
5+
endif
6+
7+
resource_dir = meson.current_source_dir() / 'resources'
8+
add_project_arguments('-J=' + resource_dir, language: 'd')
9+
10+
src = [
11+
'clang/Compiler.d',
12+
'clang/Cursor.d',
13+
'clang/Diagnostic.d',
14+
'clang/File.d',
15+
'clang/Index.d',
16+
'clang/SourceLocation.d',
17+
'clang/SourceRange.d',
18+
'clang/Token.d',
19+
'clang/TranslationUnit.d',
20+
'clang/Type.d',
21+
'clang/Util.d',
22+
'clang/Visitor.d',
23+
'clang/c/BuildSystem.d',
24+
'clang/c/CXCompilationDatabase.d',
25+
'clang/c/CXErrorCode.d',
26+
'clang/c/CXString.d',
27+
'clang/c/Documentation.d',
28+
'clang/c/Index.d',
29+
'clang/c/Platform.d',
30+
'dstep/Configuration.d',
31+
'dstep/core/Exceptions.d',
32+
'dstep/driver/Application.d',
33+
'dstep/driver/CommandLine.d',
34+
'dstep/driver/Util.d',
35+
'dstep/translator/CommentIndex.d',
36+
'dstep/translator/Context.d',
37+
'dstep/translator/ConvertCase.d',
38+
'dstep/translator/Declaration.d',
39+
'dstep/translator/Enum.d',
40+
'dstep/translator/HeaderIndex.d',
41+
'dstep/translator/IncludeHandler.d',
42+
'dstep/translator/MacroDefinition.d',
43+
'dstep/translator/MacroIndex.d',
44+
'dstep/translator/MacroParser.d',
45+
'dstep/translator/Options.d',
46+
'dstep/translator/Output.d',
47+
'dstep/translator/Preprocessor.d',
48+
'dstep/translator/Record.d',
49+
'dstep/translator/Translator.d',
50+
'dstep/translator/Type.d',
51+
'dstep/translator/TypeInference.d',
52+
'dstep/translator/TypedefIndex.d',
53+
'dstep/translator/objc/Category.d',
54+
'dstep/translator/objc/ObjcInterface.d',
55+
]
56+
57+
# Required for adding llvm as dependency
58+
add_languages('cpp')
59+
# Only clang is required, but adding llvm also add the directory where
60+
# libclang.so is found
61+
llvm = dependency('llvm')
62+
# Link to clang
63+
add_project_link_arguments('-L=-lclang', language: 'd')
64+
65+
executable(
66+
'dstep',
67+
src + [ 'dstep/main.d' ],
68+
dependencies: [ llvm ]
69+
)
70+
71+
unittest_exe = executable(
72+
'dstep_unittest',
73+
src + [ 'dummy_main.d' ],
74+
dependencies: [ llvm ],
75+
d_unittest: true
76+
)
77+
test('unittest', unittest_exe)
78+

0 commit comments

Comments
 (0)