-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
608 lines (503 loc) · 26.9 KB
/
CMakeLists.txt
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
cmake_minimum_required(VERSION 2.8)
project(infinispan-hotrod-dotnet)
if(NOT DEFINED HOTROD_VERSION_MAJOR OR "${HOTROD_VERSION_MAJOR}" STREQUAL "")
set(HOTROD_VERSION_MAJOR "8")
endif(NOT DEFINED HOTROD_VERSION_MAJOR OR "${HOTROD_VERSION_MAJOR}" STREQUAL "")
if(NOT DEFINED HOTROD_VERSION_MINOR OR "${HOTROD_VERSION_MINOR}" STREQUAL "")
set(HOTROD_VERSION_MINOR "1")
endif(NOT DEFINED HOTROD_VERSION_MINOR OR "${HOTROD_VERSION_MINOR}" STREQUAL "")
if(NOT DEFINED HOTROD_VERSION_PATCH OR "${HOTROD_VERSION_PATCH}" STREQUAL "")
set(HOTROD_VERSION_PATCH "1")
endif(NOT DEFINED HOTROD_VERSION_PATCH OR "${HOTROD_VERSION_PATCH}" STREQUAL "")
if(NOT DEFINED HOTROD_VERSION_LABEL OR "${HOTROD_VERSION_LABEL}" STREQUAL "")
set(HOTROD_VERSION_LABEL "SNAPSHOT")
endif(NOT DEFINED HOTROD_VERSION_LABEL OR "${HOTROD_VERSION_LABEL}" STREQUAL "")
if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
message(FATAL_ERROR "You are calling cmake from the source directory. Please create a separate build directory and call cmake from there. See README.md for details.")
endif("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(PLATFORM "x64")
# Map from version label to assembly revision.
set(REVISION_SNAPSHOT "0")
set(REVISION_Alpha1 "1")
set(REVISION_Alpha2 "2")
set(REVISION_Alpha3 "3")
set(REVISION_Alpha4 "4")
set(REVISION_Alpha5 "5")
set(REVISION_Alpha6 "6")
set(REVISION_Beta1 "1")
set(REVISION_Beta2 "2")
set(REVISION_Beta3 "3")
set(REVISION_Beta4 "4")
set(REVISION_Beta5 "5")
set(REVISION_Beta6 "6")
set(REVISION_DR0 "0")
set(REVISION_DR1 "1")
set(REVISION_DR2 "2")
set(REVISION_DR3 "3")
set(REVISION_DR4 "4")
set(REVISION_DR5 "5")
set(REVISION_DR6 "6")
set(REVISION_DR7 "7")
set(REVISION_DR8 "8")
set(REVISION_DR9 "9")
set(REVISION_Beta1 "10")
set(REVISION_ER1 "11")
set(REVISION_ER2 "12")
set(REVISION_ER3 "13")
set(REVISION_ER4 "14")
set(REVISION_ER5 "15")
set(REVISION_ER6 "16")
set(REVISION_ER7 "17")
set(REVISION_ER8 "18")
set(REVISION_ER9 "19")
set(REVISION_CR1 "21")
set(REVISION_CR2 "22")
set(REVISION_CR3 "23")
set(REVISION_Final "30")
set(REVISION_GA "30")
string(TIMESTAMP REVISION_SNAPSHOT "%y%j" UTC)
# CPack version.
set(CPACK_PACKAGE_VERSION_MAJOR "${HOTROD_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${HOTROD_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${HOTROD_VERSION_PATCH}.${HOTROD_VERSION_LABEL}")
set(HOTROD_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# Assembly version.
get_property(HOTROD_VERSION_REVISION VARIABLE PROPERTY "REVISION_${HOTROD_VERSION_LABEL}")
if("${HOTROD_VERSION_REVISION}" STREQUAL "")
message(FATAL_ERROR "No revision mapping defined for HOTROD_VERSION_LABEL '${HOTROD_VERSION_LABEL}'. ${HOTROD_VERSION_REVISION}")
endif("${HOTROD_VERSION_REVISION}" STREQUAL "")
set(HOTROD_ASSEMBLY_VERSION "${HOTROD_VERSION_MAJOR}.${HOTROD_VERSION_MINOR}.${HOTROD_VERSION_PATCH}.${HOTROD_VERSION_REVISION}")
set(HOTROD_ASSEMBLY_PRODUCT_NAME "${CMAKE_PROJECT_NAME}")
set(HOTROD_ASSEMBLY_DESCRIPTION ".NET Hot Rod Client")
set(HOTROD_ASSEMBLY_TITLE "${HOTROD_ASSEMBLY_DESCRIPTION}")
set(HOTROD_ASSEMBLY_COPYRIGHT "Copyright 2009 - 2014, Red Hat Inc. and/or its affiliates.")
set(CPACK_PACKAGE_VENDOR "Infinispan")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set(CPACK_WIX_UPGRADE_GUID "7cc17657-80b5-417f-9209-710682f852f4") # This value should not change.
message("HotRod Version: ${HOTROD_VERSION}")
message("HotRod Assembly Version: ${HOTROD_ASSEMBLY_VERSION}")
message(STATUS "HOTRODCPP_HOME value is :" ${HOTRODCPP_HOME})
if(DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
find_package(Protobuf)
else(DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
find_package(Protobuf REQUIRED)
endif(DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
function(HR_PROTOBUF_GENERATE_CSHARP SRCS)
if(NOT ARGN)
message(SEND_ERROR "Error: PROTOBUF_GENERATE_CSHARP() called without any proto files")
return()
endif()
if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
# Create an include path for each file specified
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(ABS_PATH ${ABS_FIL} PATH)
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
if(${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
endforeach()
else()
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if(DEFINED PROTOBUF_IMPORT_DIRS)
foreach(DIR ${PROTOBUF_IMPORT_DIRS})
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
if(${_contains_already} EQUAL -1)
list(APPEND _protobuf_include_path -I ${ABS_PATH})
endif()
endforeach()
endif()
set(${SRCS})
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
"${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE_CS}
ARGS --csharp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
DEPENDS ${ABS_FIL}
COMMENT "Running C# protocol buffer compiler on ${FIL}"
VERBATIM)
endforeach()
set_source_files_properties(${${SRCS}} PROPERTIES GENERATED TRUE)
set(${SRCS} ${${SRCS}} PARENT_SCOPE)
endfunction()
include_directories(${PROTOBUF_INCLUDE_DIRS})
if(WIN32) # Needed for prebuild on windows
# ## Generated and build the SWIG wrapper ###
if(NOT DEFINED HOTRODCPP_HOME AND DEFINED ENV{HOTRODCPP_HOME})
set(HOTRODCPP_HOME $ENV{HOTRODCPP_HOME})
endif(NOT DEFINED HOTRODCPP_HOME AND DEFINED ENV{HOTRODCPP_HOME})
if(NOT DEFINED HOTRODCPP_HOME)
message(FATAL_ERROR "Please define HOTRODCPP_HOME.")
endif(NOT DEFINED HOTRODCPP_HOME)
message(STATUS "HOTRODCPP_HOME value is :" ${HOTRODCPP_HOME})
set(SWIG_BUILD "${CMAKE_CURRENT_BINARY_DIR}/swig")
set(NATIVE_DIR "${SWIG_BUILD}/native_client")
set(NATIVE_LIB_DIR "${NATIVE_DIR}/lib")
if(NOT DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
file(MAKE_DIRECTORY "${SWIG_BUILD}" "${NATIVE_DIR}")
file(TO_CMAKE_PATH "${HOTRODCPP_HOME}" CMAKE_CPP_HOME)
file(COPY "${CMAKE_CPP_HOME}/lib/" DESTINATION "${NATIVE_LIB_DIR}" PATTERN "*")
file(COPY "${CMAKE_CPP_HOME}/include/" DESTINATION "${NATIVE_DIR}/include" PATTERN "*")
endif(NOT DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
hr_protobuf_generate_csharp(PROTO_SRCS
src/resources/proto/base_types.proto
src/resources/proto/message-wrapping.proto
src/resources/proto/query.proto
)
hr_protobuf_generate_csharp(TEST_PROTO_SRCS
test/resources/proto3/addressbook.proto
test/resources/proto3/bank.proto
)
add_custom_target(
swig ALL
COMMAND cmake -G "${CMAKE_GENERATOR}" "-DPROTOBUF_INCLUDE_DIR=${PROTOBUF_INCLUDE_DIR}" "-DHOTRODCPP_HOME=${NATIVE_DIR}" "-DSWIG_DIR=${SWIG_DIR}" "-DSWIG_EXECUTABLE=${SWIG_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/swig"
COMMAND cmake --build . --config "${CMAKE_CFG_INTDIR}"
WORKING_DIRECTORY "${SWIG_BUILD}"
DEPENDS ${PROTO_SRCS} ${TEST_PROTO_SRCS}
)
# ## Compile the C# code ###
if(NOT DEFINED NLOG_DLL AND DEFINED ENV{NLOG_DLL})
set(NLOG_DLL $ENV{NLOG_DLL})
endif(NOT DEFINED NLOG_DLL AND DEFINED ENV{NLOG_DLL})
if(NOT DEFINED NLOG_DLL)
message(FATAL_ERROR "Please define NLOG_DLL.")
endif(NOT DEFINED NLOG_DLL)
if(NOT DEFINED NUNIT_DLL AND DEFINED ENV{NUNIT_DLL})
set(NUNIT_DLL $ENV{NUNIT_DLL})
endif(NOT DEFINED NUNIT_DLL AND DEFINED ENV{NUNIT_DLL})
if(NOT DEFINED NUNIT_DLL)
message(FATAL_ERROR "Please define NUNIT_DLL.")
endif(NOT DEFINED NUNIT_DLL)
if(NOT DEFINED NLOG_LICENSE AND DEFINED ENV{NLOG_LICENSE})
set(NLOG_LICENSE $ENV{NLOG_LICENSE})
set(NLOG_LICENSE_LOCAL "${CMAKE_CURRENT_BINARY_DIR}/NLog_License.txt")
file(COPY "${NLOG_LICENSE}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
get_filename_component(NLOG_LICENSE_NAME "${NLOG_LICENSE}" NAME)
file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/${NLOG_LICENSE_NAME}" "${NLOG_LICENSE_LOCAL}")
endif(NOT DEFINED NLOG_LICENSE AND DEFINED ENV{NLOG_LICENSE})
if(NOT DEFINED NLOG_LICENSE)
message(WARNING "Please define NLOG_LICENSE if you plan to distribute the package.")
endif(NOT DEFINED NLOG_LICENSE)
file(COPY "${NLOG_DLL}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY "${NLOG_LICENSE}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
get_filename_component(NLOG_DLL_NAME "${NLOG_DLL}" NAME)
get_filename_component(NLOG_LICENSE_NAME "${NLOG_LICENSE}" NAME)
set(NLOG_DLL_LOCAL "${CMAKE_CURRENT_BINARY_DIR}/NLog.dll")
set(NLOG_LICENSE_LOCAL "${CMAKE_CURRENT_BINARY_DIR}/NLog_License.txt")
file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/${NLOG_DLL_NAME}" "${NLOG_DLL_LOCAL}")
file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/${NLOG_LICENSE_NAME}" "${NLOG_LICENSE_LOCAL}")
# GAC requires strong names
if(NOT DEFINED HOTROD_SNK AND DEFINED ENV{HOTROD_SNK})
set(HOTROD_SNK $ENV{HOTROD_SNK})
endif(NOT DEFINED HOTROD_SNK AND DEFINED ENV{HOTROD_SNK})
if(DEFINED HOTROD_SNK)
set(KEYFILE "<KeyOriginatorFile>${HOTROD_SNK}</KeyOriginatorFile>")
else(DEFINED HOTROD_SNK)
set(KEYFILE "")
message(WARNING "No key provided. The generated DLL won't have a strong name.")
endif(DEFINED HOTROD_SNK)
string(REPLACE "/" "\\" W_S "${CMAKE_CURRENT_SOURCE_DIR}")
string(REPLACE "/" "\\" W_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
string(REPLACE "/" "\\" W_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
string(REPLACE "/" "\\" W_SWIG_BUILD "${SWIG_BUILD}")
configure_file(templates/hotrodcs.proj.in hotrodcs.csproj)
configure_file(templates/hotrodcs-tests.proj.in hotrodcs-tests.csproj)
configure_file(templates/AssemblyInfo.cs.in AssemblyInfo.cs)
set(ARCH 64)
# configure_file(src/main/cs/Infinispan/HotRod/Impl/RemoteCacheSWIGImpl.cs.i "${SWIG_BUILD}/RemoteCacheSWIGImpl.cs")
find_program(MSBUILD_BINARY MSBuild.exe HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;MSBuildToolsPath]")
if(NOT MSBUILD_BINARY)
message(FATAL_ERROR "Failed to find MSBuild.exe")
endif(NOT MSBUILD_BINARY)
include_external_msproject(vs-hotrodcs-bin hotrodcs.csproj
TYPE AA8E36D7-FD51-4D63-A68E-227F5C4871C6
GUID AA8E36D7-FD51-4D63-A68E-227F5C4871C6
swig)
add_custom_target(hotrodcs-bin DEPENDS swig vs-hotrodcs-bin)
include_external_msproject(vs-hotrodcs-test-bin hotrodcs-tests.csproj
TYPE 97560E9D-C7BA-40D6-9728-B39B1333EF49
GUID 97560E9D-C7BA-40D6-9728-B39B1333EF49
PLATFORM ${PLATFORM}
vs-hotrodcs-bin)
if(DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
add_custom_target(hotrodcs-test-bin DEPENDS vs-hotrodcs-test-bin hotrod-java-events-jar)
else(DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
add_custom_target(hotrodcs-test-bin DEPENDS hotrodcs-bin vs-hotrodcs-test-bin hotrod-java-events-jar)
endif(DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
# else (WIN32)
# find_program(XBUILD_BINARY xbuild)
# if (NOT XBUILD_BINARY)
# message (FATAL_ERROR "Please make sure xbuild is on the PATH.")
# endif (NOT XBUILD_BINARY)
#
# find_program(MONO_BINARY mono)
# if (NOT MONO_BINARY)
# message (FATAL_ERROR "Please make sure mono is on the PATH.")
# endif (NOT MONO_BINARY)
#
# add_custom_target(hotrodcs-bin ALL
# COMMAND ${XBUILD_BINARY} "/tv:4.5" "hotrodcs.proj"
# DEPENDS hotrodcs_wrap)
#
# add_custom_target(hotrodcs-tests-bin ALL
# COMMAND ${XBUILD_BINARY} "/tv:4.5" "hotrodcs-tests.csproj"
# DEPENDS hotrodcs-bin)
# endif (WIN32)
# ## Run the tests. ###
include(CTest)
if(NOT DEFINED HOTROD_JBOSS_HOME)
if(NOT DEFINED ENV{JBOSS_HOME})
message(WARNING "You must set the JBOSS_HOME environment variable or use -DHOTROD_JBOSS_HOME=/the/path to run integration tests")
endif(NOT DEFINED ENV{JBOSS_HOME})
set(HOTROD_JBOSS_HOME $ENV{JBOSS_HOME})
endif(NOT DEFINED HOTROD_JBOSS_HOME)
find_program(NUNIT_BINARY nunit3-console.exe)
if(NOT NUNIT_BINARY)
message(FATAL_ERROR "Please make sure nunit3-console.exe is on the PATH.")
endif(NOT NUNIT_BINARY)
if(WIN32)
set(UT_PATH "$ENV{PATH}")
if(NOT DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
# Add the native libs to the path.
file(TO_NATIVE_PATH "${NATIVE_LIB_DIR}" native_dir)
set(UT_PATH "${native_dir};${UT_PATH}")
endif(NOT DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
# Add the wrapper libs to the path.
foreach(loop_var ${CMAKE_CONFIGURATION_TYPES})
file(TO_NATIVE_PATH "${SWIG_BUILD}/${loop_var}" native_dir)
set(UT_PATH "${native_dir};${UT_PATH}")
endforeach(loop_var)
endif(WIN32)
if(NOT DEFINED ENABLE_JAVA_TESTING OR ENABLE_JAVA_TESTING)
# Add target for building the java sources.
find_program(MAVEN_BINARY mvn mvn.bat)
if(NOT MAVEN_BINARY)
message(FATAL_ERROR "Failed to find Maven.")
endif(NOT MAVEN_BINARY)
if(NOT IKVM_CUSTOM_BIN_PATH)
find_program(IKVM_BINARY ikvm ikvm.exe)
if(NOT IKVM_BINARY)
message(FATAL_ERROR "Failed to find IKVM.")
endif(NOT IKVM_BINARY)
find_program(IKVMSTUB_BINARY ikvmstub ikvmstub.exe)
if(NOT IKVMSTUB_BINARY)
message(FATAL_ERROR "Failed to find IKVMSTUB.")
endif(NOT IKVMSTUB_BINARY)
else(NOT IKVM_CUSTOM_BIN_PATH)
set(IKVM_BINARY ${IKVM_CUSTOM_BIN_PATH}/ikvm.exe)
set(IKVMSTUB_BINARY ${IKVM_CUSTOM_BIN_PATH}/ikvmstub.exe)
endif(NOT IKVM_CUSTOM_BIN_PATH)
set(java_tests_dir ${CMAKE_CURRENT_BINARY_DIR}/java_tests)
set(java_events_dir ${CMAKE_CURRENT_BINARY_DIR}/java_events)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/java_tests DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/java_events DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY ${CMAKE_SOURCE_DIR}/maven-settings.xml DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
# Pass the updated path using an external script.
file(TO_NATIVE_PATH "${IKVM_BINARY}" IKVM_NATIVE_BINARY)
configure_file(templates/run_ikvm.bat.in ${java_tests_dir}/run_ikvm.bat)
configure_file(templates/run_ispn.bat.in ${CMAKE_CURRENT_BINARY_DIR}/run_ispn.bat)
add_custom_target(hotrod-ikvm-jar ALL
COMMAND ${IKVMSTUB_BINARY}
-out:${java_tests_dir}/hotrodcs.jar
-nostdlib
"-lib:%windir%/microsoft.net/framework/v4.0.30319"
"${CMAKE_CURRENT_BINARY_DIR}/hotrodcs.dll"
COMMAND ${IKVMSTUB_BINARY}
-out:${java_tests_dir}/hotrodcs-tests.jar
-nostdlib
"-lib:%windir%/microsoft.net/framework/v4.0.30319"
"-lib:${CMAKE_CURRENT_BINARY_DIR}/"
"${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/$<CONFIG>/hotrodcs-tests.dll"
COMMAND ${IKVMSTUB_BINARY}
-out:${java_tests_dir}/mscorlib.jar
-nostdlib
"-lib:%windir%/microsoft.net/framework/v4.0.30319"
mscorlib
COMMAND ${MAVEN_BINARY}
-DhotrodVersion=${HOTROD_VERSION}
-DhotrodIKVMStubJar=${java_tests_dir}/hotrodcs.jar
-DhotrodTestsIKVMStubJar=${java_tests_dir}/hotrodcs-tests.jar
-DmscorlibIKVMStubJar=${java_tests_dir}/mscorlib.jar
--settings ../maven-settings.xml
"clean" "package"
WORKING_DIRECTORY ${java_tests_dir}
DEPENDS hotrodcs-test-bin)
add_custom_target(hotrod-java-events-jar ALL
COMMAND ${MAVEN_BINARY}
"clean" "package"
WORKING_DIRECTORY ${java_events_dir})
add_custom_command(TARGET hotrod-java-events-jar POST_BUILD
COMMAND(${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/java_events/target/java-filters-converters.jar" "${JBOSS_HOME}/standalone/deployments"))
add_test(NAME java_tests
WORKING_DIRECTORY ${java_tests_dir}
COMMAND ${java_tests_dir}/run_ikvm.bat
-enableassertions
-Dorg.jboss.logging.provider=jdk
# -DVERBOSE_HOTROD_JAVA_TESTS=true
-Djava.net.preferIPv4Stack=true
-Xreference:${CMAKE_CURRENT_BINARY_DIR}/hotrodcs.dll
-Xreference:${CMAKE_CURRENT_BINARY_DIR}/obj/${PLATFORM}/$<CONFIG>/hotrodcs-tests.dll
"org.infinispan.client.hotrod.JavaClientTests")
set_tests_properties(java_tests PROPERTIES ENVIRONMENT "HOTROD_IPSTACK=IPV4;JAVA_TESTS_DIR=${java_tests_dir}" TIMEOUT 1200)
add_test(NAME cross_language_test
WORKING_DIRECTORY ${java_tests_dir}
COMMAND ${java_tests_dir}/run_ikvm.bat
-enableassertions
-Dorg.jboss.logging.provider=jdk
# -DVERBOSE_HOTROD_JAVA_TESTS=true
-Djava.net.preferIPv4Stack=true
-Dinfinispan.client.hotrod.java=${java_tests_dir}/target/infinispan-client-hotrod
-Dinfinispan.client.hotrod.dotnet=${java_tests_dir}/hotrodcs.jar
-Xreference:${CMAKE_CURRENT_BINARY_DIR}/hotrodcs.dll
-Xreference:${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/$<CONFIG>/hotrodcs-tests.dll
"org.infinispan.client.hotrod.CrossLanguageHotRodTest")
set_tests_properties(cross_language_test PROPERTIES ENVIRONMENT "HOTROD_IPSTACK=IPV4;JAVA_TESTS_DIR=${java_tests_dir}" TIMEOUT 1200)
# #
# ### NO MORE COMPATIBILITY MODE WITH 9.4.0
# #
# #add_test(NAME compatibility_serializer_test
# #WORKING_DIRECTORY ${java_tests_dir}
# #COMMAND ${java_tests_dir}/run_ikvm.bat
# #-enableassertions
# #-Dorg.jboss.logging.provider=jdk
# ## -DVERBOSE_HOTROD_JAVA_TESTS=true
# #-Djava.net.preferIPv4Stack=true
# #-Dinfinispan.client.hotrod.java=${java_tests_dir}/target/infinispan-client-hotrod
# #-Dinfinispan.client.hotrod.dotnet=${java_tests_dir}/hotrodcs.jar
# #-Xreference:${CMAKE_CURRENT_BINARY_DIR}/hotrodcs.dll
# #-Xreference:${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/$<CONFIG>/hotrodcs-tests.dll
# #"org.infinispan.client.hotrod.StringSerializerHotRodTest")
# #set_tests_properties(compatibility_serializer_test PROPERTIES ENVIRONMENT "HOTROD_IPSTACK=IPV4;JAVA_TESTS_DIR=${java_tests_dir}" TIMEOUT 1200)
endif(NOT DEFINED ENABLE_JAVA_TESTING OR ENABLE_JAVA_TESTING)
if(NOT DEFINED ENABLE_CSHARP_TESTING OR ENABLE_CSHARP_TESTING)
# use the specific clustered-indexing.xml until ISPN-6912 is resolved, then use docs/examples/configs/clustered-indexing.xml
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/infinispan.xml DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/infinispan-sasl.xml DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/infinispan-ssl.xml DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/hotrod_service.keytab DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore.jks DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/truststore.jks DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore_server_sni1_rsa.jks DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore_server_sni2_rsa.jks DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore_server_sni3_untrusted_rsa.jks DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/application-roles.properties DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/application-users.properties DESTINATION "${JBOSS_HOME}/server/conf")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/infinispan-ca.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore_client.p12 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/malicious_client.p12 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore_server_sni1_rsa.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore_server_sni2_rsa.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/malicious.pem DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/test/resources/proto2" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION}" PATTERN "*")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/wordCountStream.js DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/macbeth.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/${PLATFORM}/${CONFIGURATION})
file(MAKE_DIRECTORY "${JBOSS_HOME}/server1")
file(COPY "${JBOSS_HOME}/server/conf" DESTINATION "${JBOSS_HOME}/server1")
if(WIN32)
# Pass the updated path using an external script.
file(TO_NATIVE_PATH "${NUNIT_BINARY}" NUNIT_NATIVE_BINARY)
configure_file(templates/nunit.bat.in nunit.bat)
add_test(NAME csharp_tests_default COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ DefaultTestSuite TestResult-default.xml)
add_test(NAME csharp_tests_security COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ SecurityTestSuite TestResult-security.xml)
add_test(NAME csharp_tests_authentication COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ AuthenticationTestSuite TestResult-authentication.xml)
# #add_test(NAME csharp_tests_compatibility COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ CompatibilityModeTestSuite TestResult-compatibility.xml)
add_test(NAME csharp_tests_query COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ RemoteQueryTestSuite TestResult-query.xml)
add_test(NAME csharp_tests_counter COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ CounterTestSuite TestResult-counter.xml)
add_test(NAME csharp_tests_counter_with_listener COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ CounterWithListenerTestSuite TestResult-counter.xml)
add_test(NAME csharp_tests_cluster COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ ClusterTestSuite TestResult-cluster.xml)
add_test(NAME csharp_tests_adminop COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ AdminOpTestSuite TestResult-adminop.xml)
# Skipping xsite testing for now
# add_test(NAME csharp_tests_xsite COMMAND nunit.bat bin/${PLATFORM}/$<CONFIG>/ XSiteTestSuite TestResult-xsite.xml)
else(WIN32)
add_test(csharp_unittests ${MONO_BINARY} ${NUNIT_BINARY} hotrodcs-tests.dll)
set_tests_properties(csharp_unittests PROPERTIES ENVIRONMENT "JBOSS_HOME=${HOTROD_JBOSS_HOME}")
endif(WIN32)
endif(NOT DEFINED ENABLE_CSHARP_TESTING OR ENABLE_CSHARP_TESTING)
endif(WIN32) # / Needed for prebuild on windows
# ## Packaging. ###
set(CPACK_GENERATOR "WIX")
set(CPACK_SOURCE_GENERATOR "ZIP")
# Native client.
if(WIN32 AND NOT DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/swig/native_client/lib/hotrod.dll" DESTINATION lib/)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/swig/native_client/lib/hotrod.lib" DESTINATION lib/)
# Native wrapper.
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/swig/$<CONFIG>/hotrod_wrap.dll" DESTINATION lib/ OPTIONAL)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/swig/$<CONFIG>/hotrod_wrap.lib" DESTINATION lib/ OPTIONAL)
# Native wrapper.
# Managed wrapper.
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/hotrodcs.dll" DESTINATION lib/)
# Managed wrapper API doc for IDE.
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/hotrodcs.xml" DESTINATION lib/)
# Dependencies.
file(TO_CMAKE_PATH ${GOOGLE_PROTOBUF_NUPKG} CM_GOOGLE_PROTOBUF_NUPKG)
file(TO_CMAKE_PATH ${PROTOBUF_PROTOC_EXECUTABLE_CS} CM_PROTOBUF_PROTOC_EXECUTABLE_CS)
install(FILES "${NLOG_DLL_LOCAL}" DESTINATION lib/)
install(FILES "${NLOG_LICENSE_LOCAL}" DESTINATION lib/ OPTIONAL)
install(FILES "${CM_GOOGLE_PROTOBUF_NUPKG}/Google.Protobuf.3.8.0/lib/net45/Google.Protobuf.dll" DESTINATION lib/)
install(FILES "${CM_PROTOBUF_PROTOC_EXECUTABLE_CS}" DESTINATION bin/)
endif(WIN32 AND NOT DEFINED ENV{HOTROD_PREBUILT_LIB_DIR})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/README.txt.in" README.txt NEWLINE_STYLE CRLF)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/License.txt" License.txt NEWLINE_STYLE CRLF)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/License.rtf" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/License.txt"
"${CMAKE_CURRENT_BINARY_DIR}/README.txt"
DESTINATION .)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs DESTINATION ${SHARE_INSTALL_PREFIX}/)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/wix.xml.in" wix.xml)
set(CPACK_WIX_TEMPLATE "wix.xml")
set(CPACK_WIX_UPGRADE_GUID "7cc17657-80b5-417f-9209-710682f852f4") # This value should not change.
set(CPACK_SOURCE_IGNORE_FILES "/build.*/;/\\\\.git/")
# Bundle-specific properties (see wix-bundle.cmake).
if(DEFINED HOTROD_BUILD_BUNDLE OR DEFINED ENV{HOTROD_BUILD_BUNDLE})
if(NOT DEFINED HOTROD_VCREDIST_x86)
if(DEFINED ENV{HOTROD_VCREDIST_x86})
set(HOTROD_VCREDIST_x86 "$ENV{HOTROD_VCREDIST_x86}")
else()
message(FATAL_ERROR "When building a bundle you need to point HOTROD_VCREDIST_x86 to the corresponding VC++ x86 runtime to be included in the bundle.")
endif()
endif()
if(NOT DEFINED HOTROD_VCREDIST_x64)
if(DEFINED ENV{HOTROD_VCREDIST_x64})
set(HOTROD_VCREDIST_x64 "$ENV{HOTROD_VCREDIST_x64}")
else()
message(FATAL_ERROR "When building a bundle you need to point HOTROD_VCREDIST_x64 to the corresponding VC++ x64 runtime to be included in the bundle.")
endif()
endif()
if(NOT DEFINED HOTROD_DOTNET)
if(DEFINED ENV{HOTROD_DOTNET})
set(HOTROD_DOTNET "$ENV{HOTROD_DOTNET}")
else()
message(FATAL_ERROR "When building a bundle you need to point HOTROD_DOTNET to the corresponding .NET runtime to be included in the bundle.")
endif()
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/wix-bundle.xml.in" wix-bundle.xml)
endif()
include(CPack)
if(ENABLE_DOXYGEN)
# ## Documentation ###
find_package(Doxygen)
if(DOXYGEN_FOUND)
# -- Configure the Template Doxyfile for our specific project
configure_file(templates/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE)
# Delete any previously generated docs
if(EXISTS ${CMAKE_BINARY_DIR}/api_docs)
file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/api_docs)
endif(EXISTS ${CMAKE_BINARY_DIR}/api_docs)
# -- Add a custom target to run Doxygen when ever the project is built
add_custom_target(docs ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
# Include the API docs in the package.
install(FILES ${CMAKE_BINARY_DIR}/api_docs/html/ DESTINATION docs/api)
endif(DOXYGEN_FOUND)
endif(ENABLE_DOXYGEN)