Skip to content
Snippets Groups Projects
Commit ddb6347f authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: Allow custom library definition

Expand the imstk_add_library cmake function by exposing the variables
H_FILES (headers) CPP_FILES (source) and SUBDIR_LIST (build interface
directories - the current source dir is always included).

If those values are not manually set, the previous behavior applies,
where all the files and directories in the root directory are used for
that target.

Used that new mechanism for the Rendering target to prepare for Vulkan
integration.
parent 247b04ba
No related branches found
No related tags found
No related merge requests found
......@@ -3,9 +3,30 @@
#-----------------------------------------------------------------------------
include(imstkAddLibrary)
imstk_add_library( Rendering
H_FILES
imstkVTKRenderer.h
RenderDelegate/imstkVTKCubeRenderDelegate.h
RenderDelegate/imstkVTKLineMeshRenderDelegate.h
RenderDelegate/imstkVTKPlaneRenderDelegate.h
RenderDelegate/imstkVTKRenderDelegate.h
RenderDelegate/imstkVTKSphereRenderDelegate.h
RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.h
RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.h
CPP_FILES
imstkVTKRenderer.cpp
RenderDelegate/imstkVTKCubeRenderDelegate.cpp
RenderDelegate/imstkVTKLineMeshRenderDelegate.cpp
RenderDelegate/imstkVTKPlaneRenderDelegate.cpp
RenderDelegate/imstkVTKRenderDelegate.cpp
RenderDelegate/imstkVTKSphereRenderDelegate.cpp
RenderDelegate/imstkVTKSurfaceMeshRenderDelegate.cpp
RenderDelegate/imstkVTKTetrahedralMeshRenderDelegate.cpp
SUBDIR_LIST
RenderDelegate
DEPENDS
${VTK_LIBRARIES}
Scene
#VERBOSE
)
#-----------------------------------------------------------------------------
......
......@@ -14,7 +14,7 @@ function(imstk_add_library target)
set(options VERBOSE)
set(oneValueArgs)
set(multiValueArgs H_FILES CPP_FILES DEPENDS)
set(multiValueArgs H_FILES CPP_FILES SUBDIR_LIST DEPENDS)
include(CMakeParseArguments)
cmake_parse_arguments(target "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
......@@ -32,14 +32,26 @@ function(imstk_add_library target)
#-----------------------------------------------------------------------------
# Get files and directories
#-----------------------------------------------------------------------------
file(GLOB_RECURSE target_H_FILES "${CMAKE_CURRENT_SOURCE_DIR}/imstk*.h")
file(GLOB_RECURSE target_CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/imstk*.cpp")
file(GLOB_RECURSE testing_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Testing/*")
if(testing_CPP_FILES)
list(REMOVE_ITEM target_H_FILES ${testing_FILES})
list(REMOVE_ITEM target_CPP_FILES ${testing_FILES})
if( NOT target_H_FILES AND NOT target_CPP_FILES )
file(GLOB_RECURSE target_H_FILES "${CMAKE_CURRENT_SOURCE_DIR}/imstk*.h")
file(GLOB_RECURSE target_CPP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/imstk*.cpp")
file(GLOB_RECURSE testing_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Testing/*")
if(testing_CPP_FILES)
list(REMOVE_ITEM target_H_FILES ${testing_FILES})
list(REMOVE_ITEM target_CPP_FILES ${testing_FILES})
endif()
endif()
if( NOT target_SUBDIR_LIST )
imstk_subdir_list(target_SUBDIR_LIST ${CMAKE_CURRENT_SOURCE_DIR})
endif()
imstk_subdir_list(target_SUBDIR_LIST ${CMAKE_CURRENT_SOURCE_DIR})
list(APPEND target_BUILD_INTERFACE_LIST "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
foreach(subdir ${target_SUBDIR_LIST})
if( NOT ${subdir} STREQUAL "Testing")
list(APPEND target_BUILD_INTERFACE_LIST "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${subdir}>")
endif()
endforeach()
#-----------------------------------------------------------------------------
# Create target (library)
......@@ -59,11 +71,6 @@ function(imstk_add_library target)
#-----------------------------------------------------------------------------
# Include directories
#-----------------------------------------------------------------------------
list(APPEND target_BUILD_INTERFACE_LIST "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
foreach(subdir ${target_SUBDIR_LIST})
list(APPEND target_BUILD_INTERFACE_LIST "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${subdir}>")
endforeach()
target_include_directories( ${target} PUBLIC
${target_BUILD_INTERFACE_LIST}
$<INSTALL_INTERFACE:${iMSTK_INSTALL_INCLUDE_DIR}>
......
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