You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by iv...@apache.org on 2021/12/22 16:45:26 UTC
[ignite] branch master updated: IGNITE-15694 CPP: Document new building process of Ignite C++ and ODBC on Windows - Fixes #9680.
This is an automated email from the ASF dual-hosted git repository.
ivandasch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 25ecc34 IGNITE-15694 CPP: Document new building process of Ignite C++ and ODBC on Windows - Fixes #9680.
25ecc34 is described below
commit 25ecc34637b7a6457df98bda2c4221b404712ab9
Author: Ivan Daschinsky <iv...@apache.org>
AuthorDate: Wed Dec 22 19:40:06 2021 +0300
IGNITE-15694 CPP: Document new building process of Ignite C++ and ODBC on Windows - Fixes #9680.
Signed-off-by: Ivan Daschinsky <iv...@apache.org>
---
docs/_docs/SQL/ODBC/odbc-driver.adoc | 61 ++++++++++------------
.../cpp-odbc-linux-build-prerequisites.adoc | 43 +++++++++++++++
docs/_docs/quick-start/cpp.adoc | 42 +++++++++++----
docs/_docs/thin-clients/cpp-thin-client.adoc | 27 +++++++---
modules/platforms/cpp/CMakeLists.txt | 12 ++---
5 files changed, 130 insertions(+), 55 deletions(-)
diff --git a/docs/_docs/SQL/ODBC/odbc-driver.adoc b/docs/_docs/SQL/ODBC/odbc-driver.adoc
index 9f4e9b8..b707b09 100644
--- a/docs/_docs/SQL/ODBC/odbc-driver.adoc
+++ b/docs/_docs/SQL/ODBC/odbc-driver.adoc
@@ -163,62 +163,57 @@ Apache Ignite ODBC Driver was officially tested on:
== Building ODBC Driver
-Ignite is shipped with pre-built installers for both 32- and 64-bit versions of the driver for Windows. So if you just want to install ODBC driver on Windows you may go straight to the <<Installing ODBC Driver>> section for installation instructions.
+Ignite is shipped with pre-built installers for both 32- and 64-bit versions of the driver for Windows.
+So if you just want to install ODBC driver on Windows, you may go straight to the <<Installing ODBC Driver>>
+section for installation instructions.
-If you use Linux you will still need to build ODBC driver before you can install it. So if you are using Linux or if you still want to build the driver by yourself for Windows, then keep reading.
-
-Ignite ODBC Driver source code is shipped as part of the Ignite package and it should be built before usage.
-
-Since the ODBC Driver is written in {cpp}, it is shipped as part of Ignite {cpp} and depends on some of the {cpp} libraries. More specifically, it depends on the `utils` and `binary` Ignite libraries. This means that you will need to build them prior to building the ODBC driver itself.
-
-We assume here that you are using the binary Ignite release. If you are using the source release, instead of `%IGNITE_HOME%\platforms\cpp` path you should use `%IGNITE_HOME%\modules\platforms\cpp` throughout.
+For Linux, you will still need to build an ODBC driver before installing it.
+So if you are using Linux or still want to build the driver yourself for Windows, refer to the next section.
=== Building on Windows
-You will need MS Visual Studio 2010 or later to be able to build the ODBC driver on Windows. Once you have it, open Ignite solution `%IGNITE_HOME%\platforms\cpp\project\vs\ignite.sln` (or `ignite_86.sln` if you are running 32-bit platform), left-click on odbc project in the "Solution Explorer" and choose "Build". Visual Studio will automatically detect and build all the necessary dependencies.
-
-The path to the .sln file may vary depending on whether you're building from source files or binaries. If you don't see your .sln file in `%IGNITE_HOME%\platforms\cpp\project\vs\`, try looking in `%IGNITE_HOME%\modules\platforms\cpp\project\vs\`.
-
-NOTE: If you are using VS 2015 or later (MSVC 14.0 or later), you need to add `legacy_stdio_definitions.lib` as an additional library to odbc project linker's settings in order to be able to build the project. To add this library to the linker input in the IDE, open the context menu for the project node, choose `Properties`, then in the `Project Properties` dialog box, choose `Linker`, and edit the `Linker Input` to add `legacy_stdio_definitions.lib` to the semi-colon-separated list.
+To start with, install the dependencies below:
-Once the build process is complete, you can find `ignite.odbc.dll` in `%IGNITE_HOME%\platforms\cpp\project\vs\x64\Release` for the 64-bit version and in `%IGNITE_HOME%\platforms\cpp\project\vs\Win32\Release` for the 32-bit version.
+* MS Visual C++ (10.0 and up), g++ (4.4.0 and up)
+* OpenSSL (32-bit or 64-bit versions)
+* CMake 3.6+
+* http://wixtoolset.org[WiX Toolset] and add it to `%Path%`.
-NOTE: Be sure to use the corresponding driver (32-bit or 64-bit) for your system.
-
-=== Building installers on Windows
-
-Once you have built driver binaries you may want to build installers for easier installation. Ignite uses link:http://wixtoolset.org[WiX Toolset] to generate ODBC installers, so to build them you'll need to download and install WiX. Make sure you have added the `bin` directory of the WiX Toolset to your PATH variable.
-
-Once everything is ready, open a terminal and navigate to the directory `%IGNITE_HOME%\platforms\cpp\odbc\install`. Execute the following commands one by one to build installers:
+Then, perform the following:
+. Navigate to the `%IGNITE_HOME%\platforms\cpp` folder.
+. Build drivers and installers using the following steps:
[tabs]
--
tab:64-bit driver[]
[source,shell]
----
-candle.exe ignite-odbc-amd64.wxs
-light.exe -ext WixUIExtension ignite-odbc-amd64.wixobj
+mkdir cmake-build-release-64
+cmake .. -DWITH_CORE=OFF -DWITH_ODBC=ON -DWITH_ODBC_MSI=ON -DCMAKE_GENERATOR_PLATFORM=x64 -DOPENSSL_ROOT_DIR=<openssl 64-bit install dir> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=..\install\amd64
+cmake --build . --target install --config Release
----
tab:32-bit driver[]
-[source,shell]
+[source,bat]
----
-candle.exe ignite-odbc-x86.wxs
-light.exe -ext WixUIExtension ignite-odbc-x86.wixobj
+mkdir cmake-build-release-32
+cmake .. -DWITH_CORE=OFF -DWITH_ODBC=ON -DWITH_ODBC_MSI=ON -DCMAKE_GENERATOR_PLATFORM=Win32 -DOPENSSL_ROOT_DIR=<openssl 32-bit install dir> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=..\install\x86
+cmake --build . --target install --config Release
----
--
-As a result, `ignite-odbc-amd64.msi` and `ignite-odbc-x86.msi` files should appear in the directory. You can use them to install your freshly built drivers.
+As a result, `ignite-odbc-amd64.msi` and `ignite-odbc-x86.msi` files should appear
+in `%IGNITE_HOME%\platforms\cpp\install\amd64\bin` and `%IGNITE_HOME%\platforms\cpp\install\x86\bin` directories respectively.
=== Building on Linux
-On a Linux-based operating system, you will need to install an ODBC Driver Manager of your choice to be able to build and use the Ignite ODBC Driver. The ODBC Driver has been tested with link:http://www.unixodbc.org[UnixODBC].
+On a Linux-based operating system, you will need to install an ODBC Driver Manager of your choice to be able
+to build and use the Ignite ODBC Driver. The ODBC Driver has been tested with link:http://www.unixodbc.org[UnixODBC].
==== Prerequisites
-include::includes/cpp-linux-build-prerequisites.adoc[]
+include::includes/cpp-odbc-linux-build-prerequisites.adoc[]
-NOTE: The JDK is used only during the build process and not by the ODBC driver itself.
==== Building ODBC driver
- Create a build directory for cmake. We'll refer to it as `${CPP_BUILD_DIR}`
@@ -231,7 +226,7 @@ tab:Ubuntu[]
[source,bash,subs="attributes,specialchars"]
----
cd ${CPP_BUILD_DIR}
-cmake -DCMAKE_BUILD_TYPE=Release -DWITH_ODBC=ON ${IGNITE_HOME}/platforms/cpp -DCMAKE_INSTALL_PREFIX=${CPP_INSTALL_DIR}
+cmake -DCMAKE_BUILD_TYPE=Release -DWITH_CORE=OFF -DWITH_ODBC=ON ${IGNITE_HOME}/platforms/cpp -DCMAKE_INSTALL_PREFIX=${CPP_INSTALL_DIR}
make
sudo make install
----
@@ -240,8 +235,8 @@ tab:CentOS/RHEL[]
[source,shell,subs="attributes,specialchars"]
----
cd ${CPP_BUILD_DIR}
-cmake3 -DCMAKE_BUILD_TYPE=Release -DWITH_ODBC=ON ${IGNITE_HOME}/platforms/cpp -DCMAKE_INSTALL_PREFIX=${CPP_INSTALL_DIR}
-make
+cmake3 -DCMAKE_BUILD_TYPE=Release -DWITH_CORE=OFF -DWITH_ODBC=ON ${IGNITE_HOME}/platforms/cpp -DCMAKE_INSTALL_PREFIX=${CPP_INSTALL_DIR}
+make
sudo make install
----
diff --git a/docs/_docs/includes/cpp-odbc-linux-build-prerequisites.adoc b/docs/_docs/includes/cpp-odbc-linux-build-prerequisites.adoc
new file mode 100644
index 0000000..1bf34b7
--- /dev/null
+++ b/docs/_docs/includes/cpp-odbc-linux-build-prerequisites.adoc
@@ -0,0 +1,43 @@
+// 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.
+The following packages need to be installed:
+
+- C++ compiler
+- cmake 3.6+
+- openssl, including header files
+- unixODBC
+
+Installation instructions for several popular distributions are listed below:
+[tabs]
+--
+tab:Ubuntu 18.04/20.04[]
+[source,bash,subs="attributes,specialchars"]
+----
+sudo apt-get install -y build-essential cmake unixodbc-dev libssl-dev
+----
+
+tab:CentOS/RHEL 7[]
+[source,shell,subs="attributes,specialchars"]
+----
+sudo yum install -y epel-release
+sudo yum install -y cmake3 unixODBC-devel openssl-devel make gcc-c++
+----
+
+tab:CentOS/RHEL 8[]
+[source,shell,subs="attributes,specialchars"]
+----
+sudo yum install -y cmake3 unixODBC-devel openssl-devel make gcc-c++
+----
+--
diff --git a/docs/_docs/quick-start/cpp.adoc b/docs/_docs/quick-start/cpp.adoc
index cdc3306..08aa6df 100644
--- a/docs/_docs/quick-start/cpp.adoc
+++ b/docs/_docs/quick-start/cpp.adoc
@@ -41,15 +41,39 @@ Once the cluster is started, you can use the Ignite C++ thin client to perform c
Ignite ships with a robust {cpp} client.
To get started with Ignite and {cpp}, you will need to be familiar with building {cpp} applications.
-. Install `openssl` and add it to your path.
. If you haven't already, download/install <<Installing Ignite,Apache Ignite>>.
-. Navigate to the `{IGNITE_HOME}/platforms/cpp/project/vs` folder.
-. Launch the appropriate Visual Studio solution file for your system (`ignite.sln` is for 64-bit).
-. Build the solution.
+. Install `CMake 3.6+` and add it to the `%Path%`.
+. Install `OpenSSL`.
+. Set `%JAVA_HOME%` environment variable.
+. Navigate to the `%IGNITE_HOME%\platforms\cpp\` folder.
+. Create build directory `%IGNITE_HOME%\platforms\cpp\cmake-build-release`.
+. Build and install `Ignite C++`.
-From here, you can create your own code, or run one of the existing examples located in the `{IGNITE_HOME}/platforms/cpp/examples/project/vs` directory.
+[tabs]
+--
+tab:Win32[]
+[source,bat,subs="attributes,specialchars"]
+----
+cd cmake-build-release
+cmake .. -DWITH_THIN_CLIENT=ON -DCMAKE_GENERATOR_PLATFORM=Win32 -DOPENSSL_ROOT_DIR=<openssl install dir> -DCMAKE_INSTALL_PREFIX=<ignite cpp install dir>
+cmake --build . --target install --config Release
+----
+
+tab:Win64[]
+[source,bat,subs="attributes,specialchars"]
+----
+cd cmake-build-release
+cmake .. -DWITH_THIN_CLIENT=ON -DCMAKE_GENERATOR_PLATFORM=x64 -DOPENSSL_ROOT_DIR=<openssl install dir> -DCMAKE_INSTALL_PREFIX=<ignite cpp install dir>
+cmake --build . --target install --config Release
+----
+--
+`CMake` by default generates on Windows Visual Studio projects. You can find generated projects in CMake
+build directory and open `Ignite.C++.sln` in Visual Studio.
-There is much more information about how to build, test, and use GGCE for {cpp} in the `readme.txt` and `DEVNOTES.txt` files located in the `{IGNITE_HOME}/platforms/cpp` folder.
+From here, you can create your own code, or run one of the existing examples located in the `{IGNITE_HOME}/platforms/cpp/examples/` directory.
+
+There is much more information about how to build, test, and use Apache Ignite for {cpp} in the `README.txt` and
+`DEVNOTES.txt` files located in the `{IGNITE_HOME}/platforms/cpp` folder.
For information about the {cpp} thin client, see link:thin-clients/cpp-thin-client[C++ Thin Client].
@@ -72,7 +96,7 @@ tab:Ubuntu[]
[source,bash,subs="attributes,specialchars"]
----
cd ${CPP_BUILD_DIR}
-cmake -DCMAKE_BUILD_TYPE=Release -DWITH_ODBC=ON -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
+cmake -DCMAKE_BUILD_TYPE=Release -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
make
sudo make install
----
@@ -81,8 +105,8 @@ tab:CentOS/RHEL[]
[source,shell,subs="attributes,specialchars"]
----
cd ${CPP_BUILD_DIR}
-cmake3 -DCMAKE_BUILD_TYPE=Release -DWITH_ODBC=ON -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
-make
+cmake3 -DCMAKE_BUILD_TYPE=Release -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
+make
sudo make install
----
diff --git a/docs/_docs/thin-clients/cpp-thin-client.adoc b/docs/_docs/thin-clients/cpp-thin-client.adoc
index 8bb5612..cc69237 100644
--- a/docs/_docs/thin-clients/cpp-thin-client.adoc
+++ b/docs/_docs/thin-clients/cpp-thin-client.adoc
@@ -17,7 +17,8 @@
== Prerequisites
* C++ compiler: MS Visual C++ (10.0 and up), g++ (4.4.0 and up)
-* Visual Studio 2010 or newer
+* OpenSSL
+* CMake 3.6+
== Installation
@@ -26,19 +27,31 @@ The source code of the C++ thin client comes with the Ignite distribution packag
[tabs]
--
-tab:Windows[]
+tab:Win64[]
[source,bat]
----
-cd %IGNITE_HOME%\platforms\cpp\project\vs
+cd %IGNITE_HOME%\platforms\cpp\
+mkdir cmake-build-release
+cd cmake-build-release
+cmake .. -DWITH_CORE=OFF -DWITH_THIN_CLIENT=ON -DCMAKE_GENERATOR_PLATFORM=x64 -DOPENSSL_ROOT_DIR=<openssl install dir> -DCMAKE_INSTALL_PREFIX=<ignite cpp install dir>
+cmake --build . --target install --config Release
+----
-msbuild ignite.sln /p:Configuration=Release /p:Platform=x64
+tab:Win32[]
+[source,bat]
+----
+cd %IGNITE_HOME%\platforms\cpp\
+mkdir cmake-build-release
+cd cmake-build-release
+cmake .. -DWITH_CORE=OFF -DWITH_THIN_CLIENT=ON -DCMAKE_GENERATOR_PLATFORM=Win32 -DOPENSSL_ROOT_DIR=<openssl install-dir> -DCMAKE_INSTALL_PREFIX=<ignite cpp install dir>
+cmake --build . --target install --config Release
----
tab:Ubuntu[]
[source,bash,subs="attributes,specialchars"]
----
cd ${CPP_BUILD_DIR}
-cmake -DCMAKE_BUILD_TYPE=Release -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
+cmake -DCMAKE_BUILD_TYPE=Release -DWITH_CORE=OFF -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
make
sudo make install
----
@@ -47,8 +60,8 @@ tab:CentOS/RHEL[]
[source,shell,subs="attributes,specialchars"]
----
cd ${CPP_BUILD_DIR}
-cmake3 -DCMAKE_BUILD_TYPE=Release -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
-make
+cmake3 -DCMAKE_BUILD_TYPE=Release -DWITH_CORE=OFF -DWITH_THIN_CLIENT=ON ${IGNITE_HOME}/platforms/cpp
+make
sudo make install
----
diff --git a/modules/platforms/cpp/CMakeLists.txt b/modules/platforms/cpp/CMakeLists.txt
index 2c35dc3..ca9d26c 100644
--- a/modules/platforms/cpp/CMakeLists.txt
+++ b/modules/platforms/cpp/CMakeLists.txt
@@ -49,12 +49,12 @@ if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
endif()
-option (WITH_CORE ON)
-option (WITH_ODBC OFF)
-option (WITH_ODBC_MSI OFF)
-option (WITH_THIN_CLIENT OFF)
-option (WITH_TESTS OFF)
-option (WARNINGS_AS_ERRORS OFF)
+option (WITH_CORE "Build Ignite.C++ Core module" ON)
+option (WITH_ODBC "Build Ignite.C++ ODBC driver module" OFF)
+option (WITH_ODBC_MSI "Build Ignite.C++ ODBC driver installer for Windows" OFF)
+option (WITH_THIN_CLIENT "Build Ignite.C++ Thin Client module" OFF)
+option (WITH_TESTS "Build Ignite.C++ tests" OFF)
+option (WARNINGS_AS_ERRORS "Treat warning as errors" OFF)
if (${WITH_CORE} OR ${WITH_TESTS})
find_package(Java 1.8 REQUIRED)