forked from RJ/playdar
/
CMakeLists.txt
127 lines (103 loc) · 4.58 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
PROJECT(playdarproject)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
SET(PLAYDAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
SET(CMAKE_MODULE_PATH "${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")
# on linux x86-64 set this to OFF if you are having (-fPIC...) build problems.
# then: cd build/ && rm -rf CMakeCache.txt CMakeFiles/ cmake_install.cmake resolvers/
# then: cmake .. ; make
# alternatively, recompile boost with -fPIC
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREADED ON)
FIND_PACKAGE(Boost 1.35 REQUIRED COMPONENTS filesystem system regex thread program_options date_time)
FIND_PACKAGE(Taglib 1.5.0 REQUIRED)
FIND_PACKAGE(Sqlite3 REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
INCLUDE_DIRECTORIES(
${PLAYDAR_PATH}/includes # playdar includes
${Boost_INCLUDE_DIR}
${SQLITE3_INCLUDE_DIR}
${TAGLIB_INCLUDES}
${CURL_INCLUDE_DIR}
/usr/local/include
${DEPS}/moost_http/include # httpd server component, GPL, forked from code from fawx.com
${DEPS}/sqlite3pp-read-only # cpp wrapper for sqlite api, patched for 64bit compile fix
${DEPS}/json_spirit_v3.00 # json parser, using boost spirit, patched for better utf8
${DEPS}/pdl-0.3.0/include # x-platform dynamic loading of libraries, minor fixes applied
${DEPS}/boost.process # (unofficial) spawning resolver scripts
${DEPS}/boost.uuid # (unofficial) UUID generation library
)
# Always check local/lib first:
LINK_DIRECTORIES(/usr/local/lib)
SET(CMAKE_VERBOSE_MAKEFILE ON)
INCLUDE(InstallRequiredSystemLibraries)
#add definitions, compiler switches, etc.
ADD_DEFINITIONS(-DBOOST_SPIRIT_THREADSAFE)
# PDL doesn't know apple mac = posix, this tells it:
IF(APPLE)
ADD_DEFINITIONS(-Dunix)
ENDIF(APPLE)
IF(WIN32)
ADD_DEFINITIONS(/DNOMINMAX)
ADD_DEFINITIONS(/DWIN32_LEAN_AND_MEAN)
ENDIF(WIN32)
IF(NOT WIN32)
# removes operators like "and", "or" and "not"
ADD_DEFINITIONS(-Wall) # -ggdb
ADD_DEFINITIONS(-g )
ADD_DEFINITIONS(-fno-operator-names)
ADD_DEFINITIONS(-fPIC)
ENDIF(NOT WIN32)
ADD_EXECUTABLE( playdar
${SRC}/application.cpp
${SRC}/resolver.cpp
${SRC}/rs_script.cpp
${SRC}/utils/uuid.cpp
# ${SRC}/utils/base64.cpp
${SRC}/utils/levenshtein.cpp
${SRC}/playdar_request_handler.cpp
${SRC}/playdar_request.cpp
${SRC}/main.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
# 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
${DEPS}/sqlite3pp-read-only/sqlite3pp.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
)
TARGET_LINK_LIBRARIES( playdar
${CURL_LIBRARIES}
${SQLITE3_LIBRARIES}
${TAGLIB_LIBRARIES} # LGPL/MPL
${SQLITE3_LIBRARIES} # public domain
${Boost_LIBRARIES} # Boost license
)
INSTALL(TARGETS playdar RUNTIME DESTINATION bin)
#
# Resolver Plugins
#
SET(LIBRARY_OUTPUT_PATH "${PLAYDAR_PATH}/plugins")
IF(APPLE)
SET( PLAYDAR_PLUGIN_LDFLAGS -undefined\ dynamic_lookup )
ENDIF(APPLE)
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 )