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:
iphydf 2017-01-20 17:42:30 +00:00
parent b630121f2f
commit ce0bf232d1
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
5 changed files with 149 additions and 95 deletions

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.8.6) cmake_minimum_required(VERSION 2.8.6)
cmake_policy(VERSION 2.8.6)
project(toxcore) project(toxcore)
include(CTest) include(CTest)
@ -41,7 +42,6 @@ include(ApiDsl)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
include(MacRpath) include(MacRpath)
include(ModulePackage)
set(CMAKE_MACOSX_RPATH ON) set(CMAKE_MACOSX_RPATH ON)
@ -76,6 +76,7 @@ macro(add_flag flag)
add_cxxflag(${flag}) add_cxxflag(${flag})
endmacro() endmacro()
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Set standard version for compiler. # Set standard version for compiler.
add_cflag("-std=c99") add_cflag("-std=c99")
add_cxxflag("-std=c++11") add_cxxflag("-std=c++11")
@ -148,6 +149,7 @@ if(DEBUG)
set(MIN_LOGGER_LEVEL DEBUG) set(MIN_LOGGER_LEVEL DEBUG)
add_cflag("-g3") add_cflag("-g3")
endif() endif()
endif()
option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF) option(TRACE "Enable TRACE level logging (expensive, for network debugging)" OFF)
if(TRACE) if(TRACE)
@ -166,32 +168,7 @@ if(ASAN)
set(CMAKE_REQUIRED_LIBRARIES "${SAFE_CMAKE_REQUIRED_LIBRARIES}") set(CMAKE_REQUIRED_LIBRARIES "${SAFE_CMAKE_REQUIRED_LIBRARIES}")
endif() endif()
find_package(Threads REQUIRED) include(Dependencies)
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 )
if(OPUS_FOUND AND VPX_FOUND) if(OPUS_FOUND AND VPX_FOUND)
set(BUILD_TOXAV TRUE) set(BUILD_TOXAV TRUE)

13
appveyor.yml Normal file
View 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
View 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()

View File

@ -10,7 +10,7 @@ if(NOT ENABLE_SHARED AND NOT ENABLE_STATIC)
set(ENABLE_SHARED ON) set(ENABLE_SHARED ON)
endif() endif()
find_package(PkgConfig REQUIRED) find_package(PkgConfig)
if(COMPILE_AS_CXX) if(COMPILE_AS_CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1") 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}) add_executable(${exec} ${ARGN})
endfunction() endfunction()
function(pkg_use_module mod) function(pkg_use_module mod pkg)
pkg_search_module(${mod} ${ARGN}) if(PKG_CONFIG_FOUND)
pkg_search_module(${mod} ${pkg})
endif()
if(${mod}_FOUND) if(${mod}_FOUND)
link_directories(${${mod}_LIBRARY_DIRS}) link_directories(${${mod}_LIBRARY_DIRS})
include_directories(${${mod}_INCLUDE_DIRS}) include_directories(${${mod}_INCLUDE_DIRS})

View File

@ -24,6 +24,12 @@
#ifndef NETWORK_H #ifndef NETWORK_H
#define NETWORK_H #define NETWORK_H
#if defined(__GNUC__)
#define GNU_EXTENSION __extension__
#else
#define GNU_EXTENSION
#endif
#ifdef PLAN9 #ifdef PLAN9
#include <u.h> // Plan 9 requires this is imported first #include <u.h> // Plan 9 requires this is imported first
// Comment line here to avoid reordering by source code formatters. // Comment line here to avoid reordering by source code formatters.
@ -163,7 +169,7 @@ IP6;
typedef struct { typedef struct {
uint8_t family; uint8_t family;
__extension__ union { GNU_EXTENSION union {
IP4 ip4; IP4 ip4;
IP6 ip6; IP6 ip6;
}; };