1
0
Fork 0

Fix broken libevent/dbus cmake module

This commit is contained in:
Lars Toenning 2019-05-17 10:19:35 +02:00
parent b486273e0b
commit 5a662d97fd
3 changed files with 36 additions and 71 deletions

View file

@ -271,15 +271,19 @@ endif(EVENT_INPUT)
if (ENABLE_SWIFT)
message(STATUS "SWIFT support requested, checking for DBus/libEvent")
# DBUS
find_package(DBus REQUIRED)
list(APPEND PLATFORM_LIBS ${DBUS_LIBRARIES})
find_package(DBus)
#libevent
find_package(LibEvent REQUIRED)
list(APPEND PLATFORM_LIBS ${LIBEVENT_LIB})
find_package(LibEvent)
if (NOT DBUS_LIBRARIES OR NOT LIBEVENT_LIB)
message(FATAL_ERROR "SWIFT support requested, please ensure DBus/libEvent are available")
if (DBUS_LIBRARIES AND DBUS_INCLUDE_DIRS AND LIBEVENT_LIB AND LIBEVENT_INCLUDE_DIR)
list(APPEND PLATFORM_LIBS ${DBUS_LIBRARIES})
list(APPEND PLATFORM_LIBS ${LIBEVENT_LIB})
include_directories(${DBUS_INCLUDE_DIRS}
${LIBEVENT_INCLUDE_DIR})
else()
message(WARNING "SWIFT support requested, but dbus and/or LibEvent not found. Swift support is disabled")
set(ENABLE_SWIFT 0)
endif()
endif()
@ -521,9 +525,7 @@ include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR}
${SIMGEAR_INCLUDE_DIRS}
${PLIB_INCLUDE_DIR}
${SQLITE3_INCLUDED_DIR}
${DBUS_INCLUDE_DIRS}
${LIBEVENT_INCLUDE_DIR} )
${SQLITE3_INCLUDED_DIR} )
if (USE_AEONWAVE)
find_package(AAX REQUIRED)

View file

@ -1,59 +1,21 @@
# - Try to find DBus
# Once done, this will define
#
# DBUS_FOUND - system has DBus
# DBUS_INCLUDE_DIRS - the DBus include directories
# DBUS_LIBRARIES - link these to use DBus
#
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Finding dbus (https://www.freedesktop.org/wiki/Software/dbus/)
# Defining:
# DBUS_LIBRARY
# DBUS_INCLUDE_DIR
if(WIN32)
FIND_PATH(DBUS_INCLUDE_DIRS dbus/dbus.h PATH_SUFFIXES include HINTS ${ADDITIONAL_LIBRARY_PATHS})
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_DBUS QUIET dbus-1)
FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 PATH_SUFFIXES lib HINTS ${ADDITIONAL_LIBRARY_PATHS})
else()
include(FindPkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(DBUS dbus-1)
endif (PKG_CONFIG_FOUND)
if(DBUS_FOUND)
set(HAVE_DBUS 1)
endif(DBUS_FOUND)
endif(WIN32)
FIND_LIBRARY(DBUS_LIBRARIES
NAMES dbus-1
HINTS ${PC_DBUS_LIBDIR}
${PC_DBUS_LIBRARY_DIRS}
)
FIND_PATH(DBUS_INCLUDE_DIR
NAMES dbus/dbus.h
HINTS ${PC_DBUS_INCLUDEDIR}
${PC_DBUS_INCLUDE_DIRS}
)
GET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} DIRECTORY)
FIND_PATH(DBUS_ARCH_INCLUDE_DIR
NAMES dbus/dbus-arch-deps.h
HINTS ${PC_DBUS_INCLUDEDIR}
${PC_DBUS_INCLUDE_DIRS}
${_DBUS_LIBRARY_DIR}
${DBUS_INCLUDE_DIR}
PATH_SUFFIXES include
)
SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS DEFAULT_MSG
DBUS_INCLUDE_DIRS DBUS_LIBRARIES)

View file

@ -3,9 +3,10 @@
# LIBEVENT_LIB
# LIBEVENT_INCLUDE_DIR
find_path(LIBEVENT_INCLUDE_DIR event.h PATHS ${LibEvent_INCLUDE_PATHS})
find_library(LIBEVENT_LIB NAMES event PATHS ${LibEvent_LIB_PATHS})
FIND_PATH(LIBEVENT_INCLUDE_DIR event2/event.h PATH_SUFFIXES include HINTS ${ADDITIONAL_LIBRARY_PATHS})
if(LIBEVENT_INCLUDE_DIR AND LIBEVENT_LIB)
message(STATUS "LibEvent found.")
endif()
FIND_LIBRARY(LIBEVENT_LIB NAMES event_core PATH_SUFFIXES lib HINTS ${ADDITIONAL_LIBRARY_PATHS})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBEVENT DEFAULT_MSG
LIBEVENT_INCLUDE_DIR LIBEVENT_LIB)