[FIX] conditional build for new capi_appfw 36/25336/4
authorVasiliy Ulyanov <v.ulyanov@samsung.com>
Mon, 4 Aug 2014 06:25:40 +0000 (10:25 +0400)
committerVasiliy Ulyanov <v.ulyanov@samsung.com>
Mon, 4 Aug 2014 11:38:06 +0000 (15:38 +0400)
Change-Id: I0c605dadebc89155dc35d0cd03ad00c3cf951da1
Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
Makefile
feature_tests/new_capi_appfw.cpp [new file with mode: 0644]
probe_capi/capi_appfw.c
scripts/gen_api_config.sh [new file with mode: 0755]

index 4383672..b175428 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -128,10 +128,14 @@ dummy:    headers $(DUMMY_TARGET)
 $(ASM_OBJ): $(ASM_SRC)
        $(CC) $(ASMFLAG) -c $^ -o $@
 
+GENERATED_CONFIG = include/api_config.h
 GENERATED_HEADERS = include/api_id_mapping.h include/api_id_list.h include/id_list
-headers: $(GENERATED_HEADERS)
+headers: $(GENERATED_CONFIG) $(GENERATED_HEADERS)
 rmheaders:
-       rm -f $(GENERATED_HEADERS)
+       rm -f $(GENERATED_CONFIG) $(GENERATED_HEADERS)
+
+$(GENERATED_CONFIG): ./scripts/gen_api_config.sh
+       sh $< > $@
 
 include/api_id_mapping.h: ./scripts/gen_api_id_mapping_header.awk
 include/api_id_list.h: ./scripts/gen_api_id_mapping_header_list.awk
diff --git a/feature_tests/new_capi_appfw.cpp b/feature_tests/new_capi_appfw.cpp
new file mode 100644 (file)
index 0000000..549cc9e
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ *  DA probe
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * Vasily Ulyanov <v.ulyanov@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Contributors:
+ * - Samsung RnD Institute Russia
+ *
+ * Description:
+ *   Test app for checking capi_appfw version. The new one has app_control_h
+ *   type defined instead of service_h
+ *
+ */
+
+#include <app.h>
+
+int main(int argc, char *argv[])
+{
+       app_control_h __attribute__((unused)) handle;
+
+       return 0;
+}
index 5578450..7cbc522 100644 (file)
 #include "probeinfo.h"
 #include "binproto.h"
 #include "common_probe_init.h"
-
-/* FIXME think of a better solution for conditional build. */
-#ifndef PRIVATE_CAPI_APPFW
-
-#if !defined(service_h)
-#define PRIVATE_CAPI_APPFW
-#endif /* !service_h */
-
-#endif /* !PRIVATE_CAPI_APPFW */
+#include "api_config.h"
 
 Ecore_Event_Handler *register_orientation_event_listener();
 void unregister_orientation_event_listener(Ecore_Event_Handler *handler);
diff --git a/scripts/gen_api_config.sh b/scripts/gen_api_config.sh
new file mode 100755 (executable)
index 0000000..16edfd7
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+function check_feature()
+{
+    FEATURE="$1"
+    SRC="$2"
+    OPTS="$3"
+
+    if gcc ${OPTS} -c ${SRC}; then
+        echo "#define ${FEATURE}"
+    else
+        echo "/* ${FEATURE} config not set */"
+    fi
+}
+
+NEW_CAPI_APPFW=$(check_feature PRIVATE_CAPI_APPFW \
+                               ./feature_tests/new_capi_appfw.cpp \
+                               -I/usr/include/appfw)
+
+API_CONFIG_DEFINES="
+${NEW_CAPI_APPFW}
+"
+
+cat << EOF
+/*
+ * Autogenerated header
+ */
+
+#ifndef __API_CONFIG__
+#define __API_CONFIG__
+${API_CONFIG_DEFINES}
+#endif /* __API_CONFIG__ */
+EOF