3
votes

I downloaded CustusX from the homepage and tried to follow the build instructions. (with ./cxInstaller.py --full --all -t RelWithDebInfo as last command. That went smoothly on Kubuntu 14.04.

Now with everything checked out and available on the harddisk I tried to set up a project that such that I can do some debugging from within an IDE eg. qtcreator or eclipse. I searched the documentation but didn't find it there.

I tried to point cmake-gui at /[...]/custusx/CX/CX, chose Eclipse CDT4 - Ninja and tried to configure. But it fails since it cannot find FindEigen.cmake:

CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find Eigen (missing: EIGEN_INCLUDE_DIR EIGEN_VERSION_OK)
  (Required is at least version "2.91.0")
Call Stack (most recent call first):

/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE) CMake/FindEigen.cmake:76 (find_package_handle_standard_args) CMake/cxInitializeLibraries.cmake:273 (find_package) source/CMakeLists.txt:11 (cx_initialize_Eigen)`

I see there is a FindEigen.cmake in the CMake directory, but setting the CMAKE_MODULE_PATH didn't help either.

QtCreator didn't work either as it experiences the same problems parsing the CMake files when pointed at CMakeLists.txt at custusx/CX/CX

So, the question is how to get a running setup in an IDE preferable qtcreator or eclipse for developing custusx plugins?

2
I wanted to create a custusx tag, but I don't have enough reputation. I consider this an issue related only to this software package, so I would appreciate such a tag (this is along the lines of this answer: adding a comment and ask for creation). It seems as well that it was the intention of authors that questions are asked here (From their developers page: "Post a question on stackoverflow.com/search?q=custusx, use the tag custusx") - Joma

2 Answers

3
votes

CustusX is configured using the superbuild cxInstaller.py. As part of this build, cmake is invoked with parameters:

cmake arguments source_folder

An example when located in the build folder /home/cas/cx/CX/build_Release:

cmake -G"Eclipse CDT4 - Ninja" -DCMAKE_BUILD_TYPE:STRING=Release -DEIGEN_INCLUDE_DIR:PATH=/home/cas/cx/eigen/eigen -DCTK_DIR:PATH=/home/cas/cx/CTK/build_Release -DOpenCV_DIR:PATH=/home/cas/cx/OpenCV/build_Release ...more arguments omitted... /home/cas/cx/CX/CX

This command can be found by looking through the console output of cxInstaller.py, under the heading == configure CustusX ==. Once the superbuild is run once, you can start working with cmake-gui, QtCreator or Eclipse:

When using cmake-gui, set "Where to build the binaries" to your build folder. This will automatally cause the existing cmake configuration to be loaded. In your case, cmake-gui probably tried to configure from scratch, without arguments.

When using QtCreator, first open the root CustusX CMakeLists.txt file. This leads you to the "Configure Project" page. The cmake configuration must be added manually: Set the location of the build folder, then configure, which fails. Then, in "Project->Build Settings->CMake arguments", paste in all arguments that the superbuild (cxInstaller.py) sent to cmake, i.e. the cmake command line excluding cmake and source folder. If using ninja, you might have to configure that as well.

It seems like the current version of QtCreator (3.0.1, Ubuntu 14.04) do not read the cmake configuration of a project, requiring the procedure described above. This was not necessary with the version shipped with Ubuntu 12.04.

When using Eclipse, use "Import", then "General->Existing Projects into Workspace", select CX as root directory, when CustusX should appear as a project that can be imported directly (Caution: If you prevously configured using QtCreator, the Eclipse project files will have been deleted. Run the superbuild again)

3
votes

How to set up QtCreator 3.0.1 (Not needed for other versions of QtCreator) on Ubuntu 14.04 for CustusX:

Get CMake arguments (with minimal output):

./install/cxInstaller.py --configure -t RelWithDebInfo CustusX

Search through the output for the (long) line starting with cmake and ending with ...cx/CX/CX

Paste in these arguments in Project->Build Settings->CMake arguments