mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-18 01:57:13 +00:00
39 lines
2.0 KiB
Makefile
39 lines
2.0 KiB
Makefile
|
|
CMAKE=cmake.exe
|
|
COMPOSER_PHAR=C:\ProgramData\ComposerSetup\bin\composer.phar
|
|
PHP_BINARY=$(PHP_PREFIX)\php.exe
|
|
|
|
CMAKE_CONFIGURE = $(CMAKE) -DCMAKE_INSTALL_PREFIX=$(AWSCRT_DIR)\build\install -DCMAKE_PREFIX_PATH=$(AWSCRT_DIR)\build\install -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
|
|
CMAKE_BUILD = $(CMAKE) --build
|
|
CMAKE_BUILD_TYPE = Release
|
|
CMAKE_TARGET = --config $(CMAKE_BUILD_TYPE) --target install
|
|
|
|
# configure for static aws-crt-ffi.lib
|
|
$(AWSCRT_DIR)\build\CMakeCache.txt:
|
|
$(CMAKE_CONFIGURE) -H$(AWSCRT_DIR)\crt\aws-crt-ffi -B$(AWSCRT_DIR)\build -DBUILD_SHARED_LIBS=OFF
|
|
|
|
# build static libaws-crt-ffi.lib
|
|
$(AWSCRT_DIR)\build\libaws-crt-ffi.lib: $(AWSCRT_DIR)\build\CMakeCache.txt
|
|
$(CMAKE_BUILD) $(AWSCRT_DIR)\build $(CMAKE_TARGET)
|
|
|
|
# Force the awscrt extension DLL target to depend on the extension src
|
|
$(BUILD_DIR)\php_awscrt.dll: $(AWSCRT_DIR)\ext\awscrt.c
|
|
|
|
$(AWSCRT_DIR)\ext\awscrt.c: $(AWSCRT_DIR)\build\libaws-crt-ffi.lib $(AWSCRT_DIR)\ext\api.h $(AWSCRT_DIR)\ext\awscrt_arginfo.h
|
|
|
|
# transform\install api.h from FFI lib
|
|
$(AWSCRT_DIR)\src\api.h: $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h
|
|
php $(AWSCRT_DIR)\gen_api.php $(AWSCRT_DIR)\crt\aws-crt-ffi\src\api.h > $(AWSCRT_DIR)\src\api.h
|
|
|
|
# install api.h to ext/ as well
|
|
$(AWSCRT_DIR)\ext\api.h : $(AWSCRT_DIR)\src\api.h
|
|
copy $(AWSCRT_DIR)\src\api.h $(AWSCRT_DIR)\ext\api.h
|
|
$(PHP_BINARY) -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
|
$(PHP_BINARY) -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
|
$(PHP_BINARY) composer-setup.php
|
|
$(PHP_BINARY) -r "unlink('composer-setup.php');"
|
|
# Use PHPUnit to run tests
|
|
test-awscrt: install $(AWSCRT_DIR)\src\api.h $(BUILD_DIR)\php_awscrt.dll
|
|
$(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini composer.phar --working-dir=$(AWSCRT_DIR) update
|
|
$(PHP_BINARY) -c $(AWSCRT_DIR)\php-win.ini composer.phar --working-dir=$(AWSCRT_DIR) run test-win
|