Skip to content

Commit

Permalink
add link to pantsbuild#5788 -- maybe use variants for args for static…
Browse files Browse the repository at this point in the history
… libs
  • Loading branch information
cosmicexplorer committed Jun 8, 2018
1 parent f5b7162 commit 6410dd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/python/pants/backend/native/tasks/c_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ def compile(self, compile_request):
self.context.log.debug("no sources in request {}, skipping".format(compile_request))
return

# TODO: add -fPIC, but only to object files used for shared libs (how do we determine that?) --
# alternatively, only allow using native code to build shared libs.
c_compiler = compile_request.compiler
err_flags = ['-Werror'] if compile_request.fatal_warnings else []
# We are executing in the results_dir, so get absolute paths for everything.
# TODO: -fPIC all the time???
# We are going to execute in `output_dir`, so get absolute paths for everything.
# TODO: If we need to produce static libs, don't add -fPIC! (could use Variants -- see #5788).
cmd = [c_compiler.exe_filename] + err_flags + ['-c', '-fPIC'] + [
'-I{}'.format(os.path.abspath(inc_dir)) for inc_dir in compile_request.include_dirs
] + [os.path.abspath(src) for src in sources]
Expand Down
4 changes: 2 additions & 2 deletions src/python/pants/backend/native/tasks/cpp_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def compile(self, compile_request):

cpp_compiler = compile_request.compiler
err_flags = ['-Werror'] if compile_request.fatal_warnings else []
# We are executing in the results_dir, so get absolute paths for everything.
# TODO: -fPIC all the time???
# We are going to execute in `output_dir`, so get absolute paths for everything.
# TODO: If we need to produce static libs, don't add -fPIC! (could use Variants -- see #5788).
cmd = [cpp_compiler.exe_filename] + err_flags + ['-c', '-fPIC'] + [
'-I{}'.format(os.path.abspath(inc_dir)) for inc_dir in compile_request.include_dirs
] + [os.path.abspath(src) for src in sources]
Expand Down

0 comments on commit 6410dd2

Please sign in to comment.