Skip to content
Snippets Groups Projects
Verified Commit d767f09b authored by Jean-Christophe Fillion-Robin's avatar Jean-Christophe Fillion-Robin
Browse files

cmake: Add support for CMAKE_CROSSCOMPILING_EMULATOR

This commit updates the build systems to allow cross-compiling VTK
using toolchain defining CMAKE_CROSSCOMPILING_EMULATOR.

It simplifies the cross-compilation removing the need to independently
compile the "VTKCompileTools".

See https://cmake.org/cmake/help/v3.8/variable/CMAKE_CROSSCOMPILING_EMULATOR.html#variable:CMAKE_CROSSCOMPILING_EMULATOR
parent dae321ab
No related branches found
No related tags found
No related merge requests found
......@@ -517,7 +517,7 @@ endfunction()
# rules for the target unless NO_INSTALL argument is specified or
# VTK_INSTALL_NO_DEVELOPMENT variable is set.
function(vtk_compile_tools_target _name)
if (CMAKE_CROSSCOMPILING)
if (CMAKE_CROSSCOMPILING AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
message(AUTHOR_WARNING
"vtk_compile_tools_target is being called when CMAKE_CROSSCOMPILING is true. "
"This generally signifies a script issue. compile-tools are not expected "
......
......@@ -248,8 +248,9 @@ if(NOT VTK_BUILD_PYTHON_MODULE_DIR)
PATH "Directory where python modules will be put inside the build tree")
mark_as_advanced(VTK_BUILD_PYTHON_MODULE_DIR)
endif()
if (CMAKE_CROSSCOMPILING AND NOT COMPILE_TOOLS_IMPORTED)
# if CMAKE_CROSSCOMPILING is true, we need to import build-tools targets.
if (CMAKE_CROSSCOMPILING AND NOT COMPILE_TOOLS_IMPORTED AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
# if CMAKE_CROSSCOMPILING is true and CMAKE_CROSSCOMPILING_EMULATOR is not set, we need
# to import build-tools targets.
find_package(VTKCompileTools REQUIRED)
set (COMPILE_TOOLS_IMPORTED TRUE)
endif()
......
......@@ -10,7 +10,7 @@
set(VTK_BUILD_FORWARDING_EXECUTABLES FALSE)
vtk_module_export_info()
IF(NOT CMAKE_CROSSCOMPILING)
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
VTK_ADD_EXECUTABLE(vtkEncodeString vtkEncodeString.cxx)
vtk_compile_tools_target(vtkEncodeString)
ENDIF()
......@@ -12,7 +12,7 @@ vtk_module_export_info()
# launcher for it and should always use the RPATH to find shared libs.
SET(CMAKE_SKIP_RPATH 0)
IF(NOT CMAKE_CROSSCOMPILING)
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
ADD_EXECUTABLE(vtkHashSource vtkHashSource.cxx)
TARGET_LINK_LIBRARIES(vtkHashSource vtksys)
vtk_compile_tools_target(vtkHashSource)
......
......@@ -23,7 +23,7 @@
vtk_module_export_info()
IF(NOT CMAKE_CROSSCOMPILING)
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
ADD_EXECUTABLE(vtkParseOGLExt Tokenizer.cxx ParseOGLExt.cxx)
vtk_compile_tools_target(vtkParseOGLExt)
ENDIF()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment