mirror of
https://github.com/EndPositive/slipstream.git
synced 2025-10-08 12:25:04 +00:00
Optimize build configuration
This commit is contained in:
parent
29f3c50237
commit
9d309d48b1
4 changed files with 35 additions and 21 deletions
|
|
@ -3,28 +3,31 @@ project(slipstream C)
|
|||
|
||||
set(CMAKE_C_STANDARD 23)
|
||||
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
||||
option(GIT_SUBMODULE "Check submodules during build" ON)
|
||||
if(GIT_SUBMODULE)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
RESULT_VARIABLE GIT_SUBMOD_RESULT)
|
||||
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
|
||||
message(FATAL_ERROR "git submodule update --init --recursive failed")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(PICOQUIC_FETCH_PTLS ON)
|
||||
|
||||
set(PICOQUIC_FETCH_PTLS Y)
|
||||
add_subdirectory(extern/picoquic)
|
||||
set(DISABLE_DEBUG_PRINTF OFF)
|
||||
set(ENABLE_ASAN OFF)
|
||||
set(ENABLE_UBSAN OFF)
|
||||
set(BUILD_DEMO OFF)
|
||||
set(BUILD_HTTP OFF)
|
||||
set(BUILD_LOGLIB OFF)
|
||||
set(BUILD_LOGREADER OFF)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
list(APPEND PICOQUIC_ADDITIONAL_C_FLAGS -g -Og)
|
||||
set(BUILD_TESTING OFF)
|
||||
|
||||
set(PICOQUIC_ADDITIONAL_C_FLAGS "" CACHE STRING "Additional C flags for picoquic")
|
||||
|
||||
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||
list(APPEND PICOQUIC_ADDITIONAL_C_FLAGS -Og)
|
||||
list(APPEND PICOQUIC_ADDITIONAL_CXX_FLAGS -Og)
|
||||
set(ENABLE_ASAN Y)
|
||||
else()
|
||||
list(APPEND PICOQUIC_ADDITIONAL_C_FLAGS -O3)
|
||||
list(APPEND PICOQUIC_ADDITIONAL_CXX_FLAGS -O3)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(extern/picoquic)
|
||||
|
||||
add_executable(slipstream
|
||||
src/slipstream.c
|
||||
src/slipstream_client.c
|
||||
|
|
@ -50,7 +53,10 @@ add_executable(slipstream
|
|||
extern/SPCDNS/src/output.h
|
||||
)
|
||||
target_link_libraries(slipstream PRIVATE m)
|
||||
target_link_libraries(slipstream PRIVATE picoquic-log picoquic-core)
|
||||
target_link_libraries(slipstream PRIVATE picoquic-core)
|
||||
if (${CMAKE_BUILD_TYPE} STREQUAL DEBUG)
|
||||
target_link_libraries(slipstream PRIVATE picoquic-log)
|
||||
endif ()
|
||||
|
||||
target_include_directories(slipstream PRIVATE include)
|
||||
target_include_directories(slipstream PRIVATE extern)
|
||||
|
|
|
|||
2
extern/picoquic
vendored
2
extern/picoquic
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit ad35d94082d6c631fab790e4e8f37787b2727cdc
|
||||
Subproject commit f36b4daa6111057cb05cbbfcec287c74bdd65d06
|
||||
|
|
@ -3,7 +3,9 @@
|
|||
#include <picoquic.h>
|
||||
#include <picoquic_utils.h>
|
||||
#include <picosocks.h>
|
||||
#ifdef BUILD_LOGLIB
|
||||
#include <autoqlog.h>
|
||||
#endif
|
||||
#include <picoquic_internal.h>
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -557,7 +559,7 @@ int picoquic_slipstream_client(int listen_port, char const* server_name, int ser
|
|||
picoquic_config_init(&config);
|
||||
config.nb_connections = 8;
|
||||
// config.log_file = "-";
|
||||
#ifndef DISABLE_DEBUG_PRINTF
|
||||
#ifndef BUILD_LOGLIB
|
||||
config.qlog_dir = SLIPSTREAM_QLOG_DIR;
|
||||
#endif
|
||||
config.server_port = server_port;
|
||||
|
|
@ -583,9 +585,11 @@ int picoquic_slipstream_client(int listen_port, char const* server_name, int ser
|
|||
}
|
||||
|
||||
picoquic_set_cookie_mode(quic, 2);
|
||||
#ifdef BUILD_LOGLIB
|
||||
picoquic_set_qlog(quic, config.qlog_dir);
|
||||
picoquic_set_key_log_file_from_env(quic);;
|
||||
debug_printf_push_stream(stderr);
|
||||
#endif
|
||||
picoquic_set_key_log_file_from_env(quic);
|
||||
|
||||
ret = slipstream_connect(server_name, server_port, quic, &cnx, &client_ctx);
|
||||
if (ret != 0) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@
|
|||
#include <picoquic.h>
|
||||
#include <picoquic_packet_loop.h>
|
||||
#include <picosocks.h>
|
||||
#ifdef BUILD_LOGLIB
|
||||
#include <autoqlog.h>
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
#include <arpa/nameser.h>
|
||||
|
|
@ -525,9 +527,11 @@ int picoquic_slipstream_server(int server_port, const char* server_cert, const c
|
|||
}
|
||||
|
||||
picoquic_set_cookie_mode(quic, 2);
|
||||
#ifdef BUILD_LOGLIB
|
||||
picoquic_set_qlog(quic, config.qlog_dir);
|
||||
picoquic_set_key_log_file_from_env(quic);;
|
||||
debug_printf_push_stream(stderr);
|
||||
#endif
|
||||
picoquic_set_key_log_file_from_env(quic);
|
||||
|
||||
picoquic_packet_loop_param_t param = {0};
|
||||
param.local_af = AF_INET;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue