Allow builds on MSVC (#518)
* Import cxxopts to replace getopts usage * Add visual studio build things * Fixup abseil build parts * Replace __attribute__((unused)) with ABSL_ATTRIBUTE_UNUSED * Fixup minor windows build issues * Replace getopts usage * Temporarily fixup .rc files * More minor windows fixes * Get a working build * Revert .rc files * Revert changes to nodedbstable
parent
52b2b3bf44
commit
0195152e05
|
@ -35,6 +35,7 @@ testnet_tmp
|
|||
|
||||
*.pid
|
||||
vsproject/
|
||||
.vs
|
||||
|
||||
daemon.ini
|
||||
lokinet-win32.exe
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
cmake_minimum_required(VERSION 3.6.0)
|
||||
|
||||
set(PROJECT_NAME lokinet)
|
||||
project(${PROJECT_NAME} C CXX ASM)
|
||||
project(${PROJECT_NAME} C CXX)
|
||||
|
||||
# Core options
|
||||
option(USE_AVX2 "enable avx2 code" )
|
||||
|
@ -28,15 +28,23 @@ if(CCACHE_PROGRAM)
|
|||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
|
||||
endif()
|
||||
|
||||
if (MSVC_VERSION)
|
||||
enable_language(ASM_MASM)
|
||||
list(APPEND CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS s)
|
||||
add_definitions(/D_WIN32_WINNT=0x0600 /DNOMINMAX /DSODIUM_STATIC)
|
||||
else()
|
||||
enable_language(ASM)
|
||||
endif(MSVC_VERSION)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
# check if we have the (saner) emulation of epoll here
|
||||
# it's basically linux epoll but with a sane method of
|
||||
# dealing with closed file handles that still exist in the
|
||||
# epoll set
|
||||
#
|
||||
# Note that the zombie of Oracle Solaris 2.11.x will NOT have
|
||||
# this, the header check is the only method we have to distinguish
|
||||
# them. -rick the svr4 guy
|
||||
# check if we have the (saner) emulation of epoll here
|
||||
# it's basically linux epoll but with a sane method of
|
||||
# dealing with closed file handles that still exist in the
|
||||
# epoll set
|
||||
#
|
||||
# Note that the zombie of Oracle Solaris 2.11.x will NOT have
|
||||
# this, the header check is the only method we have to distinguish
|
||||
# them. -rick the svr4 guy
|
||||
set(SOLARIS ON)
|
||||
option(USE_POLL "Revert to using poll(2) event loop (useful if targeting Oracle Solaris)" OFF)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lsocket -lnsl")
|
||||
|
@ -72,6 +80,7 @@ if (WIN32 AND NOT STATIC_LINK_RUNTIME)
|
|||
message("for release builds, turn on STATIC_LINK_RUNTIME in cmake options")
|
||||
endif(WIN32 AND NOT STATIC_LINK_RUNTIME)
|
||||
|
||||
add_subdirectory(vendor/cxxopts)
|
||||
add_subdirectory(vendor/nlohmann)
|
||||
|
||||
# still need the headers unconditionally
|
||||
|
@ -90,11 +99,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|||
add_compile_options(-Wno-unknown-warning-option)
|
||||
endif()
|
||||
|
||||
add_compile_options(-Wall -Wextra -Wno-unknown-pragmas)
|
||||
# vla are evil
|
||||
add_compile_options(-Wvla)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
|
||||
add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas)
|
||||
if (NOT MSVC_VERSION)
|
||||
add_compile_options(-Wall -Wextra -Wno-unknown-pragmas)
|
||||
# vla are evil
|
||||
add_compile_options(-Wvla)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
|
||||
add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-Wthread-safety)
|
||||
|
@ -127,15 +138,15 @@ if (WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
|
|||
endif()
|
||||
endif(WOW64_CROSS_COMPILE OR WIN64_CROSS_COMPILE)
|
||||
|
||||
if(WIN32)
|
||||
if(WIN32 AND NOT MSVC_VERSION)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-bad-function-cast>)
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-cast-function-type>)
|
||||
# unlike unix where you get a *single* compiler ID string in .comment
|
||||
# GNU ld sees fit to merge *all* the .ident sections in object files
|
||||
# to .r[o]data section one after the other!
|
||||
# unlike unix where you get a *single* compiler ID string in .comment
|
||||
# GNU ld sees fit to merge *all* the .ident sections in object files
|
||||
# to .r[o]data section one after the other!
|
||||
add_compile_options(-fno-ident)
|
||||
set(FS_LIB stdc++fs)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
if(DEBIAN)
|
||||
add_definitions(-DDEBIAN)
|
||||
|
@ -184,10 +195,10 @@ if(TESTNET)
|
|||
add_definitions(-DTESTNET=1)
|
||||
endif(TESTNET)
|
||||
|
||||
if(NOT DEBIAN)
|
||||
if(NOT DEBIAN AND NOT MSVC_VERSION)
|
||||
set(OPTIMIZE_FLAGS -O3)
|
||||
set(DEBUG_FLAGS -O0 -g3)
|
||||
endif(NOT DEBIAN)
|
||||
endif()
|
||||
|
||||
if(ASAN)
|
||||
set(DEBUG_FLAGS ${DEBUG_FLAGS} -fsanitize=address -fno-omit-frame-pointer)
|
||||
|
@ -232,8 +243,9 @@ endif(NON_PC_TARGET)
|
|||
add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS})
|
||||
|
||||
if(NOT GIT_VERSION)
|
||||
exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "rev-parse --short HEAD" OUTPUT_VARIABLE GIT_VERSION)
|
||||
add_definitions(-DGIT_REV="${GIT_VERSION}")
|
||||
exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "rev-parse --short HEAD" OUTPUT_VARIABLE GIT_VERSION_UNSTRIP)
|
||||
string(STRIP "${GIT_VERSION_UNSTRIP}" GIT_VERSION)
|
||||
add_definitions("-DGIT_REV=\"${GIT_VERSION}\"")
|
||||
endif(NOT GIT_VERSION)
|
||||
|
||||
if(RELEASE_MOTTO)
|
||||
|
@ -320,7 +332,7 @@ if(UNIX)
|
|||
elseif(WIN32)
|
||||
get_filename_component(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-windows.c ABSOLUTE)
|
||||
get_filename_component(EV_SRC "llarp/ev/ev_win32.cpp" ABSOLUTE)
|
||||
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500)
|
||||
add_definitions(-DWIN32_LEAN_AND_MEAN -DWIN32 -DWINVER=0x0602 -D_WIN32_WINNT=0x0602)
|
||||
else()
|
||||
message(FATAL_ERROR "What operating system _are_ you building on/for?")
|
||||
endif(UNIX)
|
||||
|
@ -366,12 +378,17 @@ target_link_libraries(${ABYSS_LIB} PUBLIC ${PLATFORM_LIB})
|
|||
if (NOT WIN32)
|
||||
add_executable(${ABYSS_EXE} ${ABYSS}/main.cpp)
|
||||
target_link_libraries(${ABYSS_EXE} PUBLIC ${ABYSS_LIB} Threads::Threads)
|
||||
else()
|
||||
elseif(NOT MSVC_VERSION)
|
||||
add_executable(${ABYSS_EXE} ${ABYSS}/main.cpp llarp/win32/abyss.rc)
|
||||
target_link_libraries(${ABYSS_EXE} PUBLIC ${ABYSS_LIB} ${STATIC_LIB} ws2_32)
|
||||
else()
|
||||
add_executable(${ABYSS_EXE} ${ABYSS}/main.cpp)
|
||||
target_link_libraries(${ABYSS_EXE} PUBLIC ${ABYSS_LIB} ${STATIC_LIB} ws2_32)
|
||||
endif(NOT WIN32)
|
||||
|
||||
target_include_directories(${ABYSS_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include")
|
||||
target_include_directories(${ABYSS_EXE} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include")
|
||||
|
||||
# for freebsd
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
target_include_directories(${ABYSS_LIB} PUBLIC /usr/local/include)
|
||||
|
@ -395,8 +412,10 @@ if(SHADOW)
|
|||
else()
|
||||
if(NOT WIN32)
|
||||
add_executable(${EXE} ${EXE_SRC})
|
||||
else()
|
||||
elseif(NOT MSVC_VERSION)
|
||||
add_executable(${EXE} ${EXE_SRC} llarp/win32/version.rc)
|
||||
else()
|
||||
add_executable(${EXE} ${EXE_SRC})
|
||||
endif(NOT WIN32)
|
||||
|
||||
add_log_tag(${EXE})
|
||||
|
@ -424,6 +443,6 @@ endif(SHADOW)
|
|||
|
||||
enable_testing()
|
||||
|
||||
if (NOT SHADOW)
|
||||
if (NOT SHADOW AND NOT MSVC_VERSION)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"variables": []
|
||||
}
|
||||
]
|
||||
}
|
|
@ -19,8 +19,7 @@
|
|||
/* C++Builder defines a "random" macro */
|
||||
#undef random
|
||||
|
||||
static const randombytes_implementation *implementation =
|
||||
&randombytes_salsa20_implementation;
|
||||
static const randombytes_implementation *implementation = 0;
|
||||
|
||||
static void
|
||||
randombytes_init_if_needed(void)
|
||||
|
|
|
@ -69,8 +69,12 @@ typedef NTSTATUS(FAR PASCAL *CNGAPI_DRBG)(BCRYPT_ALG_HANDLE, UCHAR *, ULONG,
|
|||
#endif
|
||||
|
||||
#ifndef TLS
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#define TLS __declspec(thread)
|
||||
#else
|
||||
#define TLS __thread
|
||||
#endif
|
||||
#else
|
||||
#define TLS
|
||||
#endif
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#include <config.hpp> // for ensure_config
|
||||
#include <libgen.h>
|
||||
#include <llarp.h>
|
||||
#include <util/fs.hpp>
|
||||
#include <util/logger.hpp>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
|
||||
#if !defined(_WIN32) && !defined(__OpenBSD__)
|
||||
#include <wordexp.h>
|
||||
#endif
|
||||
|
||||
#include <cxxopts.hpp>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -104,43 +103,75 @@ main(int argc, char *argv[])
|
|||
absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kAbort);
|
||||
#endif
|
||||
|
||||
int opt = 0;
|
||||
// clang-format off
|
||||
cxxopts::Options options(
|
||||
"lokinet",
|
||||
"Lokinet is a private, decentralized and IP based overlay network for the internet"
|
||||
);
|
||||
options.add_options()
|
||||
("v,verbose", "Verbose", cxxopts::value<bool>())
|
||||
("h,help", "help", cxxopts::value<bool>())
|
||||
("g,generate", "generate config", cxxopts::value<bool>())
|
||||
("c,config", "generate config", cxxopts::value<bool>())
|
||||
("r,router", "run as router", cxxopts::value<bool>())
|
||||
("f,force", "overwrite", cxxopts::value<bool>());
|
||||
options.parse_positional({"config_file"});
|
||||
// clang-format on
|
||||
|
||||
bool genconfigOnly = false;
|
||||
bool asRouter = false;
|
||||
bool overWrite = false;
|
||||
while((opt = getopt(argc, argv, "hgcfrv")) != -1)
|
||||
{
|
||||
switch(opt)
|
||||
{
|
||||
case 'v':
|
||||
SetLogLevel(llarp::eLogDebug);
|
||||
llarp::LogDebug("debug logging activated");
|
||||
break;
|
||||
case 'h':
|
||||
return printHelp(argv[0], 0);
|
||||
case 'g':
|
||||
genconfigOnly = true;
|
||||
break;
|
||||
case 'c':
|
||||
genconfigOnly = true;
|
||||
break;
|
||||
case 'r':
|
||||
asRouter = true;
|
||||
break;
|
||||
case 'f':
|
||||
overWrite = true;
|
||||
break;
|
||||
default:
|
||||
return printHelp(argv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
std::string conffname; // suggestions: confFName? conf_fname?
|
||||
|
||||
if(optind < argc)
|
||||
try
|
||||
{
|
||||
auto result = options.parse(argc, argv);
|
||||
|
||||
if(result.count("verbose") > 0)
|
||||
{
|
||||
SetLogLevel(llarp::eLogDebug);
|
||||
llarp::LogDebug("debug logging activated");
|
||||
}
|
||||
|
||||
if(result.count("help"))
|
||||
{
|
||||
return printHelp(argv[0], 0);
|
||||
}
|
||||
|
||||
if(result.count("generate") > 0 || result.count("config") > 0)
|
||||
{
|
||||
genconfigOnly = true;
|
||||
}
|
||||
|
||||
if(result.count("force") > 0)
|
||||
{
|
||||
overWrite = true;
|
||||
}
|
||||
|
||||
if(result.count("router") > 0)
|
||||
{
|
||||
asRouter = true;
|
||||
}
|
||||
|
||||
if(result.count("config_file") > 0)
|
||||
{
|
||||
auto vec = result["config_file"].as< std::vector< std::string > >();
|
||||
if(!vec.empty())
|
||||
{
|
||||
conffname = vec[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const cxxopts::option_not_exists_exception& ex)
|
||||
{
|
||||
std::cerr << ex.what();
|
||||
return printHelp(argv[0]);
|
||||
}
|
||||
|
||||
if(!conffname.empty())
|
||||
{
|
||||
// when we have an explicit filepath
|
||||
fs::path fname = fs::path(argv[optind]);
|
||||
fs::path fname = fs::path(conffname);
|
||||
fs::path basedir = fname.parent_path();
|
||||
conffname = fname.string();
|
||||
conffname = resolvePath(conffname);
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
* - t_tun_in6_addr: struct in6_addr/IN6_ADDR
|
||||
*/
|
||||
#if defined Windows
|
||||
#include <windows.h>
|
||||
#include <in6addr.h>
|
||||
#include <winsock2.h>
|
||||
typedef HANDLE t_tun;
|
||||
|
|
|
@ -15,7 +15,7 @@ struct DemoHandler : public abyss::httpd::IRPCHandler
|
|||
|
||||
absl::optional< Response >
|
||||
HandleJSONRPC(Method_t method,
|
||||
__attribute__((unused)) const Params& params) override
|
||||
ABSL_ATTRIBUTE_UNUSED const Params& params) override
|
||||
{
|
||||
llarp::LogInfo("method: ", method);
|
||||
return Response::object();
|
||||
|
@ -50,7 +50,7 @@ struct DemoCall : public abyss::http::IRPCClientHandler
|
|||
}
|
||||
|
||||
void
|
||||
PopulateReqHeaders(__attribute__((unused))
|
||||
PopulateReqHeaders(ABSL_ATTRIBUTE_UNUSED
|
||||
abyss::http::Headers_t& hdr) override
|
||||
{
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ struct DemoServer : public abyss::httpd::BaseReqHandler
|
|||
};
|
||||
|
||||
int
|
||||
main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[])
|
||||
main(ABSL_ATTRIBUTE_UNUSED int argc, ABSL_ATTRIBUTE_UNUSED char* argv[])
|
||||
{
|
||||
// Ignore on Windows, we don't even get SIGPIPE (even though native *and*
|
||||
// emulated UNIX pipes exist - CreatePipe(2), pipe(3))
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace abyss
|
|||
}
|
||||
|
||||
static void
|
||||
OnTick(__attribute__((unused)) llarp_tcp_conn* conn)
|
||||
OnTick(ABSL_ATTRIBUTE_UNUSED llarp_tcp_conn* conn)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ typedef uint32 utp_link_t;
|
|||
#pragma warning(disable : 4200)
|
||||
#endif
|
||||
|
||||
#include <absl/base/attributes.h>
|
||||
|
||||
typedef uint32 (*utp_hash_compute_t)(const void *keyp, size_t keysize);
|
||||
typedef uint (*utp_hash_equal_t)(const void *key_a, const void *key_b,
|
||||
size_t keysize);
|
||||
|
@ -146,12 +148,12 @@ class utpHashTable
|
|||
|
||||
public:
|
||||
static uint
|
||||
compare(const void *k1, const void *k2, __attribute__((unused)) size_t ks)
|
||||
compare(const void *k1, const void *k2, ABSL_ATTRIBUTE_UNUSED size_t ks)
|
||||
{
|
||||
return *((K *)k1) == *((K *)k2);
|
||||
}
|
||||
static uint32
|
||||
compute_hash(const void *k, __attribute__((unused)) size_t ks)
|
||||
compute_hash(const void *k, ABSL_ATTRIBUTE_UNUSED size_t ks)
|
||||
{
|
||||
return ((K *)k)->compute_hash();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
#include <absl/base/attributes.h>
|
||||
#include "utp_utils.h"
|
||||
|
||||
#ifdef WIN32
|
||||
|
@ -286,20 +287,20 @@ utp_default_get_udp_overhead(utp_callback_arguments *args)
|
|||
}
|
||||
|
||||
uint64
|
||||
utp_default_get_random(__attribute__((unused)) utp_callback_arguments *args)
|
||||
utp_default_get_random(ABSL_ATTRIBUTE_UNUSED utp_callback_arguments *args)
|
||||
{
|
||||
return rand();
|
||||
}
|
||||
|
||||
uint64
|
||||
utp_default_get_milliseconds(__attribute__((unused))
|
||||
utp_default_get_milliseconds(ABSL_ATTRIBUTE_UNUSED
|
||||
utp_callback_arguments *args)
|
||||
{
|
||||
return UTP_GetMilliseconds();
|
||||
}
|
||||
|
||||
uint64
|
||||
utp_default_get_microseconds(__attribute__((unused))
|
||||
utp_default_get_microseconds(ABSL_ATTRIBUTE_UNUSED
|
||||
utp_callback_arguments *args)
|
||||
{
|
||||
return UTP_GetMicroseconds();
|
||||
|
|
|
@ -46,12 +46,12 @@ set(LIB_UTIL_SRC
|
|||
|
||||
add_library(${UTIL_LIB} STATIC ${LIB_UTIL_SRC})
|
||||
target_include_directories(${UTIL_LIB} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC absl::synchronization)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC absl::synchronization absl::hash)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC nlohmann_json::nlohmann_json)
|
||||
|
||||
# cut back on fluff
|
||||
if (NOT WIN32)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC absl::optional absl::variant absl::strings absl::hash cppbackport)
|
||||
target_link_libraries(${UTIL_LIB} PUBLIC absl::optional absl::variant absl::strings cppbackport)
|
||||
endif(NOT WIN32)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
@ -239,7 +239,7 @@ endif()
|
|||
|
||||
add_library(${STATIC_LIB} STATIC ${LIB_SRC})
|
||||
set(LIBS ${LIBS} libutp)
|
||||
target_link_libraries(${STATIC_LIB} PUBLIC ${ABYSS_LIB} ${PLATFORM_LIB} ${UTIL_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS})
|
||||
target_link_libraries(${STATIC_LIB} PUBLIC cxxopts ${ABYSS_LIB} ${PLATFORM_LIB} ${UTIL_LIB} ${CRYPTOGRAPHY_LIB} ${LIBS})
|
||||
|
||||
if(WITH_SHARED)
|
||||
add_library(${SHARED_LIB} SHARED ${LIB_SRC})
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
#include <util/scheduler.hpp>
|
||||
|
||||
#include <absl/strings/str_split.h>
|
||||
#include <getopt.h>
|
||||
#include <cxxopts.hpp>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/param.h> // for MIN
|
||||
|
||||
#if(__FreeBSD__) || (__OpenBSD__) || (__NetBSD__)
|
||||
#include <pthread_np.h>
|
||||
#endif
|
||||
|
@ -645,50 +643,40 @@ extern "C"
|
|||
const char *
|
||||
handleBaseCmdLineArgs(int argc, char *argv[])
|
||||
{
|
||||
const char *conffname = "daemon.ini";
|
||||
int c;
|
||||
while(1)
|
||||
|
||||
// clang-format off
|
||||
cxxopts::Options options(
|
||||
"lokinet",
|
||||
"Lokinet is a private, decentralized and IP based overlay network for the internet"
|
||||
);
|
||||
options.add_options()
|
||||
("c,config", "Config file", cxxopts::value< std::string >()->default_value("daemon.ini"))
|
||||
("o,logLevel", "logging level");
|
||||
// clang-format on
|
||||
|
||||
auto result = options.parse(argc, argv);
|
||||
std::string logLevel = result["logLevel"].as< std::string >();
|
||||
|
||||
if(logLevel == "debug")
|
||||
{
|
||||
static struct option long_options[] = {
|
||||
{"config", required_argument, 0, 'c'},
|
||||
{"logLevel", required_argument, 0, 'o'},
|
||||
{0, 0, 0, 0}};
|
||||
int option_index = 0;
|
||||
c = getopt_long(argc, argv, "c:o:", long_options, &option_index);
|
||||
if(c == -1)
|
||||
break;
|
||||
switch(c)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 'c':
|
||||
conffname = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
if(strncmp(optarg, "debug", std::min(strlen(optarg), size_t(5))) == 0)
|
||||
{
|
||||
cSetLogLevel(eLogDebug);
|
||||
}
|
||||
else if(strncmp(optarg, "info", std::min(strlen(optarg), size_t(4)))
|
||||
== 0)
|
||||
{
|
||||
cSetLogLevel(eLogInfo);
|
||||
}
|
||||
else if(strncmp(optarg, "warn", std::min(strlen(optarg), size_t(4)))
|
||||
== 0)
|
||||
{
|
||||
cSetLogLevel(eLogWarn);
|
||||
}
|
||||
else if(strncmp(optarg, "error", std::min(strlen(optarg), size_t(5)))
|
||||
== 0)
|
||||
{
|
||||
cSetLogLevel(eLogError);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cSetLogLevel(eLogDebug);
|
||||
}
|
||||
return conffname;
|
||||
else if(logLevel == "info")
|
||||
{
|
||||
cSetLogLevel(eLogInfo);
|
||||
}
|
||||
else if(logLevel == "warn")
|
||||
{
|
||||
cSetLogLevel(eLogWarn);
|
||||
}
|
||||
else if(logLevel == "error")
|
||||
{
|
||||
cSetLogLevel(eLogError);
|
||||
}
|
||||
|
||||
// this isn't thread safe, but reconfiguring during run is likely unsafe either way
|
||||
static std::string confname = result["config"].as< std::string >();
|
||||
|
||||
return confname.c_str();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@ dns_iptracker_init()
|
|||
|
||||
// not sure we want tunGatewayIP... we'll know when we get further
|
||||
bool
|
||||
dns_iptracker_setup_dotLokiLookup(dotLokiLookup *dll,
|
||||
__attribute__((unused))
|
||||
dns_iptracker_setup_dotLokiLookup(dotLokiLookup *dll, ABSL_ATTRIBUTE_UNUSED
|
||||
llarp::huint32_t tunGatewayIp)
|
||||
{
|
||||
dll->ip_tracker = &g_dns_iptracker;
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
#include <netdb.h> /* getaddrinfo, getnameinfo */
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h> /* close */
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> /* exit */
|
||||
#include <string.h> /* memset */
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h> /* close */
|
||||
|
||||
#include <algorithm> // for std::find_if
|
||||
#include <stdio.h> // sprintf
|
||||
|
@ -814,7 +814,7 @@ llarp_dnsc_init(struct dnsc_context *const dnsc, llarp::Logic *const logic,
|
|||
}
|
||||
|
||||
bool
|
||||
llarp_dnsc_stop(__attribute__((unused)) struct dnsc_context *const dnsc)
|
||||
llarp_dnsc_stop(ABSL_ATTRIBUTE_UNUSED struct dnsc_context *const dnsc)
|
||||
{
|
||||
// delete(sockaddr_in *)dnsc->server; // deallocation
|
||||
return true;
|
||||
|
|
|
@ -9,9 +9,14 @@
|
|||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <wspiapi.h>
|
||||
#ifndef ssize_t
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <BaseTsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
#else
|
||||
#define ssize_t long
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
// writev
|
||||
#ifndef _WIN32
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <future>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <win32/win32_up.h>
|
||||
|
|
|
@ -35,6 +35,12 @@ win32_tun_io::queue_write(const byte_t* buf, size_t sz)
|
|||
bool
|
||||
win32_tun_io::setup()
|
||||
{
|
||||
// Create a critical section to synchronise access to the TUN handler.
|
||||
// This *probably* has the effect of making packets move in order now
|
||||
// as only one IOCP thread will have access to the TUN handler at a
|
||||
// time
|
||||
InitializeCriticalSection(&HandlerMtx);
|
||||
|
||||
if(tuntap_start(tunif, TUNTAP_MODE_TUNNEL, 0) == -1)
|
||||
{
|
||||
llarp::LogWarn("failed to start interface");
|
||||
|
@ -59,12 +65,6 @@ win32_tun_io::setup()
|
|||
if(tunif->tun_fd == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
// Create a critical section to synchronise access to the TUN handler.
|
||||
// This *probably* has the effect of making packets move in order now
|
||||
// as only one IOCP thread will have access to the TUN handler at a
|
||||
// time
|
||||
InitializeCriticalSection(&HandlerMtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include <ev/pipe.hpp>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
llarp_ev_pkt_pipe::llarp_ev_pkt_pipe(llarp_ev_loop_ptr loop)
|
||||
|
|
|
@ -38,14 +38,14 @@ namespace llarp
|
|||
}
|
||||
|
||||
bool
|
||||
DecodeKey(__attribute__((unused)) const llarp_buffer_t& key,
|
||||
__attribute__((unused)) llarp_buffer_t* buf) override
|
||||
DecodeKey(ABSL_ATTRIBUTE_UNUSED const llarp_buffer_t& key,
|
||||
ABSL_ATTRIBUTE_UNUSED llarp_buffer_t* buf) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
HandleMessage(__attribute__((unused)) AbstractRouter* router) const override
|
||||
HandleMessage(ABSL_ATTRIBUTE_UNUSED AbstractRouter* router) const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <util/logger.hpp>
|
||||
#include <util/metrics.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
struct InboundMessageParser::msg_holder_t
|
||||
|
@ -21,18 +23,21 @@ namespace llarp
|
|||
DHTImmediateMessage m;
|
||||
LR_CommitMessage c;
|
||||
DiscardMessage x;
|
||||
|
||||
msg_holder_t() = default;
|
||||
};
|
||||
|
||||
InboundMessageParser::InboundMessageParser(AbstractRouter* _router)
|
||||
: router(_router)
|
||||
, from(nullptr)
|
||||
, msg(nullptr)
|
||||
, holder(std::make_unique< msg_holder_t >())
|
||||
, holder(new msg_holder_t())
|
||||
{
|
||||
}
|
||||
|
||||
InboundMessageParser::~InboundMessageParser()
|
||||
{
|
||||
delete holder;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace llarp
|
|||
ILinkMessage* msg;
|
||||
|
||||
struct msg_holder_t;
|
||||
std::unique_ptr< msg_holder_t > holder;
|
||||
msg_holder_t *holder;
|
||||
};
|
||||
} // namespace llarp
|
||||
#endif
|
||||
|
|
|
@ -240,7 +240,7 @@ namespace llarp
|
|||
|
||||
for(const std::string &val : toSend)
|
||||
{
|
||||
ssize_t sentLen = 0;
|
||||
int sentLen = 0;
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace llarp
|
|||
}
|
||||
|
||||
static void
|
||||
checksumDstIPv4TCP(byte_t *pld, __attribute__((unused)) size_t psz,
|
||||
checksumDstIPv4TCP(byte_t *pld, ABSL_ATTRIBUTE_UNUSED size_t psz,
|
||||
size_t fragoff, size_t chksumoff, nuint32_t oSrcIP,
|
||||
nuint32_t oDstIP, nuint32_t nSrcIP, nuint32_t nDstIP)
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ namespace llarp
|
|||
}
|
||||
|
||||
static void
|
||||
checksumDstIPv4UDP(byte_t *pld, __attribute__((unused)) size_t psz,
|
||||
checksumDstIPv4UDP(byte_t *pld, ABSL_ATTRIBUTE_UNUSED size_t psz,
|
||||
size_t fragoff, nuint32_t oSrcIP, nuint32_t oDstIP,
|
||||
nuint32_t nSrcIP, nuint32_t nDstIP)
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ namespace llarp
|
|||
}
|
||||
|
||||
static void
|
||||
checksumSrcIPv4TCP(byte_t *pld, __attribute__((unused)) size_t psz,
|
||||
checksumSrcIPv4TCP(byte_t *pld, ABSL_ATTRIBUTE_UNUSED size_t psz,
|
||||
size_t fragoff, size_t chksumoff, nuint32_t oSrcIP,
|
||||
nuint32_t oDstIP)
|
||||
{
|
||||
|
@ -206,7 +206,7 @@ namespace llarp
|
|||
}
|
||||
|
||||
static void
|
||||
checksumSrcIPv4UDP(byte_t *pld, __attribute__((unused)) size_t psz,
|
||||
checksumSrcIPv4UDP(byte_t *pld, ABSL_ATTRIBUTE_UNUSED size_t psz,
|
||||
size_t fragoff, nuint32_t oSrcIP, nuint32_t oDstIP)
|
||||
{
|
||||
if(fragoff > 6)
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
|
||||
#include <set>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <BaseTsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* nodedb.hpp
|
||||
*
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <util/threading.hpp>
|
||||
#include <util/time.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace llarp
|
|||
}
|
||||
|
||||
bool
|
||||
PoW::DecodeKey(__attribute__((unused)) const llarp_buffer_t& k,
|
||||
__attribute__((unused)) llarp_buffer_t* val)
|
||||
PoW::DecodeKey(ABSL_ATTRIBUTE_UNUSED const llarp_buffer_t& k,
|
||||
ABSL_ATTRIBUTE_UNUSED llarp_buffer_t* val)
|
||||
{
|
||||
// TODO: implement me
|
||||
return false;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace llarp
|
|||
NetID::BEncode(llarp_buffer_t *buf) const
|
||||
{
|
||||
auto term = std::find(begin(), end(), '\0');
|
||||
return bencode_write_bytestring(buf, begin(), std::distance(begin(), term));
|
||||
return bencode_write_bytestring(buf, data(), std::distance(begin(), term));
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -20,7 +20,7 @@ bool
|
|||
llarp_buffer_t::writef(const char* fmt, ...)
|
||||
{
|
||||
int written;
|
||||
ssize_t sz = size_left();
|
||||
size_t sz = size_left();
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
written = vsnprintf(reinterpret_cast< char* >(cur), sz, fmt, args);
|
||||
|
|
|
@ -128,12 +128,14 @@ struct llarp_buffer_t
|
|||
#ifndef _WIN32
|
||||
bool
|
||||
writef(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
;
|
||||
#else
|
||||
|
||||
#elif defined(__MINGW64__) || defined(__MINGW32__)
|
||||
bool
|
||||
writef(const char *fmt, ...)
|
||||
__attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 3)));
|
||||
;
|
||||
#else
|
||||
bool
|
||||
writef(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
bool
|
||||
|
|
|
@ -16,7 +16,9 @@ namespace fs = std::experimental::filesystem;
|
|||
namespace fs = cpp17::filesystem;
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
@ -26,6 +28,15 @@ namespace llarp
|
|||
using PathIter = std::function< void(const fs::path &, PathVisitor) >;
|
||||
|
||||
static PathIter IterDir = [](const fs::path &path, PathVisitor visit) {
|
||||
#ifdef _MSC_VER
|
||||
for(auto &p : fs::directory_iterator(path))
|
||||
{
|
||||
if(!visit(p.path()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
DIR *d = opendir(path.string().c_str());
|
||||
if(d == nullptr)
|
||||
return;
|
||||
|
@ -42,6 +53,7 @@ namespace llarp
|
|||
break;
|
||||
} while(ent);
|
||||
closedir(d);
|
||||
#endif
|
||||
};
|
||||
} // namespace util
|
||||
} // namespace llarp
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef LLARP_UTIL_LOGGER_INTERNAL_HPP
|
||||
#define LLARP_UTIL_LOGGER_INTERNAL_HPP
|
||||
|
||||
#include <absl/time/clock.h>
|
||||
#include <absl/time/time.h>
|
||||
#include <util/time.hpp>
|
||||
#include <sstream>
|
||||
#include <ctime>
|
||||
|
@ -55,8 +57,7 @@ namespace llarp
|
|||
(void)ts;
|
||||
return out << time_now_ms();
|
||||
#else
|
||||
auto now = llarp::Clock_t::to_time_t(llarp::Clock_t::now());
|
||||
return out << std::put_time(std::localtime(&now), ts.format);
|
||||
return out << absl::FormatTime(ts.format, absl::Now(), absl::LocalTimeZone());
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include <util/mem.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <absl/base/attributes.h>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
void
|
||||
|
@ -17,9 +19,9 @@ namespace llarp
|
|||
} // namespace llarp
|
||||
|
||||
void
|
||||
llarp_mem_slab(__attribute__((unused)) struct llarp_alloc *mem,
|
||||
__attribute__((unused)) uint32_t *buf,
|
||||
__attribute__((unused)) size_t sz)
|
||||
llarp_mem_slab(ABSL_ATTRIBUTE_UNUSED struct llarp_alloc *mem,
|
||||
ABSL_ATTRIBUTE_UNUSED uint32_t *buf,
|
||||
ABSL_ATTRIBUTE_UNUSED size_t sz)
|
||||
{
|
||||
// not implemented
|
||||
abort();
|
||||
|
|
|
@ -93,15 +93,4 @@ namespace llarp
|
|||
|
||||
} // namespace llarp
|
||||
|
||||
#if __cplusplus < 201402L
|
||||
namespace std
|
||||
{
|
||||
template < typename T, typename... Args >
|
||||
std::unique_ptr< T >
|
||||
make_unique(Args &&... args)
|
||||
{
|
||||
return std::unique_ptr< T >(new T(std::forward< Args >(args)...));
|
||||
}
|
||||
} // namespace std
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace llarp
|
|||
/// a lock that does nothing
|
||||
struct SCOPED_LOCKABLE NullLock
|
||||
{
|
||||
NullLock(__attribute__((unused)) const NullMutex* mtx)
|
||||
NullLock(ABSL_ATTRIBUTE_UNUSED const NullMutex* mtx)
|
||||
EXCLUSIVE_LOCK_FUNCTION(mtx)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ upoll_wait_select(upoll_t* upq, upoll_event_t* evs, int nev, int timeout)
|
|||
if(nev > FD_SETSIZE)
|
||||
nev = FD_SETSIZE;
|
||||
|
||||
unote_t* nvec[nev];
|
||||
unote_t** nvec = calloc(nev, sizeof(unote_t *));
|
||||
int i, maxfd = 0, e = 0, nfds = 0;
|
||||
|
||||
fd_set pollin, pollout, pollerr;
|
||||
|
@ -240,6 +240,7 @@ upoll_wait_select(upoll_t* upq, upoll_event_t* evs, int nev, int timeout)
|
|||
if(rc == SOCKET_ERROR)
|
||||
{
|
||||
assert(WSAGetLastError() == WSAENOTSOCK);
|
||||
free(nvec);
|
||||
return -WSAGetLastError();
|
||||
}
|
||||
|
||||
|
@ -269,6 +270,7 @@ upoll_wait_select(upoll_t* upq, upoll_event_t* evs, int nev, int timeout)
|
|||
++e;
|
||||
}
|
||||
}
|
||||
free(nvec);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,5 +67,5 @@ if(NOT WIN32)
|
|||
target_link_libraries(${TEST_EXE} PUBLIC absl::variant)
|
||||
else()
|
||||
target_sources(${TEST_EXE} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/win32/test.rc")
|
||||
target_link_libraries(${TEST_EXE} PUBLIC ws2_32 iphlpapi)
|
||||
target_link_libraries(${TEST_EXE} PUBLIC ws2_32 iphlpapi shlwapi)
|
||||
endif(NOT WIN32)
|
||||
|
|
|
@ -31,7 +31,7 @@ struct AbyssTestBase : public ::testing::Test
|
|||
}
|
||||
|
||||
static void
|
||||
CancelIt(void* u, __attribute__((unused)) uint64_t orig, uint64_t left)
|
||||
CancelIt(void* u, ABSL_ATTRIBUTE_UNUSED uint64_t orig, uint64_t left)
|
||||
{
|
||||
if(left)
|
||||
return;
|
||||
|
@ -104,12 +104,12 @@ struct ClientHandler : public abyss::http::IRPCClientHandler
|
|||
}
|
||||
|
||||
void
|
||||
PopulateReqHeaders(__attribute__((unused)) abyss::http::Headers_t& hdr)
|
||||
PopulateReqHeaders(ABSL_ATTRIBUTE_UNUSED abyss::http::Headers_t& hdr)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
HandleResponse(__attribute__((unused)) abyss::http::RPC_Response response)
|
||||
HandleResponse(ABSL_ATTRIBUTE_UNUSED abyss::http::RPC_Response response)
|
||||
{
|
||||
test->AsyncStop();
|
||||
return true;
|
||||
|
@ -125,7 +125,7 @@ struct ServerHandler : public abyss::httpd::IRPCHandler
|
|||
}
|
||||
|
||||
absl::optional< Response >
|
||||
HandleJSONRPC(Method_t method, __attribute__((unused)) const Params& params)
|
||||
HandleJSONRPC(Method_t method, ABSL_ATTRIBUTE_UNUSED const Params& params)
|
||||
{
|
||||
test->AssertMethod(method);
|
||||
test->called = true;
|
||||
|
|
|
@ -69,11 +69,11 @@ endif()
|
|||
list(APPEND ABSL_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# -std=X
|
||||
if (WIN32)
|
||||
if (WIN32 AND NOT MSVC_VERSION)
|
||||
set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS} -fno-ident")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS}")
|
||||
endif(WIN32)
|
||||
endif(WIN32 AND NOT MSVC_VERSION)
|
||||
|
||||
# -fexceptions
|
||||
set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#ifdef _WIN32
|
||||
#include <shlwapi.h>
|
||||
#include <windows.h>
|
||||
|
||||
#pragma comment(lib, "shlwapi.lib")
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
|
|
|
@ -181,9 +181,9 @@ absl_cc_library(
|
|||
NAME
|
||||
leak_check
|
||||
HDRS
|
||||
"$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:leak_check.h>"
|
||||
"leak_check.h"
|
||||
SRCS
|
||||
"$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:leak_check.cc>"
|
||||
"leak_check.cc"
|
||||
COPTS
|
||||
${ABSL_DEFAULT_COPTS}
|
||||
DEPS
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
*.swp
|
||||
build*
|
||||
CMakeCache.txt
|
||||
Makefile
|
||||
CMakeFiles/
|
||||
Testing/
|
||||
CTestTestfile.cmake
|
||||
cmake_install.cmake
|
|
@ -0,0 +1,70 @@
|
|||
sudo: required
|
||||
dist: trusty
|
||||
language: cpp
|
||||
os:
|
||||
- linux
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
env: COMPILER=g++-4.9
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
sources: &sources
|
||||
- llvm-toolchain-trusty-3.8
|
||||
- llvm-toolchain-trusty-5.0
|
||||
- ubuntu-toolchain-r-test
|
||||
- os: linux
|
||||
env: COMPILER=g++-4.9 UNICODE_OPTIONS=-DCXXOPTS_USE_UNICODE_HELP=Yes
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
sources: *sources
|
||||
- os: linux
|
||||
env: COMPILER=g++-5
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources: *sources
|
||||
- os: linux
|
||||
env: COMPILER=g++-5 UNICODE_OPTIONS=-DCXXOPTS_USE_UNICODE_HELP=Yes
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources: *sources
|
||||
- os: linux
|
||||
env: COMPILER=clang++-3.8 CXXFLAGS=-stdlib=libc++
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
- libc++-dev
|
||||
sources: *sources
|
||||
- os: linux
|
||||
env: COMPILER=clang++-3.8 CXXFLAGS=-stdlib=libc++ UNICODE_OPTIONS=-DCXXOPTS_USE_UNICODE_HELP=Yes
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
- libc++-dev
|
||||
sources: *sources
|
||||
- os: linux
|
||||
env: COMPILER=clang++-5.0 CMAKE_OPTIONS=-DCXXOPTS_CXX_STANDARD=17
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-5.0
|
||||
- g++-5
|
||||
sources: *sources
|
||||
script: >
|
||||
cmake -DCXXOPTS_BUILD_TESTS=ON -DCMAKE_CXX_COMPILER=$COMPILER
|
||||
-DCMAKE_CXX_FLAGS=$CXXFLAGS $UNICODE_OPTIONS $CMAKE_OPTIONS .
|
||||
&& make && make ARGS=--output-on-failure test
|
||||
|
||||
before_install:
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
|
||||