Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
91e5a372
Commit
91e5a372
authored
Oct 26, 2015
by
Kevin Modzelewski
Committed by
Kevin Modzelewski
Oct 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Statically link jemalloc
parent
323805e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
CMakeLists.txt
CMakeLists.txt
+26
-1
No files found.
CMakeLists.txt
View file @
91e5a372
...
@@ -123,6 +123,25 @@ ExternalProject_Add(libjemalloc
...
@@ -123,6 +123,25 @@ ExternalProject_Add(libjemalloc
LOG_BUILD ON
LOG_BUILD ON
LOG_INSTALL ON
)
LOG_INSTALL ON
)
#
# CMake (<3.3) has no way of knowing that an ExternalProject creates specific output files. This is a problem for ninja,
# which will not know how to build the generated file.
# Here are a couple hacks to get around it:
#
# Add a copy step. This just hides the dependency but it seems to work.
# add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/jemalloc/lib/libjemalloc_copied.a DEPENDS libjemalloc COMMAND cp "${CMAKE_BINARY_DIR}/jemalloc/lib/libjemalloc.a" ${CMAKE_BINARY_DIR}/jemalloc/lib/libjemalloc_copied.a)
# add_custom_target(libjemalloc_copied DEPENDS ${CMAKE_BINARY_DIR}/jemalloc/lib/libjemalloc_copied.a)
#
# Hack option #2: the existence of the custom target tells ninja that libjemalloc.a will get built somehow.
# The name of the target doesn't matter.
add_custom_target
(
libjemalloc_byproducts DEPENDS
${
CMAKE_BINARY_DIR
}
/jemalloc/lib/libjemalloc.a
)
#
# Hack option #3: delete the .so's and use `-ljemalloc` on the link line so that ninja doesn't know about the dependency.
# ExternalProject_Add_Step(libjemalloc disable_shared
# DEPENDEES install
# COMMAND sh -c "rm -v ${CMAKE_BINARY_DIR}/jemalloc/lib/*.so*"
# )
execute_process
(
COMMAND cat llvm_revision.txt WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE LLVMREV OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process
(
COMMAND cat llvm_revision.txt WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE LLVMREV OUTPUT_STRIP_TRAILING_WHITESPACE
)
# llvm, clang, and libunwind patches
# llvm, clang, and libunwind patches
...
@@ -261,7 +280,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/linkdeps_dummy.c COMMAND ${CMAKE_C
...
@@ -261,7 +280,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/linkdeps_dummy.c COMMAND ${CMAKE_C
add_executable
(
pyston $<TARGET_OBJECTS:PYSTON_MAIN_OBJECT> $<TARGET_OBJECTS:PYSTON_OBJECTS> $<TARGET_OBJECTS:FROM_CPYTHON> linkdeps_dummy.c
)
add_executable
(
pyston $<TARGET_OBJECTS:PYSTON_MAIN_OBJECT> $<TARGET_OBJECTS:PYSTON_OBJECTS> $<TARGET_OBJECTS:FROM_CPYTHON> linkdeps_dummy.c
)
# Wrap the stdlib in --whole-archive to force all the symbols to be included and eventually exported
# Wrap the stdlib in --whole-archive to force all the symbols to be included and eventually exported
target_link_libraries
(
pyston -Wl,--whole-archive stdlib -Wl,--no-whole-archive pthread m z readline sqlite3 gmp ssl crypto unwind pypa liblz4 double-conversion util
${
LLVM_LIBS
}
${
LIBLZMA_LIBRARIES
}
${
OPTIONAL_LIBRARIES
}
-L
${
CMAKE_BINARY_DIR
}
/jemalloc/lib -Wl,-rpath,
${
CMAKE_BINARY_DIR
}
/jemalloc/lib jemalloc
)
target_link_libraries
(
pyston -Wl,--whole-archive stdlib -Wl,--no-whole-archive pthread m z readline sqlite3 gmp ssl crypto unwind pypa liblz4 double-conversion util
${
LLVM_LIBS
}
${
LIBLZMA_LIBRARIES
}
${
OPTIONAL_LIBRARIES
}
${
CMAKE_BINARY_DIR
}
/jemalloc/lib/libjemalloc.a
)
add_dependencies
(
pyston libjemalloc
)
add_dependencies
(
pyston libjemalloc
)
# copy src/codegen/parse_ast.py to the build directory
# copy src/codegen/parse_ast.py to the build directory
...
@@ -335,5 +354,11 @@ else()
...
@@ -335,5 +354,11 @@ else()
add_custom_target
(
docs COMMAND
${
CMAKE_COMMAND
}
-E echo
"Can't create docs, doxygen not installed
\(
try sudo apt-get install doxygen grpahviz on Ubuntu and then rerun cmake
\)
"
VERBATIM
)
add_custom_target
(
docs COMMAND
${
CMAKE_COMMAND
}
-E echo
"Can't create docs, doxygen not installed
\(
try sudo apt-get install doxygen grpahviz on Ubuntu and then rerun cmake
\)
"
VERBATIM
)
endif
()
endif
()
set
(
CMAKE_EXECUTABLE_FORMAT
"ELF"
)
install
(
TARGETS pyston DESTINATION
"."
)
set
(
CPACK_GENERATOR
"TGZ"
)
include
(
CPack
)
# last file added (need to change this if we add a file that is added via a glob):
# last file added (need to change this if we add a file that is added via a glob):
# from_cpython/Lib/test/test_zipimport.py
# from_cpython/Lib/test/test_zipimport.py
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment