Skip to content

Commit

Permalink
support multiple include and libpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurel300 committed Sep 17, 2021
1 parent 2a2fe1e commit b922a96
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/ammer/Config.hx
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class Config {
return {
name: libname,
linkName: getDefine('ammer.lib.${libname}.linkName', libname).split(","),
includePath: getPath('ammer.lib.${libname}.include'),
libraryPath: getPath('ammer.lib.${libname}.library'),
includePath: getPath('ammer.lib.${libname}.include').split(","),
libraryPath: getPath('ammer.lib.${libname}.library').split(","),
headers: getDefine('ammer.lib.${libname}.headers', '${libname}.h').split(","),
abi: getEnum('ammer.lib.${libname}.abi', [
"c" => AmmerAbi.C,
Expand Down Expand Up @@ -174,8 +174,8 @@ typedef AmmerConfigLua = {
typedef AmmerLibraryConfig = {
name:String,
linkName:Array<String>,
includePath:String,
libraryPath:String,
includePath:Array<String>,
libraryPath:Array<String>,
headers:Array<String>,
abi:AmmerAbi,
contexts:Array<AmmerContext>
Expand Down
4 changes: 2 additions & 2 deletions src/ammer/build/BuildHl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class BuildHl {
requires: [BuildTools.extensions('ammer_${library.name}.hl.%OBJ%')],
command: LinkLibrary(library.abi, {
defines: ["LIBHL_EXPORTS"],
libraryPaths: (config.hl.hlLibraryPath != null ? [config.hl.hlLibraryPath] : []).concat([library.libraryPath]),
libraryPaths: (config.hl.hlLibraryPath != null ? [config.hl.hlLibraryPath] : []).concat(library.libraryPath),
libraries: [config.useMSVC ? "libhl" : "hl"].concat(library.linkName),
})
},
{
target: BuildTools.extensions('ammer_${library.name}.hl.%OBJ%'),
requires: ['ammer_${library.name}.hl.${sourceExt}'],
command: CompileObject(library.abi, {
includePaths: (config.hl.hlIncludePath != null ? [config.hl.hlIncludePath] : []).concat([library.includePath])
includePaths: (config.hl.hlIncludePath != null ? [config.hl.hlIncludePath] : []).concat(library.includePath)
})
}
];
Expand Down
4 changes: 2 additions & 2 deletions src/ammer/build/BuildLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BuildLua {
requires: [BuildTools.extensions('ammer_${library.name}.lua.%OBJ%')],
command: LinkLibrary(library.abi, {
defines: [],
libraryPaths: (config.lua.luaLibraryPath != null ? [config.lua.luaLibraryPath] : []).concat([library.libraryPath]),
libraryPaths: (config.lua.luaLibraryPath != null ? [config.lua.luaLibraryPath] : []).concat(library.libraryPath),
libraries: library.linkName,
staticLibraries: [config.useMSVC ? "liblua" : "lua"]
})
Expand All @@ -27,7 +27,7 @@ class BuildLua {
target: BuildTools.extensions('ammer_${library.name}.lua.%OBJ%'),
requires: ['ammer_${library.name}.lua.${sourceExt}'],
command: CompileObject(library.abi, {
includePaths: (config.lua.luaIncludePath != null ? [config.lua.luaIncludePath] : []).concat([library.includePath])
includePaths: (config.lua.luaIncludePath != null ? [config.lua.luaIncludePath] : []).concat(library.includePath)
})
}
];
Expand Down
6 changes: 4 additions & 2 deletions src/ammer/patch/PatchCpp.hx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ class PatchCpp {
var lb = new LineBuf();
lb.ai('<files id="haxe">\n');
lb.indent(() -> {
lb.ai('<compilerflag value="-I${ctx.libraryConfig.includePath}"/>\n');
for (path in ctx.libraryConfig.includePath)
lb.ai('<compilerflag value="-I$path"/>\n');
});
lb.ai('</files>\n');
lb.ai('<target id="haxe">\n');
lb.indent(() -> {
lb.ai('<libpath name="${ctx.libraryConfig.libraryPath}"/>\n');
for (path in ctx.libraryConfig.libraryPath)
lb.ai('<libpath name="$path"/>\n');
for (name in ctx.libraryConfig.linkName) {
lb.ai('<lib name="-l$name" unless="windows" />\n');
lb.ai('<lib name="$name" if="windows" />\n');
Expand Down

0 comments on commit b922a96

Please sign in to comment.