From 9bdb4f4c63395b4bc323d52a272d8c17070302be Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 22 Sep 2021 16:15:20 +0800 Subject: [PATCH] refact --- CMakeLists.txt | 2 +- include/common/trow.h | 27 +++++++++++++++++++++++++++ source/CMakeLists.txt | 5 +++-- source/common/CMakeLists.txt | 7 +++++++ source/common/src/trow.c | 14 ++++++++++++++ source/server/CMakeLists.txt | 11 ++++++++++- source/server/src/main.c | 20 ++++++++++++++++++++ source/util/CMakeLists.txt | 4 ++++ source/util/test/utilTests.cpp | 0 9 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 include/common/trow.h create mode 100644 source/common/src/trow.c create mode 100644 source/server/src/main.c create mode 100644 source/util/test/utilTests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d6663b15db..9324daef20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,6 @@ execute_process(COMMAND "${CMAKE_COMMAND}" --build . add_subdirectory(deps) # src -add_subdirectory(src) +add_subdirectory(source) # tests (TODO) \ No newline at end of file diff --git a/include/common/trow.h b/include/common/trow.h new file mode 100644 index 0000000000..c6e95d5d61 --- /dev/null +++ b/include/common/trow.h @@ -0,0 +1,27 @@ +/* + * 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 . + */ + +#ifndef _TD_TROW_H_ +#define _TD_TROW_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_TROW_H_*/ \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 8d850c72a1..eee512e5f9 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory(os) add_subdirectory(util) add_subdirectory(common) -add_subdirectory(lib) -add_subdirectory(dnode) \ No newline at end of file +# add_subdirectory(libs) +# add_subdirectory(client) +# add_subdirectory(server) \ No newline at end of file diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index e69de29bb2..1273a61c02 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -0,0 +1,7 @@ +aux_source_directory(src COMMON_SRC) +add_library(common ${COMMON_SRC}) +target_include_directories( + common + PUBLIC "${CMAKE_SOURCE_DIR}/include/common" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) \ No newline at end of file diff --git a/source/common/src/trow.c b/source/common/src/trow.c new file mode 100644 index 0000000000..6dea4a4e57 --- /dev/null +++ b/source/common/src/trow.c @@ -0,0 +1,14 @@ +/* + * 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 . + */ \ No newline at end of file diff --git a/source/server/CMakeLists.txt b/source/server/CMakeLists.txt index d28d40b188..9830f1093a 100644 --- a/source/server/CMakeLists.txt +++ b/source/server/CMakeLists.txt @@ -1 +1,10 @@ -add \ No newline at end of file +add_subdirectory(mnode) +add_subdirectory(vnode) +add_subdirectory(qnode) + +aux_source_directory(src TAOSD_SRC) +add_executable(taosd ${TAOSD_SRC}) +target_link_libraries( + taosd + private os +) \ No newline at end of file diff --git a/source/server/src/main.c b/source/server/src/main.c new file mode 100644 index 0000000000..75449ecd1a --- /dev/null +++ b/source/server/src/main.c @@ -0,0 +1,20 @@ +/* + * 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 . + */ +#include "os.h" + +int main(int argc, char const *argv[]) { + printf("Hello world!\n"); + return 0; +} diff --git a/source/util/CMakeLists.txt b/source/util/CMakeLists.txt index 36b09cc208..c53be0c59b 100644 --- a/source/util/CMakeLists.txt +++ b/source/util/CMakeLists.txt @@ -4,4 +4,8 @@ target_include_directories( util PUBLIC "${CMAKE_SOURCE_DIR}/include/util" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" +) +target_link_libraries( + util + PRIVATE os ) \ No newline at end of file diff --git a/source/util/test/utilTests.cpp b/source/util/test/utilTests.cpp new file mode 100644 index 0000000000..e69de29bb2