From ead24da5e0b792275ef6ec0a97ab5fc3c7b9e630 Mon Sep 17 00:00:00 2001 From: Ravindranath Kakarla Date: Thu, 23 Jun 2022 21:39:43 -0700 Subject: [PATCH] Fix C# module to build on Windows. --- native-schema-registry/c/CMakeLists.txt | 5 ++++ native-schema-registry/c/src/CMakeLists.txt | 17 +++++++------ native-schema-registry/c/test/CMakeLists.txt | 17 +++++++------ .../csharp/AWSGsrSerDe/AWSGsrSerDe.sln | 19 ++++++++++++-- .../AWSGsrSerDe/AWSGsrSerDe.csproj | 2 ++ .../csharp/AWSGsrSerDe/Libs/Libs.projitems | 25 +++++++++++++++++++ .../csharp/AWSGsrSerDe/Libs/Libs.shproj | 13 ++++++++++ .../services/schemaregistry/DataTypes.java | 2 +- native-schema-registry/target/.ignore | 1 + 9 files changed, 83 insertions(+), 18 deletions(-) create mode 100644 native-schema-registry/csharp/AWSGsrSerDe/Libs/Libs.projitems create mode 100644 native-schema-registry/csharp/AWSGsrSerDe/Libs/Libs.shproj create mode 100644 native-schema-registry/target/.ignore diff --git a/native-schema-registry/c/CMakeLists.txt b/native-schema-registry/c/CMakeLists.txt index 1e8183fc..11c29a9a 100644 --- a/native-schema-registry/c/CMakeLists.txt +++ b/native-schema-registry/c/CMakeLists.txt @@ -20,6 +20,11 @@ ELSE() set(LIB_NATIVE_SCHEMA_REGISTRY_LIBRARY_NAME ${LIB_NATIVE_SCHEMA_REGISTRY_LIBRARY_NAME_PREFIX}.so) ENDIF() +set(DATA_TYPES_MODULE_NAME native_schema_registry_c_data_types) +set(SERDE_MODULE_NAME native_schema_registry_c) +set(NATIVE_SCHEMA_REGISTRY_MODULE_NAME libnativeschemaregistry) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + add_subdirectory("src") include (CTest) enable_testing() diff --git a/native-schema-registry/c/src/CMakeLists.txt b/native-schema-registry/c/src/CMakeLists.txt index d0c065fc..d9703546 100644 --- a/native-schema-registry/c/src/CMakeLists.txt +++ b/native-schema-registry/c/src/CMakeLists.txt @@ -1,8 +1,3 @@ -set(DATA_TYPES_MODULE_NAME native_schema_registry_c_data_types) -set(SERDE_MODULE_NAME native_schema_registry_c) -set(NATIVE_SCHEMA_REGISTRY_MODULE_NAME libnativeschemaregistry) -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - #Fix the include path in GraalVM generated header file. execute_process(COMMAND sed -ie "s//\"graal_isolate.h\"/" ${LIB_NATIVE_SCHEMA_REGISTRY_PATH}/libnativeschemaregistry.h) @@ -15,6 +10,12 @@ add_library( read_only_byte_array.c mutable_byte_array.c ) +add_custom_command( + TARGET ${DATA_TYPES_MODULE_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ ${LIB_NATIVE_SCHEMA_REGISTRY_PATH}/ + COMMAND ${CMAKE_COMMAND} -E copy $ ${LIB_NATIVE_SCHEMA_REGISTRY_PATH}/ +) #Add reference to the GraalVM generated Native schema registry module. add_library( @@ -52,9 +53,9 @@ file( #####CSharp set(CSHARP_MODULE_NAME GsrSerDeCsGen) -set(CSHARP_SOURCE_PATH ${PROJECT_SOURCE_DIR}/../csharp/AWSGsrSerDe/AWSGsrSerDe/) -set(CSHARP_GEN_LIB_PATH ${CSHARP_SOURCE_PATH}/bin/) - +set(CSHARP_ROOT_PATH ${PROJECT_SOURCE_DIR}/../csharp/AWSGsrSerDe) +set(CSHARP_SOURCE_PATH ${CSHARP_ROOT_PATH}/AWSGsrSerDe/) +set(CSHARP_GEN_LIB_PATH ${CSHARP_ROOT_PATH}/Libs/) swig_add_library( ${CSHARP_MODULE_NAME} TYPE SHARED diff --git a/native-schema-registry/c/test/CMakeLists.txt b/native-schema-registry/c/test/CMakeLists.txt index cb33b260..6535e359 100644 --- a/native-schema-registry/c/test/CMakeLists.txt +++ b/native-schema-registry/c/test/CMakeLists.txt @@ -11,18 +11,21 @@ list( mutable_byte_array_test ) -foreach (test ${tests}) +foreach (test ${tests}) add_executable( "${test}" "${test}.c" ) target_link_libraries( "${test}" - native_schema_registry_c_data_types - native_schema_registry_c - ${LIB_NATIVE_SCHEMA_REGISTRY_PATH}/${LIB_NATIVE_SCHEMA_REGISTRY_LIBRARY_NAME} - cmocka + "${DATA_TYPES_MODULE_NAME}" + "cmocka" ) - add_test(NAME "${test}" COMMAND "${test}") -endforeach () \ No newline at end of file + add_test(NAME "${test}" COMMAND "${test}" ${CMAKE_CURRENT_BINARY_DIR}) +endforeach () + +add_custom_target(copy-libs-for-tests ALL + COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}/ + COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}/ +) \ No newline at end of file diff --git a/native-schema-registry/csharp/AWSGsrSerDe/AWSGsrSerDe.sln b/native-schema-registry/csharp/AWSGsrSerDe/AWSGsrSerDe.sln index a4fe192a..8cd75150 100644 --- a/native-schema-registry/csharp/AWSGsrSerDe/AWSGsrSerDe.sln +++ b/native-schema-registry/csharp/AWSGsrSerDe/AWSGsrSerDe.sln @@ -1,8 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AWSGsrSerDe", "AWSGsrSerDe\AWSGsrSerDe.csproj", "{A36E4C3C-B7C4-4670-90B1-2FC9D883CCD0}" +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32616.157 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSGsrSerDe", "AWSGsrSerDe\AWSGsrSerDe.csproj", "{A36E4C3C-B7C4-4670-90B1-2FC9D883CCD0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AWSGsrSerDe.Tests", "AWSGsrSerDe.Tests\AWSGsrSerDe.Tests.csproj", "{AD987D8A-EC56-47E8-837F-4D2A9E4ABA6C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AWSGsrSerDe.Tests", "AWSGsrSerDe.Tests\AWSGsrSerDe.Tests.csproj", "{AD987D8A-EC56-47E8-837F-4D2A9E4ABA6C}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Libs", "Libs\Libs.shproj", "{5801DEDB-DA53-4B21-91CC-E31B118C8029}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -19,4 +24,14 @@ Global {AD987D8A-EC56-47E8-837F-4D2A9E4ABA6C}.Release|Any CPU.ActiveCfg = Release|Any CPU {AD987D8A-EC56-47E8-837F-4D2A9E4ABA6C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1048530E-CE84-4D97-A3E1-8AFB8946267B} + EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + Libs\Libs.projitems*{5801dedb-da53-4b21-91cc-e31b118c8029}*SharedItemsImports = 13 + Libs\Libs.projitems*{a36e4c3c-b7c4-4670-90b1-2fc9d883ccd0}*SharedItemsImports = 5 + EndGlobalSection EndGlobal diff --git a/native-schema-registry/csharp/AWSGsrSerDe/AWSGsrSerDe/AWSGsrSerDe.csproj b/native-schema-registry/csharp/AWSGsrSerDe/AWSGsrSerDe/AWSGsrSerDe.csproj index 9fd3f679..02636c76 100644 --- a/native-schema-registry/csharp/AWSGsrSerDe/AWSGsrSerDe/AWSGsrSerDe.csproj +++ b/native-schema-registry/csharp/AWSGsrSerDe/AWSGsrSerDe/AWSGsrSerDe.csproj @@ -8,4 +8,6 @@ + + diff --git a/native-schema-registry/csharp/AWSGsrSerDe/Libs/Libs.projitems b/native-schema-registry/csharp/AWSGsrSerDe/Libs/Libs.projitems new file mode 100644 index 00000000..587c3337 --- /dev/null +++ b/native-schema-registry/csharp/AWSGsrSerDe/Libs/Libs.projitems @@ -0,0 +1,25 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + 5801dedb-da53-4b21-91cc-e31b118c8029 + + + Libs + + + + Always + + + Always + + + Always + + + Always + + + \ No newline at end of file diff --git a/native-schema-registry/csharp/AWSGsrSerDe/Libs/Libs.shproj b/native-schema-registry/csharp/AWSGsrSerDe/Libs/Libs.shproj new file mode 100644 index 00000000..14e42d45 --- /dev/null +++ b/native-schema-registry/csharp/AWSGsrSerDe/Libs/Libs.shproj @@ -0,0 +1,13 @@ + + + + 5801dedb-da53-4b21-91cc-e31b118c8029 + 14.0 + + + + + + + + diff --git a/native-schema-registry/src/main/java/com/amazonaws/services/schemaregistry/DataTypes.java b/native-schema-registry/src/main/java/com/amazonaws/services/schemaregistry/DataTypes.java index b6d53a4e..5fdd000d 100644 --- a/native-schema-registry/src/main/java/com/amazonaws/services/schemaregistry/DataTypes.java +++ b/native-schema-registry/src/main/java/com/amazonaws/services/schemaregistry/DataTypes.java @@ -21,7 +21,7 @@ public class DataTypes { static class HandlerDirectives implements CContext.Directives { public static final String INCLUDE_PATH = "c/include/"; - public static final String LIB_PATH = "c/build/src/"; + public static final String LIB_PATH = "target/"; //Intentionally blank. public static final String PROJECT_NAME = ""; diff --git a/native-schema-registry/target/.ignore b/native-schema-registry/target/.ignore new file mode 100644 index 00000000..0073127c --- /dev/null +++ b/native-schema-registry/target/.ignore @@ -0,0 +1 @@ +#Intentionally empty for build to work as expected