This is an automated email from the ASF dual-hosted git repository.
mmartell 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 c595a11 GEODE-7222: refactor build (#530)
c595a11 is described below
commit c595a117dbdbe394f34d50627b2fa475739bc7ca
Author: Michael Martell <[email protected]>
AuthorDate: Sun Sep 29 08:18:54 2019 -0700
GEODE-7222: refactor build (#530)
* Call a new generate_export_file( libraryName) function to generate the
export file for the shared and the static builds
Co-authored-by: Ivan Godwin <[email protected]>
Co-authored-by: Jacob Barrett <[email protected]>
---
CMakeLists.txt | 1 +
.../ApacheGeodeExportHeader.cmake | 39 +++++++++++++---------
cppcache/CMakeLists.txt | 8 -----
cppcache/shared/CMakeLists.txt | 23 +++----------
cppcache/static/CMakeLists.txt | 8 +++++
dependencies/CMakeLists.txt | 14 ++++----
6 files changed, 44 insertions(+), 49 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1763028..0c12822 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,7 @@ if (USE_PCH)
endif()
include(ClangFormat)
+include(ApacheGeodeExportHeader)
if(CMAKE_GENERATOR MATCHES Win64*)
diff --git a/dependencies/CMakeLists.txt b/cmake/ApacheGeodeExportHeader.cmake
similarity index 52%
copy from dependencies/CMakeLists.txt
copy to cmake/ApacheGeodeExportHeader.cmake
index 236fe06..4dda11a 100644
--- a/dependencies/CMakeLists.txt
+++ b/cmake/ApacheGeodeExportHeader.cmake
@@ -13,23 +13,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required( VERSION 3.10 )
-project( dependencies LANGUAGES NONE )
+function(generate_export_file LIB_NAME)
-find_package(Patch REQUIRED)
+ if (MSVC)
+ set(EXPORT_HEADER_CUSTOM_CONTENT "
+ #define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT APACHE_GEODE_EXPORT
-add_subdirectory( ACE )
-add_subdirectory( boost )
-add_subdirectory( sqlite )
-add_subdirectory( doxygen )
-add_subdirectory( gtest )
-add_subdirectory( benchmark )
-add_subdirectory( xerces-c )
+ #define APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
+ ")
+ else()
+ set(EXPORT_HEADER_CUSTOM_CONTENT "
+ #define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
-if (USE_RAT)
- add_subdirectory( rat )
-endif()
+ #define APACHE_GEODE_EXTERN_TEMPLATE_EXPORT APACHE_GEODE_EXPORT
+ ")
+ endif()
-if (WIN32)
- add_subdirectory( sqlite-netFx )
-endif()
+ include(GenerateExportHeader)
+
+ generate_export_header(${PROJECT_NAME}
+ BASE_NAME APACHE_GEODE
+ EXPORT_FILE_NAME apache-geode_export.h
+ CUSTOM_CONTENT_FROM_VARIABLE EXPORT_HEADER_CUSTOM_CONTENT
+ )
+
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/apache-geode_export.h DESTINATION
include/geode/internal)
+
+endfunction()
diff --git a/cppcache/CMakeLists.txt b/cppcache/CMakeLists.txt
index bee0117..86304d6 100644
--- a/cppcache/CMakeLists.txt
+++ b/cppcache/CMakeLists.txt
@@ -64,9 +64,6 @@ list(APPEND CONFIGURE_OUT_FILES
${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${COMMON_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in
${CMAKE_CURRENT_BINARY_DIR}/version.h)
-set(EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/apache-geode_export.h)
-list(APPEND CONFIGURE_OUT_FILES ${EXPORT_FILE_NAME})
-
set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
set(SOURCES_ALL ${SOURCES} ${PRIVATE_HEADERS} ${PUBLIC_HEADERS}
${CONFIGURE_IN_FILES} ${CONFIGURE_OUT_FILES})
@@ -118,11 +115,6 @@ target_include_directories(_apache-geode INTERFACE
add_dependencies(_apache-geode version-header)
install(DIRECTORY ${COMMON_INCLUDE_DIR} DESTINATION .)
-install(FILES
- ${EXPORT_FILE_NAME}
- DESTINATION include/geode/internal
-)
-
add_subdirectory(shared)
add_subdirectory(static)
add_subdirectory(test)
diff --git a/cppcache/shared/CMakeLists.txt b/cppcache/shared/CMakeLists.txt
index e8803a0..d1722e5 100644
--- a/cppcache/shared/CMakeLists.txt
+++ b/cppcache/shared/CMakeLists.txt
@@ -18,28 +18,13 @@ project(apache-geode LANGUAGES CXX)
add_library(apache-geode SHARED ${SOURCES_ALL} ${RESOURCES})
if (MSVC)
- set(EXPORT_HEADER_CUSTOM_CONTENT "
-#define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT APACHE_GEODE_EXPORT
-
-#define APACHE_GEODE_EXTERN_TEMPLATE_EXPORT
-")
-
target_compile_options(apache-geode
PRIVATE
/bigobj # C1128 - large number of templates causes too many section.
- )
-else()
- set(EXPORT_HEADER_CUSTOM_CONTENT "
-#define APACHE_GEODE_EXPLICIT_TEMPLATE_EXPORT
-
-#define APACHE_GEODE_EXTERN_TEMPLATE_EXPORT APACHE_GEODE_EXPORT
-")
+ )
endif()
-include(GenerateExportHeader)
-generate_export_header(apache-geode
- EXPORT_FILE_NAME ${EXPORT_FILE_NAME}
- CUSTOM_CONTENT_FROM_VARIABLE EXPORT_HEADER_CUSTOM_CONTENT)
+generate_export_file( "apache-geode" )
set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
@@ -53,7 +38,9 @@ target_link_libraries(apache-geode
target_include_directories(apache-geode
PUBLIC
- $<TARGET_PROPERTY:_apache-geode,INTERFACE_INCLUDE_DIRECTORIES>)
+ $<TARGET_PROPERTY:_apache-geode,INTERFACE_INCLUDE_DIRECTORIES>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+)
set_target_properties(apache-geode PROPERTIES
PUBLIC_HEADER "${PUBLIC_HEADERS}"
diff --git a/cppcache/static/CMakeLists.txt b/cppcache/static/CMakeLists.txt
index 9b8d663..6a63a94 100644
--- a/cppcache/static/CMakeLists.txt
+++ b/cppcache/static/CMakeLists.txt
@@ -17,6 +17,9 @@ project(apache-geode-static LANGUAGES CXX)
add_library(apache-geode-static STATIC ${SOURCES_ALL})
+generate_export_file( "apache-geode-static" )
+
+
set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
target_compile_definitions(apache-geode-static PUBLIC
@@ -30,6 +33,11 @@ target_link_libraries(apache-geode-static
_WarningsAsError
_CppCodeCoverage)
+target_include_directories(apache-geode-static
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+)
+
add_dependencies(client-libraries apache-geode-static)
set_target_properties(apache-geode-static PROPERTIES
diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt
index 236fe06..e3aacaa 100644
--- a/dependencies/CMakeLists.txt
+++ b/dependencies/CMakeLists.txt
@@ -18,13 +18,13 @@ project( dependencies LANGUAGES NONE )
find_package(Patch REQUIRED)
-add_subdirectory( ACE )
-add_subdirectory( boost )
-add_subdirectory( sqlite )
-add_subdirectory( doxygen )
-add_subdirectory( gtest )
-add_subdirectory( benchmark )
-add_subdirectory( xerces-c )
+add_subdirectory(ACE)
+add_subdirectory(boost)
+add_subdirectory(sqlite)
+add_subdirectory(doxygen)
+add_subdirectory(gtest)
+add_subdirectory(benchmark)
+add_subdirectory(xerces-c)
if (USE_RAT)
add_subdirectory( rat )