1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 SET(project_prefix "capi")
4 SET(libdir ${LIB_INSTALL_DIR})
7 SET(submodule "peripheral-io")
8 SET(fw_name "${project_prefix}-${service}-${submodule}")
12 SET(dependents "dlog glib-2.0 gio-2.0 gio-unix-2.0 capi-base-common")
13 SET(pc_dependents "capi-base-common")
15 SET(CMAKE_INSTALL_PREFIX ${prefix})
16 SET(PREFIX $(CMAKE_INSTALL_PREFIX))
17 SET(VERSION ${version})
19 FIND_PROGRAM(GDBUS_CODEGEN NAMES gdbus-codegen)
20 EXEC_PROGRAM(${GDBUS_CODEGEN} ARGS
22 --generate-c-code ${CMAKE_SOURCE_DIR}/src/peripheral_io_gdbus \\
23 --c-namespace PeripheralIoGdbus \\
24 --interface-prefix org.tizen.system.peripheral_io. \\
25 ${CMAKE_SOURCE_DIR}/src/peripheral_io.xml \\
29 INCLUDE_DIRECTORIES(${INC_DIR})
31 INCLUDE(FindPkgConfig)
32 pkg_check_modules(${fw_name} REQUIRED ${dependents})
33 FOREACH(flag ${${fw_name}_CFLAGS})
34 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
37 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
39 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -fPIC")
40 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
41 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
43 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=%{_libdir}")
45 SET(SOURCES src/peripheral_adc.c
50 src/peripheral_io_gdbus.c
54 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
56 TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
58 SET_TARGET_PROPERTIES(${fw_name}
65 INSTALL(TARGETS ${fw_name} DESTINATION ${libdir})
67 DIRECTORY ${INC_DIR}/ DESTINATION include
69 PATTERN "${INC_DIR}/*.h"
72 SET(PC_NAME ${fw_name})
73 SET(PC_REQUIRED ${pc_dependents})
74 SET(PC_LDFLAGS -l${fw_name})
81 INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${libdir}/pkgconfig)
83 ADD_SUBDIRECTORY(test)