2013-11-08 22:32:07 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
2018-05-24 16:10:11 +00:00
|
|
|
project (mympd C)
|
2014-01-08 01:22:05 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
|
2019-01-05 00:01:34 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "5")
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
2018-06-17 20:23:37 +00:00
|
|
|
|
2014-11-11 20:13:11 +00:00
|
|
|
if(CMAKE_BUILD_TYPE MATCHES RELEASE)
|
2018-09-16 21:22:36 +00:00
|
|
|
set(ASSETS_PATH "/usr/share/${PROJECT_NAME}/htdocs")
|
2018-06-17 22:42:22 +00:00
|
|
|
set(DEBUG "OFF")
|
2014-11-11 20:13:11 +00:00
|
|
|
else()
|
|
|
|
set(ASSETS_PATH "${PROJECT_SOURCE_DIR}/htdocs")
|
2018-06-17 22:42:22 +00:00
|
|
|
set(DEBUG "ON")
|
2014-11-11 20:13:11 +00:00
|
|
|
endif()
|
2014-02-16 18:46:53 +00:00
|
|
|
|
2019-01-05 12:29:10 +00:00
|
|
|
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
|
|
|
MESSAGE("++ 64 bit architecture")
|
|
|
|
set(PKGARCH64 "ON")
|
|
|
|
else()
|
|
|
|
MESSAGE("++ 32 bit architecture")
|
|
|
|
set(PKGARCH64 "OFF")
|
|
|
|
endif()
|
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
find_package(LibMPDClient REQUIRED)
|
2019-01-05 00:25:30 +00:00
|
|
|
find_package(Threads REQUIRED)
|
2019-01-18 17:50:34 +00:00
|
|
|
find_package(OpenSSL REQUIRED)
|
2014-01-08 01:22:05 +00:00
|
|
|
|
2019-01-05 12:29:10 +00:00
|
|
|
configure_file(src/global.h.in ${PROJECT_BINARY_DIR}/global.h)
|
2019-01-18 17:50:34 +00:00
|
|
|
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${LIBMPDCLIENT_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
|
2014-01-08 01:22:05 +00:00
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
|
2019-01-28 00:35:03 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -O1 -Wall -fstack-protector -D_FORTIFY_SOURCE=2 -pie -fPIE -DMG_ENABLE_SSL")
|
2019-01-15 00:51:13 +00:00
|
|
|
|
2019-01-28 00:35:03 +00:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -fsanitize=address \
|
|
|
|
-fsanitize=undefined -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable -fsanitize=vla-bound \
|
|
|
|
-fsanitize=null -fsanitize=return -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=bounds-strict \
|
|
|
|
-fsanitize=alignment -fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow \
|
|
|
|
-fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool -fsanitize=enum -fsanitize=vptr -static-libasan")
|
2019-01-22 00:20:04 +00:00
|
|
|
|
|
|
|
#for use with valgrind, disable above 2 set commands and enable the following set commands
|
2019-01-28 00:35:03 +00:00
|
|
|
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -DMG_ENABLE_SSL")
|
|
|
|
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb")
|
2019-01-15 00:51:13 +00:00
|
|
|
|
2019-01-20 23:48:13 +00:00
|
|
|
#compiler flags for mympd src
|
2019-01-18 17:50:34 +00:00
|
|
|
file(GLOB MYMPD_SRC_FILES "src/*.c")
|
|
|
|
set_property(SOURCE ${MYMPD_SRC_FILES} PROPERTY COMPILE_FLAGS "-Wextra -pedantic -Wformat=2 -Wno-unused-parameter -Wshadow -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs")
|
|
|
|
|
2019-01-20 23:48:13 +00:00
|
|
|
#compiler flags for mongoose.c
|
|
|
|
set_property(SOURCE dist/src/mongoose/mongoose.c PROPERTY COMPILE_FLAGS "-Wno-format-truncation")
|
|
|
|
|
2019-01-15 00:51:13 +00:00
|
|
|
set (CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro -Wl,-z,now")
|
2018-06-24 18:30:59 +00:00
|
|
|
|
2018-07-09 21:58:25 +00:00
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
set(SOURCES
|
2019-01-05 21:28:18 +00:00
|
|
|
src/main.c
|
|
|
|
src/global.c
|
2013-11-08 22:32:07 +00:00
|
|
|
src/mpd_client.c
|
2019-01-05 00:01:34 +00:00
|
|
|
src/web_server.c
|
2019-01-08 00:09:43 +00:00
|
|
|
src/mympd_api.c
|
2018-10-07 21:21:00 +00:00
|
|
|
src/list.c
|
2019-01-05 00:01:34 +00:00
|
|
|
src/tiny_queue.c
|
2018-07-30 22:05:37 +00:00
|
|
|
dist/src/mongoose/mongoose.c
|
|
|
|
dist/src/frozen/frozen.c
|
2018-08-06 20:51:48 +00:00
|
|
|
dist/src/inih/ini.c
|
2013-11-13 14:30:54 +00:00
|
|
|
)
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2018-05-24 16:10:11 +00:00
|
|
|
add_executable(mympd ${SOURCES})
|
2019-01-05 00:25:30 +00:00
|
|
|
target_link_libraries(mympd ${LIBMPDCLIENT_LIBRARY} ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2018-05-24 16:10:11 +00:00
|
|
|
install(TARGETS mympd DESTINATION bin)
|
2018-09-06 22:10:40 +00:00
|
|
|
install(FILES contrib/mympd.1 DESTINATION share/man/man1)
|
|
|
|
install(PROGRAMS contrib/crcert.sh DESTINATION share/${PROJECT_NAME}/)
|
|
|
|
install(FILES contrib/mympd.service DESTINATION share/${PROJECT_NAME}/)
|
2018-09-17 17:31:45 +00:00
|
|
|
install(FILES contrib/mympd.conf.dist DESTINATION ../etc/${PROJECT_NAME}/)
|
2018-07-16 17:51:59 +00:00
|
|
|
install(FILES htdocs/mympd.webmanifest DESTINATION share/${PROJECT_NAME}/htdocs/)
|
2018-07-30 22:05:37 +00:00
|
|
|
install(FILES dist/htdocs/index.html DESTINATION share/${PROJECT_NAME}/htdocs/)
|
|
|
|
install(FILES dist/htdocs/player.html DESTINATION share/${PROJECT_NAME}/htdocs/)
|
|
|
|
install(FILES dist/htdocs/sw.min.js DESTINATION share/${PROJECT_NAME}/htdocs/)
|
|
|
|
install(FILES dist/htdocs/js/player.min.js DESTINATION share/${PROJECT_NAME}/htdocs/js/)
|
|
|
|
install(FILES dist/htdocs/js/bootstrap-native-v4.min.js DESTINATION share/${PROJECT_NAME}/htdocs/js/)
|
2018-08-22 12:06:22 +00:00
|
|
|
install(FILES dist/htdocs/js/mympd.min.js DESTINATION share/${PROJECT_NAME}/htdocs/js/)
|
2018-11-05 23:13:22 +00:00
|
|
|
install(FILES dist/htdocs/js/keymap.min.js DESTINATION share/${PROJECT_NAME}/htdocs/js/)
|
2018-07-30 22:05:37 +00:00
|
|
|
install(FILES dist/htdocs/css/bootstrap.min.css DESTINATION share/${PROJECT_NAME}/htdocs/css/)
|
2018-08-22 12:06:22 +00:00
|
|
|
install(FILES dist/htdocs/css/mympd.min.css DESTINATION share/${PROJECT_NAME}/htdocs/css/)
|
2018-06-21 21:29:49 +00:00
|
|
|
install(DIRECTORY htdocs/assets DESTINATION share/${PROJECT_NAME}/htdocs)
|
2018-09-20 20:13:04 +00:00
|
|
|
install(DIRECTORY DESTINATION ../var/lib/${PROJECT_NAME}/pics)
|
2018-09-24 20:55:53 +00:00
|
|
|
install(DIRECTORY DESTINATION ../var/lib/${PROJECT_NAME}/tmp)
|
2018-10-01 19:12:59 +00:00
|
|
|
install(DIRECTORY DESTINATION ../var/lib/${PROJECT_NAME}/state)
|
2018-10-15 22:34:25 +00:00
|
|
|
install(DIRECTORY DESTINATION ../etc/${PROJECT_NAME}/syscmds)
|
2018-09-25 22:49:14 +00:00
|
|
|
install(DIRECTORY dist/smartpls DESTINATION ../var/lib/${PROJECT_NAME})
|