Skip to content

Commit

Permalink
Add libffi build
Browse files Browse the repository at this point in the history
  • Loading branch information
zeha committed Feb 16, 2024
1 parent 4b76f88 commit c264f42
Show file tree
Hide file tree
Showing 4 changed files with 865 additions and 0 deletions.
100 changes: 100 additions & 0 deletions MagPython/LibFFI.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{36DFC1C0-EB3A-48D0-8E5B-A09387F102E2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>LibFFI</RootNamespace>
<ProjectName>LibFFI</ProjectName>
</PropertyGroup>
<Import Project="common.props" />
<PropertyGroup>
<TopDir>$(MSBuildProjectDirectory)\..\</TopDir>
<IntDir>$(MSBuildProjectDirectory)\$(Configuration)-Int\</IntDir>
<OutDir>$(MSBuildProjectDirectory)\$(Configuration)\</OutDir>
<SourceDir>$(TopDir)\libffi\</SourceDir>
<LibFFITarget>X86_WIN32</LibFFITarget>
<LibFFISourceDir>$(SourceDir)\src</LibFFISourceDir>
<LibFFITargetSourceDir>$(SourceDir)\src\x86</LibFFITargetSourceDir>
<LibFFITargetPregeneratedIncludeDir>$(SourceDir)\msvc_build\x86_win32\include</LibFFITargetPregeneratedIncludeDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WIN32;X86;$(LibFFITarget);_M_IX86;FFI_BUILDING_DLL;USE_DL_PREFIX;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SourceDir)\include;$(LibFFITargetSourceDir);$(LibFFITargetPregeneratedIncludeDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OmitFramePointers>true</OmitFramePointers>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<AdditionalUsingDirectories>$(LibFFISourceDir);$(LibFFITargetSourceDir);$(LibFFITargetPregeneratedIncludeDir);%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="$(LibFFITargetPregeneratedIncludeDir)\ffi.h" />
<ClInclude Include="$(LibFFITargetPregeneratedIncludeDir)\fficonfig.h" />
<ClInclude Include="$(SourceDir)\include\ffi_cfi.h" />
<ClInclude Include="$(SourceDir)\include\ffi_common.h" />
<ClInclude Include="$(LibFFITargetSourceDir)\asmnames.h" />
<ClInclude Include="$(LibFFITargetSourceDir)\ffitarget.h" />
<ClInclude Include="$(LibFFITargetSourceDir)\internal.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(LibFFISourceDir)\closures.c" />
<ClCompile Include="$(LibFFISourceDir)\dlmalloc.c" />
<ClCompile Include="$(LibFFISourceDir)\prep_cif.c" />
<ClCompile Include="$(LibFFISourceDir)\types.c" />
<ClInclude Include="$(LibFFITargetSourceDir)\ffi.c" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="$(LibFFITargetSourceDir)\sysv_intel.S">
<Command>
cl /FA /EP /nologo /I"$(SourceDir)\include" /I"$(LibFFITargetPregeneratedIncludeDir)" /I"$(LibFFITargetSourceDir)" "%(FullPath)" &gt; $(IntDir)asm.i
masm $(IntDir)asm.i /I"src\" /I"$(SourceDir)\include" /I"$(LibFFITargetPregeneratedIncludeDir)" /I"$(LibFFITargetSourceDir)" -o "$(IntDir)asm.obj"
</Command>
<Outputs>asm.obj;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
7 changes: 7 additions & 0 deletions MagPython/MagPython.metaproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
<Import Project="common.props"/>

<ItemGroup>
<ProjectLibFFI Include="$(SolutionDir)\LibFFI.vcxproj" />
<ProjectOpenSSL Include="$(SolutionDir)\openssl.vcxproj" />
<ProjectFreezeMagPython Include="$(SolutionDir)\FreezeMagPython.vcxproj" />
<ProjectMagPython Include="$(SolutionDir)\MagPython.vcxproj" />
<ProjectTest Include="$(SolutionDir)\test.vcxproj" />
</ItemGroup>

<Target Name="Build" Outputs="@(CollectedBuildOutput)">
<MSBuild
BuildInParallel="True" StopOnFirstFailure="True"
Properties="SolutionDir=$(SolutionDir);Configuration=$(Configuration);Platform=$(Platform)"
Projects="@(ProjectLibFFI)">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
</MSBuild>
<MSBuild
BuildInParallel="True" StopOnFirstFailure="True"
Properties="SolutionDir=$(SolutionDir);Configuration=$(Configuration);Platform=$(Platform)"
Expand Down
Loading

0 comments on commit c264f42

Please sign in to comment.