/strigi-0.7.7/libstreamanalyzer/CMakeLists.txt
CMake | 147 lines | 100 code | 26 blank | 21 comment | 8 complexity | d209cbe3e9039f36c0f555b3b3a45f34 MD5 | raw file
Possible License(s): LGPL-2.0
1project (libstreamanalyzer)
2
3##### cmake settings #####
4
5cmake_minimum_required(VERSION 2.6)
6
7cmake_policy(VERSION 2.6.0)
8if(POLICY CMP0017)
9 cmake_policy(SET CMP0017 NEW)
10endif()
11
12set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
13include(MacroCheckGccVisibility)
14include(MacroFindOptionalDep)
15enable_testing()
16
17##### global variables #####
18
19# due to a bug in libxml2, we only get thread support if _REENTRANT is defined
20add_definitions(-D_REENTRANT)
21
22set(LIBSTREAMANALYZER_VERSION_MAJOR 0)
23set(LIBSTREAMANALYZER_VERSION_MINOR 7)
24set(LIBSTREAMANALYZER_VERSION_PATCH 7)
25set(LIBSTREAMANALYZER_VERSION ${LIBSTREAMANALYZER_VERSION_MAJOR}.${LIBSTREAMANALYZER_VERSION_MINOR}.${LIBSTREAMANALYZER_VERSION_PATCH})
26set(LIBSTREAMANALYZER_SOVERSION ${LIBSTREAMANALYZER_VERSION_MAJOR})
27
28option(BUILD_UTILS "build luceneindexer, xmlindexer, rdfindexer, ontoprint utilities" ON)
29option(BUILD_DEEPTOOLS "build deep find and deepgrep tools" ON)
30option(ENABLE_XINE
31 "enable Xine support. This adds support for a larger number of media formats(highly unstable)." OFF)
32option(ENABLE_FFMPEG
33 "enable FFMPEG support. This adds support for a larger number of media formats(testing)." ON)
34option(ENABLE_EXIV2
35 "enable exiv2 support. This allows you to index EXIF/IPTC metadata." ON)
36set(CLUCENE_MIN_VERSION "0.9.21")
37option(ENABLE_CLUCENE "enable CLucene support (recommended)" ON)
38option(ENABLE_CLUCENE_NG "enable clucene-ng (version 1+) support (testing)" ON)
39
40# definition of LIB_DESTINATION which is the path where the lib is installed
41set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
42set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name" FORCE)
43
44# Set up RPATH handling, so the libs are found if they are installed to a non-standard location.
45# By default cmake builds the targets with full RPATH to everything in the build directory,
46# but then removes the RPATH when installing.
47# These two options below make it set the RPATH of the installed targets to all
48# RPATH directories outside the current CMAKE_BINARY_DIR and also the library
49# install directory. Alex
50set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
51set(CMAKE_INSTALL_RPATH ${LIB_DESTINATION} )
52
53if(NOT WIN32 AND NOT CMAKE_SYSTEM MATCHES "SunOS-5*.")
54 add_definitions(-fPIC)
55endif(NOT WIN32 AND NOT CMAKE_SYSTEM MATCHES "SunOS-5*.")
56
57##### environment inspection #####
58
59# check for visibility support
60macro_check_gcc_visibility(__STRIGI_HAVE_GCC_VISIBILITY)
61
62# check for required packages
63if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
64 find_package(LibStreams REQUIRED)
65else()
66 set(LIBSTREAMS_INCLUDE_DIRS
67 ${libstreams_SOURCE_DIR}/include
68 ${libstreams_BINARY_DIR}/include
69 )
70 set(LIBSTREAMS_LIBRARIES streams)
71endif()
72
73
74find_package(Threads REQUIRED)
75if (NOT CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_USE_WIN32_THREADS_INIT)
76 message(FATAL_ERROR "Strigi needs either pthreads or win32 threads, none was found.")
77endif (NOT CMAKE_USE_PTHREADS_INIT AND NOT CMAKE_USE_WIN32_THREADS_INIT)
78
79find_package(LibXml2 REQUIRED)
80find_package(Iconv REQUIRED)
81find_package(Boost REQUIRED)
82
83find_optional_dep(CLucene ENABLE_CLUCENE CLucene_FOUND "CLucene backend")
84find_optional_dep(CLucene1 ENABLE_CLUCENE_NG CLUCENE1_FOUND "CLucene Version 1+ backend")
85find_optional_dep(Exiv2 ENABLE_EXIV2 EXIV2_FOUND "indexing of EXIF/IPTC metadata")
86find_optional_dep(FFmpeg ENABLE_FFMPEG FFMPEG_FOUND "indexing FFMPEG" COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE)
87find_package(XAttr)
88include(ConfigureChecks.cmake)
89configure_file(LibStreamAnalyzer.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibStreamAnalyzerConfig.cmake @ONLY )
90
91##### building and testing #####
92
93configure_file(${libstreamanalyzer_SOURCE_DIR}/strigi_thread.h.cmake
94 ${libstreamanalyzer_BINARY_DIR}/include/strigi/strigi_thread.h)
95
96# every directory needs the headers that will be installed
97include_directories(${LIBSTREAMS_INCLUDE_DIRS}
98 ${libstreamanalyzer_SOURCE_DIR}/include
99 ${libstreamanalyzer_SOURCE_DIR}/include/strigi
100 ${libstreamanalyzer_BINARY_DIR}/include
101 ${libstreamanalyzer_BINARY_DIR}/include/strigi
102 ${libstreamanalyzer_SOURCE_DIR}/lib
103 ${libstreamanalyzer_BINARY_DIR}/lib
104 ${ICONV_INCLUDE_DIR}
105 ${LIBSTREAMS_LIBRARY_DIRS}
106 ${EXIV2_INCLUDEDIR}
107 ${XINE_INCLUDE_DIR}
108 ${FFMPEG_INCLUDE_DIRS}
109 ${MAGIC_INCLUDE_DIR}
110 ${LIBXML2_INCLUDE_DIR}
111 ${Boost_INCLUDE_DIR}
112)
113if(XATTR_FOUND)
114 include_directories(${XATTR_INCLUDE_DIR})
115endif(XATTR_FOUND)
116
117add_subdirectory(lib)
118add_subdirectory(plugins)
119#add_subdirectory(tests)
120
121
122##### installing #####
123
124# all installed files are listed here
125# headers
126file(GLOB STRIGI_HEADERS include/strigi/*.h)
127install(FILES
128 ${STRIGI_HEADERS}
129 ${libstreamanalyzer_BINARY_DIR}/include/strigi/strigi_thread.h
130 DESTINATION include/strigi
131)
132install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibStreamAnalyzerConfig.cmake
133 DESTINATION ${LIB_DESTINATION}/libstreamanalyzer)
134# ontologies
135file (GLOB STRIGI_ONTOLOGIES share/strigi/fieldproperties/*.rdfs)
136install(FILES
137 ${STRIGI_ONTOLOGIES}
138 DESTINATION share/strigi/fieldproperties/
139)
140# library
141if(NOT WIN32)
142 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lib/libstreamanalyzer.pc.cmake
143 ${CMAKE_CURRENT_BINARY_DIR}/lib/libstreamanalyzer.pc)
144
145 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/libstreamanalyzer.pc
146 DESTINATION ${LIB_DESTINATION}/pkgconfig)
147endif(NOT WIN32)