[WIP] use vcpkg for getopt; build windows shared lib enhancements (#350)

* fix MSVC compiler shared library issues - mostly around 'extern const'

* add vcpkg install getopt to appveyor-windows.yml

show appveyor where to get getopt from vcpkg (non-static lib to avoid LGPL violation)

* add missing else case in lsquic_shared_support.h for windows static lib path

* have cmake spit out it's version

have cmake copy dependent dlls to build dir for tests on windows (getopt.dll)

* copy getopt.dll dep for tests

added commented version that requires >= 3.21 but handles any dll deps

* try caching boringssl dir to reduce CI build time since it's always same commit specified in config file

define VCPKG_ROOT in env since I can't seem to find it by VCPKG_ROOT or VCPKG_INSTALLED_DIR in appveyor's cmake v3.16 + vcpkg

* make windows cache dependent on yml and cmd

* sync up with changes to ls-qpack
This commit is contained in:
Tyler Young 2021-12-15 11:38:20 -05:00 committed by GitHub
parent df67278304
commit f07b3eae43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 1182 additions and 2124 deletions

View file

@ -120,8 +120,12 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_ENC_LOGGER_HEADER=\\\"lsquic_qpack
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_DEC_LOGGER_HEADER=\\\"lsquic_qpack_dec_logger.h\\\"")
IF(LSQUIC_SHARED_LIB)
add_library(lsquic SHARED ${lsquic_STAT_SRCS} )
add_library(lsquic SHARED ${lsquic_STAT_SRCS})
TARGET_LINK_LIBRARIES(lsquic PRIVATE ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB})
IF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQUIC_EXPORTS")
TARGET_LINK_LIBRARIES(lsquic PRIVATE ws2_32.lib)
ENDIF()
ELSE()
add_library(lsquic STATIC ${lsquic_STAT_SRCS})
ENDIF()

@ -1 +1 @@
Subproject commit 0b33c64ee8cb90ac32d4bf6152c406fc27016394
Subproject commit c74cd4b2c3f97c069584615dc37fdd22a9110c80

View file

@ -6,6 +6,8 @@
#ifndef LSQUIC_CUBIC_H
#define LSQUIC_CUBIC_H 1
#include "lsquic_shared_support.h"
struct lsquic_conn;
struct lsquic_cubic {
@ -32,7 +34,7 @@ struct lsquic_cubic {
#define TCP_MSS 1460
extern const struct cong_ctl_if lsquic_cong_cubic_if;
LSQUIC_EXTERN const struct cong_ctl_if lsquic_cong_cubic_if;
void
lsquic_cubic_set_flags (struct lsquic_cubic *cubic, enum cubic_flags flags);

View file

@ -2,6 +2,8 @@
#ifndef LSQUIC_ENC_SESS_H
#define LSQUIC_ENC_SESS_H 1
#include "lsquic_shared_support.h"
struct lsquic_alarmset;
struct lsquic_engine_public;
struct lsquic_packet_out;
@ -315,27 +317,27 @@ struct enc_session_funcs_iquic
const unsigned char *, size_t);
};
extern
LSQUIC_EXTERN
#ifdef NDEBUG
const
#endif
struct enc_session_funcs_common lsquic_enc_session_common_gquic_1;
extern
LSQUIC_EXTERN
#ifdef NDEBUG
const
#endif
struct enc_session_funcs_common lsquic_enc_session_common_gquic_2;
extern const struct enc_session_funcs_common lsquic_enc_session_common_ietf_v1;
LSQUIC_EXTERN const struct enc_session_funcs_common lsquic_enc_session_common_ietf_v1;
extern
LSQUIC_EXTERN
#ifdef NDEBUG
const
#endif
struct enc_session_funcs_gquic lsquic_enc_session_gquic_gquic_1;
extern const struct enc_session_funcs_iquic lsquic_enc_session_iquic_ietf_v1;
LSQUIC_EXTERN const struct enc_session_funcs_iquic lsquic_enc_session_iquic_ietf_v1;
#define select_esf_common_by_ver(ver) ( \
ver == LSQVER_ID27 ? &lsquic_enc_session_common_ietf_v1 : \
@ -353,9 +355,9 @@ extern const struct enc_session_funcs_iquic lsquic_enc_session_iquic_ietf_v1;
extern const char *const lsquic_enclev2str[];
extern const struct lsquic_stream_if lsquic_cry_sm_if;
LSQUIC_EXTERN const struct lsquic_stream_if lsquic_cry_sm_if;
extern const struct lsquic_stream_if lsquic_mini_cry_sm_if;
LSQUIC_EXTERN const struct lsquic_stream_if lsquic_mini_cry_sm_if;
/* RFC 7301, Section 3.2 */
#define ALERT_NO_APPLICATION_PROTOCOL 120

