Implement libswapcore empty library 90/195590/2
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Tue, 13 Nov 2018 17:24:41 +0000 (20:24 +0300)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 28 Dec 2018 08:57:59 +0000 (11:57 +0300)
This patch is the first step towards allows us to implement new library.

Change-Id: Icd9c8dfd180187010beab10a479a034f89ad12f9

packaging/swap-probe.spec
src/CMakeLists.txt [new file with mode: 0644]
src/core/core.cpp [new file with mode: 0644]
src/core/core.h [new file with mode: 0644]
src/core/internal_deps.h [new file with mode: 0644]

index d6112a85ff377fcd66139419ea18fe0d9d5cd6ba..126c2d7a8674f8029aab0a22a937cf0f251b4393 100644 (file)
@@ -28,6 +28,7 @@ ExcludeArch: %{ix86} x86_64
 
 
 # common requires
+BuildRequires: cmake
 BuildRequires: ecore-devel
 BuildRequires: elementary-devel
 BuildRequires: capi-appfw-application-devel
@@ -143,6 +144,12 @@ export LINKER_PATH=$(LD_LIBRARY_PATH=./elf_parsing/ ./elf_parsing/parse_elf -f e
 
 export TIZEN_FEATURE_WAYLAND=y
 
+# build "cmake"
+mkdir build && cd build
+cmake -DBINDIR=%{_bindir} -DLIBDIR=%{_libdir} ../src/ && make VERBOSE=1 || false
+cd -
+
+# build 'make'
 make rmheaders
 make headers
 make -j
@@ -163,6 +170,11 @@ rm -rf ${RPM_BUILD_ROOT}
 
 %make_install
 
+# install "cmake"
+cd build
+%make_install
+cd -
+
 %files -n swap-probe
 %license LICENSE.MIT
 %license LICENSE.LGPLv2.1+
@@ -175,6 +187,7 @@ rm -rf ${RPM_BUILD_ROOT}
 %{_libdir}/swap_probe_ui.so
 %{_libdir}/swap_probe_capi.so
 %{_libdir}/swap_probe_screenshot.so
+%{_libdir}/libswapcore.so
 
 %files -n swap-probe-devel
 %{_includedir}/ld_preload_*.h
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e4d62e0
--- /dev/null
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(swapcore)
+
+set(CMAKE_CXX_FLAGS
+  "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -fvisibility=hidden -nodefaultlibs -lc"
+)
+
+# setup headers
+include_directories(
+  ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+# setup sources
+set(SRC
+  core/core.cpp
+)
+
+add_library(${PROJECT_NAME} SHARED ${SRC})
+
+# add 'make install' target
+install(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
diff --git a/src/core/core.cpp b/src/core/core.cpp
new file mode 100644 (file)
index 0000000..6c930b5
--- /dev/null
@@ -0,0 +1,8 @@
+#include "core.h"
+#include "internal_deps.h"
+
+extern "C" SWAP_INTERFACE_ATTRIBUTE
+int __swap_init()
+{
+    return 0;
+}
diff --git a/src/core/core.h b/src/core/core.h
new file mode 100644 (file)
index 0000000..476639c
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef CORE_H
+#define CORE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __swap_init();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CORE_H
diff --git a/src/core/internal_deps.h b/src/core/internal_deps.h
new file mode 100644 (file)
index 0000000..25281aa
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef INTERNAL_DEPS_H
+#define INTERNAL_DEPS_H
+
+#define SWAP_INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
+
+#endif // INTERNAL_DEPS_H