Skip to content

Commit

Permalink
Dissolve msh3_headers, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Dec 31, 2024
1 parent 3b471e9 commit 9f600f4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
16 changes: 3 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,16 @@ if (WIN32)
# Statically link the OS included part of the runtime.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
set(QUIC_COMMON_DEFINES WIN32_LEAN_AND_MEAN SECURITY_WIN32)
# TODO - Get these to work on Linux
list(APPEND MSH3_COMMON_DEFINES VER_BUILD_ID=${MSH3_VER_BUILD_ID})
list(APPEND MSH3_COMMON_DEFINES VER_SUFFIX=${MSH3_VER_SUFFIX})

add_compile_definitions(WIN32_LEAN_AND_MEAN)
if(HAS_SPECTRE)
list(APPEND QUIC_COMMON_FLAGS /Qspectre)
add_compile_options(/Qspectre)
endif()
# Compile/link flags
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL /Zi")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /Zi")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /IGNORE:4075 /DEBUG /OPT:REF /OPT:ICF")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /IGNORE:4075 /DEBUG /OPT:REF /OPT:ICF")
else()
set(QUIC_COMMON_DEFINES _GNU_SOURCE)
endif()

set(MSH3_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE STRING "Output directory for build artifacts")
Expand All @@ -65,12 +61,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${MSH3_OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${MSH3_OUTPUT_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${MSH3_OUTPUT_DIR})

# Public include header.
add_library(msh3_headers INTERFACE)
target_compile_features(msh3_headers INTERFACE cxx_std_20)
target_compile_definitions(msh3_headers INTERFACE ${MSH3_COMMON_DEFINES})
target_include_directories(msh3_headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

# ls-qpack dependency
option(MSH3_USE_EXTERNAL_LSQPACK "Use an external ls-qpack installation")
if(MSH3_USE_EXTERNAL_LSQPACK)
Expand Down
12 changes: 10 additions & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ else()
set(SOURCES msh3.cpp)
endif()
add_library(msh3 SHARED ${SOURCES})
target_include_directories(msh3 PUBLIC $<INSTALL_INTERFACE:include>)
target_link_libraries(msh3 PRIVATE msquic msquic_platform ls-qpack::ls-qpack msh3_headers)
target_compile_features(msh3 PRIVATE cxx_std_20)
target_compile_definitions(msh3 PRIVATE
"VER_BUILD_ID=${MSH3_VER_BUILD_ID}"
"VER_SUFFIX=${MSH3_VER_SUFFIX}"
)
target_include_directories(msh3 PUBLIC
$<BUILD_INTERFACE:${msh3_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(msh3 PRIVATE msquic msquic_platform ls-qpack::ls-qpack)
if (NOT BUILD_SHARED_LIBS)
target_link_libraries(msh3 PRIVATE base_link)
endif()
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

set(SOURCES msh3test.cpp)
add_executable(msh3test ${SOURCES})
target_link_libraries(msh3test msh3 msh3_headers)
target_link_libraries(msh3test msh3)
install(TARGETS msh3test EXPORT msh3 RUNTIME DESTINATION bin)
2 changes: 1 addition & 1 deletion tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

set(SOURCES msh3_app.cpp)
add_executable(msh3app ${SOURCES})
target_link_libraries(msh3app msh3 msh3_headers)
target_link_libraries(msh3app msh3)
install(TARGETS msh3app EXPORT msh3 RUNTIME DESTINATION bin)

0 comments on commit 9f600f4

Please sign in to comment.