Skip to content

Static lib compilation for UWP #26

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

Closed
wants to merge 2 commits into from
Closed
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
110 changes: 110 additions & 0 deletions Release/src/build/vs14.uwp/cpprestsdk140.uwp.staticlib.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))\Build\version.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{47A5CFDC-C244-45A6-9830-38CB303CB495}</ProjectGuid>
<Keyword>StaticLibrary</Keyword>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>8.2</ApplicationTypeRevision>
<ProjectName>cpprestsdk140.uwp.staticlib</ProjectName>
<PlatformToolset>v140</PlatformToolset>
<ConfigurationType>StaticLibrary</ConfigurationType>
<OutDir>$(OutDir)\$(MsBuildProjectName)</OutDir>
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))\Build\Config.Definitions.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))\Build\Release.Product.Settings" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
<Import Project="..\common.vcxitems" Label="Shared" />
<Import Project="..\winrt.vcxitems" Label="Shared" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DebugFileSuffix>d</DebugFileSuffix>
</PropertyGroup>
<PropertyGroup>
<TargetName>$(CppRestBaseFileName)140$(DebugFileSuffix)_uwp_$(CppRestSDKVersionFileSuffix)</TargetName>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import lib for the shared library cpprest140d_uwp_2_7.dll already has this name. I would prefer using different names here to minimize chances of mistaking the library type (import/static).
How about following a specific naming convention for static libs, say add _static suffix (cpprest140d_uwp_static_2_7.lib) or prepend the name with lib (libcpprest140d_uwp_2_7.lib).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some one suggested we can look at doing something similar to boost, http://www.boost.org/doc/libs/1_42_0/more/getting_started/windows.html#library-naming

If you are building a static library, use the lib prefix.
If the library is linking statically to the C++ standard library and compiler runtime support libraries, use s in the .lib name.
In this case, we are not linking statically to the runtime. so we can go with libcpprest140d_uwp_2_7.lib.
In future, if someone wants to add another version to link to the runtime statically, we can add _s to the name.
What do you think.

</PropertyGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup>
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_NO_ASYNCRTIMP;_NO_PPLXIMP;_USRDLL;%(PreprocessorDefinitions);</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalIncludeDirectories>$(CasablancaIncludeDir);$(CasablancaSrcDir)\pch;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<AdditionalOptions>-Zm250 /bigobj %(AdditionalOptions)</AdditionalOptions>
<WholeProgramOptimization Condition="'$(Configuration)'=='Release'">true</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<LinkTimeCodeGeneration Condition="'$(Configuration)'=='Release'">UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ItemDefinitionGroup>
<PostBuildEvent>
<Command>copy /Y $(OutDir)\* $(OutDir)..\
exit 0</Command>
<Message>Copying $(TargetName).winrt binaries to OutDir and removing appcontainer flag</Message>
</PostBuildEvent>
<Lib>
<TargetMachine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MachineX86</TargetMachine>
</Lib>
<Lib>
<TargetMachine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MachineX86</TargetMachine>
</Lib>
<Lib>
<TargetMachine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MachineX64</TargetMachine>
</Lib>
<Lib>
<TargetMachine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
21 changes: 21 additions & 0 deletions cpprestsdk140.sln
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpprestsdk140.wod", "Releas
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpprestsdk140.uwp", "Release\src\build\vs14.uwp\cpprestsdk140.uwp.vcxproj", "{36D79E79-7E9E-4B3A-88A3-9F9B295C80B9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpprestsdk140.uwp.staticlib", "Release\src\build\vs14.uwp\cpprestsdk140.uwp.staticlib.vcxproj", "{47A5CFDC-C244-45A6-9830-38CB303CB495}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRunner.android.NativeActivity", "Release\tests\common\TestRunner\vs14.android\TestRunner.android.NativeActivity\TestRunner.android.NativeActivity.vcxproj", "{D1060D0A-A10E-444D-9F6B-9676EA453F9A}"
EndProject
Global
Expand All @@ -55,6 +57,8 @@ Global
Release\src\build\common.vcxitems*{3a584d9c-1a98-4046-b7d3-b7171ef42d34}*SharedItemsImports = 4
Release\src\build\winrt.vcxitems*{0a9ba181-7876-4b3d-a5e0-ee673fa51c05}*SharedItemsImports = 9
Release\src\build\android.vcxitems*{65951c40-a332-4b54-89c2-7cdaf30d5f66}*SharedItemsImports = 9
Release\src\build\winrt.vcxitems*{47a5cfdc-c244-45a6-9830-38cb303cb495}*SharedItemsImports = 4
Release\src\build\common.vcxitems*{47a5cfdc-c244-45a6-9830-38cb303cb495}*SharedItemsImports = 4
Release\src\build\win32.vcxitems*{1014c621-bc2d-4813-b8c1-6d83ad6f9249}*SharedItemsImports = 4
Release\src\build\common.vcxitems*{1014c621-bc2d-4813-b8c1-6d83ad6f9249}*SharedItemsImports = 4
Release\src\build\winrt.vcxitems*{36d79e79-7e9e-4b3a-88a3-9f9b295c80b9}*SharedItemsImports = 4
Expand Down Expand Up @@ -206,6 +210,22 @@ Global
{36D79E79-7E9E-4B3A-88A3-9F9B295C80B9}.Release|x64.Build.0 = Release|x64
{36D79E79-7E9E-4B3A-88A3-9F9B295C80B9}.Release|x86.ActiveCfg = Release|Win32
{36D79E79-7E9E-4B3A-88A3-9F9B295C80B9}.Release|x86.Build.0 = Release|Win32
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|ARM.ActiveCfg = Debug|ARM
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|ARM.Build.0 = Debug|ARM
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|Win32.ActiveCfg = Debug|Win32
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|Win32.Build.0 = Debug|Win32
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|x64.ActiveCfg = Debug|x64
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|x64.Build.0 = Debug|x64
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|x86.ActiveCfg = Debug|Win32
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Debug|x86.Build.0 = Debug|Win32
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|ARM.ActiveCfg = Release|ARM
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|ARM.Build.0 = Release|ARM
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|Win32.ActiveCfg = Release|Win32
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|Win32.Build.0 = Release|Win32
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|x64.ActiveCfg = Release|x64
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|x64.Build.0 = Release|x64
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|x86.ActiveCfg = Release|Win32
{47A5CFDC-C244-45A6-9830-38CB303CB495}.Release|x86.Build.0 = Release|Win32
{D1060D0A-A10E-444D-9F6B-9676EA453F9A}.Debug|ARM.ActiveCfg = Debug|ARM
{D1060D0A-A10E-444D-9F6B-9676EA453F9A}.Debug|ARM.Build.0 = Debug|ARM
{D1060D0A-A10E-444D-9F6B-9676EA453F9A}.Debug|Win32.ActiveCfg = Debug|x86
Expand Down Expand Up @@ -245,5 +265,6 @@ Global
{AFB49019-965B-4C10-BAFF-C86C16D58010} = {64F2F240-04BE-43B2-97BE-DA47FDFE8393}
{3A584D9C-1A98-4046-B7D3-B7171EF42D34} = {64F2F240-04BE-43B2-97BE-DA47FDFE8393}
{36D79E79-7E9E-4B3A-88A3-9F9B295C80B9} = {64F2F240-04BE-43B2-97BE-DA47FDFE8393}
{47A5CFDC-C244-45A6-9830-38CB303CB495} = {64F2F240-04BE-43B2-97BE-DA47FDFE8393}
EndGlobalSection
EndGlobal