Turn on feature: engine state (enable / disable)
[platform/upstream/csr-framework.git] / test / CMakeLists.txt
1 # Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
2 #
3 #    Licensed under the Apache License, Version 2.0 (the "License");
4 #    you may not use this file except in compliance with the License.
5 #    You may obtain a copy of the License at
6 #
7 #        http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #    Unless required by applicable law or agreed to in writing, software
10 #    distributed under the License is distributed on an "AS IS" BASIS,
11 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #    See the License for the specific language governing permissions and
13 #    limitations under the License.
14 #
15 # @file        CMakeLists.txt
16 # @author      Kyungwook Tak (k.tak@samsung.com)
17 # @brief       build test program of csr-framework
18 #
19 FIND_PACKAGE(Threads REQUIRED)
20 ADD_DEFINITIONS("-DBOOST_TEST_DYN_LINK")
21 ADD_DEFINITIONS("-DTEST_TARGET=\"${TEST_TARGET}\"")
22
23 ################### make test common library ##################
24 PKG_CHECK_MODULES(${TARGET_CSR_TEST_COMMON}_DEP
25         REQUIRED
26         glib-2.0
27         pkgmgr
28         pkgmgr-info
29 )
30
31 SET(${TARGET_CSR_TEST_COMMON}_SRCS
32         test-common.cpp
33         colour_log_formatter.cpp
34 )
35
36 INCLUDE_DIRECTORIES(
37         SYSTEM
38         ${${TARGET_CSR_TEST_COMMON}_DEP_INCLUDE_DIRS}
39 )
40
41 INCLUDE_DIRECTORIES(
42         ${PROJECT_SOURCE_DIR}/src/include
43         .
44 )
45
46 ADD_LIBRARY(${TARGET_CSR_TEST_COMMON} SHARED ${${TARGET_CSR_TEST_COMMON}_SRCS})
47
48 SET_TARGET_PROPERTIES(${TARGET_CSR_TEST_COMMON}
49         PROPERTIES
50                 COMPILE_FLAGS "-D_GNU_SOURCE -fvisibility=default"
51 )
52
53 TARGET_LINK_LIBRARIES(${TARGET_CSR_TEST_COMMON}
54         ${${TARGET_CSR_TEST_COMMON}_DEP_LIBRARIES}
55         ${TARGET_CSR_CLIENT}
56 )
57
58 INSTALL(TARGETS ${TARGET_CSR_TEST_COMMON} DESTINATION ${LIB_INSTALL_DIR})
59 #################################################################
60
61 ###################### make api test program ####################
62 PKG_CHECK_MODULES(${TARGET_CSR_TEST}_DEP
63         REQUIRED
64 )
65
66 SET(${TARGET_CSR_TEST}_SRCS
67         test-api-content-screening.cpp
68         test-api-content-screening-async.cpp
69         test-api-engine-manager.cpp
70         test-api-web-protection.cpp
71         test-main.cpp
72         test-helper.cpp
73 )
74
75 INCLUDE_DIRECTORIES(
76         SYSTEM
77         ${${TARGET_CSR_TEST}_DEP_INCLUDE_DIRS}
78 )
79
80 INCLUDE_DIRECTORIES(
81         ${PROJECT_SOURCE_DIR}/src/include
82         .
83 )
84
85 ADD_EXECUTABLE(${TARGET_CSR_TEST} ${${TARGET_CSR_TEST}_SRCS})
86
87 TARGET_LINK_LIBRARIES(${TARGET_CSR_TEST}
88         ${TARGET_CSR_TEST_COMMON}
89         ${TARGET_CSR_CLIENT}
90         ${${TARGET_CSR_TEST}_DEP_LIBRARIES}
91         -lboost_unit_test_framework
92         -ldl
93 )
94
95 INSTALL(TARGETS ${TARGET_CSR_TEST} DESTINATION ${BIN_DIR})
96 INSTALL(DIRECTORY resources/ DESTINATION ${TEST_DIR})
97
98 ADD_SUBDIRECTORY(internals)
99 ADD_SUBDIRECTORY(popup)
100 ADD_SUBDIRECTORY(thread-pool)
101 #################################################################