Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use pkg-config to find Wasmer libs #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Install Wasmer
run: |
curl https://get.wasmer.io -sSfL | sh
source /home/runner/.wasmer/wasmer.sh
sudo mkdir -p /usr/local/lib/pkgconfig
wasmer config --pkg-config | sudo tee /usr/local/lib/pkgconfig/wasmer.pc
- name: Checkout code
uses: actions/checkout@v2
- name: Configure
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install Wasmer
run: |
curl https://get.wasmer.io -sSfL | sh
source /home/runner/.wasmer/wasmer.sh
sudo mkdir -p /usr/local/lib/pkgconfig
wasmer config --pkg-config | sudo tee /usr/local/lib/pkgconfig/wasmer.pc
- name: Checkout code
uses: actions/checkout@v2
- name: Configure
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@ execute_process (
)
string(REGEX REPLACE "\n$" "" PHP_SOURCE "${PHP_SOURCE}")

message("Using source directory: ${PHP_SOURCE}")
execute_process (
COMMAND wasmer config --includedir
OUTPUT_VARIABLE WASMER_SOURCE
)
string(REGEX REPLACE "\n$" "" WASMER_SOURCE "${WASMER_SOURCE}")

message("Using PHP include directory: ${PHP_SOURCE}")
message("Using Wasmer include directory: ${WASMER_SOURCE}")

include_directories(${PHP_SOURCE})
include_directories(${PHP_SOURCE}/main)
include_directories(${PHP_SOURCE}/Zend)
include_directories(${PHP_SOURCE}/TSRM)
include_directories(${WASMER_SOURCE})
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_SOURCE_DIR}/include)

Expand Down
10 changes: 6 additions & 4 deletions config.m4
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
dnl config.m4 for extension Wasmer

PHP_ARG_ENABLE(wasmer, whether to enable Wasmer support,
AS_HELP_STRING(--enable-wasmer, Enable Wasmer support))
PHP_ARG_WITH(wasmer, for Wasmer support,
AS_HELP_STRING(--with-wasmer, Include Wasmer support))

if test "$PHP_WASMER" != "no"; then
AC_DEFINE(HAVE_WASMER, 1, [ Have Wasmer support ])
PKG_CHECK_MODULES([LIBWASMER], [wasmer >= 1.0.2])
PKG_CHECK_MODULES([LIBWASMER], [wasmer < 2.0.0])
PHP_EVAL_INCLINE($LIBWASMER_CFLAGS)
PHP_EVAL_LIBLINE($LIBWASMER_LIBS, WASMER_SHARED_LIBADD)

PHP_SUBST(WASMER_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(wasmer, ./lib, WASMER_SHARED_LIBADD)

WASMER_API="src/api/config.c src/api/engine.c src/api/store.c src/api/wasmer.c src/api/wat.c"
WASMER_API_OBJECTS="src/api/objects/extern.c src/api/objects/foreign.c src/api/objects/func.c src/api/objects/frame.c src/api/objects/global.c src/api/objects/instance.c src/api/objects/memory.c src/api/objects/module.c src/api/objects/table.c src/api/objects/trap.c src/api/objects/val.c"
Expand Down
Loading