Commit 381e2fcd authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #263 from dagar/profile

cmake add oprofile and gperftools
parents cc06ac6e 793d7d6b
......@@ -18,9 +18,11 @@ endif()
option(ENABLE_CCACHE "enable caching compiler output" ON)
option(ENABLE_GIL "threading use GIL" ON)
option(ENABLE_GOLD "enable the gold linker" ON)
option(ENABLE_GPERFTOOLS "enable the google performance tools" OFF)
option(ENABLE_GRWL "threading use GRWL" OFF)
option(ENABLE_INTEL_JIT_EVENTS "LLVM support for Intel JIT Events API" OFF)
option(ENABLE_LLVM_DEBUG "LLVM debug symbols" OFF)
option(ENABLE_OPROFILE "enable oprofile support" OFF)
option(ENABLE_SELF_HOST "use pyston to test pyston" OFF)
option(ENABLE_VALGRIND "pyston valgrind support" OFF)
......@@ -119,6 +121,14 @@ else()
add_definitions(-DTHREADING_USE_GIL=1 -DTHREADING_USE_GRWL=0)
endif()
if(ENABLE_GPERFTOOLS)
set(OPTIONAL_LIBRARIES ${OPTIONAL_LIBRARIES} profiler)
endif()
if(ENABLE_OPROFILE)
set(OPTIONAL_LIBRARIES ${OPTIONAL_LIBRARIES} opagent)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wreturn-type -Wno-sign-compare -Wno-unused -Wno-sign-compare -Wno-unused-parameter -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -std=c++11 -fPIC -fno-rtti -fexceptions -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -Woverloaded-virtual -Wno-invalid-offsetof -Wcast-qual -Wno-sign-conversion -Wnon-virtual-dtor -Winit-self -Wmissing-include-dirs -Wstrict-overflow=5 -Wpointer-arith -Wtype-limits -Wwrite-strings -Wempty-body -Waggregate-return -Wmissing-field-initializers -Wredundant-decls -Winline -Wint-to-pointer-cast -Wlong-long -Wvla -Wno-attributes")
......@@ -151,7 +161,7 @@ add_subdirectory(tools)
add_executable(pyston $<TARGET_OBJECTS:PYSTON_MAIN_OBJECT> $<TARGET_OBJECTS:PYSTON_OBJECTS> $<TARGET_OBJECTS:FROM_CPYTHON>)
# 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 readline gmp unwind pypa double-conversion ${LLVM_LIBS} ${LIBLZMA_LIBRARIES})
target_link_libraries(pyston -Wl,--whole-archive stdlib -Wl,--no-whole-archive pthread m readline gmp unwind pypa double-conversion ${LLVM_LIBS} ${LIBLZMA_LIBRARIES} ${OPTIONAL_LIBRARIES})
# copy src/codegen/parse_ast.py to the build directory
add_custom_command(TARGET pyston POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/codegen/parse_ast.py ${CMAKE_BINARY_DIR}/src/codegen/parse_ast.py)
......
......@@ -20,7 +20,15 @@ file(GLOB GC_SRCS gc/*.cpp)
file(GLOB RUNTIME_BUILTIN_MODULES_SRCS runtime/builtin_modules/*.cpp)
file(GLOB RUNTIME_SRCS runtime/*.cpp)
add_library(PYSTON_OBJECTS OBJECT codegen/profiling/profiling.cpp ${ANALYSIS_SRCS} ${ASM_WRITING_SRCS} ${CAPI_SRCS} ${CODEGEN_SRCS} ${CODEGEN_IRGEN_SRCS} ${CODEGEN_OPT_SRCS} ${CORE_SRCS} ${GC_SRCS} ${RUNTIME_BUILTIN_MODULES_SRCS} ${RUNTIME_SRCS})
if(ENABLE_GPERFTOOLS)
set(OPTIONAL_SRCS ${OPTIONAL_SRCS} codegen/profiling/pprof.cpp)
endif()
if(ENABLE_OPROFILE)
set(OPTIONAL_SRCS codegen/profiling/oprofile.cpp)
endif()
add_library(PYSTON_OBJECTS OBJECT codegen/profiling/profiling.cpp ${ANALYSIS_SRCS} ${ASM_WRITING_SRCS} ${CAPI_SRCS} ${CODEGEN_SRCS} ${CODEGEN_IRGEN_SRCS} ${CODEGEN_OPT_SRCS} ${CORE_SRCS} ${GC_SRCS} ${RUNTIME_BUILTIN_MODULES_SRCS} ${RUNTIME_SRCS} ${OPTIONAL_SRCS})
add_dependencies(PYSTON_OBJECTS libunwind pypa ${LLVM_LIBS})
add_library(PYSTON_MAIN_OBJECT OBJECT jit.cpp)
add_dependencies(PYSTON_MAIN_OBJECT ${LLVM_LIBS})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment