Merge "Fixed incompatibility heap free" into tizen
[platform/core/api/mediavision.git] / CMakeLists.txt
1
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3 SET(fw_name "capi-media-vision")
4
5 PROJECT(${fw_name})
6
7 SET(CMAKE_INSTALL_PREFIX /usr)
8 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
9
10 # Configure for porting layer:
11
12 option(MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT
13        "Turn on building of licensed port of the barcode detecting module (if OFF - open port will be built)." OFF)
14 option(MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT
15        "Turn on building of licensed port of the barcode generating module (if OFF - open port will be built)." OFF)
16 option(MEDIA_VISION_IMAGE_LICENSE_PORT
17        "Turn on building of licensed port of the image module (if OFF - open port will be built)." OFF)
18 option(MEDIA_VISION_FACE_LICENSE_PORT
19        "Turn on building of licensed port of the face module (if OFF - open port will be built)." OFF)
20 option(MEDIA_VISION_SURVEILLANCE_LICENSE_PORT
21        "Turn on building of licensed port of the surveillance module (if OFF - open port will be built)." OFF)
22
23 set(MV_COMMON_LIB_NAME "mv_common")
24 set(MV_BARCODE_DETECTOR_LIB_NAME "mv_barcode_detector" CACHE STRING
25        "Name of the library will be built for barcode detecting module (without extension).")
26 set(MV_BARCODE_GENERATOR_LIB_NAME "mv_barcode_generator" CACHE STRING
27        "Name of the library will be built for barcode generating module (without extension).")
28 set(MV_IMAGE_LIB_NAME "mv_image" CACHE STRING
29        "Name of the library will be built for image module (without extension).")
30 set(MV_FACE_LIB_NAME "mv_face" CACHE STRING
31        "Name of the library will be built for barcode generating module (without extension).")
32 set(MV_SURVEILLANCE_LIB_NAME "mv_surveillance" CACHE STRING
33        "Name of the library will be built for surveillance module (without extension).")
34
35
36 SET(INC_DIR "${PROJECT_SOURCE_DIR}/include")
37 SET(INC_COMMON "${PROJECT_SOURCE_DIR}/mv_common/include")
38
39 message(STATUS "In_dir ${INC_DIR}")
40
41 if(MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT)
42     add_definitions(-DMEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT)
43     SET(INC_BARCODE_DETECTOR "${PROJECT_SOURCE_DIR}/mv_barcode/barcode_detector_lic/include")
44 else()
45     SET(INC_BARCODE_DETECTOR "${PROJECT_SOURCE_DIR}/mv_barcode/barcode_detector/include")
46 endif()
47
48 if(MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT)
49     add_definitions(-DMEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT)
50     SET(INC_BARCODE_GENERATOR "${PROJECT_SOURCE_DIR}/mv_barcode/barcode_generator_lic/include")
51 else()
52     SET(INC_BARCODE_GENERATOR "${PROJECT_SOURCE_DIR}/mv_barcode/barcode_generator/include")
53 endif()
54
55 if(MEDIA_VISION_IMAGE_LICENSE_PORT)
56     add_definitions(-DMEDIA_VISION_IMAGE_LICENSE_PORT)
57     SET(INC_IMAGE "${PROJECT_SOURCE_DIR}/mv_image/image_lic/include")
58 else()
59     SET(INC_IMAGE "${PROJECT_SOURCE_DIR}/mv_image/image/include")
60 endif()
61
62 if(MEDIA_VISION_FACE_LICENSE_PORT)
63     add_definitions(-DMEDIA_VISION_FACE_LICENSE_PORT)
64     SET(INC_FACE "${PROJECT_SOURCE_DIR}/mv_face/face_lic/include")
65 else()
66     SET(INC_FACE "${PROJECT_SOURCE_DIR}/mv_face/face/include")
67 endif()
68
69 if(MEDIA_VISION_SURVEILLANCE_LICENSE_PORT)
70     add_definitions(-DMEDIA_VISION_SURVEILLANCE_LICENSE_PORT)
71     SET(INC_SURVEILLANCE "${PROJECT_SOURCE_DIR}/mv_surveillance/surveillance_lic/include")
72 else()
73     SET(INC_SURVEILLANCE "${PROJECT_SOURCE_DIR}/mv_surveillance/surveillance/include")
74 endif()
75
76 INCLUDE_DIRECTORIES(${INC_DIR}
77                     ${INC_COMMON}
78                     ${INC_BARCODE_DETECTOR}
79                     ${INC_BARCODE_GENERATOR}
80                     ${INC_FACE}
81                     ${INC_IMAGE}
82                     ${INC_SURVEILLANCE})
83
84 SET(dependents "dlog capi-media-tool capi-system-info")
85 SET(pc_dependents "dlog")
86
87 INCLUDE(FindPkgConfig)
88 pkg_check_modules(${fw_name} REQUIRED ${dependents})
89 FOREACH(flag ${${fw_name}_CFLAGS})
90     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
91     SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
92 ENDFOREACH(flag)
93
94 SET(CMAKE_C_FLAGS "-I./include -I./include/headers ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -w")
95 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
96
97 SET(CMAKE_CXX_FLAGS "-I./include -I./include/headers ${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -fPIC")
98 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g --w")
99
100 IF("${ARCH}" STREQUAL "arm")
101     ADD_DEFINITIONS("-DTARGET")
102 ENDIF("${ARCH}" STREQUAL "arm")
103
104 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
105 ADD_DEFINITIONS("-DTIZEN_DEBUG")
106
107 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
108
109 ADD_SUBDIRECTORY(mv_common)
110 ADD_SUBDIRECTORY(mv_barcode)
111 ADD_SUBDIRECTORY(mv_image)
112 ADD_SUBDIRECTORY(mv_face)
113 ADD_SUBDIRECTORY(mv_surveillance)
114
115 aux_source_directory(src SOURCES)
116 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
117
118 TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS}
119                                  ${MV_COMMON_LIB_NAME}
120                                  ${MV_BARCODE_DETECTOR_LIB_NAME}
121                                  ${MV_BARCODE_GENERATOR_LIB_NAME}
122                                  ${MV_IMAGE_LIB_NAME}
123                                  ${MV_FACE_LIB_NAME}
124                                  ${MV_SURVEILLANCE_LIB_NAME})
125
126 SET_TARGET_PROPERTIES(${fw_name}
127      PROPERTIES
128      VERSION ${FULLVER}
129      SOVERSION ${MAJORVER}
130      CLEAN_DIRECT_OUTPUT 1
131 )
132
133 INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
134 INSTALL(
135         DIRECTORY ${INC_DIR}/ DESTINATION include/media
136         FILES_MATCHING
137         PATTERN "*_private.h" EXCLUDE
138         PATTERN "*.h"
139         )
140
141 SET(PC_NAME ${fw_name})
142 SET(PC_REQUIRED ${pc_dependents})
143 SET(PC_LDFLAGS -l${fw_name})
144 SET(PC_CFLAGS -I\${includedir}/media)
145
146 CONFIGURE_FILE(
147     ${fw_name}.pc.in
148     ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
149     @ONLY
150 )
151 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
152
153 ADD_SUBDIRECTORY(test)
154
155 IF(UNIX)
156
157 ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
158 ADD_CUSTOM_COMMAND(
159         DEPENDS clean
160         COMMENT "distribution clean"
161         COMMAND find
162         ARGS    .
163         -not -name config.cmake -and \(
164         -name tester.c -or
165         -name Testing -or
166         -name CMakeFiles -or
167         -name cmake.depends -or
168         -name cmake.check_depends -or
169         -name CMakeCache.txt -or
170         -name cmake.check_cache -or
171         -name *.cmake -or
172         -name Makefile -or
173         -name core -or
174         -name core.* -or
175         -name gmon.out -or
176         -name install_manifest.txt -or
177         -name *.pc -or
178         -name *~ \)
179         | grep -v TC | xargs rm -rf
180         TARGET  distclean
181         VERBATIM
182 )
183
184 ENDIF(UNIX)
185