Detach common library
authorSangwan Kwon <sangwan.kwon@samsung.com>
Mon, 18 Nov 2019 03:26:42 +0000 (12:26 +0900)
committer권상완/Security 2Lab(SR)/Engineer/삼성전자 <sangwan.kwon@samsung.com>
Fri, 22 Nov 2019 01:52:17 +0000 (10:52 +0900)
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
14 files changed:
CMake/Macro.cmake
src/CMakeLists.txt
src/vist/CMakeLists.txt
src/vist/common/CMakeLists.txt [new file with mode: 0644]
src/vist/common/common.cpp [new file with mode: 0644]
src/vist/common/tests/exception.cpp [moved from src/vist/tests/exception.cpp with 100% similarity]
src/vist/common/tests/logger.cpp [moved from src/vist/tests/logger.cpp with 100% similarity]
src/vist/common/tests/result.cpp [moved from src/vist/tests/result.cpp with 100% similarity]
src/vist/ipc/CMakeLists.txt [new file with mode: 0644]
src/vist/ipc/ipc.cpp [new file with mode: 0644]
src/vist/query-builder/CMakeLists.txt
src/vist/query-builder/query-builder.cpp [new file with mode: 0644]
src/vist/sdk/CMakeLists.txt
src/vist/sdk/sdk.cpp [new file with mode: 0644]

index d7e804d..326fd61 100644 (file)
@@ -39,9 +39,15 @@ ENDMACRO(ADD_VIST_LIBRARY)
 MACRO(ADD_VIST_CLIENT_LIBRARY TARGET)
        ADD_LIBRARY(${TARGET} OBJECT ${ARGN})
        LIST(APPEND ${TARGET_VIST_CLIENT_LIB}_SRCS $<TARGET_OBJECTS:${TARGET}>)
-       SET(${TARGET_VIST_LIB}_SRCS ${${TARGET_VIST_CLIENT_LIB}_SRCS} PARENT_SCOPE)
+       SET(${TARGET_VIST_CLIENT_LIB}_SRCS ${${TARGET_VIST_CLIENT_LIB}_SRCS} PARENT_SCOPE)
 ENDMACRO(ADD_VIST_CLIENT_LIBRARY)
 
+MACRO(ADD_VIST_COMMON_LIBRARY TARGET)
+       ADD_LIBRARY(${TARGET} OBJECT ${ARGN})
+       LIST(APPEND ${TARGET_VIST_COMMON_LIB}_SRCS $<TARGET_OBJECTS:${TARGET}>)
+       SET(${TARGET_VIST_COMMON_LIB}_SRCS ${${TARGET_VIST_COMMON_LIB}_SRCS} PARENT_SCOPE)
+ENDMACRO(ADD_VIST_COMMON_LIBRARY)
+
 MACRO(ADD_VIST_POLICY_LIBRARY TARGET)
        ADD_LIBRARY(${TARGET} OBJECT ${ARGN})
        LIST(APPEND ${TARGET_VIST_POLICY_LIB}_SRCS $<TARGET_OBJECTS:${TARGET}>)
index 52f231e..1648043 100644 (file)
@@ -14,6 +14,7 @@
 
 SET(TARGET_OSQUERY_LIB osquery)
 SET(TARGET_VIST_CLIENT_LIB vist-client)
+SET(TARGET_VIST_COMMON_LIB vist-common)
 SET(TARGET_VIST_LIB vist)
 SET(TARGET_VIST_POLICY_LIB vist-policy)
 
index 66bfde5..e4c7c9c 100644 (file)
@@ -18,6 +18,7 @@ SET(TARGET_VIST_TEST vist-test)
 
 SET(${TARGET_VIST_LIB}_SRCS "")
 SET(${TARGET_VIST_LIB}_TESTS "")
+SET(${TARGET_VIST_COMMON_LIB}_SRCS "")
 
 SET(DEPENDENCY klay dlog gflags)
 
@@ -31,6 +32,8 @@ ADD_DEFINITIONS(-DDB_PATH="${DB_INSTALL_DIR}/.vist.db"
                                -DSCRIPT_INSTALL_DIR="${SCRIPT_INSTALL_DIR}")
 
 ADD_SUBDIRECTORY(client)
+ADD_SUBDIRECTORY(common)
+ADD_SUBDIRECTORY(ipc)
 ADD_SUBDIRECTORY(notification)
 ADD_SUBDIRECTORY(policy)
 ADD_SUBDIRECTORY(sdk)
@@ -70,12 +73,11 @@ INSTALL(TARGETS ${TARGET_VIST_CLI}
                                        WORLD_READ
                                        WORLD_EXECUTE)
 
-FILE(GLOB COMMON_TESTS "tests/*.cpp")
-ADD_VIST_TEST(${COMMON_TESTS})
-
 ADD_EXECUTABLE(${TARGET_VIST_TEST} main/tests.cpp
                                                                   ${${TARGET_VIST_LIB}_TESTS})
 TARGET_LINK_LIBRARIES(${TARGET_VIST_TEST} ${TARGET_VIST_LIB}
+                                                                                 ${TARGET_VIST_CLIENT_LIB}
+                                                                                 ${TARGET_VIST_COMMON_LIB}
                                                                                  gtest)
 TARGET_LINK_WHOLE(${TARGET_VIST_TEST} ${TARGET_OSQUERY_LIB})
 ADD_TEST(${TARGET_VIST_TEST} ${TARGET_VIST_TEST})
diff --git a/src/vist/common/CMakeLists.txt b/src/vist/common/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c76ae24
--- /dev/null
@@ -0,0 +1,26 @@
+#  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License
+
+PKG_CHECK_MODULES(VIST_COMMON_DEPS REQUIRED gflags klay dlog)
+
+INCLUDE_DIRECTORIES(SYSTEM . ${VIST_COMMON_DEPS_INCLUDE_DIRS})
+
+ADD_VIST_COMMON_LIBRARY(vist_common common.cpp)
+
+FILE(GLOB COMMON_TESTS "tests/*.cpp")
+ADD_VIST_TEST(${COMMON_TESTS})
+
+ADD_LIBRARY(${TARGET_VIST_COMMON_LIB} STATIC ${${TARGET_VIST_COMMON_LIB}_SRCS})
+TARGET_LINK_LIBRARIES(${TARGET_VIST_COMMON_LIB} ${VIST_COMMON_DEPS_LIBRARIES}
+                                                                                               pthread)
diff --git a/src/vist/common/common.cpp b/src/vist/common/common.cpp
new file mode 100644 (file)
index 0000000..14ffe17
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ *  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+#include <vist/exception.hpp>
+#include <vist/logger.hpp>
+#include <vist/result.hpp>
diff --git a/src/vist/ipc/CMakeLists.txt b/src/vist/ipc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..616a117
--- /dev/null
@@ -0,0 +1,16 @@
+# Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ADD_VIST_COMMON_LIBRARY(vist_ipc ipc.cpp)
diff --git a/src/vist/ipc/ipc.cpp b/src/vist/ipc/ipc.cpp
new file mode 100644 (file)
index 0000000..2a92627
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ *  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+#include <vist/ipc/client.hpp>
+#include <vist/ipc/server.hpp>
index 5f41c24..3965ab0 100644 (file)
@@ -12,6 +12,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License
 
+ADD_VIST_COMMON_LIBRARY(vist_query_builder query-builder.cpp)
+
 /// TSQB: Type Safe Query Builder
 FILE(GLOB TSQB_TESTS "tests/*.cpp")
 ADD_VIST_TEST(${TSQB_TESTS})
diff --git a/src/vist/query-builder/query-builder.cpp b/src/vist/query-builder/query-builder.cpp
new file mode 100644 (file)
index 0000000..21f34b0
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ *  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+#include <vist/query-builder.hpp>
index 5e233cf..a370c59 100644 (file)
@@ -13,5 +13,7 @@
 # limitations under the License.
 #
 
+ADD_VIST_COMMON_LIBRARY(vist_sdk sdk.cpp)
+
 FILE(GLOB POLICY_SDK_TESTS "tests/*.cpp")
 ADD_VIST_TEST(${POLICY_SDK_TESTS})
diff --git a/src/vist/sdk/sdk.cpp b/src/vist/sdk/sdk.cpp
new file mode 100644 (file)
index 0000000..ab97ed9
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ *  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+
+#include <vist/sdk/policy-model.hpp>
+#include <vist/sdk/policy-provider.hpp>
+#include <vist/sdk/policy-value.hpp>