Skip to content

Commit 3aab30f

Browse files
committed
Add built-in compilation of extra symbols
Fixes #1456 and #1253. Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 1e60113 commit 3aab30f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1473
-1234
lines changed

build/LLVM.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ function SetupLLVMIncludes()
4242
includedirs
4343
{
4444
path.join(LLVMRootDirDebug, "include"),
45+
path.join(LLVMRootDirDebug, "lld/include"),
4546
path.join(LLVMRootDirDebug, "clang/include"),
4647
path.join(LLVMRootDirDebug, "clang/lib"),
4748
path.join(LLVMRootDirDebug, "build/include"),
@@ -52,6 +53,7 @@ function SetupLLVMIncludes()
5253
includedirs
5354
{
5455
path.join(LLVMRootDirRelease, "include"),
56+
path.join(LLVMRootDirRelease, "lld/include"),
5557
path.join(LLVMRootDirRelease, "clang/include"),
5658
path.join(LLVMRootDirRelease, "clang/lib"),
5759
path.join(LLVMRootDirRelease, "build/include"),
@@ -62,6 +64,7 @@ function SetupLLVMIncludes()
6264
includedirs
6365
{
6466
path.join(LLVMRootDir, "include"),
67+
path.join(LLVMRootDir, "lld/include"),
6568
path.join(LLVMRootDir, "clang/include"),
6669
path.join(LLVMRootDir, "clang/lib"),
6770
path.join(LLVMBuildDir, "include"),
@@ -195,7 +198,16 @@ function SetupLLVMLibs()
195198
"LLVMDebugInfoMSF",
196199
"LLVMBinaryFormat",
197200
"LLVMSupport",
198-
"LLVMDemangle"
201+
"LLVMDemangle",
202+
"lldCommon",
203+
"lldCore",
204+
"lldCOFF",
205+
"lldELF",
206+
"lldDriver",
207+
"lldReaderWriter",
208+
"lldYAML",
209+
"lldMachO",
210+
"lldMachOOld"
199211
}
200212

201213
filter(c)

src/AST/TargetTriple.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public static bool IsWindows(this string targetTriple)
1010
{
1111
var parts = targetTriple.Split('-');
1212
return parts.Contains("windows") ||
13-
parts.Contains("win32") || parts.Contains("win64");
13+
parts.Contains("win32") || parts.Contains("win64") ||
14+
parts.Any(p => p.StartsWith("mingw"));
1415
}
1516

1617
public static bool IsMacOS(this string targetTriple)

src/CppParser/Bindings/CLI/CppParser.cpp

Lines changed: 127 additions & 50 deletions
Large diffs are not rendered by default.

src/CppParser/Bindings/CLI/CppParser.h

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ namespace CppSharp
1717
enum class ParserResultKind;
1818
enum class SourceLocationKind;
1919
ref class ClangParser;
20+
ref class CppLinkerOptions;
2021
ref class CppParserOptions;
21-
ref class LinkerOptions;
2222
ref class Parser;
2323
ref class ParserDiagnostic;
2424
ref class ParserResult;
@@ -87,6 +87,12 @@ namespace CppSharp
8787
void set(::System::Collections::Generic::List<::System::String^>^);
8888
}
8989

90+
property ::System::Collections::Generic::List<::System::String^>^ CompilationOptions
91+
{
92+
::System::Collections::Generic::List<::System::String^>^ get();
93+
void set(::System::Collections::Generic::List<::System::String^>^);
94+
}
95+
9096
property ::System::Collections::Generic::List<::System::String^>^ SourceFiles
9197
{
9298
::System::Collections::Generic::List<::System::String^>^ get();
@@ -199,6 +205,11 @@ namespace CppSharp
199205
unsigned int get();
200206
}
201207

208+
property unsigned int CompilationOptionsCount
209+
{
210+
unsigned int get();
211+
}
212+
202213
property unsigned int SourceFilesCount
203214
{
204215
unsigned int get();
@@ -235,6 +246,12 @@ namespace CppSharp
235246

236247
void ClearArguments();
237248

249+
::System::String^ GetCompilationOptions(unsigned int i);
250+
251+
void AddCompilationOptions(::System::String^ s);
252+
253+
void ClearCompilationOptions();
254+
238255
::System::String^ GetSourceFiles(unsigned int i);
239256

240257
void AddSourceFiles(::System::String^ s);
@@ -276,26 +293,26 @@ namespace CppSharp
276293
bool __ownsNativeInstance;
277294
};
278295

279-
public ref class LinkerOptions : ICppInstance
296+
public ref class CppLinkerOptions : ICppInstance
280297
{
281298
public:
282299

283-
property struct ::CppSharp::CppParser::LinkerOptions* NativePtr;
300+
property struct ::CppSharp::CppParser::CppLinkerOptions* NativePtr;
284301
property ::System::IntPtr __Instance
285302
{
286303
virtual ::System::IntPtr get();
287304
virtual void set(::System::IntPtr instance);
288305
}
289306

290-
LinkerOptions(struct ::CppSharp::CppParser::LinkerOptions* native);
291-
LinkerOptions(struct ::CppSharp::CppParser::LinkerOptions* native, bool ownNativeInstance);
292-
static LinkerOptions^ __CreateInstance(::System::IntPtr native);
293-
static LinkerOptions^ __CreateInstance(::System::IntPtr native, bool __ownsNativeInstance);
294-
LinkerOptions();
307+
CppLinkerOptions(struct ::CppSharp::CppParser::CppLinkerOptions* native);
308+
CppLinkerOptions(struct ::CppSharp::CppParser::CppLinkerOptions* native, bool ownNativeInstance);
309+
static CppLinkerOptions^ __CreateInstance(::System::IntPtr native);
310+
static CppLinkerOptions^ __CreateInstance(::System::IntPtr native, bool __ownsNativeInstance);
311+
CppLinkerOptions();
295312

296-
LinkerOptions(CppSharp::Parser::LinkerOptions^ _0);
313+
CppLinkerOptions(CppSharp::Parser::CppLinkerOptions^ _0);
297314

298-
~LinkerOptions();
315+
~CppLinkerOptions();
299316

300317
property ::System::Collections::Generic::List<::System::String^>^ Arguments
301318
{
@@ -504,7 +521,13 @@ namespace CppSharp
504521

505522
static CppSharp::Parser::ParserResult^ ParseHeader(CppSharp::Parser::CppParserOptions^ Opts);
506523

507-
static CppSharp::Parser::ParserResult^ ParseLibrary(CppSharp::Parser::LinkerOptions^ Opts);
524+
static CppSharp::Parser::ParserResult^ ParseLibrary(CppSharp::Parser::CppLinkerOptions^ Opts);
525+
526+
static CppSharp::Parser::ParserResult^ Build(CppSharp::Parser::CppParserOptions^ Opts, CppSharp::Parser::CppLinkerOptions^ LinkerOptions, ::System::String^ File, bool Last);
527+
528+
static CppSharp::Parser::ParserResult^ Compile(CppSharp::Parser::CppParserOptions^ Opts, ::System::String^ File);
529+
530+
static CppSharp::Parser::ParserResult^ Link(CppSharp::Parser::CppParserOptions^ Opts, CppSharp::Parser::CppLinkerOptions^ LinkerOptions, ::System::String^ File, bool Last);
508531

509532
protected:
510533

src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser-symbols.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ extern "C" void c__N_CppSharp_N_CppParser_S_ParserTargetInfo_ParserTargetInfo___
372372
struct CppSharp::CppParser::ParserTargetInfo& (CppSharp::CppParser::ParserTargetInfo::*_239)(const struct CppSharp::CppParser::ParserTargetInfo&) = &CppSharp::CppParser::ParserTargetInfo::operator=;
373373
extern "C" void c__N_CppSharp_N_CppParser_S_CppParserOptions_CppParserOptions___1__N_CppSharp_N_CppParser_S_CppParserOptions(void* __instance, const CppSharp::CppParser::CppParserOptions& _0) { ::new (__instance) CppSharp::CppParser::CppParserOptions(_0); }
374374
struct CppSharp::CppParser::CppParserOptions& (CppSharp::CppParser::CppParserOptions::*_240)(const struct CppSharp::CppParser::CppParserOptions&) = &CppSharp::CppParser::CppParserOptions::operator=;
375-
extern "C" void c__N_CppSharp_N_CppParser_S_LinkerOptions_LinkerOptions___1__N_CppSharp_N_CppParser_S_LinkerOptions(void* __instance, const CppSharp::CppParser::LinkerOptions& _0) { ::new (__instance) CppSharp::CppParser::LinkerOptions(_0); }
376-
struct CppSharp::CppParser::LinkerOptions& (CppSharp::CppParser::LinkerOptions::*_241)(const struct CppSharp::CppParser::LinkerOptions&) = &CppSharp::CppParser::LinkerOptions::operator=;
375+
extern "C" void c__N_CppSharp_N_CppParser_S_CppLinkerOptions_CppLinkerOptions___1__N_CppSharp_N_CppParser_S_CppLinkerOptions(void* __instance, const CppSharp::CppParser::CppLinkerOptions& _0) { ::new (__instance) CppSharp::CppParser::CppLinkerOptions(_0); }
376+
struct CppSharp::CppParser::CppLinkerOptions& (CppSharp::CppParser::CppLinkerOptions::*_241)(const struct CppSharp::CppParser::CppLinkerOptions&) = &CppSharp::CppParser::CppLinkerOptions::operator=;
377377
struct CppSharp::CppParser::ParserDiagnostic& (CppSharp::CppParser::ParserDiagnostic::*_242)(const struct CppSharp::CppParser::ParserDiagnostic&) = &CppSharp::CppParser::ParserDiagnostic::operator=;
378378
struct CppSharp::CppParser::ParserResult& (CppSharp::CppParser::ParserResult::*_243)(const struct CppSharp::CppParser::ParserResult&) = &CppSharp::CppParser::ParserResult::operator=;
379379
class CppSharp::CppParser::ClangParser& (CppSharp::CppParser::ClangParser::*_244)(class CppSharp::CppParser::ClangParser&&) = &CppSharp::CppParser::ClangParser::operator=;

0 commit comments

Comments
 (0)