mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Add appveyor build for native windows tests.
It doesn't compile, yet. A few changes (like VLA support) need to be made before we can enable appveyor as a required PR check.
This commit is contained in:
parent
b630121f2f
commit
ce0bf232d1
159
CMakeLists.txt
159
CMakeLists.txt
|
@ -1,4 +1,5 @@
|
|||
cmake_minimum_required(VERSION 2.8.6)
|
||||
cmake_policy(VERSION 2.8.6)
|
||||
project(toxcore)
|
||||
include(CTest)
|
||||
|
||||
|
@ -41,7 +42,6 @@ include(ApiDsl)
|
|||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(MacRpath)
|
||||
include(ModulePackage)
|
||||
|
||||
set(CMAKE_MACOSX_RPATH ON)
|
||||
|
||||
|
@ -76,77 +76,79 @@ macro(add_flag flag)
|
|||
add_cxxflag(${flag})
|
||||
endmacro()
|
||||
|
||||
# Set standard version for compiler.
|
||||
add_cflag("-std=c99")
|
||||
add_cxxflag("-std=c++11")
|
||||
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
# Set standard version for compiler.
|
||||
add_cflag("-std=c99")
|
||||
add_cxxflag("-std=c++11")
|
||||
|
||||
# Warn on non-ISO C.
|
||||
add_cflag("-pedantic")
|
||||
# Warn on non-ISO C.
|
||||
add_cflag("-pedantic")
|
||||
|
||||
option(WARNINGS "Enable additional compiler warnings" ON)
|
||||
if(WARNINGS)
|
||||
# Add all warning flags we can.
|
||||
add_flag("-Wall")
|
||||
add_flag("-Wextra")
|
||||
add_flag("-Weverything")
|
||||
option(WARNINGS "Enable additional compiler warnings" ON)
|
||||
if(WARNINGS)
|
||||
# Add all warning flags we can.
|
||||
add_flag("-Wall")
|
||||
add_flag("-Wextra")
|
||||
add_flag("-Weverything")
|
||||
|
||||
# Disable specific warning flags for both C and C++.
|
||||
add_flag("-Wno-cast-align")
|
||||
add_flag("-Wno-conversion")
|
||||
add_flag("-Wno-covered-switch-default")
|
||||
add_flag("-Wno-documentation-deprecated-sync")
|
||||
add_flag("-Wno-format-nonliteral")
|
||||
add_flag("-Wno-missing-field-initializers")
|
||||
add_flag("-Wno-missing-prototypes")
|
||||
add_flag("-Wno-padded")
|
||||
add_flag("-Wno-parentheses")
|
||||
add_flag("-Wno-return-type")
|
||||
add_flag("-Wno-sign-compare")
|
||||
add_flag("-Wno-sign-conversion")
|
||||
add_flag("-Wno-tautological-constant-out-of-range-compare")
|
||||
add_flag("-Wno-type-limits")
|
||||
add_flag("-Wno-undef")
|
||||
add_flag("-Wno-unreachable-code")
|
||||
add_flag("-Wno-unused-macros")
|
||||
add_flag("-Wno-unused-parameter")
|
||||
add_flag("-Wno-vla")
|
||||
# Disable specific warning flags for both C and C++.
|
||||
add_flag("-Wno-cast-align")
|
||||
add_flag("-Wno-conversion")
|
||||
add_flag("-Wno-covered-switch-default")
|
||||
add_flag("-Wno-documentation-deprecated-sync")
|
||||
add_flag("-Wno-format-nonliteral")
|
||||
add_flag("-Wno-missing-field-initializers")
|
||||
add_flag("-Wno-missing-prototypes")
|
||||
add_flag("-Wno-padded")
|
||||
add_flag("-Wno-parentheses")
|
||||
add_flag("-Wno-return-type")
|
||||
add_flag("-Wno-sign-compare")
|
||||
add_flag("-Wno-sign-conversion")
|
||||
add_flag("-Wno-tautological-constant-out-of-range-compare")
|
||||
add_flag("-Wno-type-limits")
|
||||
add_flag("-Wno-undef")
|
||||
add_flag("-Wno-unreachable-code")
|
||||
add_flag("-Wno-unused-macros")
|
||||
add_flag("-Wno-unused-parameter")
|
||||
add_flag("-Wno-vla")
|
||||
|
||||
# Disable specific warning flags for C.
|
||||
add_cflag("-Wno-assign-enum")
|
||||
add_cflag("-Wno-bad-function-cast")
|
||||
add_cflag("-Wno-double-promotion")
|
||||
add_cflag("-Wno-gnu-zero-variadic-macro-arguments")
|
||||
add_cflag("-Wno-packed")
|
||||
add_cflag("-Wno-reserved-id-macro")
|
||||
add_cflag("-Wno-shadow")
|
||||
add_cflag("-Wno-shorten-64-to-32")
|
||||
add_cflag("-Wno-unreachable-code-return")
|
||||
add_cflag("-Wno-unused-but-set-variable")
|
||||
add_cflag("-Wno-used-but-marked-unused")
|
||||
# Disable specific warning flags for C.
|
||||
add_cflag("-Wno-assign-enum")
|
||||
add_cflag("-Wno-bad-function-cast")
|
||||
add_cflag("-Wno-double-promotion")
|
||||
add_cflag("-Wno-gnu-zero-variadic-macro-arguments")
|
||||
add_cflag("-Wno-packed")
|
||||
add_cflag("-Wno-reserved-id-macro")
|
||||
add_cflag("-Wno-shadow")
|
||||
add_cflag("-Wno-shorten-64-to-32")
|
||||
add_cflag("-Wno-unreachable-code-return")
|
||||
add_cflag("-Wno-unused-but-set-variable")
|
||||
add_cflag("-Wno-used-but-marked-unused")
|
||||
|
||||
# Disable specific warning flags for C++.
|
||||
add_cxxflag("-Wno-c++11-compat")
|
||||
add_cxxflag("-Wno-c++11-extensions")
|
||||
add_cxxflag("-Wno-c++11-narrowing")
|
||||
add_cxxflag("-Wno-c99-extensions")
|
||||
add_cxxflag("-Wno-narrowing")
|
||||
add_cxxflag("-Wno-old-style-cast")
|
||||
add_cxxflag("-Wno-variadic-macros")
|
||||
add_cxxflag("-Wno-vla-extension")
|
||||
endif()
|
||||
# Disable specific warning flags for C++.
|
||||
add_cxxflag("-Wno-c++11-compat")
|
||||
add_cxxflag("-Wno-c++11-extensions")
|
||||
add_cxxflag("-Wno-c++11-narrowing")
|
||||
add_cxxflag("-Wno-c99-extensions")
|
||||
add_cxxflag("-Wno-narrowing")
|
||||
add_cxxflag("-Wno-old-style-cast")
|
||||
add_cxxflag("-Wno-variadic-macros")
|
||||
add_cxxflag("-Wno-vla-extension")
|
||||
endif()
|
||||
|
||||
option(ERROR_ON_WARNING "Make compilation error on a warning" OFF)
|
||||
if(ERROR_ON_WARNING)
|
||||
# Set error-on-warn for C compilation. C++ compilation can't use this because
|
||||
# treating 'c' input as 'c++' when in C++ mode is deprecated in clang and
|
||||
# there is no way to turn off that warning.
|
||||
add_cflag("-Werror")
|
||||
endif()
|
||||
option(ERROR_ON_WARNING "Make compilation error on a warning" OFF)
|
||||
if(ERROR_ON_WARNING)
|
||||
# Set error-on-warn for C compilation. C++ compilation can't use this because
|
||||
# treating 'c' input as 'c++' when in C++ mode is deprecated in clang and
|
||||
# there is no way to turn off that warning.
|
||||
add_cflag("-Werror")
|
||||
endif()
|
||||
|
||||
option(DEBUG "Enable assertions and other debugging facilities" OFF)
|
||||
if(DEBUG)
|
||||
set(MIN_LOGGER_LEVEL DEBUG)
|
||||
add_cflag("-g3")
|
||||
option(DEBUG "Enable assertions and other debugging facilities" OFF)
|
||||
if(DEBUG)
|
||||
set(MIN_LOGGER_LEVEL DEBUG)
|
||||
add_cflag("-g3")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF)
|
||||
|
@ -166,32 +168,7 @@ if(ASAN)
|
|||
set(CMAKE_REQUIRED_LIBRARIES "${SAFE_CMAKE_REQUIRED_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
find_library(NCURSES_LIBRARIES ncurses )
|
||||
find_library(UTIL_LIBRARIES util )
|
||||
find_library(RT_LIBRARIES rt )
|
||||
|
||||
# For toxcore.
|
||||
pkg_use_module(LIBSODIUM REQUIRED libsodium )
|
||||
|
||||
# For toxav.
|
||||
pkg_use_module(OPUS opus )
|
||||
pkg_use_module(VPX vpx )
|
||||
|
||||
# For tox-bootstrapd.
|
||||
pkg_use_module(LIBCONFIG libconfig )
|
||||
|
||||
# For auto tests.
|
||||
pkg_use_module(CHECK check )
|
||||
|
||||
# For tox-spectest.
|
||||
pkg_use_module(MSGPACK msgpack )
|
||||
|
||||
# For av_test.
|
||||
pkg_use_module(OPENCV opencv )
|
||||
pkg_use_module(PORTAUDIO portaudio-2.0 )
|
||||
pkg_use_module(SNDFILE sndfile )
|
||||
include(Dependencies)
|
||||
|
||||
if(OPUS_FOUND AND VPX_FOUND)
|
||||
set(BUILD_TOXAV TRUE)
|
||||
|
|
13
appveyor.yml
Normal file
13
appveyor.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
install:
|
||||
- curl https://download.libsodium.org/libsodium/releases/libsodium-1.0.11-msvc.zip -o libsodium-1.0.11-msvc.zip
|
||||
- unzip libsodium-1.0.11-msvc.zip
|
||||
|
||||
before_build:
|
||||
- cmake . -DBOOTSTRAP_DAEMON=OFF
|
||||
|
||||
build:
|
||||
project: INSTALL.vcxproj
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
56
cmake/Dependencies.cmake
Normal file
56
cmake/Dependencies.cmake
Normal file
|
@ -0,0 +1,56 @@
|
|||
###############################################################################
|
||||
#
|
||||
# :: For UNIX-like systems that have pkg-config.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
include(ModulePackage)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
find_library(NCURSES_LIBRARIES ncurses )
|
||||
find_library(UTIL_LIBRARIES util )
|
||||
find_library(RT_LIBRARIES rt )
|
||||
|
||||
# For toxcore.
|
||||
pkg_use_module(LIBSODIUM libsodium )
|
||||
|
||||
# For toxav.
|
||||
pkg_use_module(OPUS opus )
|
||||
pkg_use_module(VPX vpx )
|
||||
|
||||
# For tox-bootstrapd.
|
||||
pkg_use_module(LIBCONFIG libconfig )
|
||||
|
||||
# For auto tests.
|
||||
pkg_use_module(CHECK check )
|
||||
|
||||
# For tox-spectest.
|
||||
pkg_use_module(MSGPACK msgpack )
|
||||
|
||||
# For av_test.
|
||||
pkg_use_module(OPENCV opencv )
|
||||
pkg_use_module(PORTAUDIO portaudio-2.0)
|
||||
pkg_use_module(SNDFILE sndfile )
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# :: For Windows and other systems lacking pkg-config.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
if(NOT LIBSODIUM_FOUND)
|
||||
include_directories(include)
|
||||
find_library(LIBSODIUM_LIBRARIES
|
||||
NAMES
|
||||
sodium
|
||||
libsodium
|
||||
PATHS
|
||||
Win32/Release/v140/static
|
||||
x64/Release/v140/static
|
||||
)
|
||||
if(LIBSODIUM_LIBRARIES)
|
||||
set(LIBSODIUM_FOUND TRUE)
|
||||
endif()
|
||||
message("libsodium: ${LIBSODIUM_LIBRARIES}")
|
||||
endif()
|
|
@ -10,7 +10,7 @@ if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC)
|
|||
set(ENABLE_SHARED ON)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(COMPILE_AS_CXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1")
|
||||
|
@ -34,8 +34,10 @@ function(add_c_executable exec)
|
|||
add_executable(${exec} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(pkg_use_module mod)
|
||||
pkg_search_module(${mod} ${ARGN})
|
||||
function(pkg_use_module mod pkg)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_search_module(${mod} ${pkg})
|
||||
endif()
|
||||
if(${mod}_FOUND)
|
||||
link_directories(${${mod}_LIBRARY_DIRS})
|
||||
include_directories(${${mod}_INCLUDE_DIRS})
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define GNU_EXTENSION __extension__
|
||||
#else
|
||||
#define GNU_EXTENSION
|
||||
#endif
|
||||
|
||||
#ifdef PLAN9
|
||||
#include <u.h> // Plan 9 requires this is imported first
|
||||
// Comment line here to avoid reordering by source code formatters.
|
||||
|
@ -163,7 +169,7 @@ IP6;
|
|||
|
||||
typedef struct {
|
||||
uint8_t family;
|
||||
__extension__ union {
|
||||
GNU_EXTENSION union {
|
||||
IP4 ip4;
|
||||
IP6 ip6;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user