-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ffi support for windows x64 (#357)
* add ffi support for windows x64 * add ffi test
- Loading branch information
1 parent
2547647
commit 842e0ad
Showing
6 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SPC\builder\windows\library; | ||
|
||
use SPC\builder\windows\SystemUtil; | ||
use SPC\exception\RuntimeException; | ||
use SPC\store\FileSystem; | ||
|
||
class libffi_win extends WindowsLibraryBase | ||
{ | ||
public const NAME = 'libffi-win'; | ||
|
||
protected function build() | ||
{ | ||
$vs_ver_dir = match (SystemUtil::findVisualStudio()['version']) { | ||
'vs17' => '/win32/vs17_x64', | ||
'vs16' => '/win32/vs16_x64', | ||
default => throw new RuntimeException('Current VS version is not supported yet!'), | ||
}; | ||
|
||
// start build | ||
cmd()->cd($this->source_dir . $vs_ver_dir) | ||
->execWithWrapper( | ||
$this->builder->makeSimpleWrapper('msbuild'), | ||
'libffi-msvc.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64' | ||
); | ||
FileSystem::createDir(BUILD_LIB_PATH); | ||
FileSystem::createDir(BUILD_INCLUDE_PATH); | ||
copy($this->source_dir . $vs_ver_dir . '\x64\Release\libffi.lib', BUILD_LIB_PATH . '\libffi.lib'); | ||
copy($this->source_dir . $vs_ver_dir . '\x64\Release\libffi.pdb', BUILD_LIB_PATH . '\libffi.pdb'); | ||
copy($this->source_dir . '\include\ffi.h', BUILD_INCLUDE_PATH . '\ffi.h'); | ||
|
||
FileSystem::replaceFileStr(BUILD_INCLUDE_PATH . '\ffi.h', '#define LIBFFI_H', "#define LIBFFI_H\n#define FFI_BUILDING"); | ||
copy($this->source_dir . '\src\x86\ffitarget.h', BUILD_INCLUDE_PATH . '\ffitarget.h'); | ||
copy($this->source_dir . '\fficonfig.h', BUILD_INCLUDE_PATH . '\fficonfig.h'); | ||
|
||
// copy($this->source_dir . '\msvc_build\out\static-Release\X64\libffi.lib', BUILD_LIB_PATH . '\libffi.lib'); | ||
// copy($this->source_dir . '\msvc_build\include\ffi.h', BUILD_INCLUDE_PATH . '\ffi.h'); | ||
// copy($this->source_dir . '\msvc_build\include\fficonfig.h', BUILD_INCLUDE_PATH . '\fficonfig.h'); | ||
// copy($this->source_dir . '\src\x86\ffitarget.h', BUILD_INCLUDE_PATH . '\ffitarget.h'); | ||
|
||
// FileSystem::replaceFileStr(BUILD_INCLUDE_PATH . '\ffi.h', '..\..\src\x86\ffitarget.h', 'ffitarget.h'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters