-
Notifications
You must be signed in to change notification settings - Fork 263
Fixes to enable swift section objects #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,11 +81,17 @@ def main(): | |
action="store_true", | ||
dest="test", | ||
default=False) | ||
parser.add_argument("--arch", | ||
help="target architecture", | ||
action="store", | ||
dest="arch", | ||
default=None) | ||
args = parser.parse_args() | ||
|
||
swiftc = os.path.abspath(args.swiftc) | ||
build_dir = os.path.abspath(args.build_dir) | ||
swift_build_dir = os.path.abspath(args.swift_build_dir) | ||
arch = args.arch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit-pick: You could simply reference |
||
|
||
if not os.path.exists(build_dir): | ||
run("mkdir -p {}".format(build_dir)) | ||
|
@@ -112,7 +118,7 @@ def main(): | |
run("{0} -c {1} -emit-object {2} -module-name XCTest -parse-as-library -emit-module " | ||
"-emit-module-path {3}/XCTest.swiftmodule -o {3}/XCTest.o -force-single-frontend-invocation " | ||
"-module-link-name XCTest".format(swiftc, style_options, " ".join(sourcePaths), build_dir)) | ||
run("clang {0}/XCTest.o -shared -o {0}/libXCTest.so -Wl,--no-undefined -Wl,-soname,libXCTest.so -L{1}/lib/swift/linux/ -lswiftGlibc -lswiftCore -lm".format(build_dir, swift_build_dir)) | ||
run("clang {1}/lib/swift/linux/{2}/swift_begin.o {0}/XCTest.o {1}/lib/swift/linux/{2}/swift_end.o -shared -o {0}/libXCTest.so -Wl,--no-undefined -Wl,-soname,libXCTest.so -L{1}/lib/swift/linux/ -lswiftGlibc -lswiftCore -lm".format(build_dir, swift_build_dir, arch)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fantastic. Thanks, @hpux735! 💯 Personally I've been meaning to reformat this convoluted string interpolation to use identifiers--something like the following: run('clang {swift_build_dir}/lib/swift/linux/{arch}/swift_begin.o '
'{build_dir}/XCTest.o '
'{swift_build_dir}/lib/swift/linux/{arch}/swift_end.o '
'-shared -o {build_dir}/libXCTest.so '
'-Wl,--no-undefined -Wl,-soname,libXCTest.so '
'-L{swift_build_dir}/lib/swift/linux/ '
'-lswiftGlibc -lswiftCore -lm'.format(
build_dir=build_dir,
swift_build_dir=swift_build_dir,
arch=arch)) Doing so makes it a little easier for me to follow what's going on. I can take care of that at a later time--I think this is fine for now! |
||
|
||
# If we were given an install directive, perform installation | ||
if args.module_path is not None and args.lib_path is not None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to explicitly mark
default=None
here.argparse
already usesNone
in the absence of the option being specified.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the build invocation below uses
arch
. Shouldn't--arch
be marked asrequired=True
here?