blob: e5f4c4e9f6fc8d341079c9f00542a8e4562c107c (
plain)
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
105
106
107
108
109
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(ttrace C CXX)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "\${prefix}")
SET(VERSION_MAJOR 1)
SET(VERSION "${VERSION_MAJOR}.1")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
# compiler flags
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS}")
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
# Generate ttrace.h
SET(TTRACE_H_IN ttrace.h.in)
IF("${TTRACE_PROFILE}" STREQUAL "tv")
SET(TTRACE_PROFILE_TV ON)
ELSEIF("${TTRACE_PROFILE}" STREQUAL "wearable")
SET(TTRACE_PROFILE_WERABLE ON)
ELSE()
SET(TTRACE_PROFILE_MOBILE ON)
ENDIF()
IF("${TTRACE_TIZEN_VERSION_MAJOR}" STREQUAL "3")
SET(TTRACE_TIZEN_VERSION_MAJOR "3")
ELSE()
SET(TTRACE_TIZEN_VERSION_MAJOR "2")
ENDIF()
configure_file(${TTRACE_H_IN} "include/ttrace.h")
#################################################################
# Build ttrace Library (Shared)
# ------------------------------
SET(TTRACE "ttrace")
SET(SRCS_ttrace src/ttrace.c
src/TTraceWrapper.cpp)
SET(HEADERS_ttrace ttrace.h
TTraceWrapper.h
trace.h)
INCLUDE(FindPkgConfig)
pkg_check_modules(pkg_ttrace REQUIRED dlog capi-base-common ttrace-extension-static)
FOREACH(flag ${pkg_ttrace_CFLAGS})
SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} ${flag}")
ENDFOREACH(flag)
ADD_LIBRARY(${TTRACE} SHARED ${SRCS_ttrace}
src/trace.c
)
SET_TARGET_PROPERTIES(${TTRACE} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${TTRACE} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES(${TTRACE} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_common})
TARGET_LINK_LIBRARIES(${TTRACE} ${pkg_ttrace_LDFLAGS} "-ldl")
CONFIGURE_FILE(${TTRACE}.pc.in ${TTRACE}.pc @ONLY)
INSTALL(TARGETS ${TTRACE} DESTINATION ${LIBDIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TTRACE}.pc DESTINATION ${LIBDIR}/pkgconfig)
#################################################################
# Build ttrace Library (Static)
# ------------------------------
SET(TTRACE_STATIC "ttrace-static")
ADD_LIBRARY(${TTRACE_STATIC} STATIC ${SRCS_ttrace})
SET_TARGET_PROPERTIES(${TTRACE_STATIC} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS_common} -fpic")
SET_TARGET_PROPERTIES(${TTRACE_STATIC} PROPERTIES OUTPUT_NAME ttrace)
CONFIGURE_FILE(${TTRACE_STATIC}.pc.in ${TTRACE_STATIC}.pc @ONLY)
INSTALL(TARGETS ${TTRACE_STATIC} DESTINATION ${LIBDIR})
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TTRACE_STATIC}.pc DESTINATION ${LIBDIR}/pkgconfig)
TARGET_LINK_LIBRARIES(${TTRACE_STATIC} ${pkg_ttrace_LDFLAGS} "-ldl")
FOREACH(hfile ${HEADERS_ttrace})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${hfile} DESTINATION ${INCLUDEDIR})
ENDFOREACH(hfile)
#################################################################
# Build atrace Library (KK)
# ------------------------------
SET(ATRACE "atrace")
SET(SRCS_atrace src/atrace/atrace.cpp)
SET(HEADERS_atrace src/ttrace/ttrace.h)
INCLUDE(FindPkgConfig)
pkg_check_modules(pkg_atrace REQUIRED zlib)
FOREACH(flag ${pkg_atrace_CXXFLAGS})
SET(EXTRA_CXXFLAGS_common "${EXTRA_CXXFLAGS_common} ${flag}")
ENDFOREACH(flag)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} ${EXTRA_CXXFLAGS_common}")
MESSAGE("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
ADD_EXECUTABLE(${ATRACE} ${SRCS_atrace})
SET_TARGET_PROPERTIES(${ATRACE} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${ATRACE} PROPERTIES VERSION ${VERSION})
#SET_TARGET_PROPERTIES(${ATRACE} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_common})
TARGET_LINK_LIBRARIES(${ATRACE} ${pkg_atrace_LDFLAGS} "-ldl -lsmack")
CONFIGURE_FILE(${ATRACE}.pc.in ${ATRACE}.pc @ONLY)
INSTALL(TARGETS ${ATRACE} DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ATRACE}.pc DESTINATION ${LIBDIR}/pkgconfig)
|