Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dissolve msh3_headers, cleanup #260

Merged
merged 2 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
7 changes: 5 additions & 2 deletions tool/msh3_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
--*/

#include "msh3.hpp"
#include <vector>
#include <cstring>

#include <atomic>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>

using namespace std;

Expand Down
Loading