/
CMakeLists.txt
133 lines (112 loc) · 4.92 KB
/
CMakeLists.txt
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
PROJECT(playdarproject)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
SET(PLAYDAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
SET(CMAKE_MODULE_PATH "${PLAYDAR_PATH}/CMakeModules")
SET(SRC "${PLAYDAR_PATH}/src")
SET(DEPS "${PLAYDAR_PATH}/deps")
SET(RESOLVERS_DIR "${PLAYDAR_PATH}/resolvers")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PLAYDAR_PATH}/bin")
# Don't really do 'make install' properly yet:
SET(CMAKE_INSTALL_PREFIX "/usr/local")
FIND_PACKAGE(Taglib 1.5.0 REQUIRED)
FIND_PACKAGE(Boost 1.35 REQUIRED COMPONENTS filesystem system regex thread program_options)
FIND_PACKAGE(OsspUuid REQUIRED)
FIND_PACKAGE(Sqlite3 REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
# we're not doing this because CMake sucks and RJ's machine had the right one
# in /usr/local and an old one in /usr and CMake chose the wrong one :P
#FIND_PACKAGE(Uriparser 0.7.0 REQUIRED)
INCLUDE_DIRECTORIES(
${PLAYDAR_PATH}/includes # playdar includes
#${URIPARSER_INCLUDE_DIR}
${OSSPUUID_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${SQLITE3_INCLUDE_DIR}
${TAGLIB_INCLUDES}
/usr/local/include
${DEPS}/moost_http/include # our httpd server, from erikf's moost
${DEPS}/sqlite3pp-read-only # cpp wrapper for sqlite api
${DEPS}/json_spirit_v3.00 # json parser, using boost spirit
${DEPS}/pdl-0.3.0/include # x-platform dynamic loading of libraries
${DEPS}/boost.process # spawning resolver scripts
)
# Always check local/lib first:
LINK_DIRECTORIES(/usr/local/lib)
SET(CMAKE_VERBOSE_MAKEFILE ON)
INCLUDE(InstallRequiredSystemLibraries)
#add definitions, compiler switches, etc.
ADD_DEFINITIONS(-Wall -ggdb)
# PDL doesn't know apple mac = posix, this tells it:
IF(APPLE)
ADD_DEFINITIONS(-Dunix)
ENDIF(APPLE)
ADD_EXECUTABLE(scanner # EXCLUDE_FROM_ALL
${SRC}/scanner/scanner.cpp
${SRC}/library.cpp
${DEPS}/sqlite3pp-read-only/sqlite3pp.cpp
)
TARGET_LINK_LIBRARIES(scanner
uriparser
${SQLITE3_LIBRARIES}
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_THREAD_LIBRARY}
${OSSPUUID_LIBRARIES}
${TAGLIB_LIBRARIES})
ADD_EXECUTABLE( playdar
${SRC}/application.cpp
${SRC}/resolver.cpp
${SRC}/resolver_service.cpp
${SRC}/rs_local_library.cpp
${SRC}/rs_script.cpp
${SRC}/library.cpp
${SRC}/playdar/playdar_request_handler.cpp
${SRC}/playdar_request.cpp
${SRC}/playdar/main.cpp
# sqlite wrapper:
${DEPS}/sqlite3pp-read-only/sqlite3pp.cpp
# json parser:
${DEPS}/json_spirit_v3.00/json_spirit/json_spirit_reader.cpp
${DEPS}/json_spirit_v3.00/json_spirit/json_spirit_value.cpp
${DEPS}/json_spirit_v3.00/json_spirit/json_spirit_writer.cpp
# moost http:
${DEPS}/moost_http/src/http/filesystem_request_handler.cpp
${DEPS}/moost_http/src/http/mime_types.cpp
${DEPS}/moost_http/src/http/reply.cpp
${DEPS}/moost_http/src/http/request_parser.cpp
# Portable Dynamic Loader:
${DEPS}/pdl-0.3.0/src/DynamicLibrary.cpp
${DEPS}/pdl-0.3.0/src/DynamicLibraryManager.cpp
${DEPS}/pdl-0.3.0/src/DynamicLoader.cpp
${DEPS}/pdl-0.3.0/src/LoaderException.cpp
# Our own misc utils:
${SRC}/utils/base64.cpp
${SRC}/utils/levenshtein.cpp
)
TARGET_LINK_LIBRARIES( playdar
${CURL_LIBRARIES}
${TAGLIB_LIBRARIES} # LGPL/MPL
${SQLITE3_LIBRARIES} # public domain
#${URIPARSER_LIBRARIES} # BSD
uriparser
${OSSPUUID_LIBRARIES} # BSD-like
${Boost_REGEX_LIBRARY} # Boost license
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
INSTALL(TARGETS scanner RUNTIME DESTINATION bin)
INSTALL(TARGETS playdar RUNTIME DESTINATION bin)
#
# Resolver Plugins
#
SET(LIBRARY_OUTPUT_PATH "${PLAYDAR_PATH}/plugins")
FILE(GLOB PLUGINDIRS "${RESOLVERS_DIR}/*")
FOREACH(PLUGDIR ${PLUGINDIRS})
IF(IS_DIRECTORY ${PLUGDIR})
MESSAGE( STATUS "Adding plugin directory: ${PLUGDIR}" )
ADD_SUBDIRECTORY(${PLUGDIR})
ENDIF(IS_DIRECTORY ${PLUGDIR})
ENDFOREACH(PLUGDIR)