summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 1c976e25e2e70d731aa39f8726014f7920a50225 (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
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(hal-api-tdm C)

SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}/bin")
SET(INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include")
SET(LIBDIR ${CMAKE_LIBDIR_PREFIX})
SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.1.0")

SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "${PREFIX}/bin")
SET(INCLUDEDIR "${PREFIX}/include")
SET(LIBDIR ${CMAKE_LIBDIR_PREFIX})

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)

if (${DEFAULT_LOG_DLOG})
	SET(PKG_MODULES
		hal-api-common
		dlog
		libtbm
	)
        ADD_DEFINITIONS("-DENABLE_DLOG=1")
else()
	SET(PKG_MODULES
		hal-api-common
		libtbm
	)
        ADD_DEFINITIONS("-DENABLE_DLOG=0")
endif()


INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})

FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)

SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -fPIC -Wl,-z,relro")
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions -fstack-protector-strong")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt")
SET(CMAKE_EXE_LINKER_FLAGS "-pie")

ADD_DEFINITIONS("-DLOG_TAG=\"HALAPI_TDM\"")


SET(SRCS
        src/hal-api-tdm.c
        src/hal-tdm-log.c)

ADD_LIBRARY(		${PROJECT_NAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(	${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl -lm -Wl,-z,nodelete,--no-undefined)
SET_TARGET_PROPERTIES(	${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(	${PROJECT_NAME} PROPERTIES VERSION ${VERSION})

CONFIGURE_FILE(		${PROJECT_NAME}.pc ${PROJECT_NAME}.pc @ONLY)
INSTALL(TARGETS		${PROJECT_NAME} DESTINATION ${LIBDIR}/hal)
INSTALL(DIRECTORY	${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${INCLUDEDIR}/hal FILES_MATCHING PATTERN "hal-tdm*.h")
INSTALL(FILES		${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)