You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ba...@apache.org on 2019/12/13 15:50:25 UTC

[nifi-minifi-cpp] branch master updated: MINIFICPP-1091 - Updated Windows.md

This is an automated email from the ASF dual-hosted git repository.

bakaid pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a790f4  MINIFICPP-1091 - Updated Windows.md
4a790f4 is described below

commit 4a790f4c4b8b59e517df4eaf176b89f6771c9d14
Author: Daniel Bakai <ba...@apache.org>
AuthorDate: Fri Dec 13 16:47:49 2019 +0100

    MINIFICPP-1091 - Updated Windows.md
    
    Signed-off-by: Daniel Bakai <ba...@apache.org>
    
    Approved by aboda on GH
    
    This closes #694
---
 Windows.md       | 69 ++++++++++++++++++++++++++++++++++++++++++++------------
 win_build_vs.bat |  2 +-
 2 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/Windows.md b/Windows.md
index e09d199..4726628 100644
--- a/Windows.md
+++ b/Windows.md
@@ -17,29 +17,70 @@
 
 ## Requirements
 
-Apache NiFi MiNiFi C++ has been built on Window Server 2016, 2019, and Windows 10 operating systems. Since the project is CMAKE focused we suggest building via
-Visual Studio 2017 or our ms_build.bat script. In order to build the MSI, please install the [WiX Toolset](https://wixtoolset.org/)
+Apache NiFi MiNiFi C++ has been built on Window Server 2016, 2019, and Windows 10 operating systems. The project is CMake focused we suggest building via
+Visual Studio 2017 or our `win_build_vs.bat` script.
 
-The project previously required OpenSSL to be installed. If you follow our build procedures, below, you will not need to install that dependency. Further, any MSI
-distributable requires that systems install the [Visual Studio 2010 redistributables](https://www.microsoft.com/en-us/download/details.aspx?id=26999&irgwc=1&OCID=AID681541_aff_7593_312327&tduid=(ir__2dz2dkkuookfr3a22jsv1zgwwn2xmb9vrhvzwmdq00)
+The project previously required OpenSSL to be installed. If you follow our build procedures, below, you will not need to install that dependency.
+
+### Required software
+
+ - Visual Studio 2017
+ - [CMake](https://cmake.org/download/)
+ - [Git](https://git-scm.com/download/win)
+ - (Optional) [WiX Toolset](https://wixtoolset.org/releases/) (only for building the MSI)
+ - (Optional) JDK (only for JNI support)
+
+### JNI support
+Though the project is written in C++, JNI functionality supports running Java processors stored in NiFi Archives. These can be run
+in a much smaller memory footprint and consume fewer resources. If your systems do not support Java or you do not want a JDK installed, please use non-JNI builds.
 
 ## Building with Visual Studio 
 
-In order to support Visual Studio you must install [plugins capable of building CMAKE](https://devblogs.microsoft.com/cppblog/cmake-support-in-visual-studio/). We also advise
+In order to support Visual Studio you must install [plugins capable of building CMake](https://devblogs.microsoft.com/cppblog/cmake-support-in-visual-studio/). We also advise
 installing WiX and Visual Studio Command Prompt via the marketplace. To do this please go to the Tools Menu, followed by Extensions and Updates. Once the popup displays you
-may install additional features from Online sources in the Online menui.
+may install additional features from Online sources in the Online menu.
 
-Once you have CMAKE support available please select the appropriate target. A file named CMakeSettings.json provides a few base configurations, x64-RelWithDebInfo, x64-Release,
-x64-RelWithDebInfo-WithJNI, and x64-Release-WithJNI. Though the project is written in C++, JNI functionality supports running Java processors stored in NiFi Archives. These can be run
-in a much smaller memory footprint and consumer fewer resources. If your systems do not support Java or you do not want a JDK installed, please select the non JNI targets.
+A file named CMakeSettings.json provides the CMake configuration.
 
-CMAKE must generate its cache, under Cache in the CMake Menu. After that is complete go to 'Build Only' under the CMAKE menu. Due to limitations in Visual Studio's CMAKE support, it is advised
-that you build minifi.lib then minifiexe targets. Once you have built these targets, you may use the cpack command to build your MSI. If you are building with JNI functionality the MSI will be
+CMake must generate its cache, under Cache in the CMake Menu. After that is complete go to 'Build Only' under the CMake menu. Due to limitations in Visual Studio's CMake support, it is advised
+that you build `minifi.lib` then `minifiexe` targets. Once you have built these targets, you may use the `cpack` command to build your MSI. If you are building with JNI functionality the MSI will be
 significantly larger ( about 160 MB ) since it contains the base NARs to run the standard set of Apache NiFi processors. 
 
 ## Building via the build script
 
-The preferred way of building the project is via the win_build_vs.bat script found in our root source folder. You must supply a single command, the build directory. Typically you create a directory
-with CMAKE and build in that referencing your CMAKE tree. Simply supply win_build_vs.bat an argument like 'build' as the name of your build directory and it will create this directory building the 
-project within it. If WiX is installed cpack will create your MSI in the chosen build directory.
+The preferred way of building the project is via the `win_build_vs.bat` script found in our root source folder. Its first parameter is mandatory, the directory in which it will build the project. `build` is a good default choice for this.
+
+After the build directory it will take optional parameters modifying the CMake configuration used in the build:
+
+| Argument | Effect |
+|----------|------------------------------------------------|
+| /T | Disables tests |
+| /P | Enables MSI creation |
+| /K | Enables Kafka extension |
+| /J | Enables JNI |
+| /64 | Creates 64-bit build instead of a 32-bit one |
+| /D | Builds RelWithDebInfo build instead of Release |
+
+Examples:
+ - 32-bit build with kafka, disabling tests, enabling MSI creation: `win_build_vs.bat build32 /T /K /P`
+ - 64-bit build with JNI, with debug symbols: `win_build_vs.bat build64 /64 /J /D`
+
+`win_build_vs.bat` requires a Visual Studio 2017 build environment to be set up. For 32-bit builds this can be achieved by using the `x86 Native Tools Command Prompt for VS 2017`, for 64-bit builds by using the `x64 Native Tools Command Prompt for VS 2017`.
+
+## Building directly with CMake
+
+The project can also be built manually using CMake. It requires the same environment the build script does (the proper Native Tools Command Prompt).
+
+A basic working CMake configuration can be inferred from the `win_build_vs.bat`.
+
+`win_build_vs.bat /64 /P` is equivalent to running the following commands:
 
+```
+mkdir build
+cd build
+cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE_INIT=Release -DCMAKE_BUILD_TYPE=Release -DWIN32=WIN32 -DENABLE_LIBRDKAFKA=OFF -DENABLE_JNI=OFF -DOPENSSL_OFF=OFF -DENABLE_COAP=OFF -DUSE_SHARED_LIBS=OFF -DDISABLE_CONTROLLER=ON  -DBUILD_ROCKSDB=ON -DFORCE_WINDOWS=ON -DUSE_SYSTEM_UUID=OFF -DDISABLE_LIBARCHIVE=ON -DDISABLE_SCRIPTING=ON -DEXCLUDE_BOOST=ON -DENABLE_WEL=TRUE -DFAIL_ON_WARNINGS=OFF -DSKIP_TESTS=OFF ..
+msbuild /m nifi-minifi-cpp.sln /property:Configuration=Release /property:Platform=x64
+copy main\Release\minifi.exe main\
+cpack
+ctest -C Release
+```
\ No newline at end of file
diff --git a/win_build_vs.bat b/win_build_vs.bat
index fcb69dc..3a70447 100644
--- a/win_build_vs.bat
+++ b/win_build_vs.bat
@@ -54,7 +54,7 @@ for %%x in (%*) do (
 	set generator="Visual Studio 15 2017 Win64"
     )
     if [%%~x] EQU [/D] ( 
-	set cmake_build_type=RelwithDebInfo
+	set cmake_build_type=RelWithDebInfo
     )
 )