From 0a713d0f546f65041adcdd311aa2cad4c0d63f67 Mon Sep 17 00:00:00 2001 From: Jacyking <43704572+Jacyking@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:37:32 +0800 Subject: [PATCH 1/6] add_subdirectory ormpp --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index ec9a846a..0a7633d1 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,22 @@ int main() { cmake -B build -DENABLE_SQLITE3=ON -DCMAKE_BUILD_TYPE=Debug cmake --build build --config Debug +## 作为第三方库引入 + +```cmake +set(ENABLE_MYSQL ON) +add_definitions(-DORMPP_ENABLE_MYSQL) +add_subdirectory(ormpp) +``` + +```cmake +set(ENABLE_MYSQL ON) +add_definitions(-DORMPP_ENABLE_MYSQL) +add_library(ormpp INTERFACE) +target_link_libraries(ormpp INTERFACE ${MYSQL_LIBRARY}) +target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp ${MYSQL_INCLUDE_DIR}) +``` + ### 编译器支持 需要支持C++17的编译器, 要求的编译器版本:linux gcc7.2, clang4.0; windows >vs2017 update5 From eb521b1985bbaa6995a996deb732c3964a6d43b4 Mon Sep 17 00:00:00 2001 From: Jacyking <43704572+Jacyking@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:42:00 +0800 Subject: [PATCH 2/6] [no ci] --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0a7633d1..c363678b 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,8 @@ add_definitions(-DORMPP_ENABLE_MYSQL) add_subdirectory(ormpp) ``` +或者 + ```cmake set(ENABLE_MYSQL ON) add_definitions(-DORMPP_ENABLE_MYSQL) From febf113d2a7cfe8725d22076c61bd530dd24a3e3 Mon Sep 17 00:00:00 2001 From: Jacyking <43704572+Jacyking@users.noreply.github.com> Date: Wed, 28 Feb 2024 18:31:04 +0800 Subject: [PATCH 3/6] [no ci] --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c363678b..8926022a 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,7 @@ add_subdirectory(ormpp) set(ENABLE_MYSQL ON) add_definitions(-DORMPP_ENABLE_MYSQL) add_library(ormpp INTERFACE) +include(cmake/mysql.cmake) target_link_libraries(ormpp INTERFACE ${MYSQL_LIBRARY}) target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp ${MYSQL_INCLUDE_DIR}) ``` From dd016378b605cde3c283c5f9dd4b42aa26c53061 Mon Sep 17 00:00:00 2001 From: Jacyking <43704572+Jacyking@users.noreply.github.com> Date: Thu, 29 Feb 2024 10:16:28 +0800 Subject: [PATCH 4/6] [no ci] --- README.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8926022a..ffb451ae 100644 --- a/README.md +++ b/README.md @@ -194,14 +194,13 @@ cmake --build build --config Debug ## 作为第三方库引入 +mysql ```cmake set(ENABLE_MYSQL ON) add_definitions(-DORMPP_ENABLE_MYSQL) add_subdirectory(ormpp) ``` - 或者 - ```cmake set(ENABLE_MYSQL ON) add_definitions(-DORMPP_ENABLE_MYSQL) @@ -211,6 +210,37 @@ target_link_libraries(ormpp INTERFACE ${MYSQL_LIBRARY}) target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp ${MYSQL_INCLUDE_DIR}) ``` +sqlite +```cmake +set(ENABLE_SQLITE3 ON) +add_definitions(-DORMPP_ENABLE_SQLITE3) +add_subdirectory(ormpp) +``` +或者 +```cmake +set(ENABLE_SQLITE3 ON) +add_definitions(-DORMPP_ENABLE_SQLITE3) +add_library(ormpp INTERFACE) +target_link_libraries(ormpp INTERFACE sqlite3) +target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp thirdparty/sqlite3) +``` + +pg +```cmake +set(ENABLE_PG ON) +add_definitions(-DORMPP_ENABLE_PG) +add_subdirectory(ormpp) +``` +或者 +```cmake +set(ENABLE_PG ON) +add_definitions(-DORMPP_ENABLE_PG) +add_library(ormpp INTERFACE) +include(cmake/pgsql.cmake) +target_link_libraries(ormpp INTERFACE ${PGSQL_LIBRARY}) +target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp ${PGSQL_INCLUDE_DIR}) +``` + ### 编译器支持 需要支持C++17的编译器, 要求的编译器版本:linux gcc7.2, clang4.0; windows >vs2017 update5 From f21933f5439e0bee0c04558df387dcf2808b7c6f Mon Sep 17 00:00:00 2001 From: Jacyking <43704572+Jacyking@users.noreply.github.com> Date: Thu, 29 Feb 2024 10:18:40 +0800 Subject: [PATCH 5/6] [no ci] --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ffb451ae..467e76e9 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ cmake --build build --config Debug ## 作为第三方库引入 -mysql +1. mysql ```cmake set(ENABLE_MYSQL ON) add_definitions(-DORMPP_ENABLE_MYSQL) @@ -210,7 +210,7 @@ target_link_libraries(ormpp INTERFACE ${MYSQL_LIBRARY}) target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp ${MYSQL_INCLUDE_DIR}) ``` -sqlite +2. sqlite ```cmake set(ENABLE_SQLITE3 ON) add_definitions(-DORMPP_ENABLE_SQLITE3) @@ -225,7 +225,7 @@ target_link_libraries(ormpp INTERFACE sqlite3) target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp thirdparty/sqlite3) ``` -pg +3. pg ```cmake set(ENABLE_PG ON) add_definitions(-DORMPP_ENABLE_PG) From 1252344b7ecf01b39820015c2b90ee4273e00e71 Mon Sep 17 00:00:00 2001 From: Jacyking <43704572+Jacyking@users.noreply.github.com> Date: Thu, 29 Feb 2024 10:19:45 +0800 Subject: [PATCH 6/6] [no ci] --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 467e76e9..ffb451ae 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ cmake --build build --config Debug ## 作为第三方库引入 -1. mysql +mysql ```cmake set(ENABLE_MYSQL ON) add_definitions(-DORMPP_ENABLE_MYSQL) @@ -210,7 +210,7 @@ target_link_libraries(ormpp INTERFACE ${MYSQL_LIBRARY}) target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp ${MYSQL_INCLUDE_DIR}) ``` -2. sqlite +sqlite ```cmake set(ENABLE_SQLITE3 ON) add_definitions(-DORMPP_ENABLE_SQLITE3) @@ -225,7 +225,7 @@ target_link_libraries(ormpp INTERFACE sqlite3) target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp thirdparty/sqlite3) ``` -3. pg +pg ```cmake set(ENABLE_PG ON) add_definitions(-DORMPP_ENABLE_PG)