diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 6aea926..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -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) - diff --git a/cmake/FindReadline.cmake b/cmake/FindReadline.cmake deleted file mode 100644 index 1d4cc55..0000000 --- a/cmake/FindReadline.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# 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) diff --git a/config.h.cmake b/config.h.cmake deleted file mode 100644 index ddc0cd1..0000000 --- a/config.h.cmake +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -#cmakedefine BUILD_BINDIR "@BUILD_BINDIR@" - -#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" - -#endif // CONFIG_H diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..c21167e --- /dev/null +++ b/meson.build @@ -0,0 +1,38 @@ +project('Miraclecast', + 'c', + version: '1', + meson_version: '>=0.39', + default_options: ['buildtype=debugoptimized', 'c_std=gnu11'] +) + +add_project_arguments('-D_GNU_SOURCE', language: 'c') + +conf_data = configuration_data() +conf_data.set('BUILD_BINDIR', + '"' + join_paths(get_option('prefix'), get_option('bindir')) + '"' +) +conf_data.set('PACKAGE_STRING', + '"@0@ @1@"'.format(meson.project_name(), meson.project_version()) +) +configure_file(output: 'config.h', + configuration: conf_data +) + +c_compiler = meson.get_compiler('c') +readline = c_compiler.find_library('readline', required: false) +if readline.found() + add_project_arguments('-DHAVE_READLINE', language: 'c') +endif + +if get_option('build-enable-debug') + add_project_arguments('-DBUILD_ENABLE_DEBUG', language: 'c') +endif + +glib2 = dependency('glib-2.0') +udev = dependency('libudev') +libsystemd = dependency('libsystemd') + +subdir('src') +subdir('res') +subdir('test') + diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..0f4eaee --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,16 @@ +option('build-enable-debug', + type: 'boolean', + value: true, + description: 'Enable Debug') +option('rely-udev', + type: 'boolean', + value: false, + description: 'Rely in udev tag to select device') +option('build-tests', + type: 'boolean', + value: true, + description: 'Enable TEST') +option('build-demo', + type: 'boolean', + value: false, + description: 'Enable DEMO') diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt deleted file mode 100644 index 4cb3f19..0000000 --- a/res/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ - -########### install files ############### - -install( - PROGRAMS miracle-gst gstplayer uibc-viewer - DESTINATION bin - ) - -INSTALL( - FILES org.freedesktop.miracle.conf - DESTINATION /etc/dbus-1/system.d - ) diff --git a/res/meson-install-scripts.sh b/res/meson-install-scripts.sh new file mode 100755 index 0000000..d18a1f2 --- /dev/null +++ b/res/meson-install-scripts.sh @@ -0,0 +1,8 @@ +#!/bin/sh +RESDIR="${MESON_SOURCE_ROOT}/res" +BINDIR="${MESON_INSTALL_DESTDIR_PREFIX}/$1" + +install -dv "$BINDIR" +install -v "$RESDIR"/miracle-gst "$BINDIR" +install -v "$RESDIR"/gstplayer "$BINDIR" +install -v "$RESDIR"/uibc-viewer "$BINDIR" diff --git a/res/meson.build b/res/meson.build new file mode 100644 index 0000000..d63d753 --- /dev/null +++ b/res/meson.build @@ -0,0 +1,6 @@ +meson.add_install_script('meson-install-scripts.sh', get_option('bindir')) + +install_data( + 'org.freedesktop.miracle.conf', + install_dir: join_paths('/', get_option('sysconfdir'), 'dbus-1', 'system.d') +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 96fe570..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -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) -# diff --git a/src/ctl/CMakeLists.txt b/src/ctl/CMakeLists.txt deleted file mode 100644 index d6d98e4..0000000 --- a/src/ctl/CMakeLists.txt +++ /dev/null @@ -1,86 +0,0 @@ - -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) -# -# diff --git a/src/ctl/meson.build b/src/ctl/meson.build new file mode 100644 index 0000000..f3e6800 --- /dev/null +++ b/src/ctl/meson.build @@ -0,0 +1,24 @@ +inc = include_directories('../..') +deps = [libsystemd, libmiracle_shared_dep] +if readline.found() + deps += readline +endif + +miracle_wifictl_srcs = ['ctl-cli.c', 'ctl-wifi.c', 'wifictl.c'] +executable('miracle-wifictl', miracle_wifictl_srcs, + install: true, + include_directories: inc, + dependencies: deps +) + +miracle_sinkctl_srcs = ['ctl-cli.c', + 'ctl-sink.c', + 'ctl-wifi.c', + 'sinkctl.c', + 'wfd.c' +] +executable('miracle-sinkctl', miracle_sinkctl_srcs, + install: true, + include_directories: inc, + dependencies: deps +) diff --git a/src/dhcp/CMakeLists.txt b/src/dhcp/CMakeLists.txt deleted file mode 100644 index 7935d68..0000000 --- a/src/dhcp/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ - -########### 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) -# -# -# diff --git a/src/dhcp/meson.build b/src/dhcp/meson.build new file mode 100644 index 0000000..1dce905 --- /dev/null +++ b/src/dhcp/meson.build @@ -0,0 +1,11 @@ +miracle_dhcp_srcs = ['dhcp.c', + 'common.c', + 'ipv4ll.c', + 'client.c', + 'server.c' +] +executable('miracle-dhcp', miracle_dhcp_srcs, + install: true, + include_directories: include_directories('../..'), + dependencies: [glib2, udev, libmiracle_shared_dep] +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..1179ab3 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,11 @@ +subdir('shared') +subdir('wifi') +subdir('dhcp') +subdir('ctl') +subdir('uibc') + +executable('miracled', 'miracled.c', + dependencies: libmiracle_shared_dep, + include_directories: include_directories('..'), + install: true +) diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt deleted file mode 100644 index f757fba..0000000 --- a/src/shared/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -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 -# -# -# diff --git a/src/shared/meson.build b/src/shared/meson.build new file mode 100644 index 0000000..4af9e34 --- /dev/null +++ b/src/shared/meson.build @@ -0,0 +1,22 @@ +libmiracle_shared = static_library('miracle-shared', + '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', + dependencies: [libsystemd] +) +libmiracle_shared_dep = declare_dependency( + include_directories: include_directories('.'), + link_with: libmiracle_shared +) diff --git a/src/uibc/CMakeLists.txt b/src/uibc/CMakeLists.txt deleted file mode 100644 index ac81904..0000000 --- a/src/uibc/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -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) diff --git a/src/uibc/meson.build b/src/uibc/meson.build new file mode 100644 index 0000000..17a06db --- /dev/null +++ b/src/uibc/meson.build @@ -0,0 +1,5 @@ +m = c_compiler.find_library('m', required: false) +executable('miracle-uibcctl', 'miracle-uibcctl.h', 'miracle-uibcctl.c', + install: true, + dependencies: [m, libmiracle_shared_dep] +) diff --git a/src/wifi/CMakeLists.txt b/src/wifi/CMakeLists.txt deleted file mode 100644 index c041e34..0000000 --- a/src/wifi/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ - -########### 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) -# diff --git a/src/wifi/meson.build b/src/wifi/meson.build new file mode 100644 index 0000000..e0176f4 --- /dev/null +++ b/src/wifi/meson.build @@ -0,0 +1,14 @@ +inc = include_directories('../..') +miracle_wifid_src = ['wifid.h', + 'wifid.c', + 'wifid-dbus.c', + 'wifid-link.c', + 'wifid-peer.c', + 'wifid-supplicant.c' +] +executable('miracle-wifid', miracle_wifid_src, + include_directories: inc, + install: true, + dependencies: [udev, glib2, libsystemd, libmiracle_shared_dep] +) + diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000..b2feb2a --- /dev/null +++ b/test/meson.build @@ -0,0 +1,33 @@ +check = dependency('check', required: false) +deps = [udev, glib2, check, libsystemd, libmiracle_shared_dep] + +if check.found() + test_rtsp = executable('test_rtsp', 'test_rtsp.c', dependencies: deps) + + test_wpas = executable('test_wpas', 'test_wpas.c', dependencies: deps) + + test_valgrind = executable('test_valgrind', + 'test_valgrind.c', + dependencies: deps + ) + + valgrind = find_program('valgrind') + +# set(VALGRIND CK_FORK=no valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --leak-resolution=high --error-exitcode=1 --suppressions=${CMAKE_SOURCE_DIR}/test.supp) +# +# add_custom_target(memcheck-verify +# DEPENDS test_rtsp test_wpas test_valgrind +# COMMAND ${VALGRIND} --log-file=/dev/null ./test_valgrind >/dev/null | +# test 1 = $$? +# COMMENT "verify memcheck") +# +# add_custom_target(memcheck +# DEPENDS memcheck-verify +# COMMAND for i in $(MEMTESTS) | +# do | +# ${VALGRIND} --log-file=${CMAKE_SOURCE_DIR}/$$i.memlog | +# ${CMAKE_SOURCE_DIR}/$$i >/dev/null || (echo "memcheck failed on: $$i" ; exit 1) ; | +# done +# SOURCES test_rtsp test_valgrind test_wpas +# COMMENT "verify memcheck") +endif