1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-03-09 23:38:56 +00:00

put back cmake files

This commit is contained in:
Derek Dai 2017-04-06 22:13:31 +08:00
parent 4836850bf9
commit 92312fd4e7
No known key found for this signature in database
GPG key ID: E109CC97553EF009
10 changed files with 390 additions and 0 deletions

33
CMakeLists.txt Normal file
View file

@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 2.8)
project(Miraclecast)
SET(PACKAGE_NAME miraclecast)
SET(PACKAGE_VERSION 1)
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake
${CMAKE_MODULE_PATH})
set(CMAKE_C_FLAGS "-std=gnu11 ${CMAKE_C_FLAGS}")
add_definitions(-D_GNU_SOURCE)
SET(BUILD_BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
OPTION(BUILD_ENABLE_DEBUG "Enable Debug" ON )
OPTION(RELY_UDEV "Rely in udev tag to select device" OFF )
OPTION(BUILD_TESTS "Enable TEST" ON )
if(BUILD_ENABLE_DEBUG)
add_definitions(-DBUILD_ENABLE_DEBUG)
endif()
find_package(PkgConfig)
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
pkg_check_modules (UDEV REQUIRED libudev)
pkg_check_modules (SYSTEMD REQUIRED libsystemd)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
add_subdirectory(src)
add_subdirectory(res)
add_subdirectory(test)

29
cmake/FindReadline.cmake Normal file
View file

@ -0,0 +1,29 @@
# from http://websvn.kde.org/trunk/KDE/kdeedu/cmake/modules/FindReadline.cmake
# http://websvn.kde.org/trunk/KDE/kdeedu/cmake/modules/COPYING-CMAKE-SCRIPTS
# --> BSD licensed
#
# GNU Readline library finder
if(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)
set(READLINE_FOUND TRUE)
else(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)
FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h
/usr/include/readline
)
# 2008-04-22 The next clause used to read like this:
#
# FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
# FIND_LIBRARY(NCURSES_LIBRARY NAMES ncurses )
# include(FindPackageHandleStandardArgs)
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG NCURSES_LIBRARY READLINE_INCLUDE_DIR READLINE_LIBRARY )
#
# I was advised to modify it such that it will find an ncurses library if
# required, but not if one was explicitly given, that is, it allows the
# default to be overridden. PH
FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY )
MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY)
endif(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY)

8
config.h.cmake Normal file
View file

@ -0,0 +1,8 @@
#ifndef CONFIG_H
#define CONFIG_H
#cmakedefine BUILD_BINDIR "@BUILD_BINDIR@"
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
#endif // CONFIG_H

12
res/CMakeLists.txt Normal file
View file

@ -0,0 +1,12 @@
########### install files ###############
install(
PROGRAMS miracle-gst gstplayer uibc-viewer
DESTINATION bin
)
INSTALL(
FILES org.freedesktop.miracle.conf
DESTINATION /etc/dbus-1/system.d
)

38
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,38 @@
set(CMAKE_C_FLAGS "-std=gnu11 ${CMAKE_C_FLAGS}")
add_subdirectory(shared)
add_subdirectory(wifi)
add_subdirectory(dhcp)
add_subdirectory(ctl)
add_subdirectory(uibc)
set(miracled_SRCS miracled.h miracled.c)
add_executable(miracled ${miracled_SRCS})
target_link_libraries(miracled miracle-shared)
install(TARGETS miracled DESTINATION bin)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/shared)
########### install files ###############
#original Makefile.am contents follow:
#include $(top_srcdir)/common.am
#SUBDIRS = shared wifi dhcp ctl
#
#bin_PROGRAMS = miracled
#
#miracled_SOURCES = \
# miracled.h \
# miracled.c
#miracled_CPPFLAGS = \
# $(AM_CPPFLAGS) \
# $(DEPS_CFLAGS)
#miracled_LDADD = \
# shared/libmiracle-shared.la \
# $(DEPS_LIBS)
#

86
src/ctl/CMakeLists.txt Normal file
View file