View file

@ -2,6 +2,8 @@
#ifndef LSQUIC_HTTP1X_IF_H
#define LSQUIC_HTTP1X_IF_H 1
#include "lsquic_shared_support.h"
struct lsquic_hset_if;
struct lsquic_conn;
@ -12,7 +14,7 @@ struct http1x_ctor_ctx
int is_server;
};
extern const struct lsquic_hset_if *const lsquic_http1x_if;
LSQUIC_EXTERN const struct lsquic_hset_if *const lsquic_http1x_if;
#define MAX_HTTP1X_HEADERS_SIZE (64 * 1024)

View file

@ -24,6 +24,8 @@
#include <stdint.h>
#include <stdio.h>
#include "lsquic_shared_support.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -93,7 +95,8 @@ enum lsquic_logger_module {
/* Each module has its own log level.
*/
extern enum lsq_log_level lsq_log_levels[N_LSQUIC_LOGGER_MODULES];
LSQUIC_EXTERN enum lsq_log_level lsq_log_levels[N_LSQUIC_LOGGER_MODULES];
extern const char *const lsqlm_to_str[N_LSQUIC_LOGGER_MODULES];

View file

@ -6,6 +6,7 @@
#include "lsquic_packet_common.h"
#include "lsquic_packet_gquic.h"
#include "lsquic_shared_support.h"
struct lsquic_conn;
struct lsquic_packet_in;
@ -192,7 +193,6 @@ struct parse_funcs
int
(*pf_parse_path_resp_frame) (const unsigned char *buf, size_t,
uint64_t *resp);
#ifndef NDEBUG
/* These float reading and writing functions assume `mem' has at least
* 2 bytes.
*/
@ -200,7 +200,6 @@ struct parse_funcs
(*pf_write_float_time16) (lsquic_time_t time_us, void *mem);
uint64_t
(*pf_read_float_time16) (const void *mem);
#endif
ssize_t
(*pf_generate_simple_prst) (const lsquic_cid_t *cid,
unsigned char *, size_t);
@ -334,11 +333,10 @@ struct parse_funcs
(*pf_datagram_frame_size) (size_t);
};
extern const struct parse_funcs lsquic_parse_funcs_gquic_Q043;
extern const struct parse_funcs lsquic_parse_funcs_gquic_Q046;
extern const struct parse_funcs lsquic_parse_funcs_gquic_Q050;
extern const struct parse_funcs lsquic_parse_funcs_ietf_v1;
LSQUIC_EXTERN const struct parse_funcs lsquic_parse_funcs_gquic_Q043;
LSQUIC_EXTERN const struct parse_funcs lsquic_parse_funcs_gquic_Q046;
LSQUIC_EXTERN const struct parse_funcs lsquic_parse_funcs_gquic_Q050;
LSQUIC_EXTERN const struct parse_funcs lsquic_parse_funcs_ietf_v1;
#define select_pf_by_ver(ver) ( \
(1 << (ver)) & (1 << LSQVER_043) ? \

View file

@ -0,0 +1,37 @@
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_shared_support.h - Support for building a shared library.
*/
#ifndef LSQUIC_SHARED_SUPPORT
#define LSQUIC_SHARED_SUPPORT 1
#ifndef LSQUIC_EXTERN
# ifdef _MSC_VER /* WIN32 */
/* MSVC (and CMake on Windows) doesn't like to export extern const symbols, they need to be forced. */
# ifdef LSQUIC_SHARED_LIB
# ifdef LSQUIC_EXPORTS
# define LSQUIC_EXTERN __declspec(dllexport) extern
# else /* LSQUIC_EXPORTS */
# define LSQUIC_EXTERN __declspec(dllimport) extern
# endif /* LSQUIC_EXPORTS */
# else
# define LSQUIC_EXTERN extern
# endif
# else /* _MSC_VER */
# define LSQUIC_EXTERN extern
# endif /* _MSC_VER */
#endif /* LSQUIC_EXTERN */
#endif /* LSQUIC_SHARED_SUPPORT */

View file

@ -6,12 +6,12 @@
#ifndef LSQUIC_STOCK_SHI
#define LSQUIC_STOCK_SHI 1
#include "lsquic_shared_support.h"
#ifdef __cplusplus
extern "C" {
#endif
struct stock_shared_hash;
struct stock_shared_hash *
@ -25,6 +25,6 @@ lsquic_stock_shared_hash_destroy (struct stock_shared_hash *);
}
#endif
extern const struct lsquic_shared_hash_if stock_shi;
LSQUIC_EXTERN const struct lsquic_shared_hash_if stock_shi;
#endif