Skip to content

Commit

Permalink
Add MinGW to CI (#1802)
Browse files Browse the repository at this point in the history
  • Loading branch information
pawel-soja committed Dec 30, 2022
1 parent 3078819 commit 6cf617e
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 17 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Package
name: Debian Packages

on:
workflow_dispatch:
Expand Down Expand Up @@ -27,6 +27,6 @@ jobs:
with:
path: 'indi'

- name: Build INDI Core Package
- name: Build INDI Core Packages
run: |
indi/scripts/indi-core-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
branches:
- 'master'


jobs:
build:
runs-on: ubuntu-latest
Expand Down
File renamed without changes.
60 changes: 60 additions & 0 deletions .github/workflows/windows-mingw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: MinGW

on:
workflow_dispatch:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Debug

permissions:
contents: read

jobs:
build:
runs-on: windows-latest

strategy:
matrix:
include:
- { sys: mingw64, env: x86_64 }
# - { sys: mingw32, env: i686 }

defaults:
run:
shell: msys2 {0}

steps:
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
install: >-
mingw-w64-${{matrix.env}}-openssl
base-devel
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-libnova
zlib-devel
- name: Get INDI Sources
uses: actions/checkout@v3

- name: Build INDI Core
run: |
mkdir build
cd build
cmake .. -DINDI_BUILD_SERVER=OFF -DINDI_BUILD_DRIVERS=OFF
cmake --build .
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows
name: Visual Studio

on:
workflow_dispatch:
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# INDI Core Library
[![Linux](https://github.com/indilib/indi/actions/workflows/default.yml/badge.svg)](https://github.com/indilib/indi/actions)
[![Linux Deb Package](https://github.com/indilib/indi/actions/workflows/package.yml/badge.svg)](https://github.com/indilib/indi/actions)

[![Linux](https://github.com/indilib/indi/actions/workflows/linux.yml/badge.svg)](https://github.com/indilib/indi/actions)
[![Debian Packages](https://github.com/indilib/indi/actions/workflows/linux-packages.yml/badge.svg)](https://github.com/indilib/indi/actions)
[![MacOS](https://github.com/indilib/indi/actions/workflows/macos.yml/badge.svg)](https://github.com/indilib/indi/actions)
[![PyIndi](https://github.com/indilib/indi/actions/workflows/pyindi.yml/badge.svg)](https://github.com/indilib/indi/actions)
[![Windows Client](https://github.com/indilib/indi/actions/workflows/windows.yml/badge.svg)](https://github.com/indilib/indi/actions)
[![Visual Studio](https://github.com/indilib/indi/actions/workflows/windows-visual.yml/badge.svg)](https://github.com/indilib/indi/actions)
[![MinGW](https://github.com/indilib/indi/actions/workflows/windows-mingw.yml/badge.svg)](https://github.com/indilib/indi/actions)
[![PyIndi](https://github.com/indilib/indi/actions/workflows/linux-pyindi.yml/badge.svg)](https://github.com/indilib/indi/actions)

INDI is a standard for astronomical instrumentation control. INDI Library is an Open Source POSIX implementation of the
[Instrument-Neutral-Device-Interface protocol](http://www.clearskyinstitute.com/INDI/INDI.pdf).
Expand Down
2 changes: 1 addition & 1 deletion libs/indicore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ list(APPEND ${PROJECT_NAME}_SOURCES
indiuserio.c
)

if(NOT WIN32)
if(UNIX)
list(APPEND ${PROJECT_NAME}_PRIVATE_HEADERS
sharedblob_parse.h
shm_open_anon.h)
Expand Down
24 changes: 22 additions & 2 deletions libs/indidevice/indiutility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,31 @@
#include "indiutility.h"
#include <cerrno>

#ifdef _MSC_VER

#include <direct.h>

#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
#endif

#define mkdir _mkdir

#endif

namespace INDI
{

#ifndef _WINDOWS
int mkdir(const char *path, mode_t mode)
{
#ifdef _WIN32
INDI_UNUSED(mode);
return ::mkdir(path);
#else
return ::mkdir(path, mode);
#endif
}

int mkpath(std::string s, mode_t mode)
{
size_t pre = 0, pos;
Expand Down Expand Up @@ -61,7 +82,6 @@ int mkpath(std::string s, mode_t mode)
}
return mdret;
}
#endif

std::string format_time(const std::tm &tm, const char *format)
{
Expand Down
13 changes: 10 additions & 3 deletions libs/indidevice/indiutility.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,23 @@ inline static size_t indi_strlcpy(char * dst, const char * src, size_t maxlen)

// C++
#ifdef __cplusplus

#ifdef _WINDOWS
typedef unsigned int mode_t;
#endif

namespace INDI
{
/**
* @brief Create directory.
*/
int mkdir(const char *path, mode_t mode);

/**
* @brief Create a path directory - this function uses 'mkdir'
* @note Not available on Windows. Need to use C++17 cross-platform std::filesystem later.
*/
#ifndef _WINDOWS
int mkpath(std::string path, mode_t mode);
#endif

/**
* @brief Converts the date and time to string - this function uses 'strftime'
*/
Expand Down
7 changes: 4 additions & 3 deletions libs/sockets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ list(APPEND ${PROJECT_NAME}_SOURCES
tcpsocket.cpp
)

if(WIN32)
if(UNIX)
list(APPEND ${PROJECT_NAME}_SOURCES
tcpsocket_win.cpp
tcpsocket_unix.cpp
)
else()
list(APPEND ${PROJECT_NAME}_SOURCES
tcpsocket_unix.cpp
tcpsocket_win.cpp
)
target_link_libraries(${PROJECT_NAME} -lws2_32)
endif()

# Setup Target
Expand Down
2 changes: 2 additions & 0 deletions libs/sockets/tcpsocket_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include "tcpsocket.h"
#include "tcpsocket_p.h"

#ifdef _MSC_VER
#pragma comment(lib, "Ws2_32.lib")
#endif

bool TcpSocketPrivate::createSocket(int domain)
{
Expand Down

0 comments on commit 6cf617e

Please sign in to comment.