Browse Source

Wire -Ddefine support.

pull/1/head
Tarmo Pikaro 13 years ago committed by triton
parent
commit
e203d5fcea
  1. 4
      examples/Hello/Hello.h
  2. 6
      examples/Hello/premake4.lua
  3. 5
      src/Generator/CodeGenerator.cs
  4. 6
      src/Parser/Parser.cpp
  5. 2
      src/Parser/Parser.h

4
examples/Hello/Hello.h

@ -2,6 +2,10 @@ @@ -2,6 +2,10 @@
#include <iostream>
#include <fstream>
#ifndef WIN32
#error "Generator should understand defines as well"
#endif
class Hello
{
public:

6
examples/Hello/premake4.lua

@ -9,10 +9,10 @@ solution "Hello" @@ -9,10 +9,10 @@ solution "Hello"
debugdir ( "./bin/")
configuration "Debug"
defines { "DEBUG" }
defines { "DEBUG", "WIN32" }
configuration "Release"
defines { "NDEBUG" }
defines { "NDEBUG", "WIN32" }
flags { "Optimize" }
project "Hello"
@ -36,7 +36,7 @@ project "Hello" @@ -36,7 +36,7 @@ project "Hello"
buildrule {
description = "Compiling $(InputFile)...",
commands = {
'..\\..\\bin\\generator.exe -vs=10 -ns=CppCsBind -outdir=CppCsBind -I. hello.h',
'..\\..\\bin\\generator.exe -D=WIN32 -vs=10 -ns=CppCsBind -outdir=CppCsBind -I. hello.h',
},
outputs = { "CppCsBind\\hello_wrapper.cpp" }
}

5
src/Generator/CodeGenerator.cs

@ -44,8 +44,13 @@ namespace Cxxi @@ -44,8 +44,13 @@ namespace Cxxi
{
Library = library,
Verbose = false,
<<<<<<< HEAD
IncludeDirs = options.IncludeDirs
FileName = file,
=======
IncludeDirs = options.IncludeDirs,
Defines = options.Defines,
>>>>>>> 7304ce4... Wire -Ddefine support.
toolSetToUse = options.toolset2use
};

6
src/Parser/Parser.cpp

@ -208,6 +208,12 @@ void Parser::Setup(ParserOptions^ Opts) @@ -208,6 +208,12 @@ void Parser::Setup(ParserOptions^ Opts)
C->getHeaderSearchOpts().AddPath(s, frontend::Angled, true, false, true);
}
for each(System::String^% def in Opts->Defines)
{
String s = marshalString<E_UTF8>(def);
C->getPreprocessorOpts().addMacroDef(s);
}
// Initialize the default platform headers.
std::string ResourceDir = GetClangResourceDir(".");
C->getHeaderSearchOpts().ResourceDir = ResourceDir;

2
src/Parser/Parser.h

@ -37,10 +37,12 @@ public ref struct ParserOptions @@ -37,10 +37,12 @@ public ref struct ParserOptions
ParserOptions()
{
IncludeDirs = gcnew List<System::String^>();
Defines = gcnew List<System::String^>();
}
// Include directories
List<System::String^>^ IncludeDirs;
List<System::String^>^ Defines;
// C/C++ header file name.
System::String^ FileName;

Loading…
Cancel
Save