forked from igprof/igprof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
104 lines (95 loc) · 3.52 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
PROJECT(IGPROF C CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
FIND_PACKAGE(Threads)
# Options.
OPTION(IGPROF_BUILD_TESTS "Build tests." OFF)
# Default to "release with debug info", i.e. "-O2 -g".
IF(NOT CMAKE_CONFIGURATION_TYPE AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Build type: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF()
# Flags we need.
ADD_DEFINITIONS(-D__STDC_FORMAT_MACROS)
ADD_DEFINITIONS(-D__STDC_LIMIT_MACROS)
IF(${CMAKE_SYSTEM_NAME} MATCHES Linux)
ADD_DEFINITIONS(-D_GNU_SOURCE)
SET(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} -Wl,-z,nodefs
CACHE STRING "Flags used by the linker during the creation of dll's.")
ENDIF()
# Use ANSI mode for C and stricter compile options with GCC.
SET(CMAKE_C_FLAGS "${CMAKE_ANSI_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_FLAGS})
IF(CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS(-ansi -pedantic -W -Wall -Wno-long-long -Werror)
ENDIF()
IF(UNIX)
SET(IGPROF_LIBS ${IGPROF_LIBS} ${CMAKE_DL_LIBS})
ENDIF()
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES 64)
FIND_PATH(UNWIND_INCLUDE_DIR libunwind.h)
FIND_LIBRARY(UNWIND_LIBRARY NAMES unwind)
ENDIF()
# Build web page
FIND_PATH(PROTOVIS_ROOT protovis-r3.2.js)
FIND_PATH(JQUERY_ROOT jquery-1.4.4.min.js)
FIND_PATH(JQUERY_BA_HASHCHANGE_ROOT jquery.ba-hashchange.min.js)
IF(JQUERY_BA_HASHCHANGE_ROOT AND JQUERY_ROOT AND PROTOVIS_ROOT)
ADD_CUSTOM_TARGET(igprof-book ALL
COMMAND src/igprof-book-build
--js-path ${JQUERY_ROOT}:${PROTOVIS_ROOT}:${JQUERY_BA_HASHCHANGE_ROOT}
src/igprof-book.html
--driver src/igprof-book.in > igprof-book
DEPENDS src/igprof-book.html src/igprof-book src/igprof-book.js)
INSTALL(FILES igprof-book
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ENDIF()
# Build targets.
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR} ${UNWIND_INCLUDE_DIR})
ADD_LIBRARY(igprof SHARED
src/hook.cc
src/buffer.cc
src/sym-cache.cc
src/walk-syms.cc
src/profile.cc
src/profile-fd.cc
src/profile-mem.cc
src/profile-empty.cc
src/profile-perf.cc
src/profile-trace.cc
src/profile-calls.cc
src/profile-finstrument.cc
src/trace.cc
src/trace-mem.cc
src/trace-mmap.cc
src/trace-throw.cc)
#SET_TARGET_PROPERTIES(igprof PROPERTIES LINK_FLAGS -Wl,-z,nodefs)
TARGET_LINK_LIBRARIES(igprof ${UNWIND_LIBRARY} ${IGPROF_LIBS} ${CMAKE_THREAD_LIBS_INIT})
ADD_EXECUTABLE(igprof-analyse src/analyse.cc)
TARGET_LINK_LIBRARIES(igprof-analyse ${CMAKE_DL_LIBS})
INSTALL(TARGETS igprof igprof-analyse
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
INSTALL(FILES
src/igprof-analyse-old
src/igprof-func
src/igprof-navigator
src/igprof-navigator-summary
src/igprof-segment
src/igprof-populator
src/igprof-symbol-sizes
src/igprof
src/igpython-analyse
src/igtrace
src/igtrace-mmap-analysis
src/igtrace-mmap-summary
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
INSTALL(FILES src/sym-resolve.h DESTINATION include/igprof)
# Tests.
IF(IGPROF_BUILD_TESTS)
# FIXME: Build libraries from sources in test/*.cc.
# FIXME: Run igprof-regression-tests
ENDIF()