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)