Skip to content

Commit

Permalink
tars-tools.cmake add lib show
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanshudong committed Oct 25, 2024
1 parent 40c6293 commit 936f499
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
14 changes: 7 additions & 7 deletions cmake/Thirdparty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -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
)

Expand Down
31 changes: 24 additions & 7 deletions servant/makefile/tars-tools.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -56,23 +58,27 @@ 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)
set(LIB_SSL "libssl")
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()

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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("-------------------------------------------------------------------------------------")

2 changes: 1 addition & 1 deletion servant/script/cmake_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion servant/script/cmake_http_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 936f499

Please sign in to comment.