summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: fb0aca42e8b31485f24243cdf8b1d06c499ceb6f (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
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(drm-trusted CXX)

#Verbose
#SET(CMAKE_VERBOSE_MAKEFILE ON)

# Message
#MESSAGE("FLAGS: ${CMAKE_C_FLAGS}")
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(LIBDIR ${PREFIX}/lib)
SET(INCLUDEDIR ${PREFIX}/include)
SET(VERSION 0.0.1)

SET(SRCS
	service/drm_trusted_client.cpp
	service/drm_trusted_client_ipc.cpp
)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)

SET(extapi "-fvisibility=hidden")
SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${extapi}")

#SET(DEBUG "-Wall -Werror -ggdb3 -fno-omit-frame-pointer -rdynamic -fno-optimize-sibling-calls -fstack-protector-all")
#SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${DEBUG}")

INCLUDE(FindPkgConfig)
pkg_check_modules(exppkgs REQUIRED dlog capi-base-common)

FOREACH(flag ${exppkgs_CFLAGS})
	SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
ENDFOREACH(flag)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} "-ldl" )
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${exppkgs_LDFLAGS})
SET_TARGET_PROPERTIES(
	drm-trusted
	PROPERTIES
	SOVERSION 0
	VERSION 0.0.1
)

FIND_PROGRAM(UNAME NAMES uname)
EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
IF("${ARCH}" STREQUAL "arm")
	ADD_DEFINITIONS("-DTARGET")
	MESSAGE("add -DTARGET")
ENDIF("${ARCH}" STREQUAL "arm")

CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc)
INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION /usr/include/drm-trusted/)