@ -0,0 +1,86 @@
find_package(Readline)
########### next target ###############
set(miracle-wifictl_SRCS ctl.h
ctl-cli.c
ctl-wifi.c
wifictl.c)
add_executable(miracle-wifictl ${miracle-wifictl_SRCS})
install(TARGETS miracle-wifictl DESTINATION bin)
if(READLINE_FOUND)
message(STATUS "Compiling with Readline support")
set_property(TARGET miracle-wifictl
APPEND
PROPERTY COMPILE_DEFINITIONS HAVE_READLINE)
target_link_libraries(miracle-wifictl ${READLINE_LIBRARY})
endif(READLINE_FOUND)
target_link_libraries(miracle-wifictl miracle-shared)
########### next target ###############
set(miracle-sinkctl_SRCS ctl.h
ctl-cli.c
ctl-sink.h
ctl-sink.c
ctl-wifi.c
sinkctl.c
wfd.c)
add_executable(miracle-sinkctl ${miracle-sinkctl_SRCS})
install(TARGETS miracle-sinkctl DESTINATION bin)
if(READLINE_FOUND)
message(STATUS "Compiling with Readline support")
set_property(TARGET miracle-sinkctl
APPEND
PROPERTY COMPILE_DEFINITIONS HAVE_READLINE)
target_link_libraries(miracle-sinkctl ${READLINE_LIBRARY})
endif(READLINE_FOUND)
target_link_libraries(miracle-sinkctl miracle-shared)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/shared)
########### install files ###############
#original Makefile.am contents follow:
#include $(top_srcdir)/common.am
#bin_PROGRAMS = miracle-wifictl miracle-sinkctl
#
#miracle_wifictl_SOURCES = \
# ctl.h \
# ctl-cli.c \
# ctl-wifi.c \
# wifictl.c
#miracle_wifictl_CPPFLAGS = \
# $(AM_CPPFLAGS) \
# $(DEPS_CFLAGS)
#miracle_wifictl_LDADD = \
# ../shared/libmiracle-shared.la \
# -lreadline \
# $(DEPS_LIBS)
#
#miracle_sinkctl_SOURCES = \
# ctl.h \
# ctl-cli.c \
# ctl-sink.c \
# ctl-wifi.c \
# sinkctl.c
#miracle_sinkctl_CPPFLAGS = \
# $(AM_CPPFLAGS) \
# $(DEPS_CFLAGS)
#miracle_sinkctl_LDADD = \
# ../shared/libmiracle-shared.la \
# -lreadline \
# $(DEPS_LIBS)
#
#

62
src/dhcp/CMakeLists.txt Normal file
View file

@ -0,0 +1,62 @@
########### next target ###############
set(miracle-dhcp_SRCS dhcp.c
gdhcp.h
unaligned.h
common.h
common.c
ipv4ll.h
ipv4ll.c
client.c
server.c)
add_executable(miracle-dhcp ${miracle-dhcp_SRCS})
find_package(PkgConfig)
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
pkg_check_modules (UDEV REQUIRED libudev)
link_directories( ${UDEV_LIBRARY_DIRS})
include_directories( ${UDEV_INCLUDE_DIRS})
target_link_libraries(miracle-dhcp ${UDEV_LIBRARIES})
link_directories( ${GLIB2_LIBRARY_DIRS})
include_directories( ${GLIB2_INCLUDE_DIRS})
target_link_libraries(miracle-dhcp ${GLIB2_LIBRARIES})
target_link_libraries(miracle-dhcp miracle-shared)
install(TARGETS miracle-dhcp DESTINATION bin)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/shared)
########### install files ###############
#original Makefile.am contents follow:
#include $(top_srcdir)/common.am
#bin_PROGRAMS = miracle-dhcp
#
#miracle_dhcp_SOURCES = \
# dhcp.c \
# gdhcp.h \
# unaligned.h \
# common.h \
# common.c \
# ipv4ll.h \
# ipv4ll.c \
# client.c \
# server.c
#miracle_dhcp_CPPFLAGS = \
# $(AM_CPPFLAGS) \
# $(DEPS_CFLAGS) \
# $(GDHCP_CFLAGS)
#miracle_dhcp_LDADD = \
# ../shared/libmiracle-shared.la \
# $(DEPS_LIBS) \
# $(GDHCP_LIBS)
#
#
#

