-
Notifications
You must be signed in to change notification settings - Fork 104
/
zproject_java_msvc.gsl
330 lines (309 loc) · 13.9 KB
/
zproject_java_msvc.gsl
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# Generate VC++ project files for Java binding
#
# All Visual Studio versions from 2010 onwards use the same solution
# format with a different platform toolset
#
# This is a code generator built using the iMatix GSL code generation
# language. See https://github.com/zeromq/gsl for details.
#
# Copyright (c) the Contributors as noted in the AUTHORS file.
# This file is part of zproject.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
register_target ("java-msvc", "MSVC builds for Java JNI binding")
# Target provides name space isolation for its functions
function target_java_msvc
gsl from "zproject_java_lib.gsl"
.macro generate_vs20xx_build_jni (path, level)
.directory.create ("$(my.path)/$(project.libname)jni")
.terminator="\r\n"
.output "$(my.path)/$(project.libname)jni/$(project.libname)jni.vcxproj"
<?xml version="1.0" encoding="utf-8"?>
<!--
$(project.GENERATED_WARNING_HEADER:)
-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}</ProjectGuid>
<ProjectName>$(project.libname)jni</ProjectName>
<PlatformToolset>v$(my.level)0</PlatformToolset>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="DebugDLL|Win32">
<Configuration>DebugDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseDLL|Win32">
<Configuration>ReleaseDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugDLL|x64">
<Configuration>DebugDLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseDLL|x64">
<Configuration>ReleaseDLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType Condition="$\(Configuration.IndexOf('DLL')) == -1">StaticLibrary</ConfigurationType>
<ConfigurationType Condition="$\(Configuration.IndexOf('DLL')) != -1">DynamicLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$\(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
<Import Project="$\(VCTargetsPath)\\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets">
<Import Project="..\\..\\properties\\$\(Configuration).props" />
<Import Project="$\(ProjectName).props" />
</ImportGroup>
<ItemGroup>
<ClInclude Include="..\\..\\platform.h" />
<ClInclude Include="..\\..\\resource.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\\..\\..\\..\\..\\include\\$(project.header)" />
.for header where scope = "public"
<ClInclude Include="..\\..\\..\\..\\..\\include\\$(name:c).h" />
.endfor
.for class where okay
<ClInclude Include="..\\..\\..\\src\\native\\include\\$(namespace:c)_$(class.name:pascal).h" />
.endfor
</ItemGroup>
<ItemGroup>
.for class where okay
<ClCompile Include="..\\..\\..\\src\\main\\c\\$(namespace:c)_$(class.name:pascal).c">
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
.endfor
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\\..\\resource.rc" />
</ItemGroup>
<Import Project="$\(VCTargetsPath)\\Microsoft.Cpp.targets" />
<!--
$(project.GENERATED_WARNING_HEADER:)
-->
</Project>
.output "$(my.path)/$(project.libname)jni/$(project.libname)jni.vcxproj.filters"
<?xml version="1.0" encoding="utf-8"?>
<!--
$(project.GENERATED_WARNING_HEADER:)
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
.for class where okay
<ClCompile Include="..\\..\\..\\src\\main\\c\\$(namespace:c)_$(class.name:pascal).c">
<Filter>src</Filter>
</ClCompile>
.endfor
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\\..\\..\\..\\..\\include\\$(project.header)">
<Filter>include</Filter>
</ClInclude>
.for header where scope = "public"
<ClInclude Include="..\\..\\..\\..\\..\\include\\$(name:c).h">
<Filter>include</Filter>
</ClInclude>
.endfor
.for class where okay
<ClInclude Include="..\\..\\..\\src\\native\\include\\$(namespace:c)_$(class.name:pascal).h">
<Filter>include</Filter>
</ClInclude>
.endfor
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\\..\\platform.h">
<Filter>src\\include</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\\..\\resource.h">
<Filter>resource</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\\..\\resource.rc">
<Filter>resource</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{48f852d3-9723-4499-bf1a-35c0234b8ba9}</UniqueIdentifier>
</Filter>
<Filter Include="include">
<UniqueIdentifier>{95e5d24a-57a2-429a-a1f1-304165f2e3da}</UniqueIdentifier>
</Filter>
<Filter Include="src\\include">
<UniqueIdentifier>{d0c837b5-cb58-4b82-b9bf-38727c7b25bd}</UniqueIdentifier>
</Filter>
<Filter Include="resource">
<UniqueIdentifier>{48e93f8c-156c-4379-a901-4b5ad39a4eac}</UniqueIdentifier>
</Filter>
<Filter Include="packaging">
<UniqueIdentifier>{04a473ca-1d88-4e12-9190-8d9cc20efd74}</UniqueIdentifier>
</Filter>
</ItemGroup>
<!--
$(project.GENERATED_WARNING_HEADER:)
-->
</Project>
.output "$(my.path)/$(project.name:c).sln"
Microsoft Visual Studio Solution File, Format Version $(my.level).00
# $(my.path)
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$(project.libname)jni", "$(project.libname)jni\\$(project.libname)jni.vcxproj", "{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DynDebug|Win32 = DynDebug|Win32
DynDebug|x64 = DynDebug|x64
DynRelease|Win32 = DynRelease|Win32
DynRelease|x64 = DynRelease|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}.DynDebug|Win32.ActiveCfg = DebugDLL|Win32
{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}.DynDebug|Win32.Build.0 = DebugDLL|Win32
{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}.DynDebug|x64.ActiveCfg = DebugDLL|x64
{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}.DynDebug|x64.Build.0 = DebugDLL|x64
{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}.DynRelease|Win32.ActiveCfg = ReleaseDLL|Win32
{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}.DynRelease|Win32.Build.0 = ReleaseDLL|Win32
{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}.DynRelease|x64.ActiveCfg = ReleaseDLL|x64
{0C4A2E28-8C9E-4B27-85D9-BB679AD84AC7}.DynRelease|x64.Build.0 = ReleaseDLL|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
.terminator="\r\n"
.output "$(my.path)/build.bat"
@if "%ECHOON%" == "" (@echo off) else (@echo %ECHOON%)&:: set ECHOON=on if you want to debug this script
$(project.generated_warning_header_for_dot_bat:)
SET solution=$(project.name:c).sln
SET version=$(my.level)
SET log=build.log
SET tools=Microsoft Visual Studio %version%.0\\VC\\vcvarsall.bat
SET environment="%programfiles(x86)%\\%tools%"
IF NOT EXIST %environment% SET environment="%programfiles%\\%tools%"
IF NOT EXIST %environment% GOTO no_tools
ECHO Building %solution%...
CALL %environment% x86 > nul
@if "%ECHOON%" == "" (@echo off) else (@echo %ECHOON%)&:: set ECHOON=on if you want to debug this script
ECHO Platform=x86
ECHO Configuration=DynDebug
msbuild /m /v:n /p:Configuration=DynDebug /p:Platform=Win32 %solution% > %log%
IF errorlevel 1 GOTO error
ECHO Configuration=DynRelease
msbuild /m /v:n /p:Configuration=DynRelease /p:Platform=Win32 %solution% >> %log%
IF errorlevel 1 GOTO error
CALL %environment% x86_amd64 > nul
@if "%ECHOON%" == "" (@echo off) else (@echo %ECHOON%)&:: set ECHOON=on if you want to debug this script
ECHO Platform=x64
ECHO Configuration=DynDebug
msbuild /m /v:n /p:Configuration=DynDebug /p:Platform=x64 %solution% > %log%
IF errorlevel 1 GOTO error
ECHO Configuration=DynRelease
msbuild /m /v:n /p:Configuration=DynRelease /p:Platform=x64 %solution% >> %log%
IF errorlevel 1 GOTO error
ECHO Complete: %solution%
GOTO end
:error
ECHO *** ERROR, build terminated early: see %log%
GOTO end
:no_tools
ECHO *** ERROR, build tools not found: %tools%
:end
.output "$(my.path)/call_javah.bat"
@if "%ECHOON%" == "" (@echo off) else (@echo %ECHOON%)&:: set ECHOON=on if you want to debug this script
$(project.generated_warning_header_for_dot_bat:)
ECHO Generating native JNI headers...
.for class where okay
IF EXIST ..\\..\\..\\src\\native\\include\\$(namespace:c)_$(class.name:pascal).h GOTO HAVE_$(class.name:pascal)
"%JAVA_HOME%\\bin\\javah.exe" -d ..\\..\\..\\src\\native\\include -classpath ..\\..\\..\\src\\main\\java $(namespace).$(name:pascal)
:HAVE_$(class.name:pascal)
.endfor
.output "$(my.path)/$(project.libname)jni/$(project.libname)jni.props"
<?xml version="1.0" encoding="utf-8"?>
<!--
$(project.GENERATED_WARNING_HEADER:)
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<_PropertySheetDisplayName>$(project.name:) Common Settings</_PropertySheetDisplayName>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup>
<_PropertySheetDisplayName>Output Settings</_PropertySheetDisplayName>
<OutDir>..\\..\\bin\\$\(PlatformName)\\$\(DebugOrRelease)\\$\(PlatformToolset)\\$\(DefaultLinkage)\\</OutDir>
<IntDir>..\\..\\obj\\$\(PlatformName)\\$\(DebugOrRelease)\\$\(PlatformToolset)\\$\(DefaultLinkage)\\</IntDir>
<TargetDir>$\(OutDir)</TargetDir>
<TargetName>$\(TargetName)</TargetName>
<TargetPath>$\(TargetDir)$\(TargetName)$\(TargetExt)</TargetPath>
</PropertyGroup>
<!-- Configuration -->
<ItemDefinitionGroup>
<PreBuildEvent>
<Command>copy ..\\..\\platform.h ..\\..\\..\\..\\..\\include\\</Command>
<Command>..\\call_javah.bat</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>..\\..\\..\\..\\..\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$\(JAVA_HOME)\\include;$\(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
.for project.use
. if file.exists ("../$(use.project)/include")
<AdditionalIncludeDirectories>..\\..\\..\\..\\..\\..\\$(use.project)\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
. else
. if use.optional ?= 0
. abort "E: please checkout $(use.project) into ../$(use.project)"
. endif
. endif
.endfor
<CompileAs>CompileAsC</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<EnablePREfast>false</EnablePREfast>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BASE_THREADSAFE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$\(ConfigurationType)' == 'StaticLibrary'">$(PROJECT.PREFIX)JNI_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$\(ConfigurationType)' == 'DynamicLibrary'">$(PROJECT.PREFIX)JNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>Rpcrt4.lib;Ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<!-- Pull in our own library -->
<AdditionalDependencies>$(project.libname).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories Condition="$\(Configuration.IndexOf('Debug')) != -1">..\\..\\..\\..\\..\\..\\$(project.name)\\bin\\$\(PlatformName)\\Debug\\$\(PlatformToolset)\\dynamic\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="$\(Configuration.IndexOf('Release')) != -1">..\\..\\..\\..\\..\\..\\$(project.name)\\bin\\$\(PlatformName)\\Release\\$\(PlatformToolset)\\dynamic\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
.for project.use where optional = 0
<!-- Pull in $(use.project) dependency -->
<AdditionalDependencies>$(use.libname).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories Condition="$\(Configuration.IndexOf('Debug')) != -1">..\\..\\..\\..\\..\\..\\$(use.project)\\bin\\$\(PlatformName)\\Debug\\$\(PlatformToolset)\\dynamic\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="$\(Configuration.IndexOf('Release')) != -1">..\\..\\..\\..\\..\\..\\$(use.project)\\bin\\$\(PlatformName)\\Release\\$\(PlatformToolset)\\dynamic\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
.endfor
</Link>
</ItemDefinitionGroup>
<!-- Messages -->
<Target Name="CustomInfo" BeforeTargets="PrepareForBuild">
<Message Text="Will copy ..\\..\\platform.h -> ..\\..\\..\\..\\..\\include\\platform.h" Importance="high"/>
</Target>
<Target Name="LinkageInfo" BeforeTargets="PrepareForBuild">
</Target>
<!--
$(project.GENERATED_WARNING_HEADER:)
-->
</Project>
.terminator="\n"
.endmacro
project.namespace ?= switches.namespace? "org.zeromq.$(project.prefix)"
project.name_path ?= switches.name_path? "org/zeromq/$(project.prefix)"
for project.class
resolve_class (class)
endfor
if count (project.class, okay = 1)
generate_vs20xx_main ("bindings/jni/msvc")
generate_vs20xx_props ("bindings/jni/msvc/properties")
generate_vs20xx_build_jni ("bindings/jni/msvc/vs2010", "10")
generate_vs20xx_build_jni ("bindings/jni/msvc/vs2012", "11")
generate_vs20xx_build_jni ("bindings/jni/msvc/vs2013", "12")
generate_vs20xx_build_jni ("bindings/jni/msvc/vs2015", "14")
endif
endfunction