forked from apache/ignite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IGNITE-13078: C++: Add CMake build system support
This closes apache#7854
- Loading branch information
Showing
30 changed files
with
1,313 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# | ||
# 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.6) | ||
project(Ignite.C++ VERSION 2.9.0.42453) | ||
|
||
set(CMAKE_CXX_STANDARD 98) | ||
|
||
find_package(Java 1.8 REQUIRED) | ||
find_package(JNI REQUIRED) | ||
|
||
set(CMAKE_PROJECT_VERSION ${PROJECT_VERSION}) | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIGNITE_IMPL -DIGNITE_FRIEND -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS") | ||
|
||
set(CMAKE_SKIP_BUILD_RPATH FALSE) | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
|
||
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) | ||
|
||
if("${isSystemDir}" STREQUAL "-1") | ||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
endif("${isSystemDir}" STREQUAL "-1") | ||
|
||
if (WIN32) | ||
add_definitions(-DUNICODE=1) | ||
|
||
add_compile_options(/source-charset:utf-8) | ||
endif() | ||
|
||
option (WITH_ODBC OFF) | ||
option (WITH_THIN_CLIENT OFF) | ||
option (WITH_TESTS OFF) | ||
|
||
add_subdirectory(common) | ||
add_subdirectory(binary) | ||
add_subdirectory(jni) | ||
add_subdirectory(core) | ||
add_subdirectory(ignite) | ||
|
||
if (${WITH_TESTS}) | ||
enable_testing() | ||
|
||
if (EXISTS ${CMAKE_SOURCE_DIR}/core-test) | ||
add_subdirectory(core-test) | ||
endif() | ||
endif() | ||
|
||
if (${WITH_THIN_CLIENT} OR ${WITH_ODBC}) | ||
add_subdirectory(network) | ||
endif() | ||
|
||
if (${WITH_THIN_CLIENT}) | ||
add_subdirectory(thin-client) | ||
|
||
if (${WITH_TESTS} AND EXISTS ${CMAKE_SOURCE_DIR}/thin-client-test) | ||
add_subdirectory(thin-client-test) | ||
endif() | ||
endif() | ||
|
||
if (${WITH_ODBC}) | ||
add_subdirectory(odbc) | ||
|
||
if (${WITH_TESTS} AND EXISTS ${CMAKE_SOURCE_DIR}/odbc-test) | ||
add_subdirectory(odbc-test) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
project(ignite-binary) | ||
|
||
include_directories(include) | ||
|
||
set(TARGET ${PROJECT_NAME}) | ||
|
||
set(SOURCES src/binary/binary_containers.cpp | ||
src/binary/binary_raw_writer.cpp | ||
src/binary/binary_writer.cpp | ||
src/binary/binary_reader.cpp | ||
src/binary/binary_type.cpp | ||
src/binary/binary_raw_reader.cpp | ||
src/impl/binary/binary_type_manager.cpp | ||
src/impl/binary/binary_type_impl.cpp | ||
src/impl/binary/binary_utils.cpp | ||
src/impl/binary/binary_reader_impl.cpp | ||
src/impl/binary/binary_type_handler.cpp | ||
src/impl/binary/binary_writer_impl.cpp | ||
src/impl/binary/binary_schema.cpp | ||
src/impl/binary/binary_type_snapshot.cpp | ||
src/impl/binary/binary_object_header.cpp | ||
src/impl/binary/binary_object_impl.cpp | ||
src/impl/binary/binary_field_meta.cpp | ||
src/impl/interop/interop_memory.cpp | ||
src/impl/interop/interop_output_stream.cpp | ||
src/impl/interop/interop_input_stream.cpp) | ||
|
||
list(APPEND _target_libs ${TARGET}) | ||
|
||
if (WIN32) | ||
add_library(${TARGET}-objlib OBJECT ${SOURCES}) | ||
|
||
add_library(${TARGET} SHARED $<TARGET_OBJECTS:${TARGET}-objlib>) | ||
|
||
list(APPEND _target_libs ${TARGET}-objlib) | ||
else() | ||
add_library(${TARGET} SHARED ${SOURCES}) | ||
endif() | ||
|
||
foreach(_target_lib IN LISTS _target_libs) | ||
set_target_properties(${_target_lib} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) | ||
|
||
if (${_target_lib} STREQUAL ${TARGET}-objlib) | ||
set_target_properties(${_target_lib} PROPERTIES POSITION_INDEPENDENT_CODE 1) | ||
|
||
target_link_libraries(${_target_lib} ignite-common-objlib) | ||
else() | ||
target_link_libraries(${_target_lib} ignite-common) | ||
endif() | ||
|
||
target_include_directories(${_target_lib} INTERFACE include) | ||
endforeach() | ||
unset(_target_libs) | ||
|
||
install(TARGETS ${TARGET} LIBRARY DESTINATION lib) | ||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h*") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
find_path(IGNITE_INCLUDE_DIR ignite/ignite.h | ||
HINTS ${IGNITE_CPP_DIR}/include | ||
PATH_SUFFIXES ignite) | ||
|
||
find_library(IGNITE_LIB ignite HINTS ${IGNITE_CPP_DIR}/lib) | ||
|
||
find_library(IGNITE_COMMON_LIB ignite-common HINTS ${IGNITE_CPP_DIR}/lib) | ||
|
||
find_library(IGNITE_NETWORK_LIB ignite-network HINTS ${IGNITE_CPP_DIR}/lib) | ||
|
||
find_library(IGNITE_JNI_LIB ignite-jni HINTS ${IGNITE_CPP_DIR}/lib) | ||
|
||
find_library(IGNITE_THIN_CLIENT_LIB ignite-thin-client HINTS ${IGNITE_CPP_DIR}/lib) | ||
|
||
find_library(IGNITE_ODBC_LIB ignite-odbc HINTS ${IGNITE_CPP_DIR}/lib) | ||
|
||
find_library(IGNITE_BINARY_LIB ignite-binary HINTS ${IGNITE_CPP_DIR}/lib) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
find_package_handle_standard_args(Ignite DEFAULT_MSG | ||
IGNITE_LIB | ||
IGNITE_THIN_CLIENT_LIB | ||
IGNITE_ODBC_LIB | ||
IGNITE_BINARY_LIB | ||
IGNITE_NETWORK_LIB | ||
IGNITE_COMMON_LIB | ||
IGNITE_INCLUDE_DIR) |
Oops, something went wrong.