Skip to content

Commit

Permalink
Add CI/CD building script using MinGW64
Browse files Browse the repository at this point in the history
  • Loading branch information
gkv311 committed Sep 22, 2024
1 parent 1d6f3b7 commit f1da74f
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 5 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build_wglinfo_mingw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will build wglinfo on Windows
name: Build (MinGW64)

on: [push]

jobs:
build-windows-mingw:
name: Build on Windows with GCC
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0

- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ucrt64
update: true
install: >-
git
make
pacboy: >-
toolchain:p
cmake:p
ninja:p
- name: Configure wglinfo
run: |
mkdir "build"
cmake -G Ninja -D BUILD_TREAT_WARNINGS_AS_ERRORS=ON -S . -B "./build"
- name: Build wglinfo
run: |
cmake --build "./build" --config Release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wglinfo-mingw
path: build
4 changes: 3 additions & 1 deletion .github/workflows/build_wglinfo_msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0

- name: Set up MSVC
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ set (CMAKE_CXX_STANDARD 11)
if (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise /EHa /MP")
string (REGEX REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DUNICODE)
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -fPIC")
if (WIN32)
set (CMAKE_EXE_LINKER_FLAGS "-Wl,-static-libstdc++ ${CMAKE_EXE_LINKER_FLAGS}")
endif()
endif()
if (WIN32)
add_definitions(-DUNICODE)
endif()

set (BUILD_TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "Treat compilation warnings as errors")
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ wglinfo - command line tool for printing OpenGL information on Windows platform
[![Downloads](https://img.shields.io/github/downloads/gkv311/wglinfo/total.svg)](https://github.com/gkv311/wglinfo/releases)
[![License: GPL v3](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/gkv311/wglinfo/blob/master/LICENSE.txt)
[![Status](https://github.com/gkv311/wglinfo/actions/workflows/build_wglinfo_msvc.yml/badge.svg?branch=master)](https://github.com/gkv311/wglinfo/actions?query=branch%3Amaster)
[![Status](https://github.com/gkv311/wglinfo/actions/workflows/build_wglinfo_mingw.yml/badge.svg?branch=master)](https://github.com/gkv311/wglinfo/actions?query=branch%3Amaster)

wglinfo is a small utility printing information about OpenGL library available in Windows system in similar way as glxinfo does on Linux.
In case, if libEGL.dll (e.g. Angle or another implementation) is in PATH, it also prints information about EGL/GLES.
Expand Down
12 changes: 9 additions & 3 deletions wglinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

#include <GL/gl.h>

#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
#if (__GNUC__ > 8) || ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 1))
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#endif

//! Window creation tool.
struct GlWindow
{
Expand Down Expand Up @@ -1184,7 +1190,7 @@ class EglInfoWindow

};

int actual_main (int theNbArgs, char** theArgVec)
static int actual_main (int theNbArgs, const char** theArgVec)
{
bool isVerbose = false, toPrintVisuals = true, toShowEgl = true;
for (int anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
Expand All @@ -1211,7 +1217,7 @@ int actual_main (int theNbArgs, char** theArgVec)
else
{
std::cerr << "Syntax error! Unknown argument '" << theArgVec[anArgIter] << "'\n\n";
char* anArgs[2] = { theArgVec[0], "-h" };
const char* anArgs[2] = { theArgVec[0], "-h" };
actual_main (2, anArgs);
return 1;
}
Expand Down Expand Up @@ -1252,7 +1258,7 @@ int actual_main (int theNbArgs, char** theArgVec)
return 0;
}

int main(int argc, char** argv)
int main(int argc, const char** argv)
{
return actual_main(argc, argv);
}

0 comments on commit f1da74f

Please sign in to comment.