blob: 4e89d806968fa9552f189b7727acdeef56edffef (
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
64
65
66
67
68
69
70
71
72
73
74
75
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(secure-storage C)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "\${prefix}")
SET(LIBDIR "\${prefix}/lib")
SET(INCLUDEDIR "\${prefix}/include")
SET(VERSION_MAJOR 1)
SET(VERSION ${VERSION_MAJOR}.0.0)
#Verbose
#SET(CMAKE_VERBOSE_MAKEFILE ON)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED openssl security-server dlog)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
SET(ss_dir "./")
SET(ss_include_dir "./include")
SET(ss_client_dir "./client/src")
SET(ss_client_include_dir "./client/include")
SET(ss_server_dir "./server/src")
SET(ss_server_include_dir "./server/include")
SET(ss_test_dir "./testcases")
## About debug
#SET(debug_type "") # for debug - use no debugging
#SET(debug_type "-DSS_CONSOLE_USE") # for debug - use console window
SET(debug_type "-DSS_DLOG_USE") # for debug - use dlog
#SET(debug_type "") # for debug - DO NOT use
SET(use_key "-DUSE_KEY_FILE") # for private key - use key file
#SET(use_key "-DUSE_NOT") # for private key - use no private key, key will be fixed
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
###################################################################################################
## for libss-client.so (library)
SET(libss-client_SOURCES ${ss_client_dir}/ss_client_intf.c ${ss_client_dir}/ss_client_ipc.c ${ss_client_dir}/ss_manager.c)
SET(libss-client_LDFLAGS " -module -avoid-version ${OPENSSL_LIBS}")
SET(libss-client_CFLAGS " ${CFLAGS} -fPIC -I${ss_client_include_dir} -I${ss_include_dir} ${OPENSSL_CFLAGS} ${debug_type} ")
#SET(libss-client_LIBADD " ${OPENSSL_LIBS} ")
ADD_LIBRARY(ss-client SHARED ${libss-client_SOURCES})
TARGET_LINK_LIBRARIES(ss-client ${pkgs_LDFLAGS})
SET_TARGET_PROPERTIES(ss-client PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(ss-client PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES(ss-client PROPERTIES COMPILE_FLAGS "${libss-client_CFLAGS}")
###################################################################################################
###################################################################################################
## for ss-server (binary)
SET(ss-server_SOURCES ${ss_server_dir}/ss_server_ipc.c ${ss_server_dir}/ss_server_main.c)
SET(ss-server_CFLAGS " -I. -I${ss_include_dir} -I${ss_server_include_dir} ${debug_type} ${use_key} ${OPENSSL_CFLAGS} -D_GNU_SOURCE ")
SET(ss-server_LDFLAGS ${pkgs_LDFLAGS})
ADD_EXECUTABLE(ss-server ${ss-server_SOURCES})
TARGET_LINK_LIBRARIES(ss-server ${pkgs_LDFLAGS})
SET_TARGET_PROPERTIES(ss-server PROPERTIES COMPILE_FLAGS "${ss-server_CFLAGS}")
####################################################################################################
CONFIGURE_FILE(secure-storage.pc.in secure-storage.pc @ONLY)
CONFIGURE_FILE(config.in config @ONLY)
INSTALL(TARGETS ss-client DESTINATION lib)
INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/ss-server DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/secure-storage.pc DESTINATION lib/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/config DESTINATION share/secure-storage/)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/ss_manager.h DESTINATION include)
INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ss-serverd DESTINATION /etc/rc.d/init.d)
|