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")
|
2014-02-22 01:11:45 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "2")
|
2014-05-09 12:10:14 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "2")
|
2014-02-16 18:46:53 +00:00
|
|
|
|
2014-02-04 16:58:10 +00:00
|
|
|
option(WITH_MPD_HOST_CHANGE "Let users of the web frontend change the MPD Host" ON)
|
2014-10-19 17:52:23 +00:00
|
|
|
option(WITH_IPV6 "enable IPv6 support" ON)
|
2013-11-12 01:51:39 +00:00
|
|
|
|
|
|
|
find_package(LibMPDClient REQUIRED)
|
2014-02-16 18:46:53 +00:00
|
|
|
find_package(Threads REQUIRED)
|
2014-01-08 01:22:05 +00:00
|
|
|
|
2014-02-22 00:57:26 +00:00
|
|
|
configure_file(src/config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
2014-03-08 19:32:54 +00:00
|
|
|
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
|
2014-01-08 01:22:05 +00:00
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
|
2014-01-08 01:22:05 +00:00
|
|
|
set(CMAKE_C_FLAGS "-std=gnu99 -Wall")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-ggdb -pedantic")
|
2014-10-19 17:52:23 +00:00
|
|
|
if(WITH_IPV6)
|
|
|
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NS_ENABLE_IPV6)
|
|
|
|
endif()
|
2013-11-12 01:51:39 +00:00
|
|
|
|
2014-02-22 00:57:26 +00:00
|
|
|
file(GLOB RESOURCES
|
|
|
|
RELATIVE ${PROJECT_SOURCE_DIR}
|
|
|
|
htdocs/js/*
|
|
|
|
htdocs/assets/*
|
|
|
|
htdocs/css/*.min.css
|
|
|
|
htdocs/fonts/*
|
|
|
|
htdocs/index.html
|
|
|
|
)
|
|
|
|
|
2014-03-08 19:32:54 +00:00
|
|
|
add_executable(mkdata htdocs/mkdata.c)
|
2014-10-19 14:35:16 +00:00
|
|
|
set(MKDATA_EXE $<TARGET_FILE:mkdata>)
|
2014-03-08 19:32:54 +00:00
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/assets.c
|
|
|
|
COMMAND ${MKDATA_EXE} ${RESOURCES} > ${PROJECT_BINARY_DIR}/assets.c
|
2014-02-22 00:57:26 +00:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
2014-03-18 03:01:39 +00:00
|
|
|
DEPENDS ${RESOURCES} mkdata
|
2014-02-16 18:46:53 +00:00
|
|
|
)
|
|
|
|
|
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
|
2014-02-16 18:46:53 +00:00
|
|
|
src/mongoose.c
|
2014-02-22 01:11:45 +00:00
|
|
|
src/json_encode.c
|
2014-03-08 19:32:54 +00:00
|
|
|
assets.c
|
2013-11-13 14:30:54 +00:00
|
|
|
)
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2014-03-08 19:32:54 +00:00
|
|
|
add_executable(ympd ${SOURCES})
|
2014-02-16 18:46:53 +00:00
|
|
|
target_link_libraries(ympd ${LIBMPDCLIENT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
install(TARGETS ympd DESTINATION bin)
|
2014-01-17 18:41:19 +00:00
|
|
|
install(FILES ympd.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
|