diff --git a/mock/CMakeLists.txt b/mock/CMakeLists.txt index a29ebdbf..cfe1eaef 100755 --- a/mock/CMakeLists.txt +++ b/mock/CMakeLists.txt @@ -1,10 +1,19 @@ include_directories(../) file(GLOB_RECURSE SRC_FILES *.cpp) -add_library(tarsmock ${SRC_FILES}) +add_library(tarsmock STATIC ${SRC_FILES}) +add_library(tarsmock_shared SHARED ${SRC_FILES}) +target_link_libraries(tarsmock_shared tarsservant_shared tarsutil_shared) add_dependencies(tarsmock tarsservant) +add_dependencies(tarsmock_shared tarsservant) install(DIRECTORY . DESTINATION include/mock FILES_MATCHING PATTERN "*.h") install(TARGETS tarsmock RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) +install(TARGETS tarsmock_shared RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + +if (WIN32) + install(FILES $ DESTINATION bin) +endif() + diff --git a/servant/libservant/CMakeLists.txt b/servant/libservant/CMakeLists.txt index 31b80ac5..3e46dcd0 100755 --- a/servant/libservant/CMakeLists.txt +++ b/servant/libservant/CMakeLists.txt @@ -8,10 +8,22 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) aux_source_directory(. DIR_SRCS) -add_library(tarsservant ${DIR_SRCS}) +add_library(tarsservant STATIC ${DIR_SRCS}) add_dependencies(tarsservant COPY-SERVENT-TARS) install(TARGETS tarsservant LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + +add_library(tarsservant_shared SHARED ${DIR_SRCS}) +target_compile_definitions(tarsservant_shared PRIVATE SVT_DLL_EXPORT UTIL_USE_DLL) +target_link_libraries(tarsservant_shared tarsutil_shared tarsparse_shared) + +add_dependencies(tarsservant_shared COPY-SERVENT-TARS) +install(TARGETS tarsservant_shared + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +if (WIN32) + install(FILES $ DESTINATION bin) +endif() diff --git a/tools/tarsparse/CMakeLists.txt b/tools/tarsparse/CMakeLists.txt index d9f7788e..ec25bf81 100644 --- a/tools/tarsparse/CMakeLists.txt +++ b/tools/tarsparse/CMakeLists.txt @@ -28,15 +28,24 @@ foreach(LEC_YACC_SRC ${DEPENDS_LEC_YACC_SRC_LIST}) endforeach() -add_library(${TARGETNAME} ${DIR_SRCS} ${DEPENDS_SRC_LIST}) +add_library(${TARGETNAME} STATIC ${DIR_SRCS} ${DEPENDS_SRC_LIST}) +add_library(${TARGETNAME}_shared SHARED ${DIR_SRCS} ${DEPENDS_SRC_LIST}) if(UNIX) add_dependencies(${TARGETNAME} COPY-LEX-YACC) endif(UNIX) -install(TARGETS tarsparse +install(TARGETS ${TARGETNAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) +install(TARGETS ${TARGETNAME}_shared + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +if (WIN32) + install(FILES $ DESTINATION bin) +endif() + FILE(GLOB HEADERS "*.h") install(FILES ${HEADERS} DESTINATION include/tarsparse) \ No newline at end of file diff --git a/util/src/CMakeLists.txt b/util/src/CMakeLists.txt index 091af25d..31dcdf7f 100644 --- a/util/src/CMakeLists.txt +++ b/util/src/CMakeLists.txt @@ -24,13 +24,35 @@ message("----------------------------------------------------") list(APPEND DIR_SRCS ${JUMP_SRC}) list(APPEND DIR_SRCS ${MAKE_SRC}) -add_library(tarsutil ${DIR_SRCS}) +add_library(tarsutil STATIC ${DIR_SRCS}) +add_library(tarsutil_shared SHARED ${DIR_SRCS}) add_dependencies(tarsutil thirdparty) +target_link_libraries(tarsutil_shared mysqlclient) +target_compile_definitions(tarsutil_shared PRIVATE UTIL_DLL_EXPORT) + +if (TARS_SSL) + if (WIN32) + #windows动态编译需添加依赖库 + target_link_libraries(tarsutil_shared ${LIB_SSL}.lib ${LIB_CRYPTO}.lib Crypt32) + #else () + #linux动态编译未验证,暂时屏蔽 + #target_link_libraries(${LIB_TAF_UTIL} ${LIB_SSL}.a ${LIB_CRYPTO}.a) + endif () +endif() +add_dependencies(tarsutil_shared thirdparty) + install(TARGETS tarsutil LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) +install(TARGETS tarsutil_shared + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +if (WIN32) + install(FILES $ DESTINATION bin) +endif() + IF(WIN32) install(DIRECTORY epoll_windows/sys DESTINATION include)