Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
on:
- push

jobs:
build-linux:
name: Use clang and gcc via "Unix Makefiles"
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [clang, gcc]
steps:
- uses: actions/checkout@v4
- run: |
cmake -Bbuild -DCMAKE_C_COMPILER=${{ matrix.compiler }}
cmake --build build

build-windows-ninja:
name: Use clang and clang-cl via Ninja
runs-on: windows-latest
strategy:
matrix:
# On Windows, clang only enables the WIN32 flag in CMake whereas
# clang-cl also enables MSVC, because it has a cl.exe-like interface.
compiler: [clang, clang-cl]
steps:
- uses: actions/checkout@v4
- run: |
# Use Ninja because the MSBuild toolchain can only configure
# alternative compilers via "toolsets", where only ClangCL is
# supported.
cmake -Bbuild -GNinja -DCMAKE_C_COMPILER=${{ matrix.compiler }}
cmake --build build

build-windows-msbuild:
name: Use MSVC and clang-cl via MSBuild
runs-on: windows-latest
strategy:
matrix:
toolset:
# The default toolset should be the latest 'v143' when nothing is specified
-
- -TClangCL
steps:
- uses: actions/checkout@v4
- run: |
cmake -Bbuild ${{ matrix.toolset }}
cmake --build build
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ target_include_directories(${PROJECT_NAME}
$<INSTALL_INTERFACE:include>)

target_link_libraries(${PROJECT_NAME}
PUBLIC $<$<NOT:$<C_COMPILER_ID:MSVC>>:m>)
PUBLIC $<$<NOT:$<BOOL:${WIN32}>>:m>)

set_target_properties(${PROJECT_NAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ ifneq ($(shared), not-set)
endif

define run-config
mkdir -p $(BUILDDIR)
cd $(BUILDDIR) && cmake $(CURDIR) $(CONFIG_FLAGS)
cmake $(CURDIR) -B"$(BUILDDIR)" $(CONFIG_FLAGS)
endef

all clean install: $(BUILDDIR)
make -C $(BUILDDIR) $@
cmake --build $(BUILDDIR) $@

uninstall:
xargs rm < $(BUILDDIR)/install_manifest.txt
Expand Down
51 changes: 0 additions & 51 deletions cmake/GKlibSystem.cmake
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting this file because it's no longer being included since b8b8bdc#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aL9.

Maybe that's an error though...

Copy link
Author

@MarijnS95 MarijnS95 Jul 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my own testing, when adding #45 on top things now fail with ssize_t being missing: https://github.com/MarijnS95/GKlib/actions/runs/16099153358/job/45425988032

I assume because the compiler only defines _WIN32, whereas this now-unused GKlibSystem.cmake file used to set WIN32. But only for if(MSVC) of course, so cl.exe + clang-cl get it but clang would have missed out too.

EDIT: Same for the missing strerror_r, which is in the #else for #if defined(WIN32).

This file was deleted.

2 changes: 1 addition & 1 deletion include/gk_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
/*************************************************************************
* Architecture-specific modifications
**************************************************************************/
#ifdef WIN32
#ifdef _WIN32
typedef ptrdiff_t ssize_t;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void gk_NonLocalExit_Handler(int signum)
/**************************************************************************/
char *gk_strerror(int errnum)
{
#if defined(WIN32) || defined(__MINGW32__)
#if defined(_WIN32) || defined(__MINGW32__)
return strerror(errnum);
#else
#ifndef SUNOS
Expand Down
2 changes: 1 addition & 1 deletion src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ char *gk_time2str(time_t time)



#if !defined(WIN32) && !defined(__MINGW32__)
#if !defined(_WIN32) && !defined(__MINGW32__)
/************************************************************************/
/*! \brief Converts a date/time string into its equivalent time_t value

Expand Down
2 changes: 1 addition & 1 deletion src/timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ double gk_CPUSeconds(void)
#ifdef __OPENMPXXXX__
return omp_get_wtime();
#else
#if defined(WIN32) || defined(__MINGW32__)
#if defined(_WIN32) || defined(__MINGW32__)
return((double) clock()/CLOCKS_PER_SEC);
#else
struct rusage r;
Expand Down