|
|
@ -18,8 +18,9 @@ rule_end() |
|
|
|
rule("library.distribute.header") |
|
|
|
after_build(function (target) |
|
|
|
local projectdir = target:extraconf("rules", "library.distribute.header", "projectdir") |
|
|
|
local outputdir = path.join(target:targetdir(), "..", "include") |
|
|
|
local outputdir = path.join(os.projectdir(), "distribute", "include") |
|
|
|
if has_config("shipping_one") then |
|
|
|
print("Distributing header files for project: " .. target:name()) |
|
|
|
for _, filepath in ipairs(os.files(path.join(projectdir, "interface", "*.h"))) do |
|
|
|
local file = io.readfile(filepath) |
|
|
|
|
|
|
@ -32,6 +33,7 @@ rule("library.distribute.header") |
|
|
|
local replace_api2 = string.gsub(replace_api1, "API", "__declspec(dllimport)") |
|
|
|
|
|
|
|
io.writefile(path.join(outputdir, path.filename(filepath)), replace_api2) |
|
|
|
print("Distributed header file: " .. path.filename(filepath)) |
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
@ -40,8 +42,9 @@ rule_end() |
|
|
|
rule("library.force.distribute.header") |
|
|
|
after_build(function (target) |
|
|
|
local headers = target:extraconf("rules", "library.force.distribute.header", "headers") |
|
|
|
local outputdir = path.join(target:targetdir(), "..", "include") |
|
|
|
local outputdir = path.join(os.projectdir(), "distribute", "include") |
|
|
|
if has_config("shipping_one") then |
|
|
|
print("Forcing distribution of header files: " .. headers) |
|
|
|
for _, filepath in ipairs(os.files(headers)) do |
|
|
|
local file = io.readfile(filepath) |
|
|
|
|
|
|
@ -54,6 +57,21 @@ rule("library.force.distribute.header") |
|
|
|
local replace_api2 = string.gsub(replace_api1, "API", "__declspec(dllimport)") |
|
|
|
|
|
|
|
io.writefile(path.join(outputdir, path.filename(filepath)), replace_api2) |
|
|
|
print("Forced distribution of header file: " .. path.filename(filepath)) |
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
|
rule_end() |
|
|
|
|
|
|
|
rule("library.headeronly.distribute.header") |
|
|
|
on_build(function (target) |
|
|
|
print("Distributing header files for header-only library: " .. target:name()) |
|
|
|
local projectdir = target:extraconf("rules", "library.headeronly.distribute.header", "projectdir") |
|
|
|
local outputdir = path.join(os.projectdir(), "distribute", "include") |
|
|
|
if has_config("shipping_one") then |
|
|
|
for _, filepath in ipairs(os.files(path.join(projectdir, "**", "*.h"))) do |
|
|
|
os.cp(filepath, outputdir) |
|
|
|
print("Distributed header file: " .. path.filename(filepath)) |
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
|