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.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_gpio.c
50 src/peripheral_gdbus_gpio.c
51 src/peripheral_gdbus_i2c.c
52 src/peripheral_gdbus_pwm.c
53 src/peripheral_io_gdbus.c
56 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
58 TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
60 SET_TARGET_PROPERTIES(${fw_name}
67 INSTALL(TARGETS ${fw_name} DESTINATION ${libdir})
69 DIRECTORY ${INC_DIR}/ DESTINATION include
71 PATTERN "${INC_DIR}/*.h"
74 SET(PC_NAME ${fw_name})
75 SET(PC_REQUIRED ${pc_dependents})
76 SET(PC_LDFLAGS -l${fw_name})
83 INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${libdir}/pkgconfig)
85 ADD_SUBDIRECTORY(test)