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

SET(PKG_MODULES
	dlog
	hal-api-common
)

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")
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt")
SET(CMAKE_EXE_LINKER_FLAGS "-pie")

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

SET(SRCS
        src/hal-api-nfc.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(FILES		${CMAKE_CURRENT_SOURCE_DIR}/include/hal-nfc.h DESTINATION ${INCLUDEDIR}/hal)
INSTALL(FILES		${CMAKE_CURRENT_SOURCE_DIR}/include/hal-nfc-interface.h DESTINATION ${INCLUDEDIR}/hal)
INSTALL(FILES		${CMAKE_CURRENT_SOURCE_DIR}/include/hal-nfc-types.h DESTINATION ${INCLUDEDIR}/hal)
INSTALL(FILES		${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)