2013-11-08 22:32:07 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
|
|
|
project (ympd)
|
2014-01-08 01:22:05 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
|
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "1")
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
2014-01-12 19:16:07 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "5")
|
2014-01-08 01:22:05 +00:00
|
|
|
set(CPACK_GENERATOR "DEB;RPM;TGZ")
|
|
|
|
set(CPACK_SOURCE_GENERATOR "TBZ2")
|
|
|
|
set(DEBIAN_PACKAGE_SECTION "web")
|
2014-01-10 19:50:55 +00:00
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPD web client based on Websockets and Bootstrap")
|
2014-01-08 01:22:05 +00:00
|
|
|
set(CPACK_PACKAGE_CONTACT "Andrew Karpow <andy@ympd.org>")
|
2013-11-13 14:30:54 +00:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "andy@ndyk.de")
|
2014-01-08 01:22:05 +00:00
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libssl1.0.0,libmpdclient2")
|
|
|
|
|
2014-01-12 19:16:07 +00:00
|
|
|
option(WITH_STATIC_WEBSOCKETS "Build with static libwebsockets library" ON)
|
2013-11-12 01:51:39 +00:00
|
|
|
|
|
|
|
find_package(LibMPDClient REQUIRED)
|
2014-01-08 01:22:05 +00:00
|
|
|
find_package(LibWebSockets REQUIRED)
|
|
|
|
if(WITH_STATIC_WEBSOCKETS)
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
configure_file(${PROJECT_SOURCE_DIR}/src/config.h.in
|
|
|
|
${PROJECT_BINARY_DIR}/config.h)
|
|
|
|
include_directories(${PROJECT_BINARY_DIR})
|
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
include(CPack)
|
|
|
|
|
2014-01-08 01:22:05 +00:00
|
|
|
set(CMAKE_C_FLAGS "-std=gnu99 -Wall")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-ggdb -pedantic")
|
2013-11-12 01:51:39 +00:00
|
|
|
|
|
|
|
set(SOURCES
|
2013-11-08 22:32:07 +00:00
|
|
|
src/ympd.c
|
|
|
|
src/http_server.c
|
|
|
|
src/mpd_client.c
|
2013-11-13 14:30:54 +00:00
|
|
|
)
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
add_executable(ympd ${SOURCES})
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2014-01-08 01:22:05 +00:00
|
|
|
# TODO: use generator expressions introduced to CMake 2.8.12, too fresh yet
|
|
|
|
if(WITH_STATIC_WEBSOCKETS)
|
|
|
|
find_library(LIBWEBSOCKETS_LIBRARY_STATIC libwebsockets.a)
|
|
|
|
target_link_libraries(ympd ${LIBMPDCLIENT_LIBRARY}
|
|
|
|
${LIBWEBSOCKETS_LIBRARY_STATIC} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
|
|
|
|
else()
|
|
|
|
target_link_libraries(ympd ${LIBMPDCLIENT_LIBRARY}
|
|
|
|
${LIBWEBSOCKETS_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
install(TARGETS ympd DESTINATION bin)
|
|
|
|
install(DIRECTORY htdocs DESTINATION share/${PROJECT_NAME})
|
|
|
|
install(FILES contrib/init.debian DESTINATION /etc/init.d
|
|
|
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
|
2014-01-12 19:16:07 +00:00
|
|
|
WORLD_READ WORLD_EXECUTE RENAME ${PROJECT_NAME})
|
2013-11-12 01:51:39 +00:00
|
|
|
install(FILES contrib/default.debian DESTINATION /etc/default/${PROJECT_NAME}
|
2014-01-12 19:16:07 +00:00
|
|
|
RENAME ${PROJECT_NAME})
|
2013-11-13 14:30:54 +00:00
|
|
|
|