Skip calling CLOG if logging is disabled (#652)

* Skip calling CLOG if logging is disabled

Adds an unnecessary dependency if logging is disabled anyway

* Fiox dist

* Remove ifdef

* Rename and merge function

* Fix build, move clog targets into folder

* Skip folder when not actually using clog

Co-authored-by: Nick Banks <nibanks@microsoft.com>
This commit is contained in:
Thad House 2020-07-30 09:00:32 -07:00 коммит произвёл GitHub
Родитель 2316ab65bf
Коммит c869617eb6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 32 добавлений и 28 удалений

Просмотреть файл

@ -153,8 +153,6 @@ set(QUIC_OUTPUT_DIR ${QUIC_BUILD_DIR}/bin/$<IF:$<CONFIG:Debug>,Debug,Release> CA
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${QUIC_BUILD_DIR}/obj/$<IF:$<CONFIG:Debug>,Debug,Release>)
execute_process(COMMAND clog --installDirectory ${CMAKE_SOURCE_DIR}/build/clog)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QUIC_OUTPUT_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QUIC_OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${QUIC_OUTPUT_DIR})
@ -162,12 +160,26 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${QUIC_OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${QUIC_OUTPUT_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${QUIC_OUTPUT_DIR})
set(CMAKE_CLOG_OUTPUT_DIRECTORY ${QUIC_BUILD_DIR}/inc)
set(CMAKE_CLOG_SIDECAR_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/manifest)
set(CLOG_INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/build/clog)
set(CMAKE_CLOG_GENERATE_FILE ${CMAKE_SOURCE_DIR}/build/clog/CLog.cmake)
set(CMAKE_CLOG_CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/manifest/msquic.clog_config)
include(${CMAKE_CLOG_GENERATE_FILE})
if (QUIC_ENABLE_LOGGING)
execute_process(COMMAND clog --installDirectory ${CMAKE_SOURCE_DIR}/build/clog)
set(CMAKE_CLOG_OUTPUT_DIRECTORY ${QUIC_BUILD_DIR}/inc)
set(CMAKE_CLOG_SIDECAR_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/manifest)
set(CLOG_INCLUDE_DIRECTORY ${CMAKE_SOURCE_DIR}/build/clog)
set(CMAKE_CLOG_GENERATE_FILE ${CMAKE_SOURCE_DIR}/build/clog/CLog.cmake)
set(CMAKE_CLOG_CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/manifest/msquic.clog_config)
include(${CMAKE_CLOG_GENERATE_FILE})
function(add_clog_library)
CLOG_GENERATE_TARGET(${ARGV})
target_link_libraries(${ARGV0} PRIVATE inc)
set_property(TARGET ${ARGV0} PROPERTY FOLDER "clog")
endfunction()
else()
function(add_clog_library)
add_library(${ARGV0} INTERFACE)
endfunction()
endif()
set(QUIC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/inc)
set(MANIFESTED_HEADER_FILENAME ${QUIC_BUILD_DIR}/inc/MsQuicEtw.h)

Просмотреть файл

@ -44,9 +44,7 @@ if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
endif()
# Allow CLOG to preprocess all the source files.
CLOG_GENERATE_TARGET(core.clog STATIC ${SOURCES})
target_link_libraries(core.clog PRIVATE inc)
add_clog_library(core.clog STATIC ${SOURCES})
add_library(core STATIC ${SOURCES})

Просмотреть файл

@ -12,9 +12,7 @@ set(SOURCES
)
# Allow CLOG to preprocess all the source files.
CLOG_GENERATE_TARGET(msquiccoretest.clog STATIC ${SOURCES})
target_link_libraries(msquiccoretest.clog PRIVATE inc)
add_clog_library(msquiccoretest.clog STATIC ${SOURCES})
add_executable(msquiccoretest ${SOURCES})

Просмотреть файл

@ -6,7 +6,7 @@ set(SOURCES
)
# Allow CLOG to preprocess all the source files.
CLOG_GENERATE_TARGET(perfbin.clog STATIC ${SOURCES})
add_clog_library(perfbin.clog STATIC ${SOURCES})
add_executable(quicperf ${SOURCES})

Просмотреть файл

@ -8,7 +8,7 @@ set(SOURCES
)
# Allow CLOG to preprocess all the source files.
CLOG_GENERATE_TARGET(perflib.clog STATIC ${SOURCES})
add_clog_library(perflib.clog STATIC ${SOURCES})
add_library(perflib ${SOURCES})

Просмотреть файл

@ -48,9 +48,7 @@ else()
endif()
# Allow CLOG to preprocess all the source files.
CLOG_GENERATE_TARGET(platform.clog STATIC ${SOURCES})
target_link_libraries(platform.clog PRIVATE inc)
add_clog_library(platform.clog STATIC ${SOURCES})
add_library(platform STATIC ${SOURCES})

Просмотреть файл

@ -2402,6 +2402,7 @@ QuicSendContextComplete(
_In_ ULONG IoResult
)
{
UNREFERENCED_PARAMETER(SocketContext);
if (IoResult != QUIC_STATUS_SUCCESS) {
QuicTraceEvent(
DatapathErrorStatus,

Просмотреть файл

@ -340,6 +340,9 @@ QuicPlatformLogAssert(
_In_z_ const char* Expr
)
{
UNREFERENCED_PARAMETER(File);
UNREFERENCED_PARAMETER(Line);
UNREFERENCED_PARAMETER(Expr);
QuicTraceEvent(
LibraryAssert,
"[ lib] ASSERT, %u:%s - %s.",

Просмотреть файл

@ -10,9 +10,7 @@ set(SOURCES
)
# Allow CLOG to preprocess all the source files.
CLOG_GENERATE_TARGET(msquicplatformtest.clog STATIC ${SOURCES})
target_link_libraries(msquicplatformtest.clog PRIVATE inc)
add_clog_library(msquicplatformtest.clog STATIC ${SOURCES})
add_executable(msquicplatformtest ${SOURCES})

Просмотреть файл

@ -7,9 +7,7 @@ set(SOURCES
)
# Allow CLOG to preprocess all the source files.
CLOG_GENERATE_TARGET(msquictest.clog STATIC ${SOURCES})
target_link_libraries(msquictest.clog PRIVATE inc)
add_clog_library(msquictest.clog STATIC ${SOURCES})
add_executable(msquictest ${SOURCES})

Просмотреть файл

@ -17,9 +17,7 @@ set(SOURCES
)
# Allow CLOG to preprocess all the source files.
CLOG_GENERATE_TARGET(testlib.clog STATIC ${SOURCES})
target_link_libraries(testlib.clog PRIVATE inc)
add_clog_library(testlib.clog STATIC ${SOURCES})
add_library(testlib ${SOURCES})