From 88df31601366b587371bc0d8aa75652c53615cdf Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Wed, 8 Jan 2025 18:27:40 -0400 Subject: [PATCH] build: Conditionally compile senseApis --- configure.ac | 6 ++++++ m4/senseApis.m4 | 16 ++++++++++++++++ senseApis/Makefile.am | 3 +-- senseApis/xcbXorg/Makefile.am | 2 ++ senseApis/{ => xcbXorg}/xcbXorg.cpp | 0 senseApis/{ => xcbXorg}/xcbXorg.h | 0 6 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 m4/senseApis.m4 create mode 100644 senseApis/xcbXorg/Makefile.am rename senseApis/{ => xcbXorg}/xcbXorg.cpp (100%) rename senseApis/{ => xcbXorg}/xcbXorg.h (100%) diff --git a/configure.ac b/configure.ac index d01e3e3..a211467 100644 --- a/configure.ac +++ b/configure.ac @@ -53,12 +53,16 @@ AC_SUBST([AM_CPPFLAGS]) AC_SUBST([YACC]) AC_SUBST([LEX]) +m4_include([m4/senseApis.m4]) +AC_SUBST([SENSEAPIS_ENABLED]) + AC_CONFIG_HEADERS([include/config.h]) AC_CONFIG_FILES([ Makefile hcore/Makefile hcore/deviceManager/Makefile hcore/senseApis/Makefile senseApis/Makefile + senseApis/xcbXorg/Makefile ]) AC_CONFIG_COMMANDS_POST([ @@ -66,6 +70,8 @@ AC_CONFIG_COMMANDS_POST([ AC_MSG_NOTICE(m4_normalize([* MIND_VOSCILLATOR_PERIOD_MS: ${MIND_VOSCILLATOR_PERIOD_MS} ms (freq: ${MIND_VOSCILLATOR_FREQ_MS} Hz)])) + AC_MSG_NOTICE(m4_normalize( + [* SenseAPI backends enabled: ${SENSEAPIS_ENABLED}])) ]) AC_OUTPUT diff --git a/m4/senseApis.m4 b/m4/senseApis.m4 new file mode 100644 index 0000000..393788c --- /dev/null +++ b/m4/senseApis.m4 @@ -0,0 +1,16 @@ +SENSEAPIS_ENABLED= + +AC_ARG_ENABLE([senseapi-xcbxorg], + [AS_HELP_STRING([--enable-senseapi-xcbxorg], + [Enable XCB/Xorg SenseAPI backend])], + [AS_CASE([$enableval], + [no], [enable_senseapi_xcbxorg=no], + [yes|*], [ + enable_senseapi_xcbxorg=yes + AC_DEFINE([XCBXORG_ENABLED], [1], + [Define to 1 if you have XCB/Xorg SenseAPI backend]) + SENSEAPIS_ENABLED="${SENSEAPIS_ENABLED} xcbXorg" + ] + )], + [enable_senseapi_xcbxorg=no] +) diff --git a/senseApis/Makefile.am b/senseApis/Makefile.am index 3b8dfac..3b259f2 100644 --- a/senseApis/Makefile.am +++ b/senseApis/Makefile.am @@ -1,2 +1 @@ -pkglib_LTLIBRARIES=libxcbXorg.la -libxcbXorg_la_SOURCES=xcbXorg.cpp +SUBDIRS = @SENSEAPIS_ENABLED@ diff --git a/senseApis/xcbXorg/Makefile.am b/senseApis/xcbXorg/Makefile.am new file mode 100644 index 0000000..3b8dfac --- /dev/null +++ b/senseApis/xcbXorg/Makefile.am @@ -0,0 +1,2 @@ +pkglib_LTLIBRARIES=libxcbXorg.la +libxcbXorg_la_SOURCES=xcbXorg.cpp diff --git a/senseApis/xcbXorg.cpp b/senseApis/xcbXorg/xcbXorg.cpp similarity index 100% rename from senseApis/xcbXorg.cpp rename to senseApis/xcbXorg/xcbXorg.cpp diff --git a/senseApis/xcbXorg.h b/senseApis/xcbXorg/xcbXorg.h similarity index 100% rename from senseApis/xcbXorg.h rename to senseApis/xcbXorg/xcbXorg.h