From 3f9b08afc2ff5346852680ea92e2f69ea84911bf Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Wed, 5 Oct 2022 13:34:58 -0600 Subject: [PATCH 1/2] compat: add windows compat interface Signed-off-by: Eduardo Silva --- include/ctraces/ctr_compat.h | 35 +++++++++++++++++++++++++++++++++++ include/ctraces/ctr_random.h | 2 ++ include/ctraces/ctraces.h | 5 +++++ 3 files changed, 42 insertions(+) create mode 100644 include/ctraces/ctr_compat.h diff --git a/include/ctraces/ctr_compat.h b/include/ctraces/ctr_compat.h new file mode 100644 index 0000000..60c10f3 --- /dev/null +++ b/include/ctraces/ctr_compat.h @@ -0,0 +1,35 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* CTraces + * ======= + * Copyright 2022 Eduardo Silva + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CTR_COMPAT_H +#define CTR_COMPAT_H + +#ifdef _WIN32 + +#ifndef ssize_t +typedef SSIZE_T ssize_t; +#endif + + +#else +#include + +#endif /* !_WIN32 */ + +#endif /* !CTR_COMPAT_H */ diff --git a/include/ctraces/ctr_random.h b/include/ctraces/ctr_random.h index b349e70..bb34166 100644 --- a/include/ctraces/ctr_random.h +++ b/include/ctraces/ctr_random.h @@ -20,6 +20,8 @@ #ifndef CTR_RANDOM_H #define CTR_RANDOM_H +#include + ssize_t ctr_random_get(void *buf, size_t len); #endif diff --git a/include/ctraces/ctraces.h b/include/ctraces/ctraces.h index 40b4ce6..7302d2b 100644 --- a/include/ctraces/ctraces.h +++ b/include/ctraces/ctraces.h @@ -23,6 +23,9 @@ #define CTR_FALSE 0 #define CTR_TRUE !CTR_FALSE +#include +#include + /* local libs */ #include #include @@ -35,6 +38,8 @@ /* options is unused for now */ struct ctrace_opts { + /* windows compiler: error C2016: C requires that a struct or union have at least one member */ + int _make_windows_happy; }; struct ctrace { From 5622f22a1c2b59edc1b6fd017edd35dc4085fc6f Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Wed, 5 Oct 2022 13:40:32 -0600 Subject: [PATCH 2/2] ci: enable windows build Signed-off-by: Eduardo Silva --- appveyor.yml | 26 ++++++++++++++++++++++++++ scripts/win_build.bat | 1 + 2 files changed, 27 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..5e244a6 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,26 @@ +version: v1-winbuild-{build} + +image: Visual Studio 2019 + +platform: + - Win32 + - x64 + +environment: + vspath: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community' + +configuration: + - Release + +skip_commits: + message: /workflows/ + files: + - '.github/**' + +before_build: + - if %PLATFORM%==Win32 call "%vspath%\VC\Auxiliary\Build\vcvars32.bat" + - if %PLATFORM%==x64 call "%vspatH%\VC\Auxiliary\Build\vcvars64.bat" + +build_script: + - .\scripts\win_build.bat + - ctest -C Debug --test-dir .\tests\ diff --git a/scripts/win_build.bat b/scripts/win_build.bat index 4562330..3de4baa 100755 --- a/scripts/win_build.bat +++ b/scripts/win_build.bat @@ -1,6 +1,7 @@ setlocal call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" path "C:\Program Files (x86)\MSBuild\16.0\Bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin";%path% +git submodule update --init --recursive cd build cmake -G "NMake Makefiles" -DCTR_TESTS=On ..\ cmake --build .