Commit 3ef9221b authored by Brad King's avatar Brad King 💬
Browse files

ENH: Removed need for CMake 2.0 VolumeRendering asm headers hack by changing...

ENH: Removed need for CMake 2.0 VolumeRendering asm headers hack by changing the headers to .cxx files.  The needed symbols are extern-declared where they are used.  The generated sources are no longer #include-d so they are now sources and not headers.
parent 9da8d6a3
......@@ -56,49 +56,36 @@ SET( KitOpenGL_SRCS
# Stuff we need for the vtkVolumeTextureMapper3D
#-------------------------------------------------
# CMake 2.0 has a bug in its Makefile generator that prevents more
# than one generated header file in a directory from working properly
# in parallel builds. Use a hack to work-around the problem.
SET(VTK_VR_NEED_ASM_HACK 0)
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.2)
IF(CMAKE_GENERATOR MATCHES "^Unix Makefiles$")
SET(VTK_VR_NEED_ASM_HACK 1)
ENDIF(CMAKE_GENERATOR MATCHES "^Unix Makefiles$")
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.2)
IF(VTK_VR_NEED_ASM_HACK)
# Work-around the CMake 2.0 bug by building the generated
# headers with a try-compile. Create a small project that just
# includes the generator and corresponding custom commands.
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ASM/CMakeLists.txt
"PROJECT(VTKVRASM)\n"
"SET(VTK_SOURCE_DIR \"${VTK_SOURCE_DIR}\")\n"
"SET(VTK_BINARY_DIR \"${VTK_BINARY_DIR}\")\n"
"INCLUDE_DIRECTORIES(\"${VTK_BINARY_DIR}\" \"${VTK_SOURCE_DIR}/Common\")\n"
"INCLUDE(\"${VTK_SOURCE_DIR}/VolumeRendering/vtkVRASM.cmake\")\n"
)
# Create an executable to encode source files into C string literals.
ADD_EXECUTABLE(vtkVREncodeString
${VTK_SOURCE_DIR}/VolumeRendering/vtkVREncodeString.cxx
)
GET_TARGET_PROPERTY(ENCODE_EXE vtkVREncodeString LOCATION)
# Drive the custom commands with a custom target in the try-compile so
# that the headers exist at the end of the CMake stage. There may be
# some dependency issues but the asm files do not change much.
TRY_COMPILE(VTK_VR_ASM_COMPILED
${CMAKE_CURRENT_BINARY_DIR}/ASM
${CMAKE_CURRENT_BINARY_DIR}/ASM
VTKVRASM vtk_vr_generate_asm_headers
CMAKE_FLAGS -DVTK_SOURCE_DIR:PATH=${VTK_SOURCE_DIR}
-DVTK_BINARY_DIR:PATH=${VTK_BINARY_DIR}
OUTPUT_VARIABLE VTK_VR_ASM_OUTPUT
)
# The set of source files to be encoded.
SET(asm_files
vtkVolumeTextureMapper3D_FourDependentNoShadeFP
vtkVolumeTextureMapper3D_FourDependentShadeFP
vtkVolumeTextureMapper3D_OneComponentNoShadeFP
vtkVolumeTextureMapper3D_OneComponentShadeFP
vtkVolumeTextureMapper3D_TwoDependentNoShadeFP
vtkVolumeTextureMapper3D_TwoDependentShadeFP
)
# Report the result of generating the headers.
IF(VTK_VR_ASM_COMPILED)
MESSAGE(STATUS "VolumeRendering asm header generation succeeded.")
ELSE(VTK_VR_ASM_COMPILED)
MESSAGE(FATAL_ERROR "VolumeRendering asm header generation failed: [${VTK_VR_ASM_OUTPUT}]")
ENDIF(VTK_VR_ASM_COMPILED)
ELSE(VTK_VR_NEED_ASM_HACK)
# CMake is powerful enough to generate the headers correctly.
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/vtkVRASM.cmake)
ENDIF(VTK_VR_NEED_ASM_HACK)
# Create custom commands to encode each assembly file into a C string
# literal in a header file.
FOREACH(file ${asm_files})
SET(src ${VTK_SOURCE_DIR}/VolumeRendering/${file}.asm)
SET(res ${VTK_BINARY_DIR}/VolumeRendering/${file}.cxx)
ADD_CUSTOM_COMMAND(
OUTPUT ${res}
DEPENDS ${src} vtkVREncodeString
COMMAND ${ENCODE_EXE}
ARGS ${res} ${src} ${file}
)
SET( KitOpenGL_SRCS ${KitOpenGL_SRCS} ${res} )
SET_SOURCE_FILES_PROPERTIES(${res} PROPERTIES WRAP_EXCLUDE 1)
ENDFOREACH(file)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/vtkVolumeRenderingToolkit.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkVolumeRenderingToolkit.h )
......
......@@ -33,12 +33,12 @@
#include "vtkOpenGLExtensionManager.h"
#include "vtkgl.h"
#include "vtkVolumeTextureMapper3D_OneComponentShadeFP.h"
#include "vtkVolumeTextureMapper3D_OneComponentNoShadeFP.h"
#include "vtkVolumeTextureMapper3D_TwoDependentNoShadeFP.h"
#include "vtkVolumeTextureMapper3D_TwoDependentShadeFP.h"
#include "vtkVolumeTextureMapper3D_FourDependentNoShadeFP.h"
#include "vtkVolumeTextureMapper3D_FourDependentShadeFP.h"
extern const char* vtkVolumeTextureMapper3D_OneComponentShadeFP;
extern const char* vtkVolumeTextureMapper3D_OneComponentNoShadeFP;
extern const char* vtkVolumeTextureMapper3D_TwoDependentNoShadeFP;
extern const char* vtkVolumeTextureMapper3D_TwoDependentShadeFP;
extern const char* vtkVolumeTextureMapper3D_FourDependentNoShadeFP;
extern const char* vtkVolumeTextureMapper3D_FourDependentShadeFP;
//extern "C" void (*glXGetProcAddressARB(const GLubyte *procName))( void );
......@@ -66,7 +66,7 @@
}}
//#ifndef VTK_IMPLEMENT_MESA_CXX
vtkCxxRevisionMacro(vtkOpenGLVolumeTextureMapper3D, "1.6");
vtkCxxRevisionMacro(vtkOpenGLVolumeTextureMapper3D, "1.7");
vtkStandardNewMacro(vtkOpenGLVolumeTextureMapper3D);
//#endif
......
# Create an executable to encode source files into C string literals.
ADD_EXECUTABLE(vtkVREncodeString
${VTK_SOURCE_DIR}/VolumeRendering/vtkVREncodeString.cxx
)
GET_TARGET_PROPERTY(ENCODE_EXE vtkVREncodeString LOCATION)
# The set of source files to be encoded.
SET(asm_files
vtkVolumeTextureMapper3D_FourDependentNoShadeFP
vtkVolumeTextureMapper3D_FourDependentShadeFP
vtkVolumeTextureMapper3D_OneComponentNoShadeFP
vtkVolumeTextureMapper3D_OneComponentShadeFP
vtkVolumeTextureMapper3D_TwoDependentNoShadeFP
vtkVolumeTextureMapper3D_TwoDependentShadeFP
)
# Create custom commands to encode each assembly file into a C string
# literal in a header file.
SET(ASM_HEADERS)
FOREACH(file ${asm_files})
SET(src ${VTK_SOURCE_DIR}/VolumeRendering/${file}.asm)
SET(res ${VTK_BINARY_DIR}/VolumeRendering/${file}.h)
ADD_CUSTOM_COMMAND(
OUTPUT ${res}
DEPENDS ${src} vtkVREncodeString
COMMAND ${ENCODE_EXE}
ARGS ${res} ${src} ${file}
)
SET(ASM_HEADERS ${ASM_HEADERS} ${res})
ENDFOREACH(file)
# Add dependencies to drive the above custom commands. See comments
# in VTK/VolumeRendering/CMakeLists.txt near where this file is
# included for details.
IF(VTKVRASM_SOURCE_DIR)
# We are being included from the VTKVRASM project. Drive the custom
# commands with a custom target.
ADD_CUSTOM_TARGET(vtk_vr_generate_asm_headers ALL DEPENDS ${ASM_HEADERS})
ELSE(VTKVRASM_SOURCE_DIR)
# We are being included from the main VTK project. Just add the
# dependencies to the file that includes the generated headers.
SET_SOURCE_FILES_PROPERTIES(vtkOpenGLVolumeTextureMapper3D.cxx
PROPERTIES OBJECT_DEPENDS "${ASM_HEADERS}")
ENDIF(VTKVRASM_SOURCE_DIR)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment