1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-26 23:07:17 +00:00

add workng cmake build enviroment

This commit is contained in:
Andrew Karpow 2013-11-08 23:32:07 +01:00
parent 1b44249105
commit 6a4e1301a8
3 changed files with 94 additions and 0 deletions

29
CMakeLists.txt Normal file
View File

@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 2.6)
project (ympd)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPD web client based on Websockets and
Bootstrap")
SET(CPACK_PACKAGE_VENDOR "Andrew Karpow <andy@ndyk.de>")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
FIND_PACKAGE(LibWebSockets REQUIRED)
FIND_PACKAGE(LibMPDClient REQUIRED)
INCLUDE(CheckCSourceCompiles)
SET(SOURCES
src/ympd.c
src/http_server.c
src/mpd_client.c
)
ADD_EXECUTABLE(ympd ${SOURCES})
ADD_DEFINITIONS(-DDATADIR="${CMAKE_INSTALL_PREFIX}/share")
TARGET_LINK_LIBRARIES(ympd ${LIBMPDCLIENT_LIBRARY} ${LIBWEBSOCKETS_LIBRARIES})
INSTALL(TARGETS ympd DESTINATION bin)
INSTALL(DIRECTORY htdocs DESTINATION share/${PROJECT_NAME})

View File

@ -0,0 +1,32 @@
# - Try to find LibMPDClient
# Once done, this will define
#
# LIBMPDCLIENT_FOUND - System has LibMPDClient
# LIBMPDCLIENT_INCLUDE_DIRS - The LibMPDClient include directories
# LIBMPDCLIENT_LIBRARIES - The libraries needed to use LibMPDClient
# LIBMPDCLIENT_DEFINITIONS - Compiler switches required for using LibMPDClient
find_package(PkgConfig)
pkg_check_modules(PC_LIBMPDCLIENT QUIET libmpdclient)
set(LIBMPDCLIENT_DEFINITIONS ${PC_LIBMPDCLIENT_CFLAGS_OTHER})
find_path(LIBMPDCLIENT_INCLUDE_DIR
NAMES mpd/player.h
HINTS ${PC_LIBMPDCLIENT_INCLUDEDIR} ${PC_LIBMPDCLIENT_INCLUDE_DIRS}
)
find_library(LIBMPDCLIENT_LIBRARY
NAMES mpdclient
HINTS ${PC_LIBMPDCLIENT_LIBDIR} ${PC_LIBMPDCLIENT_LIBRARY_DIRS}
)
set(LIBMPDCLIENT_LIBRARIES ${LIBMPDCLIENT_LIBRARY})
set(LIBMPDCLIENT_INCLUDE_DIRS ${LIBMPDCLIENT_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibMPDClient DEFAULT_MSG
LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR
)
mark_as_advanced(LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR)

View File

@ -0,0 +1,33 @@
# This module tries to find libWebsockets library and include files
#
# LIBWEBSOCKETS_INCLUDE_DIR, path where to find libwebsockets.h
# LIBWEBSOCKETS_LIBRARY_DIR, path where to find libwebsockets.so
# LIBWEBSOCKETS_LIBRARIES, the library to link against
# LIBWEBSOCKETS_FOUND, If false, do not try to use libWebSockets
#
# This currently works probably only for Linux
FIND_PATH ( LIBWEBSOCKETS_INCLUDE_DIR libwebsockets.h
/usr/local/include
/usr/include
)
FIND_LIBRARY ( LIBWEBSOCKETS_LIBRARIES websockets
/usr/local/lib
/usr/lib
)
GET_FILENAME_COMPONENT( LIBWEBSOCKETS_LIBRARY_DIR ${LIBWEBSOCKETS_LIBRARIES} PATH )
SET ( LIBWEBSOCKETS_FOUND "NO" )
IF ( LIBWEBSOCKETS_INCLUDE_DIR )
IF ( LIBWEBSOCKETS_LIBRARIES )
SET ( LIBWEBSOCKETS_FOUND "YES" )
ENDIF ( LIBWEBSOCKETS_LIBRARIES )
ENDIF ( LIBWEBSOCKETS_INCLUDE_DIR )
MARK_AS_ADVANCED(
LIBWEBSOCKETS_LIBRARY_DIR
LIBWEBSOCKETS_INCLUDE_DIR
LIBWEBSOCKETS_LIBRARIES
)