You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/04/03 17:10:29 UTC
[geode-native] branch develop updated: GEODE-4968: Parameterized
product names in Find module (#253)
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 a923bf9 GEODE-4968: Parameterized product names in Find module (#253)
a923bf9 is described below
commit a923bf9606b97f514c2d3ec74130df00b1d12535
Author: Ryan McMahon <rm...@pivotal.io>
AuthorDate: Tue Apr 3 10:10:27 2018 -0700
GEODE-4968: Parameterized product names in Find module (#253)
- Add example generation to top-level CMakeLists.txt
- Only include dotnet on windows
Signed-off-by: Ryan McMahon <mc...@gmail.com>
Signed-off-by: Michael Oleske <mo...@pivotal.io>
---
CMakeLists.txt | 6 ++--
examples/CMakeLists.txt | 16 ++++++++-
examples/{CMakeLists.txt => CMakeLists.txt.in} | 0
...dGeodeNative.cmake => FindGeodeNative.cmake.in} | 4 +--
examples/cpp/CMakeLists.txt | 40 +++++++++++++++++++--
...MakeLists.txt => CMakeLists.txt.cpp_example.in} | 8 ++---
examples/cpp/{CMakeLists.txt => CMakeLists.txt.in} | 0
examples/cpp/customserializer/CMakeLists.txt | 37 -------------------
examples/cpp/put-get-remove/CMakeLists.txt | 34 ------------------
examples/dotnet/AuthInitialize/CMakeLists.txt | 33 -----------------
examples/dotnet/CMakeLists.txt | 42 +++++++++++++++++++---
...eLists.txt => CMakeLists.txt.dotnet_example.in} | 7 ++--
.../dotnet/{CMakeLists.txt => CMakeLists.txt.in} | 0
examples/dotnet/PdxAutoSerializer/CMakeLists.txt | 33 -----------------
14 files changed, 101 insertions(+), 159 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26a8fe0..b283195 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,9 +4,9 @@
# 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.
@@ -263,12 +263,12 @@ add_subdirectory(sqliteimpl)
add_subdirectory(tests)
add_subdirectory(templates/security)
add_subdirectory(docs/api)
+add_subdirectory(examples)
if (${BUILD_CLI})
add_subdirectory(clicache)
add_subdirectory(plugins/SQLiteCLI)
endif()
-install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/examples/ DESTINATION examples)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/xsds/ DESTINATION xsds)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/defaultSystem/ DESTINATION defaultSystem)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 6a9be68..83fa1bb 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -17,5 +17,19 @@ cmake_minimum_required(VERSION 3.10)
project(examples LANGUAGES NONE)
+string(REPLACE " " "" PRODUCT_NAME_NOSPACE ${PRODUCT_NAME})
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt COPYONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGeodeNative.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake/Find${PRODUCT_NAME_NOSPACE}.cmake @ONLY)
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
+ DESTINATION examples)
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake/Find${PRODUCT_NAME_NOSPACE}.cmake
+ DESTINATION examples/cmake)
+
add_subdirectory(cpp)
-add_subdirectory(dotnet)
+if (BUILD_CLI)
+ add_subdirectory(dotnet)
+endif()
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt.in
similarity index 100%
copy from examples/CMakeLists.txt
copy to examples/CMakeLists.txt.in
diff --git a/examples/cmake/FindGeodeNative.cmake b/examples/cmake/FindGeodeNative.cmake.in
similarity index 97%
rename from examples/cmake/FindGeodeNative.cmake
rename to examples/cmake/FindGeodeNative.cmake.in
index fc1e0d5..aca0650 100644
--- a/examples/cmake/FindGeodeNative.cmake
+++ b/examples/cmake/FindGeodeNative.cmake.in
@@ -70,7 +70,7 @@ else()
endif()
# Begin - component "cpp"
-set(_GEODE_NATIVE_CPP_NAMES apache-geode)
+set(_GEODE_NATIVE_CPP_NAMES @PRODUCT_LIB_NAME@)
find_library(GeodeNative_CPP_LIBRARY
NAMES ${_GEODE_NATIVE_CPP_NAMES}
@@ -88,7 +88,7 @@ find_path(GeodeNative_CPP_INCLUDE_DIR NAMES geode/CacheFactory.hpp
# End - component "cpp"
# Begin - component "dotnet"
-set(_GEODE_NATIVE_DOTNET_NAMES Apache.Geode.dll)
+set(_GEODE_NATIVE_DOTNET_NAMES @PRODUCT_DLL_NAME@.dll)
find_file(GeodeNative_DOTNET_LIBRARY
NAMES ${_GEODE_NATIVE_DOTNET_NAMES}
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 883a8b0..12e7484 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -17,6 +17,40 @@ cmake_minimum_required(VERSION 3.10)
project(examples LANGUAGES NONE)
-add_subdirectory(customserializable)
-add_subdirectory(customserializer)
-add_subdirectory(put-get-remove)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt COPYONLY)
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
+ BUILDING.md
+ DESTINATION examples/cpp)
+
+function(add_example)
+ set(options)
+ set(oneValueArgs NAME)
+ set(multiValueArgs SOURCE)
+ cmake_parse_arguments(ADD_EXAMPLE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+
+ foreach(SOURCE ${ADD_EXAMPLE_SOURCE})
+ list(APPEND EXAMPLE_SOURCES_PATHS ${ADD_EXAMPLE_NAME}/${SOURCE})
+ endforeach()
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.cpp_example.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${ADD_EXAMPLE_NAME}/CMakeLists.txt
+ @ONLY)
+
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${ADD_EXAMPLE_NAME}/CMakeLists.txt
+ ${EXAMPLE_SOURCES_PATHS}
+ ${ADD_EXAMPLE_NAME}/startserver.sh
+ ${ADD_EXAMPLE_NAME}/stopserver.sh
+ DESTINATION examples/cpp/${ADD_EXAMPLE_NAME})
+endfunction()
+
+add_example(NAME customserializable
+ SOURCE main.cpp Order.cpp Order.hpp)
+
+add_example(NAME customserializer
+ SOURCE main.cpp Order.cpp Order.hpp OrderSerializer.cpp OrderSerializer.hpp)
+
+add_example(NAME put-get-remove
+ SOURCE main.cpp)
diff --git a/examples/cpp/customserializable/CMakeLists.txt b/examples/cpp/CMakeLists.txt.cpp_example.in
similarity index 87%
rename from examples/cpp/customserializable/CMakeLists.txt
rename to examples/cpp/CMakeLists.txt.cpp_example.in
index e87add3..5fdbdde 100644
--- a/examples/cpp/customserializable/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt.cpp_example.in
@@ -15,7 +15,7 @@
cmake_minimum_required(VERSION 3.5)
-project(customserializable LANGUAGES CXX)
+project(@ADD_EXAMPLE_NAME@ LANGUAGES CXX)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
set(CMAKE_CXX_STANDARD 11)
@@ -25,11 +25,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
endif()
-find_package(GeodeNative REQUIRED COMPONENTS cpp)
+find_package(@PRODUCT_NAME_NOSPACE@ REQUIRED COMPONENTS cpp)
-add_executable(${PROJECT_NAME}
- main.cpp
- Order.cpp)
+add_executable(${PROJECT_NAME} @ADD_EXAMPLE_SOURCE@)
target_link_libraries(${PROJECT_NAME}
PUBLIC
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt.in
similarity index 100%
copy from examples/cpp/CMakeLists.txt
copy to examples/cpp/CMakeLists.txt.in
diff --git a/examples/cpp/customserializer/CMakeLists.txt b/examples/cpp/customserializer/CMakeLists.txt
deleted file mode 100644
index 23bf07a..0000000
--- a/examples/cpp/customserializer/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-cmake_minimum_required(VERSION 3.5)
-
-project(customserializer LANGUAGES CXX)
-
-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
-set(CMAKE_CXX_STANDARD 11)
-
-if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
- add_compile_options(-m64)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
-endif()
-
-find_package(GeodeNative REQUIRED COMPONENTS cpp)
-
-add_executable(${PROJECT_NAME}
- main.cpp
- Order.cpp
- OrderSerializer.cpp)
-
-target_link_libraries(${PROJECT_NAME}
- PUBLIC
- GeodeNative::cpp)
diff --git a/examples/cpp/put-get-remove/CMakeLists.txt b/examples/cpp/put-get-remove/CMakeLists.txt
deleted file mode 100644
index 1750c5c..0000000
--- a/examples/cpp/put-get-remove/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.
-
-cmake_minimum_required(VERSION 3.5)
-
-project(put-get-remove LANGUAGES CXX)
-
-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
-set(CMAKE_CXX_STANDARD 11)
-
-if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
- add_compile_options(-m64)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
-endif()
-
-find_package(GeodeNative REQUIRED COMPONENTS cpp)
-
-add_executable(${PROJECT_NAME} main.cpp)
-
-target_link_libraries(${PROJECT_NAME}
- PUBLIC
- GeodeNative::cpp)
diff --git a/examples/dotnet/AuthInitialize/CMakeLists.txt b/examples/dotnet/AuthInitialize/CMakeLists.txt
deleted file mode 100644
index 1b55eaf..0000000
--- a/examples/dotnet/AuthInitialize/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-cmake_minimum_required(VERSION 3.10)
-
-project(AuthInitialize LANGUAGES CSharp)
-
-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
-
-find_package(GeodeNative REQUIRED COMPONENTS dotnet)
-
-add_executable(${PROJECT_NAME}
- Program.cs
- ExampleAuthInitialize.cs)
-
-target_link_libraries(${PROJECT_NAME}
- GeodeNative::dotnet)
-
-set_target_properties(${PROJECT_NAME} PROPERTIES
- VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
- VS_DOTNET_REFERENCES "System;${GeodeNative_DOTNET_LIBRARY}")
diff --git a/examples/dotnet/CMakeLists.txt b/examples/dotnet/CMakeLists.txt
index 68076ce..d5088ae 100644
--- a/examples/dotnet/CMakeLists.txt
+++ b/examples/dotnet/CMakeLists.txt
@@ -15,9 +15,43 @@
cmake_minimum_required(VERSION 3.10)
-project(Apache.Geode.Examples LANGUAGES NONE)
+project(examples LANGUAGES NONE)
-add_subdirectory(AuthInitialize)
-add_subdirectory(PdxAutoSerializer)
-add_subdirectory(PutGetRemove)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt COPYONLY)
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt
+ README.md
+ DESTINATION examples/dotnet)
+
+function(add_example)
+ set(options)
+ set(oneValueArgs NAME)
+ set(multiValueArgs SOURCE)
+ cmake_parse_arguments(ADD_EXAMPLE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+
+ foreach(SOURCE ${ADD_EXAMPLE_SOURCE})
+ list(APPEND EXAMPLE_SOURCES_PATHS ${ADD_EXAMPLE_NAME}/${SOURCE})
+ endforeach()
+
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.dotnet_example.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${ADD_EXAMPLE_NAME}/CMakeLists.txt
+ @ONLY)
+
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${ADD_EXAMPLE_NAME}/CMakeLists.txt
+ ${EXAMPLE_SOURCES_PATHS}
+ ${ADD_EXAMPLE_NAME}/README.md
+ ${ADD_EXAMPLE_NAME}/startserver.ps1
+ ${ADD_EXAMPLE_NAME}/stopserver.ps1
+ DESTINATION examples/dotnet/${ADD_EXAMPLE_NAME})
+endfunction()
+
+add_example(NAME AuthInitialize
+ SOURCE ExampleAuthInitialize.cs Program.cs)
+
+add_example(NAME PdxAutoSerializer
+ SOURCE Order.cs Program.cs)
+
+add_example(NAME PutGetRemove
+ SOURCE Program.cs)
diff --git a/examples/dotnet/PutGetRemove/CMakeLists.txt b/examples/dotnet/CMakeLists.txt.dotnet_example.in
similarity index 87%
rename from examples/dotnet/PutGetRemove/CMakeLists.txt
rename to examples/dotnet/CMakeLists.txt.dotnet_example.in
index 3e3329f..26f23dd 100644
--- a/examples/dotnet/PutGetRemove/CMakeLists.txt
+++ b/examples/dotnet/CMakeLists.txt.dotnet_example.in
@@ -15,14 +15,13 @@
cmake_minimum_required(VERSION 3.10)
-project(PutGetRemove LANGUAGES CSharp)
+project(@ADD_EXAMPLE_NAME@ LANGUAGES CSharp)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
-find_package(GeodeNative REQUIRED COMPONENTS dotnet)
+find_package(@PRODUCT_NAME_NOSPACE@ REQUIRED COMPONENTS dotnet)
-add_executable(${PROJECT_NAME}
- Program.cs)
+add_executable(${PROJECT_NAME} @ADD_EXAMPLE_SOURCE@)
target_link_libraries(${PROJECT_NAME}
GeodeNative::dotnet)
diff --git a/examples/dotnet/CMakeLists.txt b/examples/dotnet/CMakeLists.txt.in
similarity index 100%
copy from examples/dotnet/CMakeLists.txt
copy to examples/dotnet/CMakeLists.txt.in
diff --git a/examples/dotnet/PdxAutoSerializer/CMakeLists.txt b/examples/dotnet/PdxAutoSerializer/CMakeLists.txt
deleted file mode 100644
index 989009f..0000000
--- a/examples/dotnet/PdxAutoSerializer/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-cmake_minimum_required(VERSION 3.10)
-
-project(PDXAutoSerializer LANGUAGES CSharp)
-
-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../cmake)
-
-find_package(GeodeNative REQUIRED COMPONENTS dotnet)
-
-add_executable(${PROJECT_NAME}
- Program.cs
- Order.cs)
-
-target_link_libraries(${PROJECT_NAME}
- GeodeNative::dotnet)
-
-set_target_properties(${PROJECT_NAME} PROPERTIES
- VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
- VS_DOTNET_REFERENCES "System;${GeodeNative_DOTNET_LIBRARY}")
--
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.