INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE(FindPkgConfig)
+IF(X11_SUPPORT)
pkg_check_modules(pkgs REQUIRED dlog glib-2.0 gio-2.0 nfc-common nfc capi-base-common
vconf ecore-x)
+ELSE()
+pkg_check_modules(pkgs REQUIRED dlog glib-2.0 gio-2.0 nfc-common nfc capi-base-common
+ vconf)
+ENDIF(X11_SUPPORT)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
ADD_DEFINITIONS("-DTARGET")
ENDIF("${ARCH}" STREQUAL "arm")
+IF(X11_SUPPORT)
+ ADD_DEFINITIONS("-DHAVE_X11")
+ENDIF(X11_SUPPORT)
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+%bcond_with x
+
Name: capi-network-nfc
Summary: NFC Core API
Version: 0.1.5
BuildRequires: nfc-common-devel
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(vconf)
+%if %{with x}
BuildRequires: pkgconfig(ecore-x)
+%endif
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+%if %{with x}
+ -DX11_SUPPORT=On
+%else
+ -DX11_SUPPORT=Off
+%endif
make %{?jobs:-j%jobs}
#include <gio/gio.h>
#include <vconf.h>
+#ifdef HAVE_X11
#include <Ecore_X.h>
+#endif
#include <net_nfc_typedef_internal.h>
#include "nfc_internal.h"
static pid_t _get_focus_app_pid()
{
+#ifdef HAVE_X11
Ecore_X_Window focus;
pid_t pid;
if (ecore_x_netwm_pid_get(focus, &pid))
return pid;
+#endif
return -1;
}