mirror of
https://github.com/albfan/miraclecast.git
synced 2025-02-12 21:11:59 +00:00
cleanup cmake config
This commit is contained in:
parent
12193e473c
commit
544758f3d2
7 changed files with 62 additions and 66 deletions
|
@ -1,20 +1,8 @@
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake
|
||||||
${CMAKE_MODULE_PATH})
|
${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-std=gnu11")
|
set(CMAKE_C_FLAGS "-std=gnu11")
|
||||||
|
add_definitions(-D_GNU_SOURCE)
|
||||||
add_definitions(-DBUILD_ENABLE_DEBUG)
|
|
||||||
add_definitions(-DBUILD_BINDIR="$(bindir)")
|
|
||||||
|
|
||||||
#set(CMAKE_CPP_FLAGS "-include $(top_builddir)/config.h \
|
|
||||||
#-I $(top_srcdir)/src \
|
|
||||||
#-I $(top_srcdir)/src/shared \
|
|
||||||
FILE(GLOB _ALL_FILES $(top_srcdir)/src $(top_srcdir)/src/shared)
|
|
||||||
FOREACH(_FILE ${_ALL_FILES})
|
|
||||||
IF(IS_DIRECTORY ${_FILE})
|
|
||||||
INCLUDE_DIRECTORIES(${_FILE})
|
|
||||||
ENDIF()
|
|
||||||
ENDFOREACH()
|
|
||||||
|
|
||||||
|
|
||||||
project(Miraclecast)
|
project(Miraclecast)
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
@ -23,26 +11,17 @@ add_subdirectory(src)
|
||||||
add_subdirectory(res)
|
add_subdirectory(res)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
||||||
OPTION( WITH_FOO "Enable FOO support" ON )
|
SET(BUILD_BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
OPTION( WITH_BAR "Enable BAR component" OFF )
|
OPTION(BUILD_ENABLE_DEBUG "Enable Debug" ON )
|
||||||
SET( BAZ 18 )
|
OPTION(BUILD_TESTS "Enable TEST" ON )
|
||||||
|
|
||||||
SET(PACKAGE_NAME miraclecast)
|
SET(PACKAGE_NAME miraclecast)
|
||||||
SET(PACKAGE_VERSION 1)
|
SET(PACKAGE_VERSION 1)
|
||||||
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||||
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
|
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
|
||||||
|
pkg_check_modules (UDEV REQUIRED libudev)
|
||||||
|
|
||||||
########### install files ###############
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#original Makefile.am contents follow:
|
|
||||||
|
|
||||||
#SUBDIRS = src res test
|
|
||||||
#EXTRA_DIST = README.md \
|
|
||||||
# COPYING \
|
|
||||||
# NEWS
|
|
||||||
#
|
|
||||||
#ACLOCAL_AMFLAGS = -I m4
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef CONFIG_H
|
#ifndef CONFIG_H
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
#cmakedefine WITH_FOO
|
#cmakedefine BUILD_ENABLE_DEBUG
|
||||||
#cmakedefine WITH_BAR
|
|
||||||
|
#cmakedefine BUILD_BINDIR "@BUILD_BINDIR@"
|
||||||
|
|
||||||
#cmakedefine BAZ @BAZ@
|
|
||||||
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
|
||||||
|
|
||||||
#endif // CONFIG_H
|
#endif // CONFIG_H
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
set(CMAKE_C_FLAGS "-std=gnu11")
|
set(CMAKE_C_FLAGS "-std=gnu11")
|
||||||
add_definitions(-D__USE_GNU)
|
|
||||||
add_definitions(-D_GNU_SOURCE)
|
|
||||||
|
|
||||||
add_subdirectory(shared)
|
add_subdirectory(shared)
|
||||||
add_subdirectory(wifi)
|
add_subdirectory(wifi)
|
||||||
add_subdirectory(dhcp)
|
add_subdirectory(dhcp)
|
||||||
add_subdirectory(ctl)
|
add_subdirectory(ctl)
|
||||||
|
|
||||||
|
|
||||||
########### next target ###############
|
|
||||||
|
|
||||||
set(miracled_SRCS miracled.h miracled.c)
|
set(miracled_SRCS miracled.h miracled.c)
|
||||||
add_executable(miracled ${miracled_SRCS})
|
add_executable(miracled ${miracled_SRCS})
|
||||||
target_link_libraries(miracled miracle-shared)
|
target_link_libraries(miracled miracle-shared)
|
||||||
install(TARGETS miracled DESTINATION bin)
|
install(TARGETS miracled DESTINATION bin)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/shared)
|
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/shared)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
set(CMAKE_C_FLAGS "-std=gnu11")
|
set(CMAKE_C_FLAGS "-std=gnu11")
|
||||||
|
|
||||||
########### next target ###############
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules (SYSTEMD REQUIRED systemd>=213)
|
pkg_check_modules (SYSTEMD REQUIRED systemd>=213)
|
||||||
set(miracle-shared_SRCS rtsp.h
|
set(miracle-shared_SOURCES rtsp.h
|
||||||
rtsp.c
|
rtsp.c
|
||||||
shl_dlist.h
|
shl_dlist.h
|
||||||
shl_htable.h
|
shl_htable.h
|
||||||
|
@ -18,9 +17,7 @@ set(miracle-shared_SRCS rtsp.h
|
||||||
util.h
|
util.h
|
||||||
wpas.h
|
wpas.h
|
||||||
wpas.c)
|
wpas.c)
|
||||||
include_directories(/usr/include)
|
add_library(miracle-shared STATIC ${miracle-shared_SOURCES})
|
||||||
link_directories(/usr/lib)
|
|
||||||
add_library(miracle-shared STATIC ${miracle-shared_SRCS})
|
|
||||||
target_link_libraries (miracle-shared systemd)
|
target_link_libraries (miracle-shared systemd)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,11 @@ target_link_libraries(miracle-wifid miracle-shared)
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
|
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
|
||||||
pkg_check_modules (UDEV REQUIRED libudev)
|
pkg_check_modules (UDEV REQUIRED libudev)
|
||||||
link_directories( ${UDEV_LIBRARY_DIRS})
|
#link_directories( ${UDEV_LIBRARY_DIRS})
|
||||||
include_directories( ${UDEV_INCLUDE_DIRS})
|
#include_directories( ${UDEV_INCLUDE_DIRS})
|
||||||
target_link_libraries(miracle-wifid ${UDEV_LIBRARIES})
|
target_link_libraries(miracle-wifid ${UDEV_LIBRARIES})
|
||||||
link_directories( ${GLIB2_LIBRARY_DIRS})
|
#link_directories( ${GLIB2_LIBRARY_DIRS})
|
||||||
include_directories( ${GLIB2_INCLUDE_DIRS})
|
#include_directories( ${GLIB2_INCLUDE_DIRS})
|
||||||
target_link_libraries(miracle-wifid ${GLIB2_LIBRARIES})
|
target_link_libraries(miracle-wifid ${GLIB2_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS miracle-wifid DESTINATION bin)
|
install(TARGETS miracle-wifid DESTINATION bin)
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "wifid.h"
|
#include "wifid.h"
|
||||||
#include "wpas.h"
|
#include "wpas.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
struct supplicant_group {
|
struct supplicant_group {
|
||||||
unsigned long users;
|
unsigned long users;
|
||||||
|
|
|
@ -1,30 +1,53 @@
|
||||||
|
|
||||||
include_directories(${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} )
|
|
||||||
|
|
||||||
|
|
||||||
########### next target ###############
|
########### next target ###############
|
||||||
|
|
||||||
set($(tests)_SRCS ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules (CHECK check)
|
||||||
|
|
||||||
if(KDE4_BUILD_TESTS)
|
if(CHECK_FOUND)
|
||||||
|
|
||||||
kde4_add_executable($(tests) ${$(tests)_SRCS})
|
set(test_rtsp_SOURCES test_common.h test_rtsp.c)
|
||||||
|
add_executable(test_rtsp ${test_rtsp_SOURCES})
|
||||||
|
target_link_libraries(test_rtsp miracle-shared)
|
||||||
|
target_link_libraries(test_rtsp ${CHECK_LIBRARIES})
|
||||||
|
target_link_libraries(test_rtsp ${UDEV_LIBRARIES})
|
||||||
|
target_link_libraries(test_rtsp ${GLIB2_LIBRARIES})
|
||||||
|
|
||||||
target_link_libraries($(tests) ${KDE4_KDECORE_LIBS})
|
set(test_wpas_SOURCES test_common.h test_wpas.c)
|
||||||
|
add_executable(test_wpas ${test_wpas_SOURCES})
|
||||||
|
target_link_libraries(test_wpas miracle-shared)
|
||||||
|
target_link_libraries(test_wpas ${CHECK_LIBRARIES})
|
||||||
|
target_link_libraries(test_wpas ${UDEV_LIBRARIES})
|
||||||
|
target_link_libraries(test_wpas ${GLIB2_LIBRARIES})
|
||||||
|
|
||||||
endif(KDE4_BUILD_TESTS)
|
set(test_valgrind_SOURCES test_common.h test_valgrind.c)
|
||||||
|
add_executable(test_valgrind ${test_valgrind_SOURCES})
|
||||||
|
target_link_libraries(test_valgrind miracle-shared)
|
||||||
|
target_link_libraries(test_valgrind ${CHECK_LIBRARIES})
|
||||||
|
target_link_libraries(test_valgrind ${UDEV_LIBRARIES})
|
||||||
|
target_link_libraries(test_valgrind ${GLIB2_LIBRARIES})
|
||||||
|
|
||||||
########### next target ###############
|
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/shared)
|
||||||
|
|
||||||
set(test_valgrind_SRCS test_valgrind.c $(test_sources))
|
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)
|
||||||
|
|
||||||
if(KDE4_BUILD_TESTS)
|
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")
|
||||||
|
|
||||||
kde4_add_executable(test_valgrind ${test_valgrind_SRCS})
|
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")
|
||||||
|
|
||||||
target_link_libraries(test_valgrind ${KDE4_KDECORE_LIBS})
|
endif(CHECK_FOUND)
|
||||||
|
|
||||||
endif(KDE4_BUILD_TESTS)
|
|
||||||
|
|
||||||
########### install files ###############
|
########### install files ###############
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue