From aa1ea68b8575c21ec8610f6f26a2e9c8fc22c853 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 9 May 2021 14:10:58 +0800 Subject: [PATCH] TD-4088 --- src/os/CMakeLists.txt | 4 +-- src/os/inc/osEok.h | 4 +-- src/os/src/alpine/CMakeLists.txt | 7 ---- src/os/src/alpine/alpineEnv.c | 32 ------------------- src/os/src/darwin/CMakeLists.txt | 2 +- src/os/src/detail/CMakeLists.txt | 15 ++++++--- .../src/{linux/ningsi.c => detail/osAtomic.c} | 1 - .../src/{linux/linuxEnv.c => detail/osEnv.c} | 0 src/os/src/linux/CMakeLists.txt | 7 ---- src/os/src/windows/CMakeLists.txt | 4 +-- src/os/tests/CMakeLists.txt | 2 +- src/sync/CMakeLists.txt | 2 +- src/util/CMakeLists.txt | 2 +- src/util/tests/CMakeLists.txt | 2 +- src/wal/test/CMakeLists.txt | 4 +-- 15 files changed, 22 insertions(+), 66 deletions(-) delete mode 100644 src/os/src/alpine/CMakeLists.txt delete mode 100644 src/os/src/alpine/alpineEnv.c rename src/os/src/{linux/ningsi.c => detail/osAtomic.c} (99%) rename src/os/src/{linux/linuxEnv.c => detail/osEnv.c} (100%) delete mode 100644 src/os/src/linux/CMakeLists.txt diff --git a/src/os/CMakeLists.txt b/src/os/CMakeLists.txt index ab8b0f7678..efe2a1ed77 100644 --- a/src/os/CMakeLists.txt +++ b/src/os/CMakeLists.txt @@ -1,9 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) -IF (TD_LINUX) - ADD_SUBDIRECTORY(src/linux) -ELSEIF (TD_DARWIN) +IF (TD_DARWIN) ADD_SUBDIRECTORY(src/darwin) ELSEIF (TD_WINDOWS) ADD_SUBDIRECTORY(src/windows) diff --git a/src/os/inc/osEok.h b/src/os/inc/osEok.h index 0874ca975b..3ca476f840 100644 --- a/src/os/inc/osEok.h +++ b/src/os/inc/osEok.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _eok_h_fd274616_996c_400e_9023_ae70be881fa3_ -#define _eok_h_fd274616_996c_400e_9023_ae70be881fa3_ +#ifndef TDENGINE_OS_EOK_H +#define TDENGINE_OS_EOK_H #include diff --git a/src/os/src/alpine/CMakeLists.txt b/src/os/src/alpine/CMakeLists.txt deleted file mode 100644 index b5e739c24c..0000000000 --- a/src/os/src/alpine/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(TDengine) - -AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(os ${SRC}) -TARGET_LINK_LIBRARIES(os m rt) - diff --git a/src/os/src/alpine/alpineEnv.c b/src/os/src/alpine/alpineEnv.c deleted file mode 100644 index 811d98ad7f..0000000000 --- a/src/os/src/alpine/alpineEnv.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program 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. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#define _DEFAULT_SOURCE -#include "os.h" -#include "tglobal.h" - -void osInit() { - if (configDir[0] == 0) { - strcpy(configDir, "/etc/taos"); - } - - strcpy(tsVnodeDir, ""); - strcpy(tsDnodeDir, ""); - strcpy(tsMnodeDir, ""); - strcpy(tsDataDir, "/var/lib/taos"); - strcpy(tsLogDir, "/var/log/taos"); - strcpy(tsScriptDir, "/etc/taos"); - strcpy(tsOsName, "Linux"); -} \ No newline at end of file diff --git a/src/os/src/darwin/CMakeLists.txt b/src/os/src/darwin/CMakeLists.txt index c4cb28aa05..f46dfac6a1 100644 --- a/src/os/src/darwin/CMakeLists.txt +++ b/src/os/src/darwin/CMakeLists.txt @@ -2,4 +2,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(os ${SRC}) +ADD_LIBRARY(osd ${SRC}) diff --git a/src/os/src/detail/CMakeLists.txt b/src/os/src/detail/CMakeLists.txt index facfbd23af..a3db8bd8b8 100644 --- a/src/os/src/detail/CMakeLists.txt +++ b/src/os/src/detail/CMakeLists.txt @@ -7,10 +7,15 @@ AUX_SOURCE_DIRECTORY(. SRC) SET_SOURCE_FILES_PROPERTIES(osSysinfo.c PROPERTIES COMPILE_FLAGS -w) SET_SOURCE_FILES_PROPERTIES(osCoredump.c PROPERTIES COMPILE_FLAGS -w) -ADD_LIBRARY(osdetail ${SRC}) -TARGET_LINK_LIBRARIES(osdetail os) +ADD_LIBRARY(os ${SRC}) -IF (TD_ARM_32 OR TD_LINUX_32) - TARGET_LINK_LIBRARIES(osdetail atomic) +IF (TD_LINUX) + TARGET_LINK_LIBRARIES(os m rt z) + IF (TD_ARM_32 OR TD_LINUX_32) + TARGET_LINK_LIBRARIES(os atomic) + ENDIF () +ELSEIF (TD_DARWIN) + TARGET_LINK_LIBRARIES(os osd) +ELSEIF (TD_WINDOWS) + TARGET_LINK_LIBRARIES(os osw) ENDIF () - diff --git a/src/os/src/linux/ningsi.c b/src/os/src/detail/osAtomic.c similarity index 99% rename from src/os/src/linux/ningsi.c rename to src/os/src/detail/osAtomic.c index 2514c38ece..ecda573528 100644 --- a/src/os/src/linux/ningsi.c +++ b/src/os/src/detail/osAtomic.c @@ -53,4 +53,3 @@ int64_t atomic_exchange_64_impl(int64_t* ptr, int64_t val ) { return old; } #endif - diff --git a/src/os/src/linux/linuxEnv.c b/src/os/src/detail/osEnv.c similarity index 100% rename from src/os/src/linux/linuxEnv.c rename to src/os/src/detail/osEnv.c diff --git a/src/os/src/linux/CMakeLists.txt b/src/os/src/linux/CMakeLists.txt deleted file mode 100644 index b1a7ebf54e..0000000000 --- a/src/os/src/linux/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) -PROJECT(TDengine) - -AUX_SOURCE_DIRECTORY(. SRC) - -ADD_LIBRARY(os ${SRC}) -TARGET_LINK_LIBRARIES(os m rt z) diff --git a/src/os/src/windows/CMakeLists.txt b/src/os/src/windows/CMakeLists.txt index 9dcc9e7e6d..1ac2700f1d 100644 --- a/src/os/src/windows/CMakeLists.txt +++ b/src/os/src/windows/CMakeLists.txt @@ -2,6 +2,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) -ADD_LIBRARY(os ${SRC}) +ADD_LIBRARY(osw ${SRC}) -TARGET_LINK_LIBRARIES(os winmm IPHLPAPI ws2_32 MsvcLibXw) +TARGET_LINK_LIBRARIES(osw winmm IPHLPAPI ws2_32 MsvcLibXw) diff --git a/src/os/tests/CMakeLists.txt b/src/os/tests/CMakeLists.txt index 1a18a72b40..b87e3d2a62 100644 --- a/src/os/tests/CMakeLists.txt +++ b/src/os/tests/CMakeLists.txt @@ -11,5 +11,5 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR) AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) ADD_EXECUTABLE(osTest ${SOURCE_LIST}) - TARGET_LINK_LIBRARIES(osTest taos osdetail tutil common gtest pthread) + TARGET_LINK_LIBRARIES(osTest taos os tutil common gtest pthread) ENDIF() \ No newline at end of file diff --git a/src/sync/CMakeLists.txt b/src/sync/CMakeLists.txt index 82d0bbf520..521f51ceb7 100644 --- a/src/sync/CMakeLists.txt +++ b/src/sync/CMakeLists.txt @@ -11,6 +11,6 @@ TARGET_LINK_LIBRARIES(sync tutil pthread common) LIST(APPEND BIN_SRC src/syncArbitrator.c) LIST(APPEND BIN_SRC src/syncTcp.c) ADD_EXECUTABLE(tarbitrator ${BIN_SRC}) -TARGET_LINK_LIBRARIES(tarbitrator sync common osdetail tutil) +TARGET_LINK_LIBRARIES(tarbitrator sync common os tutil) #ADD_SUBDIRECTORY(test) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index a7f4f59e07..e8a1d61ee5 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -6,7 +6,7 @@ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/sync/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/rmonotonic/inc) AUX_SOURCE_DIRECTORY(src SRC) ADD_LIBRARY(tutil ${SRC}) -TARGET_LINK_LIBRARIES(tutil pthread osdetail lz4 z rmonotonic) +TARGET_LINK_LIBRARIES(tutil pthread os lz4 z rmonotonic) IF (TD_LINUX) TARGET_LINK_LIBRARIES(tutil m rt) diff --git a/src/util/tests/CMakeLists.txt b/src/util/tests/CMakeLists.txt index 0c96ed2a2f..ee99348cd9 100644 --- a/src/util/tests/CMakeLists.txt +++ b/src/util/tests/CMakeLists.txt @@ -12,7 +12,7 @@ IF (HEADER_GTEST_INCLUDE_DIR AND LIB_GTEST_STATIC_DIR) LIST(REMOVE_ITEM SOURCE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/trefTest.c) ADD_EXECUTABLE(utilTest ${SOURCE_LIST}) - TARGET_LINK_LIBRARIES(utilTest tutil common osdetail gtest pthread gcov) + TARGET_LINK_LIBRARIES(utilTest tutil common os gtest pthread gcov) LIST(APPEND BIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/trefTest.c) ADD_EXECUTABLE(trefTest ${BIN_SRC}) diff --git a/src/wal/test/CMakeLists.txt b/src/wal/test/CMakeLists.txt index f20a57899e..071ff6fdba 100644 --- a/src/wal/test/CMakeLists.txt +++ b/src/wal/test/CMakeLists.txt @@ -6,7 +6,7 @@ IF (TD_LINUX) LIST(APPEND WALTEST_SRC ./waltest.c) ADD_EXECUTABLE(waltest ${WALTEST_SRC}) - TARGET_LINK_LIBRARIES(waltest twal osdetail tutil) + TARGET_LINK_LIBRARIES(waltest twal os tutil) ENDIF () @@ -15,7 +15,7 @@ IF (TD_DARWIN) LIST(APPEND WALTEST_SRC ./waltest.c) ADD_EXECUTABLE(waltest ${WALTEST_SRC}) - TARGET_LINK_LIBRARIES(waltest twal osdetail tutil) + TARGET_LINK_LIBRARIES(waltest twal os tutil) ENDIF () -- GitLab