Skip to content

Commit

Permalink
Fix macOS build
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed May 8, 2024
1 parent 08d11f6 commit 60f327c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,36 @@ jobs:
run: |
make clean >/dev/null
make testxx -j $(nproc) && ./testxx
macos:
strategy:
matrix:
target:
- macos-12
runs-on: ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- name: Set up dependencies
run: |
brew install gtk+ gtk+3 lilv make pkg-config
- name: Regular build
env:
CFLAGS: -Werror
CXXFLAGS: -Werror
run: |
make clean >/dev/null
make -j $(nproc)
- name: Run tests (C)
env:
CFLAGS: -Werror
CXXFLAGS: -Werror
run: |
make clean >/dev/null
make test -j $(nproc) && ./test
- name: Run tests (C++)
env:
CFLAGS: -Werror
CXXFLAGS: -Werror
run: |
make clean >/dev/null
make testxx -j $(nproc) && ./testxx
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CXXFLAGS += -mstackrealign
LDFLAGS += -static
SERVER_FLAGS = -shared -Wl,-no-undefined
else
CLIENT_FLAGS = $(shell pkg-config --cflags --libs x11) -ldl
CLIENT_FLAGS = -ldl
SERVER_FLAGS = -fPIC -shared -Wl,-no-undefined
SHM_LIBS = -lrt
endif
Expand All @@ -50,10 +50,10 @@ lv2-gtk-ui-bridge.lv2/lv2-gtk-ui-bridge.so: src/ui-server.c src/ipc/*.h
$(CC) $< $(CFLAGS) $(LDFLAGS) $(LV2_FLAGS) $(SERVER_FLAGS) $(SHM_LIBS) -o $@

lv2-gtk-ui-bridge.lv2/lv2-gtk2-ui-bridge$(APP_EXT): src/ui-client.c src/ipc/*.h
$(CC) $< $(CFLAGS) $(LDFLAGS) $(LV2_FLAGS) $(shell pkg-config --cflags --libs gtk+-2.0 lilv-0) -DUI_GTK2 $(CLIENT_FLAGS) $(SHM_LIBS) -Wno-deprecated-declarations -o $@
$(CC) $< $(CFLAGS) $(LDFLAGS) $(LV2_FLAGS) $(shell pkg-config --cflags --libs gtk+-2.0 lilv-0 x11) -DUI_GTK2 $(CLIENT_FLAGS) $(SHM_LIBS) -Wno-deprecated-declarations -o $@

lv2-gtk-ui-bridge.lv2/lv2-gtk3-ui-bridge$(APP_EXT): src/ui-client.c src/ipc/*.h
$(CC) $< $(CFLAGS) $(LDFLAGS) $(LV2_FLAGS) $(shell pkg-config --cflags --libs gtk+-3.0 lilv-0) -DUI_GTK3 $(CLIENT_FLAGS) $(SHM_LIBS) -Wno-deprecated-declarations -o $@
$(CC) $< $(CFLAGS) $(LDFLAGS) $(LV2_FLAGS) $(shell pkg-config --cflags --libs gtk+-3.0 lilv-0 x11) -DUI_GTK3 $(CLIENT_FLAGS) $(SHM_LIBS) -Wno-deprecated-declarations -o $@

# ---------------------------------------------------------------------------------------------------------------------

Expand Down
13 changes: 9 additions & 4 deletions src/ui-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,11 @@ int main(int argc, char* argv[])
const long long winId = wid != NULL ? atoll(wid) : 0;

// create plug window
GtkWidget* const window = winId != 0
? gtk_plug_new(winId)
: gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget* const window =
#ifndef __APPLE__
winId != 0 ? gtk_plug_new(winId) :
#endif
gtk_window_new(GTK_WINDOW_TOPLEVEL);

if (window == NULL)
{
Expand Down Expand Up @@ -416,6 +418,7 @@ int main(int argc, char* argv[])
// handle any pending events before showing window
lv2ui_idle(&bridge);

#ifndef __APPLE__
if (winId != 0)
{
gtk_widget_show_all(window);
Expand All @@ -440,7 +443,9 @@ int main(int argc, char* argv[])
ipc_client_commit(bridge.ipc);
}
}
else if (shm == NULL)
else
#endif
if (shm == NULL)
{
g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show_all(window);
Expand Down

0 comments on commit 60f327c

Please sign in to comment.