Skip to content
Merged
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
46 changes: 46 additions & 0 deletions .github/workflows/exe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build exe and so

on:
workflow_call:
inputs:
upload-artifact:
type: boolean
required: false
default: true

jobs:
build_exe:
name: Build the executable file and shared library for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:

- name: Install X11 dependencies (macOS)
if: runner.os == 'macOS'
run: brew install libxpm # libx11

- name: install X11 dependencies (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt install -y libx11-dev libxpm-dev x11proto-dev

- uses: actions/checkout@v6
with:
persist-credentials: false

- run: make v v.so

- name: Upload wheels
if: ${{ inputs.upload-artifact }}
uses: actions/upload-artifact@v6
with:
path: |
./v
./v.so
name: v.${{ matrix.os }}.exe
if-no-files-found: error
2 changes: 2 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ on:
jobs:
wheels:
uses: ./.github/workflows/wheels.yml
exe:
uses: ./.github/workflows/exe.yml
32 changes: 1 addition & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,8 @@ jobs:
################################################################################################################################

build_exe:
name: Build the executable file and shared library for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
uses: ./.github/workflows/exe.yml

steps:

- name: Install X11 dependencies (macOS)
if: runner.os == 'macOS'
run: brew install libx11 libxpm pkg-config

- name: install X11 dependencies
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt install -y libx11-dev libxpm-dev x11proto-dev

- uses: actions/checkout@v6
with:
persist-credentials: false

- run: make v v.so

- uses: actions/upload-artifact@v6
with:
path: |
./v
./v.so
name: v.${{ matrix.os }}.exe
if-no-files-found: error

################################################################################################################################

Expand Down
13 changes: 11 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,24 @@ export VERSION_FLAGS=-DGIT_HASH="\"$(shell git rev-parse HEAD 2> /dev/null || ec
-DBUILD_USER="\"$(USER)@$(HOSTNAME)\""\
-DBUILD_DIRECTORY="\"$(PWD)\""

OS := $(shell uname)
ifeq ($(OS),Darwin)
SONAME := install_name,@rpath/
else
SONAME := soname,
endif

X11DIR= $(shell pkg-config --libs-only-L x11 xpm) # for macOS
CFLAGS= -c -std=gnu11 $(OPT) $(GPROF) $(W) $(GDB)
OFLAGS= -lm $(GPROF) -lX11 -lXpm
OFLAGS= -lm $(GPROF) -lX11 -lXpm $(X11DIR)

SRCDIR=src
OBJDIR=obj
PICDIR=obj-pic

SRCDIRS=$(shell find $(SRCDIR) -type d)
INCL=$(SRCDIRS:%=-I./%)
INCL+=$(shell pkg-config --cflags-only-I x11 xpm) # for macOS

allsrc=$(shell find $(SRCDIR) -type f -name '*.c')
allobj=$(allsrc:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
Expand All @@ -64,7 +73,7 @@ v : $(allobj)
$(CC) $^ -o $@ $(OFLAGS)

v.so: $(allpic)
$(CC) $^ -shared -Wl,-soname,$@ $(OFLAGS) -o $@
$(CC) $^ -shared -Wl,-$(SONAME)$@ $(OFLAGS) -o $@

$(OBJDIR)/%.o : $(SRCDIR)/%.c
$(CC) $(CFLAGS) $< -o $@ $(INCL) $(VERSION_FLAGS) -MMD -MT "$@ $(patsubst $(OBJDIR)%,$(PICDIR)%,$@)"
Expand Down
Loading