Skip to content

Commit

Permalink
Compile position independent folly library
Browse files Browse the repository at this point in the history
-fPIC is passed to the compiler on generation of objects, to compile
both with and without PIC (Position Independent Code), a second lib is
required.
  • Loading branch information
Caleb Marchent committed Jan 16, 2019
1 parent 13402c3 commit 347aa93
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ add_library(folly
)
apply_folly_compile_options_to_target(folly)

add_library(folly_pic
${files} ${hfiles}
${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h
)
apply_folly_compile_options_to_target(folly_pic)
set_target_properties(folly_pic PROPERTIES POSITION_INDEPENDENT_CODE True)


target_link_libraries(folly PUBLIC folly_deps)

install(TARGETS folly folly_deps
Expand Down
1 change: 1 addition & 0 deletions folly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if (CYTHON_FOUND AND PYTHONINTERP_FOUND)

add_custom_target(folly_python_bindings ALL
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/setup.py build_ext -f
DEPENDS folly_pic
WORKING_DIRECTORY ${_cybld})

# Install Folly Python Bindings
Expand Down
3 changes: 2 additions & 1 deletion folly/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
ext = Extension("folly.executor",
sources=['folly/executor.pyx'],
include_dirs=[os.getcwd()+"/..", os.getcwd()],
libraries=['folly', 'glog', 'double-conversion', 'iberty'])
libraries=['folly_pic', 'glog', 'double-conversion', 'iberty'],
library_dirs=[os.getcwd()+"/../.."])

setup(name="folly",
version='0.0.1',
Expand Down

0 comments on commit 347aa93

Please sign in to comment.