summaryrefslogtreecommitdiff
path: root/packaging/windows/installer.proj
blob: b2d1d6fb2f7bc184b447e520304750f827594d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-->

<!--
 Packaging script for Apache Qpid on Windows

 Builds the C++, .NET, and WCF components, and packages those along with user
 documentation and the python pieces needed to generate QMF stuff.
-->

<Project DefaultTargets="Clean;Installer"
    xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <PropertyGroup>
	<build_dir>$(MSBuildProjectDirectory)\build</build_dir>
	<source_root>$(MSBuildProjectDirectory)\..\..</source_root>
	<staging_dir>$(MSBuildProjectDirectory)\stage</staging_dir>
	<bits Condition="'$(bits)' == ''">32</bits>
	<qpid_version>0.21</qpid_version>
	<OutputName>qpidc</OutputName>
	<OutputType>Package</OutputType>
	<WixToolPath>C:\Program Files (x86)\Windows Installer XML v3.5\bin</WixToolPath>
        <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\wix.targets</WixTargetsPath>
    </PropertyGroup>

    <Choose>
        <When Condition="'$(bits)' == '64'">
	    <PropertyGroup>
	        <ProgramFiles>ProgramFiles64Folder</ProgramFiles>
		<CmakeGenerator>%22Visual Studio 9 2008 Win64%22</CmakeGenerator>
		<Architecture>x64</Architecture>
		<CSProjArchitecture>x64</CSProjArchitecture>
                <DotNetBindingsArchitecture>x64</DotNetBindingsArchitecture>
	    </PropertyGroup>
	</When>
	<Otherwise>
	    <PropertyGroup>
	        <ProgramFiles>ProgramFilesFolder</ProgramFiles>
		<CmakeGenerator>%22Visual Studio 9 2008%22</CmakeGenerator>
		<Architecture>x86</Architecture>
		<CSProjArchitecture>Win32</CSProjArchitecture>
                <DotNetBindingsArchitecture>Win32</DotNetBindingsArchitecture>
    </PropertyGroup>
	</Otherwise>
    </Choose>

    <ItemGroup>
	<CppDebugProjects Include="$(build_dir)\src\qpidtypes.vcproj"/>
	<CppDebugProjects Include="$(build_dir)\src\qpidcommon.vcproj"/>
	<CppDebugProjects Include="$(build_dir)\src\qpidclient.vcproj"/>
	<CppDebugProjects Include="$(build_dir)\src\qpidmessaging.vcproj"/>
	<CppDebugProjects Include="$(build_dir)\src\qmfconsole.vcproj"/>
    </ItemGroup>

    <ItemGroup>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidtypesd.dll"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidtypesd.lib"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidtypesd.pdb"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidcommond.dll"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidcommond.lib"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidcommond.pdb"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidclientd.dll"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidclientd.lib"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidclientd.pdb"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidmessagingd.dll"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidmessagingd.lib"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qpidmessagingd.pdb"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qmfconsoled.dll"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qmfconsoled.lib"/>
	<CppDebugArtifacts Include="$(build_dir)\src\Debug\qmfconsoled.pdb"/>
    </ItemGroup>

    <ItemGroup>
	<WcfProjects Include="$(source_root)\wcf\src\Apache\Qpid\**\*.csproj"/>
	<WcfArtifacts Include="$(source_root)\wcf\src\Apache\Qpid\Channel\bin\Release\Apache.Qpid.Channel.dll"/>
	<WcfArtifacts Include="$(source_root)\wcf\src\Apache\Qpid\Channel\bin\Release\Apache.Qpid.Interop.dll"/>
	<WcfExamples Include="$(source_root)\wcf\samples\**\*"
	             Exclude="$(source_root)\wcf\samples\**\.svn\**"/>
    </ItemGroup>

    <ItemGroup>
	<DotNetBindingArtifacts Include="$(build_dir)\src\Release\org.apache.qpid.messaging.dll"/>
	<DotNetBindingArtifacts Include="$(build_dir)\src\Release\org.apache.qpid.messaging.pdb"/>
	<DotNetBindingArtifacts Include="$(build_dir)\src\Release\org.apache.qpid.messaging.sessionreceiver.dll"/>
	<DotNetBindingArtifacts Include="$(build_dir)\src\Release\org.apache.qpid.messaging.sessionreceiver.pdb"/>
    </ItemGroup>

    <ItemGroup>
	<DotNetBindingDebugArtifacts Include="$(build_dir)\src\Debug\org.apache.qpid.messaging.dll"/>
	<DotNetBindingDebugArtifacts Include="$(build_dir)\src\Debug\org.apache.qpid.messaging.pdb"/>
	<DotNetBindingDebugArtifacts Include="$(build_dir)\src\Debug\org.apache.qpid.messaging.sessionreceiver.dll"/>
	<DotNetBindingDebugArtifacts Include="$(build_dir)\src\Debug\org.apache.qpid.messaging.sessionreceiver.pdb"/>
    </ItemGroup>

    <ItemGroup>
        <BoostDlls Include="$(staging_dir)\bin\boost_*.dll"/>
    </ItemGroup>

    <ItemGroup>
        <WixExtension Include="WixUtilExtension">
            <HintPath>$(WixToolPath)\WixUtilExtension.dll</HintPath>
        </WixExtension>
        <WixExtension Include="WixUIExtension">
            <HintPath>$(WixToolPath)\WixUIExtension.dll</HintPath>
        </WixExtension>
    </ItemGroup>
    <Import Project="$(WixTargetsPath)" />


    <Target Name="Clean">
    	<RemoveDir
            Directories="$(build_dir);$(staging_dir)" />
    </Target>

    <Target Name="MakeBuildDirs">
    	<MakeDir
            Directories="$(build_dir);$(staging_dir)" />
    </Target>

    <Target Name="Configure" DependsOnTargets="MakeBuildDirs">
        <Message Text="build: $(build_dir)"/>
        <Message Text="stage: $(staging_dir)"/>
    	<Exec
	    Command="cmake -G $(CmakeGenerator) -DCMAKE_INSTALL_PREFIX=$(staging_dir) $(cmake_options) $(source_root)\cpp"
	    WorkingDirectory="$(build_dir)" />
    </Target>

    <Target Name="BuildCpp" DependsOnTargets="Configure">
        <!-- Using VCBuild here with a set of vcproj files misses the
             dependencies, so use devenv to pick up everything. -->
	<!-- Need to ignore the exit code until QMF engine builds clean -->
	<Exec
	    Command="devenv qpid-cpp.sln /build Release /Project ALL_BUILD"
	    WorkingDirectory="$(build_dir)"
	    IgnoreExitCode="true" />
    </Target>

    <Target Name="BuildCppDebug" DependsOnTargets="Configure">
    	<VCBuild
	    Projects="@(CppDebugProjects)"
	    SolutionFile="$(build_dir)/qpid-cpp.sln"
	    Configuration="Debug" />
    </Target>

    <!-- StopOnFirstFailure needed to avoid a weird error trying to compile WIN32 -->
    <Target Name="BuildWcf" DependsOnTargets="BuildCpp">
        <MSBuild
	    Projects="$(source_root)\wcf\QpidWcf.sln"
	    Properties="Configuration=Release;Platform=$(CSProjArchitecture)"
	    StopOnFirstFailure="false" />
    </Target>

    <Target Name="BuildDocs" DependsOnTargets="Configure">
    	<VCBuild
	    Projects="$(build_dir)\docs\api\docs-user-api.vcproj"
	    SolutionFile="$(build_dir)/qpid-cpp.sln"
	    Configuration="Release" />
    </Target>

    <Target Name="BuildDotNetBindings"><!-- DependsOnTargets="BuildCpp;BuildCppDebug" -->
        <MSBuild
            Projects="$(source_root)\cpp\bindings\qpid\dotnet\msvc9\org.apache.qpid.messaging.sessionreceiver.sln"
            Properties="Configuration=Debug;Platform=$(Architecture)" />
        <MSBuild
            Projects="$(source_root)\cpp\bindings\qpid\dotnet\msvc9\org.apache.qpid.messaging.sessionreceiver.sln"
            Properties="Configuration=Release;Platform=$(Architecture)" />
    </Target>

    <Target Name="Stage"
            DependsOnTargets="BuildCpp;BuildCppDebug;BuildWcf;BuildDocs;BuildDotNetBindings">
        <Exec
	    Command="cmake -DCMAKE_INSTALL_CONFIG_NAME=%22Release%22 -P $(build_dir)\cmake_install.cmake" />
    	<Copy
	    SourceFiles="@(CppDebugArtifacts)"
	    DestinationFolder="$(staging_dir)\bin" />
    	<Copy
	    SourceFiles="@(WcfArtifacts)"
	    DestinationFolder="$(staging_dir)\bin" />
	<Copy
	    SourceFiles="@(WcfExamples)"
	    DestinationFiles="@(WcfExamples->'$(staging_dir)\examples\%(RecursiveDir)%(Filename)%(Extension)')" />
    	<Copy
	    SourceFiles="@(DotNetBindingArtifacts)"
	    DestinationFolder="$(staging_dir)\bin" />
    	<Copy
	    SourceFiles="@(DotNetBindingDebugArtifacts)"
	    DestinationFolder="$(staging_dir)\bin\Debug" />
    </Target>

    <Target Name="Installer" DependsOnTargets="Stage">
    <!-- Would be nice to use the WiX Tasks but I'm getting what I think are
         errors mixing 32- and 64-bit artifacts.
    	<HeatDirectory
	    ToolPath="$(WixToolPath)"
	    Directory="$(staging_dir)\include\boost"
	    ComponentGroupName="group_BoostHeaders"
	    OutputFile="boost_headers.wxs" />
	<HeatFile
	    ToolPath="$(WixToolPath)"
	    File="@(BoostDlls)"
	    ComponentGroupName="group_BoostDlls"
	    DirectoryRefId="QpidBin"
	    OutputFile="boost_dlls.wxs" />
	<Candle
	    ToolPath="$(WixToolPath)"
	    DefineConstants="qpidc_version=$(qpid_version)"
	    InstallerPlatform="x64"
	    OutputFile="qpidc-$(qpid_version)-x64.msi" />
    -->
        <Exec
	    Command="heat dir $(staging_dir)\include\qpid -var var.qpid_headers_dir -dr QpidInclude -gg -cg group_QpidHeaders -out qpid_headers.wxs" />
        <Exec
	    Command="heat dir $(staging_dir)\include\boost -var var.boost_headers_dir -dr QpidInclude -gg -cg group_BoostHeaders -out boost_headers.wxs" />
	<!-- HEAT5150 warns about self-registering DLLs; don't care -->
	<Exec
	    Command="heat dir $(staging_dir)\bin\boost -var var.boost_dll_dir -dr QpidBin -srd -gg -cg group_BoostDlls -sw5150 -out boost_dlls.wxs" />
	<Exec
	    Command="heat dir $(staging_dir)\examples -var var.examples_dir -dr QpidExamples -srd -gg -cg group_Examples -out examples.wxs" />
	<Exec
	    Command="heat dir $(staging_dir)\docs\api  -var var.api_docs_dir -dr QpidDoc -gg -cg group_APIDocs -out api_docs.wxs" />
	<Exec
	    Command="candle -dqpidc_version=$(qpid_version) -dProgramFiles=$(ProgramFiles) -dstaging_dir=$(staging_dir) -dqpid_headers_dir=$(staging_dir)\include\qpid -dboost_headers_dir=$(staging_dir)\include\boost -dboost_dll_dir=$(staging_dir)\bin\boost -dexamples_dir=$(staging_dir)\examples -dapi_docs_dir=$(staging_dir)\docs\api  -ext WiXNetFxExtension qpidc.wxs qpid_headers.wxs boost_headers.wxs boost_dlls.wxs examples.wxs api_docs.wxs -arch $(Architecture)" />
	<Exec
	    Command="light -ext WiXNetFxExtension -ext WixUtilExtension -ext WixUIExtension -cultures:en-us -out qpidc-$(qpid_version)-$(Architecture).msi qpidc.wixobj qpid_headers.wixobj boost_headers.wixobj boost_dlls.wixobj examples.wixobj api_docs.wixobj" />
    </Target>

</Project>