Skip to content
Closed
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
50 changes: 50 additions & 0 deletions .github/workflows/build-mingw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build MinGW

on:
push:
pull_request:

jobs:

build-mingw:

runs-on: windows-latest

defaults:
run:
shell: msys2 {0}

steps:

- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc
make

- name: Git Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build
run: |
ABC_USE_STDINT_H=1 make -j$(nproc) CFLAGS="-DWIN32 -DWIN32_NO_DLL" abc

- name: Test Executable
run: |
./abc.exe -c "r i10.aig; b; ps; b; rw -l; rw -lz; b; rw -lz; b; ps; cec"

- name: Stage Executable
run: |
mkdir -p staging
cp abc.exe staging/

- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: package-mingw
path: staging/
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ $(call abc_info,$(MSG_PREFIX)Using AR=$(AR))
$(call abc_info,$(MSG_PREFIX)Using LD=$(LD))

PROG := abc

OS := $(shell uname -s)
ifneq ($(filter MINGW%,$(OS)),)
OS := MINGW
endif

MODULES := \
$(wildcard src/ext*) \
Expand Down Expand Up @@ -151,10 +155,15 @@ ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD))
LIBS += -ldl
endif

ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD Darwin))
ifneq ($(OS), $(filter $(OS), FreeBSD OpenBSD NetBSD Darwin MINGW))
LIBS += -lrt
endif

# For PathMatchSpecA.
ifeq ($(OS), MINGW)
LIBS += -lshlwapi
endif

ifdef ABC_USE_LIBSTDCXX
LIBS += -lstdc++
$(call abc_info,$(MSG_PREFIX)Using explicit -lstdc++)
Expand All @@ -164,7 +173,7 @@ $(call abc_info,$(MSG_PREFIX)Using CFLAGS=$(CFLAGS))
CXXFLAGS += $(CFLAGS) -std=c++17 -fno-exceptions

SRC :=
GARBAGE := core core.* *.stackdump ./tags $(PROG) arch_flags
GARBAGE := core core.* *.stackdump ./tags $(PROG) arch_flags $(PROG).in

.PHONY: all default tags clean docs cmake_info

Expand Down Expand Up @@ -231,9 +240,17 @@ clean:
tags:
etags `find . -type f -regex '.*\.\(c\|h\)'`

ifeq ($(OS), MINGW)
$(PROG): $(OBJ)
@echo "$(MSG_PREFIX)\`\` Constructing Response File:" $(notdir @$@.in)
$(file >$@.in,$^ $(LDFLAGS) $(LIBS))
@echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@)
$(VERBOSE)$(LD) -o $@ @$@.in
else
$(PROG): $(OBJ)
@echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@)
$(VERBOSE)$(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
endif

lib$(PROG).a: $(LIBOBJ)
@echo "$(MSG_PREFIX)\`\` Linking:" $(notdir $@)
Expand Down