OpenCMISS / manage

The main project for CMake-based OpenCMISS builds
Apache License 2.0
3 stars 15 forks source link

Cannot build Fortran examples #93

Open chrispbradley opened 7 years ago

chrispbradley commented 7 years ago

There are still problems building Fortran examples with the new build system. I updated my setup, manage, cmake_modules to the latest develop versions, completely deleted my build and install trees, and rebuilt OpenCMISS. Trying to build the Burgers Fortran example using the same CMakeLists.txt files that Soroush used gives

cmake -DOpenCMISSLibs_DIR=/data/OpenCMISS/install ../../. CMake Error at /data/OpenCMISS/install/opencmisslibs-config.cmake:74 (include): include could not find load file:

/data/OpenCMISS/install/./context.cmake

Call Stack (most recent call first): CMakeLists.txt:28 (find_package)

CMake Error at /data/OpenCMISS/install/opencmisslibs-config.cmake:81 (message): Mismatch between the current context toolchain () and the toolchain in use (gnu). Call Stack (most recent call first): CMakeLists.txt:28 (find_package)

-- Configuring incomplete, errors occurred!

The first error is that the architecture path has not been set properly by the CMake scripts. This is not surprising as the toolchain, MPI etc. etc. is not considered as per https://github.com/OpenCMISS/manage/issues/86. This then leads to the second error of mismatch.

hsorby commented 7 years ago

What are the contents of the context.cmake file? and context-*.cmake file?

chrispbradley commented 7 years ago

The issue is not what is in content.cmake but rather where it is located. The install/opencmisslibs-config.cmake looks for context.cmake via

Include the context settings info

include(${_CONTEXT_PATH}/context.cmake)

with

set(_CONTEXT_PATH "${_OPENCMISS_IMPORT_PREFIX}${ARCHPATHNOMPI}")

The ${ARCHPATHNOMPI} depends on a number of things like OS, system, compiler, etc. etc. The current opencmisslibs-config.cmake does not check things like compiler etc. etc. before setting the arch path and thus it can not know what the right arch path is.

chrispbradley commented 7 years ago

In addtion, a number of the compiler variables need to be set before project is called from the orginal example CMakeLists.txt so selecting the compiler/mpi/etc. needs to be done there.

hsorby commented 7 years ago

What do the lines 62:70 show in the opencmisslibs-config.cmake file?

chrispbradley commented 7 years ago

#############################################################################

Assemble architecture-path dependent search locations

set(ARCHPATH /.) set(ARCHPATHNOMPI /.) if () include(OCArchitecturePathFunctions) getArchitecturePath(ARCHPATHNOMPI ARCHPATH) endif()

chrispbradley commented 7 years ago

Trouble is the OCArchitecturePathFunctions etc will need the OPENCMISS_TOOLCHAIN and OPENCMISS_MPI variables etc. to be set and it will not be good enough to set them as the compiler etc. needs to be set before the PROJECT call in the example CMakeLists.txt.