diff --git a/adm/cmake/occt_toolkit.cmake b/adm/cmake/occt_toolkit.cmake index 14acf42e86..b2d62050db 100644 --- a/adm/cmake/occt_toolkit.cmake +++ b/adm/cmake/occt_toolkit.cmake @@ -219,7 +219,7 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS}) message (STATUS "Info: ${USED_ITEM} from ${PROJECT_NAME} skipped due to it is empty") else() # get CSF_ value set (CURRENT_CSF ${${USED_ITEM}}) - if (NOT "${CURRENT_CSF}" STREQUAL "") + if (NOT "x${CURRENT_CSF}" STREQUAL "x") # prepare a list from a string with whitespaces separate_arguments (CURRENT_CSF) list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF}) diff --git a/adm/templates/android.toolchain.config.cmake b/adm/templates/android.toolchain.config.cmake new file mode 100644 index 0000000000..3c5c70d563 --- /dev/null +++ b/adm/templates/android.toolchain.config.cmake @@ -0,0 +1,8 @@ +# A toolchain file to configure a Makefile Generators or the Ninja generator to target Android for cross-compiling. +# Set CMAKE_ANDROID_NDK variable equal to your Android NDK path. + +set (CMAKE_SYSTEM_NAME Android) +set (CMAKE_SYSTEM_VERSION 15) # API level +set (CMAKE_ANDROID_ARCH_ABI armeabi-v7a) +set (CMAKE_ANDROID_NDK "") +set (CMAKE_ANDROID_STL_TYPE gnustl_shared) diff --git a/dox/dev_guides/building/android/android.md b/dox/dev_guides/building/android/android.md index 7ae6b4ed58..cde0363302 100644 --- a/dox/dev_guides/building/android/android.md +++ b/dox/dev_guides/building/android/android.md @@ -10,32 +10,40 @@ The steps on Windows and Ubuntu are similar. There is the only one difference: m on Windows and native GNU make on Ubuntu. Required tools (download and install if it is required): - - CMake v3.0+ http://www.cmake.org/cmake/resources/software.html - - Cross-compilation toolchain for CMake https://github.com/taka-no-me/android-cmake + - CMake v3.7+ http://www.cmake.org/cmake/resources/software.html - Android NDK rev.10+ https://developer.android.com/tools/sdk/ndk/index.html - GNU Make: MinGW v4.82+ for Windows (http://sourceforge.net/projects/mingw/files/), GNU Make 4.0 for Ubuntu. - -## Generation of makefiles + +## Prerequisites + +In toolchain file $CASROOT/adm/templates/android.toolchain.config.cmake: + + - Set CMAKE_ANDROID_NDK variable equal to your Android NDK path. + - Set CMAKE_ANDROID_STL_TYPE variable to specify which C++ standard library to use. + +The default value of CMAKE_ANDROID_STL_TYPE is gnustl_shared (GNU libstdc++ Shared) + +@figure{/dev_guides/building/android/images/android_image001.png} + +## Generation of makefiles using CMake GUI tool Run GUI tool provided by CMake: cmake-gui ### Tools configuration - Specify the root folder of OCCT ($CASROOT, which contains *CMakelists.txt* file) by clicking **Browse Source**. - Specify the location (build folder) for Cmake generated project files by clicking **Browse Build**. -@figure{/dev_guides/building/android/images/android_image001.png} +@figure{/dev_guides/building/android/images/android_image002.png} Click **Configure** button. It opens the window with a drop-down list of generators supported by CMake project. -Select "MinGW MakeFiles" item from the list +Select "MinGW Makefiles" item from the list - Choose "Specify toolchain file for cross-compiling" - Click "Next" -@figure{/dev_guides/building/android/images/android_image002.png} - - Specify a toolchain file at the next dialog by android.toolchain.cmake . It is contained by cross-compilation toolchain for CMake - - Click "Finish" @figure{/dev_guides/building/android/images/android_image003.png} -If ANDROID_NDK environment variable is not defined in current OS, add cache entry ANDROID_NDK (entry type is PATH) -- path to the NDK folder ("Add Entry" button) + - Specify a toolchain file at the next dialog by android.toolchain.config.cmake . It is contained by cross-compilation toolchain for CMake + - Click "Finish" @figure{/dev_guides/building/android/images/android_image004.png} If on Windows the message is appeared: "CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles" @@ -46,18 +54,19 @@ specify **CMAKE_MAKE_PROGRAM** to mingw32-make executable. ### OCCT Configuration How to configure OCCT, see "OCCT Configuration" section of @ref occt_dev_guides__building_cmake "Building with CMake" -taking into account the specific configuration variables for android: - - ANDROID_ABI = armeabi-v7a - - ANDROID_NATIVE_API_LEVEL = 15 - - ANDROID_NDK_LAYOUT is equal to CMAKE_BUILD_TYPE variable - - **BUILD_MODULE_Draw = OFF** - -@figure{/dev_guides/building/android/images/android_image006.png} ### Generation of makefiles Click **Generate** button and wait until the generation process is finished. -Then makefiles will appear in the build folder (e.g. D:/tmp/occt-android ). +Then makefiles will appear in the build folder (e.g. D:/occt/build-android ). + +## Generation of makefiles using CMake from the command line + +Alternatively one may specify the values without a toolchain file: + +> cmake -G "MinGW Makefiles" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=D:/DevTools/android-ndk-r13b -DCMAKE_ANDROID_STL_TYPE=gnustl_shared -DCMAKE_SYSTEM_VERSION=15 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_MAKE_PROGRAM=D:/DevTools/MinGW/bin/mingw32-make.exe -D3RDPARTY_DIR=D:/occt-3rdparty D:/occt + +@figure{/dev_guides/building/android/images/android_image006.png} ## Building makefiles of OCCT diff --git a/dox/dev_guides/building/android/images/android_image001.png b/dox/dev_guides/building/android/images/android_image001.png index b5c047e951..a4460f3230 100644 Binary files a/dox/dev_guides/building/android/images/android_image001.png and b/dox/dev_guides/building/android/images/android_image001.png differ diff --git a/dox/dev_guides/building/android/images/android_image002.png b/dox/dev_guides/building/android/images/android_image002.png index 64d002dcea..3a20979b86 100644 Binary files a/dox/dev_guides/building/android/images/android_image002.png and b/dox/dev_guides/building/android/images/android_image002.png differ diff --git a/dox/dev_guides/building/android/images/android_image003.png b/dox/dev_guides/building/android/images/android_image003.png index 782b2d8330..52c4f2edde 100644 Binary files a/dox/dev_guides/building/android/images/android_image003.png and b/dox/dev_guides/building/android/images/android_image003.png differ diff --git a/dox/dev_guides/building/android/images/android_image004.png b/dox/dev_guides/building/android/images/android_image004.png index 005ac504f7..b01d015d78 100644 Binary files a/dox/dev_guides/building/android/images/android_image004.png and b/dox/dev_guides/building/android/images/android_image004.png differ diff --git a/dox/dev_guides/building/android/images/android_image005.png b/dox/dev_guides/building/android/images/android_image005.png index 1add49f35c..e65a7b3434 100644 Binary files a/dox/dev_guides/building/android/images/android_image005.png and b/dox/dev_guides/building/android/images/android_image005.png differ diff --git a/dox/dev_guides/building/android/images/android_image006.png b/dox/dev_guides/building/android/images/android_image006.png index d9d9ff470f..97f5511ee0 100644 Binary files a/dox/dev_guides/building/android/images/android_image006.png and b/dox/dev_guides/building/android/images/android_image006.png differ diff --git a/dox/dev_guides/building/cmake/cmake.md b/dox/dev_guides/building/cmake/cmake.md index eb0456a4a1..5b334f2da5 100644 --- a/dox/dev_guides/building/cmake/cmake.md +++ b/dox/dev_guides/building/cmake/cmake.md @@ -60,7 +60,9 @@ Once the source and build directories are selected, "Configure" button should be @figure{/dev_guides/building/cmake/images/cmake_image002.png} -To build OCCT for Universal Windows Platform (UWP) specify the path to toolchain file for cross-compiling d:/occt/adm/templates/uwp.toolchain.config.cmake. +To build OCCT for **Universal Windows Platform (UWP)** specify the path to toolchain file for cross-compiling d:/occt/adm/templates/uwp.toolchain.config.cmake. + +Alternatively, if you are using CMake from the command line add options -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 . **Note**: Universal Windows Platform (UWP) is supported only on "Visual Studio 14 2015". File d:/occt/samples/xaml/ReadMe.md describes the building procedure of XAML (UWP) sample.