var Build = xdc.useModule('xdc.bld.BuildEnvironment'); var Pkg = xdc.useModule('xdc.bld.PackageContents'); var Executable = xdc.useModule('xdc.bld.Executable'); var TEST_NAMES = ["CalcTest"]; Pkg.otherFiles = [java.lang.System.getenv("TIDSP_REPO_ROOT") + "/ti_libs/IQmath/lib/IQmath_c64x+.lib"]; for each (var targ in Build.targets) { for each (var testName in TEST_NAMES) { Pkg.addRepository(java.lang.System.getenv("TIDSP_REPO_ROOT") + "/MyCompanyLibs/packages/"); Pkg.addExecutable(testName, targ, targ.platform).addObjects([testName + ".c"]); } }
I think you wanted to add this library to the link line of the executable. This can be done as follows: /* define IQ lib location */ var IQLIB = java.lang.System.getenv("TIDSP_REPO_ROOT") + "/ti_libs/IQmath/lib/IQmath_c64x+.lib"; /* define linker options necessary to use IQ lib */ var attrs = {lopts: '-l "' + IQLIB + '"'}; /* use these linker options when creating the following test */ var exe = Pkg.addExecutable(testName, targ, targ.platform, attrs); exe.addObjects([testName + ".c"]); If all executables in your package need to use IQLIB you can simplify this (like the -I above) by simply setting Pkg.attrs.lopts: Pkg.attrs.lopts = '-l "' + IQLIB + '"'; > for each (var targ in Build.targets) { > for each (var testName in TEST_NAMES) > { > Pkg.addRepository(java.lang.System.getenv("TIDSP_REPO_ROOT") + > "/MyCompanyLibs/packages/"); Pkg.addRepository() is used to add a repository into the current package. Again, I don't think this is what you wanted to do and the line above should be removed. > Pkg.addExecutable(testName, targ, targ.platform).addObjects([testName + > ".c"]); > } > } > > > Thanks for your time. In summary, I think you want something like the following: var Build = xdc.useModule('xdc.bld.BuildEnvironment'); var Pkg = xdc.useModule('xdc.bld.PackageContents'); var ROOT = java.lang.System.getenv("TIDSP_REPO_ROOT"); var IQLIB = ROOT + "/ti_libs/IQmath/lib/IQmath_c64x+.lib"; var IQINC = ROOT + "/ti_libs/IQmath/include"; Pkg.attrs.incs = '-I "' + IQINC + '"'; Pkg.attrs.lopts = '-l "' + IQLIB + '"'; var TEST_NAMES = ["CalcTest"]; for each (var targ in Build.targets) { for each (var testName in TEST_NAMES) { Pkg.addExecutable(testName, targ, targ.platform).addObjects([testName + ".c"]); } }
codec 增加lib库的参考
最新推荐文章于 2021-08-10 14:01:34 发布