geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [geode-native] branch develop updated: GEODE-4968: Further templatizing CMake product name (#262)
Date Fri, 06 Apr 2018 16:40:45 GMT
This is an automated email from the ASF dual-hosted git repository.

jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 8bf8630  GEODE-4968: Further templatizing CMake product name (#262)
8bf8630 is described below

commit 8bf863096a647aa811fc0d1c5ca94ca64ea12eb5
Author: Ryan McMahon <rmcmahon@pivotal.io>
AuthorDate: Fri Apr 6 09:40:42 2018 -0700

    GEODE-4968: Further templatizing CMake product name (#262)
    
    * GEODE-4968: Templatizing other cmake variables
    
    Signed-off-by: Michael Oleske <moleske@pivotal.io>
    
    * GEODE-4968: One more missing templatized variable
    
    Signed-off-by: Ryan McMahon <rmcmahon@pivotal.io>
    
    * GEODE-4968: Fixing serializer registration in dotnet example
    
    Signed-off-by: Michael Oleske <moleske@pivotal.io>
    
    * GEODE-4968: don't add dotnet to examples if not windows
    
    * GEODE-4968: Update auto serializer registration
    
    * GEODE-4968: Templatize ROOT cmake var
    
    Signed-off-by: Ryan McMahon <rmcmahon@pivotal.io>
    
    * GEODE-4968: Better directory variable name
    
    Signed-off-by: Michael Oleske <moleske@pivotal.io>
    
    * GEODE-4968: Templatizing remaining templatizable variables
---
 examples/CMakeLists.txt                          |   5 +-
 examples/CMakeLists.txt.in                       |   2 +-
 examples/cmake/FindGeodeNative.cmake.in          | 121 +++++++++++------------
 examples/cpp/CMakeLists.txt.cpp_example.in       |   2 +-
 examples/cpp/CMakeLists.txt.in                   |   2 +-
 examples/dotnet/CMakeLists.txt                   |   2 +-
 examples/dotnet/CMakeLists.txt.dotnet_example.in |   4 +-
 examples/dotnet/CMakeLists.txt.in                |   2 +-
 examples/dotnet/PdxAutoSerializer/Program.cs     |  10 +-
 9 files changed, 76 insertions(+), 74 deletions(-)

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 83fa1bb..0566b6c 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -18,8 +18,11 @@ cmake_minimum_required(VERSION 3.10)
 project(examples LANGUAGES NONE)
 
 string(REPLACE " " "" PRODUCT_NAME_NOSPACE ${PRODUCT_NAME})
+if (BUILD_CLI)
+  set(DOTNET_SUB_DIRECTORY "add_subdirectory(dotnet)")
+endif()
 
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
COPYONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
@ONLY)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGeodeNative.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/Find${PRODUCT_NAME_NOSPACE}.cmake
@ONLY)
 
 install(FILES
diff --git a/examples/CMakeLists.txt.in b/examples/CMakeLists.txt.in
index 6a9be68..f124022 100644
--- a/examples/CMakeLists.txt.in
+++ b/examples/CMakeLists.txt.in
@@ -18,4 +18,4 @@ cmake_minimum_required(VERSION 3.10)
 project(examples LANGUAGES NONE)
 
 add_subdirectory(cpp)
-add_subdirectory(dotnet)
+@DOTNET_SUB_DIRECTORY@
diff --git a/examples/cmake/FindGeodeNative.cmake.in b/examples/cmake/FindGeodeNative.cmake.in
index aca0650..33b947d 100644
--- a/examples/cmake/FindGeodeNative.cmake.in
+++ b/examples/cmake/FindGeodeNative.cmake.in
@@ -14,55 +14,54 @@
 # limitations under the License.
 
 #.rst:
-# FindGeodeNative
+# Find@PRODUCT_NAME_NOSPACE@
 # ---------
 #
-# Find the Geode Native headers and library.
+# Find the @PRODUCT_NAME@ headers and library.
 #
 # Imported Targets
 # ^^^^^^^^^^^^^^^^
 #
 # This module defines the following :prop_tgt:`IMPORTED` targets:
 #
-# ``GeodeNative::cpp``
-# ``GeodeNative:dotnet``
+# ``@PRODUCT_NAME_NOSPACE@::cpp``
+# ``@PRODUCT_NAME_NOSPACE@:dotnet``
 #
 # Result Variables
 # ^^^^^^^^^^^^^^^^
 #
 # This module will set the following variables in your project:
 #
-# ``GeodeNative_FOUND``
-#   true if the Geode Native headers and libraries were found.
+# ``@PRODUCT_NAME_NOSPACE@_FOUND``
+#   true if the @PRODUCT_NAME@ headers and libraries were found.
 #
-# ``GeodeNative_DOTNET_LIBRARY``
+# ``@PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY``
 #   Path to .NET assembly file.
 #
 
-set(_GEODE_NATIVE_ROOT "")
-if(GeodeNative_ROOT AND IS_DIRECTORY "${GeodeNative_ROOT}")
-    set(_GEODE_NATIVE_ROOT "${GeodeNative_ROOT}")
-    set(_GEODE_NATIVE_ROOT_EXPLICIT 1)
+set(_@PRODUCT_NAME_NOSPACE@_ROOT "")
+if(@PRODUCT_NAME_NOSPACE@_ROOT AND IS_DIRECTORY "${@PRODUCT_NAME_NOSPACE@_ROOT}")
+    set(_@PRODUCT_NAME_NOSPACE@_ROOT "${@PRODUCT_NAME_NOSPACE@_ROOT}")
+    set(_@PRODUCT_NAME_NOSPACE@_ROOT_EXPLICIT 1)
 else()
-    set(_ENV_GEODE_NATIVE_ROOT "")
+    set(_ENV_@PRODUCT_NAME_NOSPACE@_ROOT "")
     if(DEFINED ENV{GFCPP})
-        file(TO_CMAKE_PATH "$ENV{GFCPP}" _ENV_GEODE_NATIVE_ROOT)
+        file(TO_CMAKE_PATH "$ENV{GFCPP}" _ENV_@PRODUCT_NAME_NOSPACE@_ROOT)
     endif()
-    if(_ENV_GEODE_NATIVE_ROOT AND IS_DIRECTORY "${_ENV_GEODE_NATIVE_ROOT}")
-        set(_GEODE_NATIVE_ROOT "${_ENV_GEODE_NATIVE_ROOT}")
-        set(_GEODE_NATIVE_ROOT_EXPLICIT 0)
+    if(_ENV_@PRODUCT_NAME_NOSPACE@_ROOT AND IS_DIRECTORY "${_ENV_@PRODUCT_NAME_NOSPACE@_ROOT}")
+        set(_@PRODUCT_NAME_NOSPACE@_ROOT "${_ENV_@PRODUCT_NAME_NOSPACE@_ROOT}")
+        set(_@PRODUCT_NAME_NOSPACE@_ROOT_EXPLICIT 0)
     endif()
-    unset(_ENV_GEODE_NATIVE_ROOT)
+    unset(_ENV_@PRODUCT_NAME_NOSPACE@_ROOT)
 endif()
 
-set(_GEODE_NATIVE_HINTS)
-set(_GEODE_NATIVE_PATHS)
+set(_@PRODUCT_NAME_NOSPACE@_HINTS)
+set(_@PRODUCT_NAME_NOSPACE@_PATHS)
 
-if(_GEODE_NATIVE_ROOT)
-    set(_GEODE_NATIVE_HINTS ${_GEODE_NATIVE_ROOT})
-    set(_GEODE_NATIVE_HINTS ${_GEODE_NATIVE_ROOT})
+if(_@PRODUCT_NAME_NOSPACE@_ROOT)
+    set(_@PRODUCT_NAME_NOSPACE@_HINTS ${_@PRODUCT_NAME_NOSPACE@_ROOT})
 else()
-    set(_GEODE_NATIVE_PATHS (
+    set(_@PRODUCT_NAME_NOSPACE@_PATHS (
         "/opt/local"
         "/usr/local"
         "${CMAKE_CURRENT_SOURCE_DIR}/../../../"
@@ -70,73 +69,73 @@ else()
 endif()
 
 # Begin - component "cpp"
-set(_GEODE_NATIVE_CPP_NAMES @PRODUCT_LIB_NAME@)
+set(_@PRODUCT_NAME_NOSPACE@_CPP_NAMES @PRODUCT_LIB_NAME@)
 
-find_library(GeodeNative_CPP_LIBRARY
-    NAMES ${_GEODE_NATIVE_CPP_NAMES}
-    HINTS ${_GEODE_NATIVE_HINTS}
-    PATHS ${_GEODE_NATIVE_PATHS}
-    PATH_SUFFIXES geode-native/lib lib 
+find_library(@PRODUCT_NAME_NOSPACE@_CPP_LIBRARY
+    NAMES ${_@PRODUCT_NAME_NOSPACE@_CPP_NAMES}
+    HINTS ${_@PRODUCT_NAME_NOSPACE@_HINTS}
+    PATHS ${_@PRODUCT_NAME_NOSPACE@_PATHS}
+    PATH_SUFFIXES @PRODUCT_LIB_NAME@/lib lib
 )
 
 # Look for the header file.
-find_path(GeodeNative_CPP_INCLUDE_DIR NAMES geode/CacheFactory.hpp
-    HINTS ${_GEODE_NATIVE_HINTS}
-    PATHS ${_GEODE_NATIVE_PATHS}
-    PATH_SUFFIXES geode-native/include include
+find_path(@PRODUCT_NAME_NOSPACE@_CPP_INCLUDE_DIR NAMES geode/CacheFactory.hpp
+    HINTS ${_@PRODUCT_NAME_NOSPACE@_HINTS}
+    PATHS ${_@PRODUCT_NAME_NOSPACE@_PATHS}
+    PATH_SUFFIXES @PRODUCT_LIB_NAME@/include include
 )
 # End - component "cpp"
 
 # Begin - component "dotnet"
-set(_GEODE_NATIVE_DOTNET_NAMES @PRODUCT_DLL_NAME@.dll)
+set(_@PRODUCT_NAME_NOSPACE@_DOTNET_NAMES @PRODUCT_DLL_NAME@.dll)
 
-find_file(GeodeNative_DOTNET_LIBRARY
-  NAMES ${_GEODE_NATIVE_DOTNET_NAMES}
-  HINTS ${_GEODE_NATIVE_HINTS}
-  PATHS ${_GEODE_NATIVE_PATHS}
-  PATH_SUFFIXES geode-native/bin bin 
+find_file(@PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY
+  NAMES ${_@PRODUCT_NAME_NOSPACE@_DOTNET_NAMES}
+  HINTS ${_@PRODUCT_NAME_NOSPACE@_HINTS}
+  PATHS ${_@PRODUCT_NAME_NOSPACE@_PATHS}
+  PATH_SUFFIXES @PRODUCT_LIB_NAME@/bin bin
 )
 # End - component "dotnet"
 
 # TODO find version
-set(GEODE_NATIVE_VERSION_STRING 1.0)
+set(@PRODUCT_NAME_NOSPACE@_VERSION_STRING 1.0)
 
-if (GeodeNative_FIND_COMPONENTS)
-  set(_GEODE_NATIVE_REQUIRED_VARS)
-  foreach (component ${GeodeNative_FIND_COMPONENTS})
+if (@PRODUCT_NAME_NOSPACE@_FIND_COMPONENTS)
+  set(_@PRODUCT_NAME_NOSPACE@_REQUIRED_VARS)
+  foreach (component ${@PRODUCT_NAME_NOSPACE@_FIND_COMPONENTS})
     if (component STREQUAL "cpp")
-      list(APPEND _GEODE_NATIVE_REQUIRED_VARS GeodeNative_CPP_LIBRARY GeodeNative_CPP_INCLUDE_DIR)
+      list(APPEND _@PRODUCT_NAME_NOSPACE@_REQUIRED_VARS @PRODUCT_NAME_NOSPACE@_CPP_LIBRARY
@PRODUCT_NAME_NOSPACE@_CPP_INCLUDE_DIR)
     endif()
     if (component STREQUAL "dotnet")
-      list(APPEND _GEODE_NATIVE_REQUIRED_VARS GeodeNative_DOTNET_LIBRARY)
+      list(APPEND _@PRODUCT_NAME_NOSPACE@_REQUIRED_VARS @PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY)
     endif()
   endforeach()
 endif()
 
 include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GeodeNative
-                                  REQUIRED_VARS ${_GEODE_NATIVE_REQUIRED_VARS}
-                                  VERSION_VAR GEODE_NATIVE_VERSION_STRING)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(@PRODUCT_NAME_NOSPACE@
+                                  REQUIRED_VARS ${_@PRODUCT_NAME_NOSPACE@_REQUIRED_VARS}
+                                  VERSION_VAR @PRODUCT_NAME_NOSPACE@_VERSION_STRING)
 
 # Copy the results to the output variables and target.
-if(GeodeNative_FOUND)
-  if(NOT TARGET ${GEODE_NATIVE_CPP_TARGET})
-    set(GEODE_NATIVE_CPP_TARGET "GeodeNative::cpp")
-    add_library(${GEODE_NATIVE_CPP_TARGET} UNKNOWN IMPORTED)
-    set_target_properties(${GEODE_NATIVE_CPP_TARGET} PROPERTIES
+if(@PRODUCT_NAME_NOSPACE@_FOUND)
+  if(NOT TARGET ${@PRODUCT_NAME_NOSPACE@_CPP_TARGET})
+    set(@PRODUCT_NAME_NOSPACE@_CPP_TARGET "@PRODUCT_NAME_NOSPACE@::cpp")
+    add_library(${@PRODUCT_NAME_NOSPACE@_CPP_TARGET} UNKNOWN IMPORTED)
+    set_target_properties(${@PRODUCT_NAME_NOSPACE@_CPP_TARGET} PROPERTIES
       IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
-      IMPORTED_LOCATION "${GeodeNative_CPP_LIBRARY}"
-      INTERFACE_INCLUDE_DIRECTORIES "${GeodeNative_CPP_INCLUDE_DIR}")
+      IMPORTED_LOCATION "${@PRODUCT_NAME_NOSPACE@_CPP_LIBRARY}"
+      INTERFACE_INCLUDE_DIRECTORIES "${@PRODUCT_NAME_NOSPACE@_CPP_INCLUDE_DIR}")
   endif()
-  if(NOT TARGET ${GEODE_NATIVE_DOTNET_TARGET})
-    set(GEODE_NATIVE_DOTNET_TARGET "GeodeNative::dotnet")
-    add_library(${GEODE_NATIVE_DOTNET_TARGET} UNKNOWN IMPORTED)
-    set_target_properties(${GEODE_NATIVE_DOTNET_TARGET} PROPERTIES
+  if(NOT TARGET ${@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET})
+    set(@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET "@PRODUCT_NAME_NOSPACE@::dotnet")
+    add_library(${@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET} UNKNOWN IMPORTED)
+    set_target_properties(${@PRODUCT_NAME_NOSPACE@_DOTNET_TARGET} PROPERTIES
       IMPORTED_LINK_INTERFACE_LANGUAGES "CSharp"
-      IMPORTED_LOCATION "${GeodeNative_DOTNET_LIBRARY}")
+      IMPORTED_LOCATION "${@PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY}")
   endif()
 else()
   message(STATUS "FOUND var not set")
 endif()
 
-mark_as_advanced(GeodeNative_CPP_INCLUDE_DIR GeodeNative_CPP_LIBRARY GeodeNative_DOTNET_LIBRARY)
+mark_as_advanced(@PRODUCT_NAME_NOSPACE@_CPP_INCLUDE_DIR @PRODUCT_NAME_NOSPACE@_CPP_LIBRARY
@PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY)
diff --git a/examples/cpp/CMakeLists.txt.cpp_example.in b/examples/cpp/CMakeLists.txt.cpp_example.in
index 5fdbdde..c39ad9f 100644
--- a/examples/cpp/CMakeLists.txt.cpp_example.in
+++ b/examples/cpp/CMakeLists.txt.cpp_example.in
@@ -31,4 +31,4 @@ add_executable(${PROJECT_NAME} @ADD_EXAMPLE_SOURCE@)
 
 target_link_libraries(${PROJECT_NAME}
     PUBLIC
-    GeodeNative::cpp)
+    @PRODUCT_NAME_NOSPACE@::cpp)
diff --git a/examples/cpp/CMakeLists.txt.in b/examples/cpp/CMakeLists.txt.in
index 883a8b0..0af6f2c 100644
--- a/examples/cpp/CMakeLists.txt.in
+++ b/examples/cpp/CMakeLists.txt.in
@@ -15,7 +15,7 @@
 
 cmake_minimum_required(VERSION 3.10)
 
-project(examples LANGUAGES NONE)
+project(@PRODUCT_DLL_NAME@.Cpp.Examples LANGUAGES NONE)
 
 add_subdirectory(customserializable)
 add_subdirectory(customserializer)
diff --git a/examples/dotnet/CMakeLists.txt b/examples/dotnet/CMakeLists.txt
index d5088ae..75c572b 100644
--- a/examples/dotnet/CMakeLists.txt
+++ b/examples/dotnet/CMakeLists.txt
@@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 3.10)
 
 project(examples LANGUAGES NONE)
 
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
COPYONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
@ONLY)
 
 install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
diff --git a/examples/dotnet/CMakeLists.txt.dotnet_example.in b/examples/dotnet/CMakeLists.txt.dotnet_example.in
index 26f23dd..cabc6aa 100644
--- a/examples/dotnet/CMakeLists.txt.dotnet_example.in
+++ b/examples/dotnet/CMakeLists.txt.dotnet_example.in
@@ -24,8 +24,8 @@ find_package(@PRODUCT_NAME_NOSPACE@ REQUIRED COMPONENTS dotnet)
 add_executable(${PROJECT_NAME} @ADD_EXAMPLE_SOURCE@)
 
 target_link_libraries(${PROJECT_NAME}
-    GeodeNative::dotnet)
+    @PRODUCT_NAME_NOSPACE@::dotnet)
 
 set_target_properties(${PROJECT_NAME} PROPERTIES
     VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
-    VS_DOTNET_REFERENCES "System;${GeodeNative_DOTNET_LIBRARY}")
+    VS_DOTNET_REFERENCES "System;${@PRODUCT_NAME_NOSPACE@_DOTNET_LIBRARY}")
diff --git a/examples/dotnet/CMakeLists.txt.in b/examples/dotnet/CMakeLists.txt.in
index 68076ce..fb4695d 100644
--- a/examples/dotnet/CMakeLists.txt.in
+++ b/examples/dotnet/CMakeLists.txt.in
@@ -15,7 +15,7 @@
 
 cmake_minimum_required(VERSION 3.10)
 
-project(Apache.Geode.Examples LANGUAGES NONE)
+project(@PRODUCT_DLL_NAME@.DotNet.Examples LANGUAGES NONE)
 
 add_subdirectory(AuthInitialize)
 add_subdirectory(PdxAutoSerializer)
diff --git a/examples/dotnet/PdxAutoSerializer/Program.cs b/examples/dotnet/PdxAutoSerializer/Program.cs
index c5290f5..f7f6287 100644
--- a/examples/dotnet/PdxAutoSerializer/Program.cs
+++ b/examples/dotnet/PdxAutoSerializer/Program.cs
@@ -28,6 +28,10 @@ namespace Apache.Geode.Examples.Serializer
                 .Set("log-level", "none");
             var cache = cacheFactory.Create();
 
+            Console.WriteLine("Registering for reflection-based auto serialization");
+
+            cache.TypeRegistry.PdxSerializer = new ReflectionBasedAutoSerializer();
+
             var poolFactory = cache.GetPoolFactory()
                 .AddLocator("localhost", 10334);
             poolFactory.Create("pool", cache);
@@ -36,14 +40,10 @@ namespace Apache.Geode.Examples.Serializer
                 .SetPoolName("pool");
             var orderRegion = regionFactory.Create<int, Order>("example_orderobject");
 
-            Serializable.RegisterPdxSerializer(new ReflectionBasedAutoSerializer());
-
-            Console.WriteLine("Registering for reflection-based auto serialization");
-
             Console.WriteLine("Storing order object in the region");
 
             const int orderKey = 65;
-                
+
             var order = new Order(orderKey, "Vox AC30", 11);
 
             Console.WriteLine("order to put is " + order);

-- 
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.

Mime
View raw message