From aba94bb9eb82ef00c11de116af695b3af23284fb Mon Sep 17 00:00:00 2001 From: tqcq Date: Sat, 6 Jan 2024 13:01:43 +0000 Subject: [PATCH] feat/support_orm (#1) Co-authored-by: tqcq <99722391+tqcq@users.noreply.github.com> Reviewed-on: https://code.uocat.com/tqcq/ulib/pulls/1 --- .gitea/workflows/build.yaml | 2 +- .gitea/workflows/linux-hisiv500-gcc.yaml | 2 +- .gitmodules | 4 ++++ 3party/sqlpp11 | 1 + CMakeLists.txt | 3 ++- tests/3party/sqlpp11/sqlpp11_unittest.cpp | 5 +++++ tests/CMakeLists.txt | 1 + 7 files changed, 15 insertions(+), 3 deletions(-) create mode 160000 3party/sqlpp11 create mode 100644 tests/3party/sqlpp11/sqlpp11_unittest.cpp diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index f2a623b..6fe40da 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -93,5 +93,5 @@ jobs: run: | cd ${{ github.workspace }} sudo apt-get update - sudo apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++ + sudo apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++ git ${{ env.build_command }} diff --git a/.gitea/workflows/linux-hisiv500-gcc.yaml b/.gitea/workflows/linux-hisiv500-gcc.yaml index 024d0be..947e391 100644 --- a/.gitea/workflows/linux-hisiv500-gcc.yaml +++ b/.gitea/workflows/linux-hisiv500-gcc.yaml @@ -79,7 +79,7 @@ jobs: run: | cd ${{ github.workspace }} sudo apt-get update - sudo apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++ + sudo apt-get install -y libarchive-dev libssl-dev autoconf libtool pkg-config cmake make gcc g++ git cmake . -Bbuild -DCMAKE_TOOLCHAIN_FILE=toolchains/hisiv500.toolchain.cmake -DULIB_BUILD_TESTS=OFF -DCMAKE_CROSSCOMPILING_EMULATOR="qemu-arm;-L;/opt/hisi-linux/x86-arm/arm-hisiv500-linux/" cmake --build build --target all -- -j `nproc` diff --git a/.gitmodules b/.gitmodules index 2402d61..3f18805 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,7 @@ path = 3party/googletest url = https://code.uocat.com/3party/googletest branch = release-1.7.0 +[submodule "3party/sqlpp11"] + path = 3party/sqlpp11 + url = https://code.uocat.com/3party/sqlpp11 + branch = 0.64 diff --git a/3party/sqlpp11 b/3party/sqlpp11 new file mode 160000 index 0000000..7f04435 --- /dev/null +++ b/3party/sqlpp11 @@ -0,0 +1 @@ +Subproject commit 7f04435576036fc3f06d929760b5c7623485f069 diff --git a/CMakeLists.txt b/CMakeLists.txt index bd35944..64b36ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE) set(FMT_TEST OFF CACHE BOOL "Build tests" FORCE) set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3party/fmt) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3party/sqlpp11) set(JSONCPP_WITH_TESTS OFF) set(JSONCPP_WITH_POST_BUILD_UNITTEST OFF) @@ -82,7 +83,7 @@ target_sources(${PROJECT_NAME} PRIVATE src/ulib/log/log.cpp src/ulib/log/level.cpp ) -target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt jsoncpp_static) +target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt jsoncpp_static sqlpp11::sqlpp11) target_compile_definitions(${PROJECT_NAME} PRIVATE ULIB_LIBRARY_IMPL) target_include_directories(${PROJECT_NAME} PUBLIC 3party/inja diff --git a/tests/3party/sqlpp11/sqlpp11_unittest.cpp b/tests/3party/sqlpp11/sqlpp11_unittest.cpp new file mode 100644 index 0000000..69f04fa --- /dev/null +++ b/tests/3party/sqlpp11/sqlpp11_unittest.cpp @@ -0,0 +1,5 @@ +#include +#include +#include + +TEST(sqlpp11, select) { select(sqlpp::value(false).as(sqlpp::alias::a)); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 779c746..7c653dd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,6 +14,7 @@ add_executable(ulib_test ulib/system/timer_unittest.cpp 3party/inja/inja_unittest.cpp 3party/optional/optional_unittest.cpp + 3party/sqlpp11/sqlpp11_unittest.cpp ulib/utils/defer_unittest.cpp ) target_link_libraries(ulib_test PRIVATE