mirror of https://github.com/mono/CppSharp.git
7 changed files with 160 additions and 113 deletions
@ -0,0 +1,77 @@ |
|||||||
|
-- This module checks for the all the project dependencies. |
||||||
|
|
||||||
|
action = _ACTION or "" |
||||||
|
|
||||||
|
depsdir = path.getabsolute("../deps"); |
||||||
|
srcdir = path.getabsolute("../src"); |
||||||
|
incdir = path.getabsolute("../inc"); |
||||||
|
bindir = path.getabsolute("../bin"); |
||||||
|
examplesdir = path.getabsolute("../examples"); |
||||||
|
testsdir = path.getabsolute("../tests"); |
||||||
|
|
||||||
|
builddir = path.getabsolute("./" .. action); |
||||||
|
libdir = path.join(builddir, "lib"); |
||||||
|
|
||||||
|
common_flags = { "Unicode", "Symbols" } |
||||||
|
msvc_buildflags = { } -- "/wd4190", "/wd4996", "/wd4530" |
||||||
|
gcc_buildflags = { "-std=gnu++11" } |
||||||
|
|
||||||
|
msvc_cpp_defines = { } |
||||||
|
|
||||||
|
function SetupNativeProject() |
||||||
|
location (path.join(builddir, "projects")) |
||||||
|
|
||||||
|
c = configuration "Debug" |
||||||
|
defines { "DEBUG" } |
||||||
|
targetsuffix "_d" |
||||||
|
|
||||||
|
configuration "Release" |
||||||
|
defines { "NDEBUG" } |
||||||
|
|
||||||
|
-- Compiler-specific options |
||||||
|
|
||||||
|
configuration "vs*" |
||||||
|
buildoptions { msvc_buildflags } |
||||||
|
defines { msvc_cpp_defines } |
||||||
|
|
||||||
|
configuration "gcc" |
||||||
|
buildoptions { gcc_buildflags } |
||||||
|
|
||||||
|
-- OS-specific options |
||||||
|
|
||||||
|
configuration "Windows" |
||||||
|
defines { "WIN32", "_WINDOWS" } |
||||||
|
|
||||||
|
configuration(c) |
||||||
|
end |
||||||
|
|
||||||
|
function IncludeDir(dir) |
||||||
|
local deps = os.matchdirs(dir .. "/*") |
||||||
|
|
||||||
|
for i,dep in ipairs(deps) do |
||||||
|
local fp = path.join(dep, "premake4.lua") |
||||||
|
fp = path.join(os.getcwd(), fp) |
||||||
|
|
||||||
|
if os.isfile(fp) then |
||||||
|
print(string.format(" including %s", dep)) |
||||||
|
include(dep) |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
-- Examples helpers |
||||||
|
|
||||||
|
function SetupExampleProject() |
||||||
|
SetupNativeProjects() |
||||||
|
location (path.join(builddir, "deps")) |
||||||
|
end |
||||||
|
|
||||||
|
function IncludeExamples() |
||||||
|
print("Searching for examples...") |
||||||
|
IncludeDir(examplesdir) |
||||||
|
end |
||||||
|
|
||||||
|
function IncludeTests() |
||||||
|
print("Searching for tests...") |
||||||
|
IncludeDir(testsdir) |
||||||
|
end |
@ -1,55 +1,34 @@ |
|||||||
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", "WIN32" } |
|
||||||
|
|
||||||
configuration "Release" |
|
||||||
defines { "NDEBUG", "WIN32" } |
|
||||||
flags { "Optimize" } |
|
||||||
|
|
||||||
project "Hello" |
project "Hello" |
||||||
kind "SharedLib" |
|
||||||
language "C++" |
|
||||||
location "." |
|
||||||
platforms { "x32" } |
|
||||||
|
|
||||||
flags { common_flags, "Managed" } |
|
||||||
|
|
||||||
configuration "*" |
SetupNativeProject() |
||||||
buildoptions { common_msvc_copts, "/clr" } |
kind "SharedLib" |
||||||
|
language "C++" |
||||||
|
|
||||||
files { "**.h", "**.cpp", "./*.lua" } |
flags { common_flags, "Managed" } |
||||||
|
|
||||||
-- Autogenerated files, so not available on first build - specify them manually |
files { "**.h", "**.cpp", "./*.lua" } |
||||||
excludes { "CppCsBind/*.*" } |
|
||||||
files { "CppCsBind/hello_wrapper.h", "CppCsBind/hello_wrapper.cpp" } |
|
||||||
|
|
||||||
configuration "hello.h" |
-- Autogenerated files, so not available on first build - specify them manually |
||||||
buildrule { |
excludes { "CppCsBind/*.*" } |
||||||
description = "Compiling $(InputFile)...", |
files { "CppCsBind/hello_wrapper.h", "CppCsBind/hello_wrapper.cpp" } |
||||||
commands = { |
|
||||||
'..\\..\\bin\\generator.exe -D=WIN32 -vs=10 -ns=CppCsBind -outdir=CppCsBind -I. hello.h', |
|
||||||
}, |
|
||||||
outputs = { "CppCsBind\\hello_wrapper.cpp" } |
|
||||||
} |
|
||||||
|
|
||||||
|
configuration "hello.h" |
||||||
|
buildrule { |
||||||
|
description = "Compiling $(InputFile)...", |
||||||
|
commands = { |
||||||
|
'..\\..\\bin\\generator.exe -D=WIN32 -vs=10 -ns=CppCsBind -outdir=CppCsBind -I. hello.h', |
||||||
|
}, |
||||||
|
outputs = { "CppCsBind\\hello_wrapper.cpp" } |
||||||
|
} |
||||||
|
|
||||||
project "SayHello" |
project "SayHello" |
||||||
kind "ConsoleApp" |
|
||||||
language "C#" |
|
||||||
location "." |
|
||||||
platforms { "x32" } |
|
||||||
|
|
||||||
files { "**.cs", "./*.lua" } |
kind "ConsoleApp" |
||||||
|
language "C#" |
||||||
|
location "." |
||||||
|
|
||||||
|
files { "**.cs", "./*.lua" } |
||||||
|
|
||||||
links { "Hello" } |
links { "Hello" } |
||||||
|
|
||||||
|
|
||||||
|
@ -1,15 +1,10 @@ |
|||||||
project "Generator" |
project "Generator" |
||||||
kind "ConsoleApp" |
|
||||||
language "C#" |
|
||||||
location "." |
|
||||||
files { "**.cs", "**.bmp", "**.resx", "**.config" } |
|
||||||
excludes { "Filter.cs" } |
|
||||||
links { "Bridge", "System", "System.Core", "Parser" } |
|
||||||
platforms { "x32" } |
|
||||||
|
|
||||||
configuration "Debug" |
kind "ConsoleApp" |
||||||
targetdir "../../bin" |
language "C#" |
||||||
|
location "." |
||||||
|
|
||||||
configuration "Release" |
files { "**.cs", "**.bmp", "**.resx", "**.config" } |
||||||
targetdir "../../bin" |
excludes { "Filter.cs" } |
||||||
|
|
||||||
|
links { "System", "System.Core", "Bridge", "Parser" } |
||||||
|
Loading…
Reference in new issue