diff --git a/examples/Hello/Hello.cpp b/examples/Hello/Hello.cpp index d51ab963..823f1e8d 100644 --- a/examples/Hello/Hello.cpp +++ b/examples/Hello/Hello.cpp @@ -3,22 +3,16 @@ using namespace std; -void -Hello::PrintHello () +Hello::Hello () { - cout << "Hello, World!\n"; } -Hello::Hello () +void Hello::PrintHello(const char* s) { + cout << "PrintHello: " << s << "\n"; } -int -main () +bool Hello::test1(int i, float f) { - Hello h; - - h.PrintHello (); - - return 0; + return i == f; } diff --git a/examples/Hello/Hello.cs b/examples/Hello/Hello.cs index 6a168487..4a9adefb 100644 --- a/examples/Hello/Hello.cs +++ b/examples/Hello/Hello.cs @@ -1,10 +1,11 @@ -using System; +using System; +using CppCsBind; public class HelloExample { public static void Main (String[] args) { - var h = new Hello.Hello (); - h.PrintHello (); + var h = new Hello(); + h.PrintHello ("Hello world"); } } diff --git a/examples/Hello/Hello.h b/examples/Hello/Hello.h index f24f341e..c77d971a 100644 --- a/examples/Hello/Hello.h +++ b/examples/Hello/Hello.h @@ -4,5 +4,6 @@ class Hello public: Hello (); - void PrintHello (); + void PrintHello(const char* s); + bool test1(int i, float f); }; diff --git a/examples/Hello/makeSln.bat b/examples/Hello/makeSln.bat new file mode 100644 index 00000000..b527275c --- /dev/null +++ b/examples/Hello/makeSln.bat @@ -0,0 +1 @@ +@..\..\build\premake4.exe vs2010 diff --git a/examples/Hello/premake4.lua b/examples/Hello/premake4.lua new file mode 100644 index 00000000..c90ec446 --- /dev/null +++ b/examples/Hello/premake4.lua @@ -0,0 +1,51 @@ +common_flags = { } -- Otherwise /clr won't be enabled - bug ? + +solution "Hello" + platforms { "x32" } + configurations { "Debug", "Release" } + + objdir ( "./obj/" ) + targetdir ("./bin/") + debugdir ( "./bin/") + + configuration "Debug" + defines { "DEBUG" } + + configuration "Release" + defines { "NDEBUG" } + flags { "Optimize" } + +project "Hello" + kind "SharedLib" + language "C++" + location "." + platforms { "x32" } + + flags { common_flags, "Managed" } + + configuration "*" + buildoptions { common_msvc_copts, "/clr" } + + files { "**.h", "**.cpp", "./*.lua" } + + configuration "hello.h" + buildrule { + description = "Compiling $(InputFile)...", + commands = { + '..\\..\\bin\\generator.exe -ns=CppCsBind -outdir=CppCsBind -I. hello.h', + }, + outputs = { "CppCsBind\\hello.cpp" } + } + + +project "SayHello" + kind "ConsoleApp" + language "C#" + location "." + platforms { "x32" } + + files { "**.cs", "./*.lua" } + + links { "Hello" } + +