Skip to content

Commit d767f09

Browse files
committed
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
1 parent dae321a commit d767f09

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

CMake/vtkModuleMacros.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ endfunction()
517517
# rules for the target unless NO_INSTALL argument is specified or
518518
# VTK_INSTALL_NO_DEVELOPMENT variable is set.
519519
function(vtk_compile_tools_target _name)
520-
if (CMAKE_CROSSCOMPILING)
520+
if (CMAKE_CROSSCOMPILING AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
521521
message(AUTHOR_WARNING
522522
"vtk_compile_tools_target is being called when CMAKE_CROSSCOMPILING is true. "
523523
"This generally signifies a script issue. compile-tools are not expected "

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ if(NOT VTK_BUILD_PYTHON_MODULE_DIR)
248248
PATH "Directory where python modules will be put inside the build tree")
249249
mark_as_advanced(VTK_BUILD_PYTHON_MODULE_DIR)
250250
endif()
251-
if (CMAKE_CROSSCOMPILING AND NOT COMPILE_TOOLS_IMPORTED)
252-
# if CMAKE_CROSSCOMPILING is true, we need to import build-tools targets.
251+
if (CMAKE_CROSSCOMPILING AND NOT COMPILE_TOOLS_IMPORTED AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
252+
# if CMAKE_CROSSCOMPILING is true and CMAKE_CROSSCOMPILING_EMULATOR is not set, we need
253+
# to import build-tools targets.
253254
find_package(VTKCompileTools REQUIRED)
254255
set (COMPILE_TOOLS_IMPORTED TRUE)
255256
endif()

Utilities/EncodeString/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
set(VTK_BUILD_FORWARDING_EXECUTABLES FALSE)
1111
vtk_module_export_info()
1212

13-
IF(NOT CMAKE_CROSSCOMPILING)
13+
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
1414
VTK_ADD_EXECUTABLE(vtkEncodeString vtkEncodeString.cxx)
1515
vtk_compile_tools_target(vtkEncodeString)
1616
ENDIF()

Utilities/HashSource/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vtk_module_export_info()
1212
# launcher for it and should always use the RPATH to find shared libs.
1313
SET(CMAKE_SKIP_RPATH 0)
1414

15-
IF(NOT CMAKE_CROSSCOMPILING)
15+
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
1616
ADD_EXECUTABLE(vtkHashSource vtkHashSource.cxx)
1717
TARGET_LINK_LIBRARIES(vtkHashSource vtksys)
1818
vtk_compile_tools_target(vtkHashSource)

Utilities/ParseOGLExt/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
vtk_module_export_info()
2525

26-
IF(NOT CMAKE_CROSSCOMPILING)
26+
IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
2727
ADD_EXECUTABLE(vtkParseOGLExt Tokenizer.cxx ParseOGLExt.cxx)
2828
vtk_compile_tools_target(vtkParseOGLExt)
2929
ENDIF()

0 commit comments

Comments
 (0)