#!/usr/bin/python import sys sys.path.insert(0, "../../") import csbuild from csbuild import log csbuild.Toolchain("gcc").SetCxxCommand("clang++") @csbuild.project( name="myApp", workingDirectory="myApp", depends=[ "myLib", ], ) def myApp(): csbuild.AddLibraries("m", "c") csbuild.SetOutput("myApp", csbuild.ProjectType.Application) @csbuild.postPrepareBuildStep def ppbstep(project): expectedOrder = [ "c", "myLib", "iberty", "myLib2", "m", "dl", "pthread", "bfd" ] if list(project.libraries) != expectedOrder: log.LOG_ERROR("{} != {}".format(list(project.libraries), expectedOrder)) sys.exit(1) else: log.LOG_LINKER("Library order test successful.") sys.exit(0) @csbuild.project( name="myLib", workingDirectory="myLib", depends=[ "myLib2", ], ) def myLib(): csbuild.SetOutput("myLib", csbuild.ProjectType.StaticLibrary) @csbuild.scope(csbuild.ScopeDef.Final) def finalScope(): csbuild.AddLibraries("m", "iberty", "bfd") @csbuild.project( name="myLib2", workingDirectory="myLib2", depends=[], ) def myLib(): csbuild.SetOutput("myLib2", csbuild.ProjectType.StaticLibrary) @csbuild.scope(csbuild.ScopeDef.Final) def finalScope(): csbuild.AddLibraries("m", "dl", "pthread", "bfd")
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 14046 | ShadauxCat |
- Created _utils.OrderedSet() - a set which will keep all items in the same order they were inserted in - Changed all sets to OrderedSets - Fixed a missing space in the gcc toolchain - Fixed AddStaticLibraries() and AddSharedLibraries() having incorrect behavior on gcc and android toolchains, and being ignored entirely on the darwin toolchain - Added logic to ensure order of libraries - when linking, a library marked as a dependency of another library is always guaranteed to show up in the libraries list after the library that depends on it, unless there is a circular dependency, in which case luck of the draw. This should actually make it feasible to use EnableStrictOrdering() for the linux gcc toolchain again; previously the libraries ended up in undefined order and that setting was impossible to use. - Added a unit test to ensure strict ordering. It lists linux libraries, but will still work on Windows as it exits before the library verification process. - Also fixed paths in the default debug and release targets not properly being fixed up and actually outputting to a folder named {project.activeToolchainName}-{project.outputArchitecture}-{project.targetName} |