[liboblog-ce] won't compile liboblog unless compile with -DOB_BUILD_LIBOBLOG=ON

This commit is contained in:
SanmuWangZJU 2021-10-09 15:02:02 +08:00 committed by wangzelin.wzl
parent e65a4c986a
commit a6f3f1287a
6 changed files with 25 additions and 8 deletions

View File

@ -33,7 +33,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(deps/easy)
add_subdirectory(deps/oblib)
add_subdirectory(deps/logmessage)
add_subdirectory(src)
include(CMakeDependentOption)

View File

@ -86,7 +86,7 @@ function prepare_build_dir
# dep_create
function do_init
{
(cd $TOPDIR/deps/3rd && bash dep_create.sh && cd $TOPDIR && git submodule update --init)
(cd $TOPDIR/deps/3rd && bash dep_create.sh)
}
# make build directory && cmake && make (if need)

View File

@ -12,6 +12,7 @@ ob_define(OB_ENABLE_LIB_PCH ${OB_ENABLE_PCH})
ob_define(OB_ENABLE_SERVER_PCH ${OB_ENABLE_PCH})
ob_define(OB_ENALBE_UNITY ON)
ob_define(OB_MAX_UNITY_BATCH_SIZE 30)
ob_define(OB_BUILD_LIBOBLOG OFF)
ob_define(OB_RELEASEID 1)
@ -25,7 +26,7 @@ set(LD_OPT "-Wl,--build-id=uuid")
set(BUILD_OPT "${DEBUG_PREFIX}")
if (OB_USE_LLVM_LIBTOOLS)
# use llvm-ar llvm-ranlib llvm-objcopy ld.lld...
# use llvm-ar llvm-ranlib llvm-objcopy ld.lld...
set(_CMAKE_TOOLCHAIN_PREFIX llvm-)
set(_CMAKE_TOOLCHAIN_LOCATION "${DEVTOOLS_DIR}/bin")
set(LD_BIN "${DEVTOOLS_DIR}/bin/ld.lld")

View File

@ -1,3 +1,18 @@
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
add_subdirectory(src)
add_subdirectory(tests)
message(STATUS "OB_BUILD_LIBOBLOG ${OB_BUILD_LIBOBLOG}")
if (OB_BUILD_LIBOBLOG)
find_package(Git QUIET)
if (GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if (NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
add_subdirectory(${PROJECT_SOURCE_DIR}/deps/logmessage ${PROJECT_BINARY_DIR}/deps/logmessage EXCLUDE_FROM_ALL)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
add_subdirectory(src)
add_subdirectory(tests)
else()
message("cannot find executable git")
endif()
endif()

View File

@ -1,7 +1,7 @@
add_library(oblog_base INTERFACE)
target_include_directories(oblog_base INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(oblog_base
INTERFACE ob_base oblogmsg
INTERFACE ob_base oblogmsg_static
)
add_library(oblog_miner INTERFACE)

View File

@ -29,4 +29,6 @@ add_subdirectory(observer)
add_subdirectory(share)
add_subdirectory(rootserver)
add_subdirectory(tools)
add_subdirectory(liboblog)
if (OB_BUILD_LIBOBLOG)
add_subdirectory(liboblog)
endif()