Skip to content

Commit

Permalink
Fix compilation on macos (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickel8 authored Feb 13, 2024
1 parent c8944be commit 5407209
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ jobs:
- run: sudo apt install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavdevice-dev
- run: mix deps.get
- run: mix test

test-macos:
runs-on: macos-latest
name: test-macos-x86-64 OTP latest / Elixir latest
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v2
- run: brew install ffmpeg elixir
- run: mix deps.get
- run: mix test
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ HEADERS = $(XAV_DIR)/reader.h $(XAV_DIR)/decoder.h $(XAV_DIR)/utils.h
SOURCES = $(XAV_DIR)/xav_nif.c $(XAV_DIR)/reader.c $(XAV_DIR)/decoder.c $(XAV_DIR)/utils.c

ifeq ($(USE_BUNDLED_FFMPEG), true)
CFLAGS = -fPIC -I$(ERTS_INCLUDE_DIR) -I${FFMPEG_INCLUDE_DIR} -I${XAV_DIR} -shared $(XAV_DEBUG_LOGS)
LDFLAGS = -L$(FFMPEG_LIB_DIR) -Wl,--whole-archive -lavcodec -lswscale -lavutil -lavformat -Wl,--no-whole-archive
CFLAGS = -fPIC -I$(ERTS_INCLUDE_DIR) -I${FFMPEG_INCLUDE_DIR} -I${XAV_DIR} -shared $(XAV_DEBUG_LOGS)
LDFLAGS = -L$(FFMPEG_LIB_DIR) -Wl,--whole-archive -lavcodec -lswscale -lavutil -lavformat -Wl,--no-whole-archive
else
CFLAGS = -fPIC -I$(ERTS_INCLUDE_DIR) -I${XAV_DIR} -shared $(XAV_DEBUG_LOGS)
LDFLAGS = -lavcodec -lswscale -lavutil -lavformat -lavdevice -lswresample
CFLAGS = -fPIC -I$(ERTS_INCLUDE_DIR) -I${XAV_DIR} -shared $(XAV_DEBUG_LOGS)
LDFLAGS = -lavcodec -lswscale -lavutil -lavformat -lavdevice -lswresample
endif

ifeq ($(shell uname -s),Darwin)
CFLAGS += -undefined dynamic_lookup
endif

$(XAV_SO): Makefile $(SOURCES) $(HEADERS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Make sure you have installed FFMpeg development packages on your system
```elixir
def deps do
[
{:xav, "~> 0.2.0"}
{:xav, "~> 0.2.1"}
]
end
```
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Xav.MixProject do
def project do
[
app: :xav,
version: "0.2.0",
version: "0.2.1",
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
description: "Elixir media library built on top of FFmpeg",
Expand Down

0 comments on commit 5407209

Please sign in to comment.