diff --git a/cmake/Thirdparty.cmake b/cmake/Thirdparty.cmake index 9c76f866..97c7bced 100755 --- a/cmake/Thirdparty.cmake +++ b/cmake/Thirdparty.cmake @@ -57,7 +57,7 @@ if(WIN32) CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/curl SOURCE_DIR ${CMAKE_BINARY_DIR}/src/curl-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release -- j4 INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install URL_MD5 b9bb5e11d579425154a9f97ed44be9b8 ) @@ -97,7 +97,7 @@ else() CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/gtest -DBUILD_GMOCK=OFF -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} SOURCE_DIR ${CMAKE_BINARY_DIR}/src/gtest-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND make + BUILD_COMMAND make -j4 URL_MD5 6f26d634fa9cac718263c2df20df21a4 ) endif() @@ -142,7 +142,7 @@ if (TARS_PROTOBUF) CONFIGURE_COMMAND ${CMAKE_COMMAND} cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/protobuf -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND make + BUILD_COMMAND make -j4 URL_MD5 fb59398329002c98d4d92238324c4187 ) @@ -191,7 +191,7 @@ if (TARS_SSL) SOURCE_DIR ${CMAKE_BINARY_DIR}/src/openssl-lib BUILD_IN_SOURCE 1 BUILD_COMMAND make - INSTALL_COMMAND make install_sw + INSTALL_COMMAND make install_sw -j4 URL_MD5 ac0d4387f3ba0ad741b0580dd45f6ff3 ) @@ -235,7 +235,7 @@ if (TARS_MYSQL) CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/mysql -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DSTACK_DIRECTION=1 -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND make mysqlclient + BUILD_COMMAND make mysqlclient -j4 URL_MD5 3578d736b9d493eae076a67e3ed473eb ) @@ -281,7 +281,7 @@ if (TARS_GZIP) CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/zlib -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} SOURCE_DIR ${CMAKE_BINARY_DIR}/src/zlib-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND make + BUILD_COMMAND make -j4 URL_MD5 1c9f62f0778697a09d36121ead88e08e ) @@ -327,7 +327,7 @@ if (TARS_HTTP2) CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND make + BUILD_COMMAND make -j4 URL_MD5 5df375bbd532fcaa7cd4044b54b1188d ) diff --git a/servant/makefile/tars-tools.cmake.in b/servant/makefile/tars-tools.cmake.in index 17cdff74..0d8831b8 100755 --- a/servant/makefile/tars-tools.cmake.in +++ b/servant/makefile/tars-tools.cmake.in @@ -15,6 +15,7 @@ set(TARS_PATH "@CMAKE_INSTALL_PREFIX@") option(TARS_MYSQL "open mysql support" @TARS_MYSQL@) option(TARS_SSL "open ssl support" @TARS_SSL@) option(TARS_HTTP2 "open http2 support" @TARS_HTTP2@) +option(TARS_GZIP "open gzip support" @TARS_GZIP@) option(ENABLE_SHARED "enable tars shared lib" OFF) set(TARS_INC "${TARS_PATH}/include") @@ -26,8 +27,9 @@ list(APPEND TARS_TOOL_FLAG "") include_directories(${TARS_INC}) link_directories(${TARS_LIB_DIR}) -include_directories(${TARS_PATH}/thirdparty/include/mysql) +link_directories(${THRIDPARTY_LIB_DIR}) +include_directories(${TARS_PATH}/thirdparty/include/mysql) if(ENABLE_SHARED) if(WIN32) @@ -56,11 +58,13 @@ if(ENABLE_SHARED) set(LIB_CRYPTO "libcrypto") set(LIB_MYSQL "libmysql") set(LIB_HTTP2 "nghttp2") + set(LIB_GZIP "libz") else() set(LIB_SSL "ssl") set(LIB_CRYPTO "crypto") set(LIB_MYSQL "mysqlclient") set(LIB_HTTP2 "nghttp2") + set(LIB_GZIP "z") endif () else() if(WIN32) @@ -68,11 +72,13 @@ else() set(LIB_CRYPTO "libcrypto") set(LIB_MYSQL "libmysql") set(LIB_HTTP2 "nghttp2_static") + set(LIB_GZIP "z") else() set(LIB_SSL "${THRIDPARTY_LIB_DIR}/libssl.a") set(LIB_CRYPTO "${THRIDPARTY_LIB_DIR}/libcrypto.a") set(LIB_MYSQL "${THRIDPARTY_LIB_DIR}/libmysqlclient.a") set(LIB_HTTP2 "${THRIDPARTY_LIB_DIR}/libnghttp2_static.a") + set(LIB_GZIP "${THRIDPARTY_LIB_DIR}/libz.a") endif () endif() @@ -294,6 +300,10 @@ macro(gen_server APP TARGET) target_link_libraries(${TARGET} ${LIB_HTTP2}) endif() + if(TARS_GZIP) + target_link_libraries(${TARGET} ${LIB_GZIP}) + endif() + if(APPLE) target_link_libraries(${TARGET} iconv) endif() @@ -520,16 +530,15 @@ message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") message("PLATFORM: ${PLATFORM}") message("ENABLE_SHARED: ${ENABLE_SHARED}") +message("TARS_INC: ${TARS_INC}") +message("TARS_LIB_DIR: ${TARS_LIB_DIR}") message("TARS2CPP: ${TARS2CPP}") message("TARSMERGE: ${TARSMERGE}") message("TARS_MYSQL: ${TARS_MYSQL}") message("TARS_HTTP2: ${TARS_HTTP2}") message("TARS_SSL: ${TARS_SSL}") -message("TARS_WEB_HOST: ${TARS_WEB_HOST}") -message("TARS_TOKEN: ${TARS_TOKEN}") -message("TARS_K8S_WEB_HOST: ${TARS_K8S_WEB_HOST}") -message("TARS_K8S_BASE_IMAGE: ${TARS_K8S_BASE_IMAGE}") -message("TARS_K8S_TOKEN: ${TARS_K8S_TOKEN}") +message("TARS_GZIP: ${TARS_GZIP}") +message("THRIDPARTY_LIB_DIR: ${THRIDPARTY_LIB_DIR}") if(TARS_MYSQL) message("LIB_MYSQL: ${LIB_MYSQL}") endif() @@ -540,6 +549,14 @@ endif() if(TARS_HTTP2) message("LIB_HTTP2: ${LIB_HTTP2}") endif() - +if(TARS_GZIP) +message("LIB_GZIP: ${LIB_GZIP}") +endif() +message("-------------------------------------------------------------------------------------") +message("TARS_WEB_HOST: ${TARS_WEB_HOST}") +message("TARS_TOKEN: ${TARS_TOKEN}") +message("TARS_K8S_WEB_HOST: ${TARS_K8S_WEB_HOST}") +message("TARS_K8S_BASE_IMAGE: ${TARS_K8S_BASE_IMAGE}") +message("TARS_K8S_TOKEN: ${TARS_K8S_TOKEN}") message("-------------------------------------------------------------------------------------") diff --git a/servant/script/cmake_demo/CMakeLists.txt b/servant/script/cmake_demo/CMakeLists.txt index 38c1c11a..50ff21e7 100644 --- a/servant/script/cmake_demo/CMakeLists.txt +++ b/servant/script/cmake_demo/CMakeLists.txt @@ -19,7 +19,7 @@ IF (TARS_WEB_HOST STREQUAL "") ENDIF () include_directories(/usr/local/tars/cpp/thirdparty/include) -link_directories(/usr/local/tars/cpp/thirdparty/lib) +# link_directories(/usr/local/tars/cpp/thirdparty/lib) #include_directories(/home/tarsprotol/App/OtherServer) diff --git a/servant/script/cmake_http_demo/CMakeLists.txt b/servant/script/cmake_http_demo/CMakeLists.txt index 38c1c11a..50ff21e7 100644 --- a/servant/script/cmake_http_demo/CMakeLists.txt +++ b/servant/script/cmake_http_demo/CMakeLists.txt @@ -19,7 +19,7 @@ IF (TARS_WEB_HOST STREQUAL "") ENDIF () include_directories(/usr/local/tars/cpp/thirdparty/include) -link_directories(/usr/local/tars/cpp/thirdparty/lib) +# link_directories(/usr/local/tars/cpp/thirdparty/lib) #include_directories(/home/tarsprotol/App/OtherServer)