[Insight-users] compile GaussianFilter outside InsightApplications-1.4
george he
george_he7 at yahoo . com
Fri, 5 Dec 2003 11:35:36 -0800 (PST)
Hi,
I was able to install ITK and FLTK successfully,
and compile the InsightApplications-1.4 downloaded
from the web. But after I moved the directory
InsightApplications-1.4/GaussianFilter to another
location. I wasn't able to compile it anymore.
Anybody knows what was wrong?
I did try to combine the info from the CMakeLists.txt
files in the directories InsightApplications-1.4
and InsightApplications-1.4/GaussianFilter together.
Most error messages are like:
In function `fltkImageViewerGUI::CreateGUI()':
: undefined reference to
`Fl_Value_Slider::Fl_Value_Slider[in-charge](int, int,
int, int, char const*)'
In function `fltkImageViewerGUI::CreateGUI()':
: undefined reference to `fl_define_FL_DIAMOND_BOX()'
In function `Fl_Menu_Bar::Fl_Menu_Bar[in-charge](int,
int, int, int, char const*)':
: undefined reference to `vtable for Fl_Menu_Bar'
Another question is, when I try
FIND_PACKAGE(FltkImageViewer), why it was not found
even though the file FindFltkImageViewer.cmake is in
the directory ${InsightApplicationsDIR}?
Thanks,
George
Here is my new CMakeLists.txt file:
CMAKE_MINIMUM_REQUIRED(VERSION 1.6)
PROJECT(GaussianFilter)
INCLUDE_REGULAR_EXPRESSION("^.*$")
SET(InsightApplicationsDIR
$ENV{HOME}/src/InsightApplications-1.4)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${InsightApplicationsDIR})
MESSAGE("CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}")
SET(FltkImageViewerDIR
${InsightApplicationsDIR}/Auxiliary/FltkImageViewer)
# find ITK
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
MESSAGE("ITK_USE_FILE = ${ITK_USE_FILE}")
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR "Cannot build GaussianFilter
without ITK. Please set ITK_DIR.")
ENDIF(ITK_FOUND)
# find FltkImageViewer
FIND_PACKAGE(FltkImageViewer)
IF(FltkImageViewer_FOUND)
MESSAGE("FltkImageViewer_USE_FILE =
${FltkImageViewer_USE_FILE}")
INCLUDE(${FltkImageViewer_USE_FILE})
ELSE(FltkImageViewer_FOUND)
INCLUDE($ENV{HOME}/src/InsightApplications-1.4/FindFltkImageViewer.cmake)
# MESSAGE(FATAL_ERROR "Cannot build GaussianFilter
without FltkImageViewer. Please set
FltkImageViewer_DIR.")
ENDIF(FltkImageViewer_FOUND)
#
INCLUDE($ENV{HOME}/src/InsightApplications-1.4/FindFltkImageViewer.cmake)
INCLUDE_DIRECTORIES(${InsightApplicationsDIR}
${FltkImageViewerDIR})
# find OpenGL
FIND_PACKAGE(OpenGL)
IF(OPENGL_INCLUDE_PATH)
MESSAGE("OPENGL_INCLUDE_PATH=${OPENGL_INCLUDE_PATH}")
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_PATH})
ENDIF(OPENGL_INCLUDE_PATH)
# find FLTK
OPTION(USE_FLTK "Use FLTK for GUI" ON)
IF(USE_FLTK)
FIND_PACKAGE(FLTK)
IF(FLTK_FOUND)
MESSAGE("FLTK FOUND. FLTK_INCLUDE_DIR =
${FLTK_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR}
$ENV{HOME}/src/fltk-1.1.4/src)
ENDIF(FLTK_FOUND)
LINK_LIBRARIES (${FLTK_LIBRARIES})
ENDIF(USE_FLTK)
LINK_LIBRARIES (
ITKAlgorithms
ITKCommon
ITKBasicFilters
)
# set include and lib directories for FltkImageViewer
MESSAGE("FltkImageViewerDIR = ${FltkImageViewerDIR}.")
INCLUDE_DIRECTORIES(${FltkImageViewerDIR}
${GaussianFilter_SOURCE_DIR}
${GaussianFilter_BINARY_DIR})
LINK_DIRECTORIES(${FltkImageViewerDIR})
SET(GaussianFilter_SRCS
liFilterConsole.cxx
liFilterConsoleBase.cxx
GaussianFilter.cxx
)
SET(GaussianFilter2D_SRCS
liFilterConsole2D.cxx
liFilterConsole2DBase.cxx
GaussianFilter2D.cxx
)
MACRO(ADD_GUI_EXECUTABLE name sources)
ADD_EXECUTABLE(${name} ${sources})
ENDMACRO(ADD_GUI_EXECUTABLE)
MACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS files)
IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}
GREATER 1.6)
IF(CMAKE_COMPILER_IS_GNUCXX)
FOREACH(f ${files})
STRING(REGEX REPLACE "\\.fl$" ".cxx" SRC
"${f}")
STRING(REGEX REPLACE ".*/([^/]*)$" "\\1" SRC
"${SRC}")
SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES
COMPILE_FLAGS -w)
ENDFOREACH(f)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}
GREATER 1.6)
ENDMACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS)
ADD_GUI_EXECUTABLE(GaussianFilter
"${GaussianFilter_SRCS}")
ADD_GUI_EXECUTABLE(GaussianFilter2D
"${GaussianFilter2D_SRCS}")
# Take the list of GUI files, generate .cxx and .h
from them and add
# them to the build process of the target
FLTK_WRAP_UI(GaussianFilter liFilterConsoleGUI.fl)
FLTK_WRAP_UI(GaussianFilter2D liFilterConsole2DGUI.fl)
ITK_DISABLE_FLTK_GENERATED_WARNINGS(liFilterConsoleGUI.fl)
ITK_DISABLE_FLTK_GENERATED_WARNINGS(liFilterConsole2DGUI.fl)
MESSAGE("FLTK_LIBRARIES=${FLTK_LIBRARIES},
OPENGL_glu_LIBRARY=${OPENGL_glu_LIBRARY}")
TARGET_LINK_LIBRARIES(GaussianFilter
${OPENGL_glu_LIBRARY}
${OPENGL_LIBRARIES}
ITKFltkImageViewer ITKIO)
TARGET_LINK_LIBRARIES(GaussianFilter2D
${OPENGL_glu_LIBRARY}
${OPENGL_LIBRARIES}
ITKFltkImageViewer ITKIO)
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion . yahoo . com/