53
src/shared/CMakeLists.txt Normal file
View file

@ -0,0 +1,53 @@
set(CMAKE_C_FLAGS "-std=gnu11")
find_package(PkgConfig)
pkg_check_modules (SYSTEMD REQUIRED systemd>=213)
set(miracle-shared_SOURCES rtsp.h
rtsp.c
shl_dlist.h
shl_htable.h
shl_htable.c
shl_log.h
shl_log.c
shl_macro.h
shl_ring.h
shl_ring.c
shl_util.h
shl_util.c
util.h
wpas.h
wpas.c)
add_library(miracle-shared STATIC ${miracle-shared_SOURCES})
target_link_libraries (miracle-shared systemd)
########### install files ###############
#original Makefile.am contents follow:
#include $(top_srcdir)/common.am
#noinst_LTLIBRARIES = libmiracle-shared.la
#
#libmiracle_shared_la_SOURCES = \
# rtsp.h \
# rtsp.c \
# shl_dlist.h \
# shl_htable.h \
# shl_htable.c \
# shl_log.h \
# shl_log.c \
# shl_macro.h \
# shl_ring.h \
# shl_ring.c \
# shl_util.h \
# shl_util.c \
# util.h \
# wpas.h \
# wpas.c
#libmiracle_shared_la_LIBADD = -lsystemd
#
#
#

10
src/uibc/CMakeLists.txt Normal file
View file

@ -0,0 +1,10 @@
set(miracle-uibcctl_SRCS miracle-uibcctl.h
miracle-uibcctl.c)
add_executable(miracle-uibcctl ${miracle-uibcctl_SRCS})
target_link_libraries(miracle-uibcctl PRIVATE miracle-shared)
target_link_libraries(miracle-uibcctl PUBLIC m)
install(TARGETS miracle-uibcctl DESTINATION bin)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/shared)

59
src/wifi/CMakeLists.txt Normal file
View file

@ -0,0 +1,59 @@
########### next target ###############
set(miracle-wifid_SRCS wifid.h
wifid.c
wifid-dbus.c
wifid-link.c
wifid-peer.c
wifid-supplicant.c)
add_executable(miracle-wifid ${miracle-wifid_SRCS})
target_link_libraries(miracle-wifid ${KDE4_KDECORE_LIBS})
cmake_policy(SET CMP0015 NEW)
include_directories(shared)
link_directories(shared)
target_link_libraries(miracle-wifid miracle-shared)
find_package(PkgConfig)
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
pkg_check_modules (UDEV REQUIRED libudev)
#link_directories( ${UDEV_LIBRARY_DIRS})
#include_directories( ${UDEV_INCLUDE_DIRS})
target_link_libraries(miracle-wifid ${UDEV_LIBRARIES})
#link_directories( ${GLIB2_LIBRARY_DIRS})
#include_directories( ${GLIB2_INCLUDE_DIRS})
target_link_libraries(miracle-wifid ${GLIB2_LIBRARIES})
install(TARGETS miracle-wifid DESTINATION bin)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/shared)
########### install files ###############
#set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake-extensions/ )
#original Makefile.am contents follow:
#include $(top_srcdir)/common.am
#bin_PROGRAMS = miracle-wifid
#
#miracle_wifid_SOURCES = \
# wifid.h \
# wifid.c \
# wifid-dbus.c \
# wifid-link.c \
# wifid-peer.c \
# wifid-supplicant.c
#miracle_wifid_CPPFLAGS = \
# $(AM_CPPFLAGS) \
# $(DEPS_CFLAGS)
#miracle_wifid_LDADD = \
# ../shared/libmiracle-shared.la \
# $(DEPS_LIBS)
#