2017-03-23 17:08:18 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0.2)
|
2017-02-14 05:50:25 +00:00
|
|
|
|
2016-07-02 13:22:13 +00:00
|
|
|
project(Miraclecast)
|
2015-04-11 11:03:14 +00:00
|
|
|
|
2016-07-02 13:22:13 +00:00
|
|
|
SET(PACKAGE_NAME miraclecast)
|
|
|
|
SET(PACKAGE_VERSION 1)
|
|
|
|
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
2015-04-11 11:03:14 +00:00
|
|
|
|
2017-02-16 06:29:53 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
2015-03-08 23:06:19 +00:00
|
|
|
|
2016-06-30 11:31:31 +00:00
|
|
|
SET(BUILD_BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
|
2015-04-12 08:34:42 +00:00
|
|
|
OPTION(BUILD_ENABLE_DEBUG "Enable Debug" ON )
|
2015-08-23 11:24:48 +00:00
|
|
|
OPTION(RELY_UDEV "Rely in udev tag to select device" OFF )
|
2015-04-12 08:34:42 +00:00
|
|
|
OPTION(BUILD_TESTS "Enable TEST" ON )
|
2017-03-22 03:12:43 +00:00
|
|
|
OPTION(BUILD_DEMO "Enable DEMO" OFF )
|
2015-04-12 08:34:42 +00:00
|
|
|
|
2016-08-11 09:37:59 +00:00
|
|
|
if(BUILD_ENABLE_DEBUG)
|
|
|
|
add_definitions(-DBUILD_ENABLE_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2015-04-12 08:34:42 +00:00
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
|
|
|
|
pkg_check_modules (UDEV REQUIRED libudev)
|
2016-08-10 08:43:33 +00:00
|
|
|
pkg_check_modules (SYSTEMD REQUIRED libsystemd)
|
2017-03-03 09:15:30 +00:00
|
|
|
pkg_check_modules (GSTREAMER REQUIRED gstreamer-1.0)
|
2017-03-16 08:28:15 +00:00
|
|
|
pkg_check_modules (GSTREAMER_BASE REQUIRED gstreamer-base-1.0)
|
2015-03-08 23:06:19 +00:00
|
|
|
|
2017-02-16 06:29:53 +00:00
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
check_c_compiler_flag(-fstack-protector-strong HAS_STACK_PROTCTOR_STRONG)
|
2017-03-22 03:12:43 +00:00
|
|
|
check_c_compiler_flag(-fsanitize=undefined HAS_SANITIZE_UNDEFINED)
|
2017-02-16 06:29:53 +00:00
|
|
|
if(HAS_STACK_PROTCTOR_STRONG)
|
|
|
|
set(CMAKE_C_FLAGS "-fstack-protector-strong ${CMAKE_C_FLAGS}")
|
|
|
|
endif()
|
2017-03-03 00:52:40 +00:00
|
|
|
if(HAS_SANITIZE_UNDEFINED)
|
|
|
|
set(CMAKE_C_FLAGS "-fsanitize=undefined ${CMAKE_C_FLAGS}")
|
|
|
|
endif()
|
2017-02-16 06:29:53 +00:00
|
|
|
set(CMAKE_C_FLAGS "-std=gnu11 -Wall ${CMAKE_C_FLAGS}")
|
|
|
|
add_definitions(-D_GNU_SOURCE)
|
|
|
|
|
2017-02-21 03:42:26 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
|
|
|
OUTPUT_VARIABLE GCC_VERSION)
|
|
|
|
if(GCC_VERSION VERSION_LESS 4.9)
|
|
|
|
message(FATAL_ERROR "gcc >= 4.9 is requred")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2016-07-02 13:22:13 +00:00
|
|
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
|
|
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(res)
|
|
|
|
add_subdirectory(test)
|
2015-03-08 23:06:19 +00:00
|
|
|
|
2017-03-22 03:12:43 +00:00
|
|
|
if(BUILD_DEMO)
|
|
|
|
add_subdirectory(demo)
|
|
|
|
endif()
|
|
|
|
|