1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
4 SET(CMAKE_SKIP_BUILD_RPATH TRUE)
6 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
7 SET(CMAKE_BUILD_TYPE "Debug")
8 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
11 MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
12 MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
14 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
15 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections")
17 ADD_DEFINITIONS("-DSERVICE_ADAPTOR_DEBUGGING")
19 ##########################################################
21 ##########################################################
23 SET(COMMON-BASE-LIB "sal-common-base")
25 ${CMAKE_SOURCE_DIR}/common/sal_ipc.c
29 ${CMAKE_SOURCE_DIR}/include
30 ${CMAKE_SOURCE_DIR}/common
33 INCLUDE(FindPkgConfig)
34 pkg_check_modules(common_base_pkgs REQUIRED dlog glib-2.0 gio-2.0)
36 FOREACH(flag ${common_base_pkgs_CFLAGS})
37 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
40 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -std=gnu99")
41 #message(">>>[${COMMON-BASE-LIB}] extra_cflags ${EXTRA_CFLAGS}")
42 #message(">>>[${COMMON-BASE-LIB}] common_base_pkgs_cflags ${common_base_pkgs_CFLAGS}")
43 #message(">>>[${COMMON-BASE-LIB}] result ${CMAKE_C_FLAGS}")
45 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
47 ADD_LIBRARY(${COMMON-BASE-LIB} SHARED ${COMMON-BASE-SRCS})
48 TARGET_LINK_LIBRARIES(${COMMON-BASE-LIB} ${common_base_pkgs_LDFLAGS})
49 SET_TARGET_PROPERTIES(${COMMON-BASE-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
50 SET_TARGET_PROPERTIES(${COMMON-BASE-LIB} PROPERTIES VERSION ${VERSION})
52 INSTALL(TARGETS ${COMMON-BASE-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
54 ##########################################################
55 # Define common server
56 ##########################################################
58 SET(COMMON-SERVER-LIB "sal-common-server")
59 SET(COMMON-SERVER-SRCS
60 ${CMAKE_SOURCE_DIR}/common/ipc-server/sal_ipc_server.c
61 ${CMAKE_SOURCE_DIR}/common/ipc-server/sal_ipc_server_core.c
62 ${CMAKE_SOURCE_DIR}/common/ipc-server/sal_ipc_server_auth.c
63 ${CMAKE_SOURCE_DIR}/common/ipc-server/sal_ipc_server_storage.c
67 ${CMAKE_SOURCE_DIR}/include
68 ${CMAKE_SOURCE_DIR}/adaptor/auth-adaptor
69 ${CMAKE_SOURCE_DIR}/adaptor/contact-adaptor
70 ${CMAKE_SOURCE_DIR}/adaptor/storage-adaptor
71 ${CMAKE_SOURCE_DIR}/adaptor/resource-adaptor
72 ${CMAKE_SOURCE_DIR}/common
73 ${CMAKE_SOURCE_DIR}/common/ipc-server
74 ${CMAKE_SOURCE_DIR}/server
77 INCLUDE(FindPkgConfig)
78 pkg_check_modules(common_server_pkgs REQUIRED dlog glib-2.0 gio-2.0)
80 FOREACH(flag ${common_server_pkgs_CFLAGS})
81 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
84 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -std=gnu99")
85 #message(">>>[${COMMON-SERVER-LIB}] extra_cflags ${EXTRA_CFLAGS}")
86 #message(">>>[${COMMON-SERVER-LIB}] common_server_pkgs_cflags ${common_server_pkgs_CFLAGS}")
87 #message(">>>[${COMMON-SERVER-LIB}] result ${CMAKE_C_FLAGS}")
89 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
91 ADD_LIBRARY(${COMMON-SERVER-LIB} SHARED ${COMMON-SERVER-SRCS})
92 TARGET_LINK_LIBRARIES(${COMMON-SERVER-LIB} ${common_server_pkgs_LDFLAGS} sal-common-base auth-adaptor storage-adaptor)
93 SET_TARGET_PROPERTIES(${COMMON-SERVER-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
94 SET_TARGET_PROPERTIES(${COMMON-SERVER-LIB} PROPERTIES VERSION ${VERSION})
96 INSTALL(TARGETS ${COMMON-SERVER-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
98 ##########################################################
99 # Define common client
100 ##########################################################
102 SET(COMMON-CLIENT-LIB "sal-common-client")
103 SET(COMMON-CLIENT-SRCS
104 ${CMAKE_SOURCE_DIR}/common/ipc-client/sal_ipc_client.c
105 ${CMAKE_SOURCE_DIR}/common/ipc-client/sal_ipc_client_core.c
106 ${CMAKE_SOURCE_DIR}/common/ipc-client/sal_ipc_client_auth.c
107 ${CMAKE_SOURCE_DIR}/common/ipc-client/sal_ipc_client_storage.c
111 ${CMAKE_SOURCE_DIR}/include
112 ${CMAKE_SOURCE_DIR}/common
113 ${CMAKE_SOURCE_DIR}/common/ipc-client
114 ${CMAKE_SOURCE_DIR}/client
117 INCLUDE(FindPkgConfig)
118 pkg_check_modules(common_client_pkgs REQUIRED dlog glib-2.0 gio-2.0)
120 FOREACH(flag ${common_client_pkgs_CFLAGS})
121 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
124 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -std=gnu99")
125 #message(">>>[${COMMON-CLIENT-LIB}] extra_cflags ${EXTRA_CFLAGS}")
126 #message(">>>[${COMMON-CLIENT-LIB}] common_client_pkgs_cflags ${common_client_pkgs_CFLAGS}")
127 #message(">>>[${COMMON-CLIENT-LIB}] result ${CMAKE_C_FLAGS}")
129 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
131 ADD_LIBRARY(${COMMON-CLIENT-LIB} SHARED ${COMMON-CLIENT-SRCS})
132 TARGET_LINK_LIBRARIES(${COMMON-CLIENT-LIB} ${common_client_pkgs_LDFLAGS} sal-common-base)
133 SET_TARGET_PROPERTIES(${COMMON-CLIENT-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
134 SET_TARGET_PROPERTIES(${COMMON-CLIENT-LIB} PROPERTIES VERSION ${VERSION})
136 INSTALL(TARGETS ${COMMON-CLIENT-LIB} DESTINATION lib COMPONENT RuntimeLibraries)