public:user_software:documentation:lofar-cmake

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
public:user_software:documentation:lofar-cmake [2016-12-15 09:15] – Document moved from engineering:software:lofar-cmake Arno Schoenmakerspublic:user_software:documentation:lofar-cmake [2017-03-09 09:16] (current) – [Available Options] Arno Schoenmakers
Line 5: Line 5:
 For general information on CMake, please refer to the [[http://www.cmake.org/cmake/help/documentation.html|CMake documentation pages]].  For general information on CMake, please refer to the [[http://www.cmake.org/cmake/help/documentation.html|CMake documentation pages]]. 
  
-For the old guys among us: See [[.lofar-cmake:rationale|Why we migrated from Autotools to CMake]] for some information about the rationale of moving from Autotools to CMake in the past...+For the old guys among us: See [[engineering:software:lofar-cmake:rationale|Why we migrated from Autotools to CMake]] for some information about the rationale of moving from Autotools to CMake in the past...
  
  
Line 16: Line 16:
  
 === Step 1 === === Step 1 ===
-Make sure you have a working copy of (part of) the LOFAR software tree. Please refer to [[engineering:software:lofarsvn|The LOFAR Subversion Repository]] page for more information on how to check out LOFAR software.+Make sure you have a working copy of (part of) the LOFAR software tree. Please refer to [[lofarsvn|The LOFAR Subversion Repository]] page for more information on how to check out LOFAR software.
  
 <code> <code>
Line 30: Line 30:
 $ svn update LOFAR/CMake $ svn update LOFAR/CMake
 </code> </code>
 +**Note** On newer versions of svn you should probably use ''--depth=immediates'' instead of -N, but I can't get this to work with it. - Adriaan
 +
  
 === Step 2 === === Step 2 ===
Line 97: Line 99:
 | ''USE_SOCKETS''              | Use network sockets                  |      ''ON''       | | ''USE_SOCKETS''              | Use network sockets                  |      ''ON''       |
 | ''USE_THREADS''              | Use thread support                        ''ON''       | | ''USE_THREADS''              | Use thread support                        ''ON''       |
 +| ''USE_CASACORE''             | Use Casacore installation            |      ''ON''       |
  
-Some options are mutually exclusive (e.g., ''USE_LOG4CPLUS'', and ''LOG4CXX'' cannot be used simultaneously). These restrictions are checked by the [[.lofar-cmake:macros#lofaroptions|LofarOptions]] macro. Furthermore, this macro calls ''lofar_find_package'' for each package that is marked to be used. It is a fatal error if that package cannot be found.+Some options are mutually exclusive (e.g., ''USE_LOG4CPLUS'', and ''LOG4CXX'' cannot be used simultaneously). These restrictions are checked by the [[engineering:software:lofar-cmake:macros#lofaroptions|LofarOptions]] macro. Furthermore, this macro calls ''lofar_find_package'' for each package that is marked to be used. It is a fatal error if that package cannot be found.
  
 ''LOFAR_SVN_UPDATE'' uses three states. When ''<undefined>'', only files that are missing but needed are updated. When ''OFF'', files are //never// updated (this is useful if you don't have access to the SVN server, or if you're working with an exported source tree). When ''ON'', files are //always// updated. ''LOFAR_SVN_UPDATE'' uses three states. When ''<undefined>'', only files that are missing but needed are updated. When ''OFF'', files are //never// updated (this is useful if you don't have access to the SVN server, or if you're working with an exported source tree). When ''ON'', files are //always// updated.
Line 117: Line 120:
  
 == Define the package == == Define the package ==
-A leaf-package must be defined using the macro ''lofar_package'' (see [[.lofar-cmake:macros#lofarpackage|LofarPackage]]). Calling this macro ensures that dependent packages are added to the build, and that the compiler's include path and the list of libraries to link against are setup correctly. The package name must be unique in the complete source tree. +A leaf-package must be defined using the macro ''lofar_package'' (see [[engineering:software:lofar-cmake:macros#lofarpackage|LofarPackage]]). Calling this macro ensures that dependent packages are added to the build, and that the compiler's include path and the list of libraries to link against are setup correctly. The package name must be unique in the complete source tree. 
  
 For example: For example:
Line 126: Line 129:
  
 == Define external dependencies == == Define external dependencies ==
-Dependencies on external packages must be defined using the macro ''lofar_find_package'' (see [[.lofar-cmake:macros#lofarfindpackage|LofarFindPackage]]), which is a wrapper around the CMake command [[http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package|find_package]].+Dependencies on external packages must be defined using the macro ''lofar_find_package'' (see [[engineering:software:lofar-cmake:macros#lofarfindpackage|LofarFindPackage]]), which is a wrapper around the CMake command [[http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package|find_package]].
 <code cmake> <code cmake>
 include(LofarFindPackage) include(LofarFindPackage)
Line 168: Line 171:
  
 == LofarPackageVersion == == LofarPackageVersion ==
-[[.lofar-cmake:macros#lofarpackageversion|LofarPackageVersion]] is responsible for generating and/or updating the files ''%%Package__Version.h%%'', ''%%Package__Version.cc%%'', and ''%%version<pkg>%%'' (where ''<pkg>'' is the name of the current package). +[[engineering:software:lofar-cmake:macros#lofarpackageversion|LofarPackageVersion]] is responsible for generating and/or updating the files ''%%Package__Version.h%%'', ''%%Package__Version.cc%%'', and ''%%version<pkg>%%'' (where ''<pkg>'' is the name of the current package). 
 <code> <code>
 include(LofarPackageVersion) include(LofarPackageVersion)
Line 202: Line 205:
 include(LofarCTest) include(LofarCTest)
 </code> </code>
-[[.lofar-cmake:macros#lofarctest|This]] macro will add the current source directory to the compiler's include path, and generate a wrapper script around the ''runtest.sh'' script to define some required environment variables.+[[engineering:software:lofar-cmake:macros#lofarctest|This]] macro will add the current source directory to the compiler's include path, and generate a wrapper script around the ''runtest.sh'' script to define some required environment variables.
  
 == Add tests == == Add tests ==
Line 262: Line 265:
  
 === Adding a package === === Adding a package ===
-Packages are added to the build with the CMake macro ''lofar_add_package'' (see [[.lofar-cmake:macros#lofarpackage|LofarPackage]]). +Packages are added to the build with the CMake macro ''lofar_add_package'' (see [[engineering:software:lofar-cmake:macros#lofarpackage|LofarPackage]]). 
  
 For example, the ''CMakeLists.txt'' file for the ''Calibration'' meta-package contains the following two lines: For example, the ''CMakeLists.txt'' file for the ''Calibration'' meta-package contains the following two lines:
Line 287: Line 290:
  
 == LofarInit == == LofarInit ==
-Next we include the [[.lofar-cmake:macros#lofarinit|LofarInit]] macro file. This file //must// be included //before// the ''project'' command, because it will define the compilers to use (by reading the variants files). Note that at this stage the CMake variable ''CMAKE_MODULE_PATH'' is not yet set, so we need to specify the full path and filename to ''LofarInit''.+Next we include the [[engineering:software:lofar-cmake:macros#lofarinit|LofarInit]] macro file. This file //must// be included //before// the ''project'' command, because it will define the compilers to use (by reading the variants files). Note that at this stage the CMake variable ''CMAKE_MODULE_PATH'' is not yet set, so we need to specify the full path and filename to ''LofarInit''.
 <code> <code>
 include(CMake/LofarInit.cmake) include(CMake/LofarInit.cmake)
Line 299: Line 302:
  
 == LofarGeneral == == LofarGeneral ==
-Then we include the [[.lofar-cmake:macros#lofargeneral|LofarGeneral]] macro file, which mainly performs a number of checks for the presence of system header files. This file //must// be included immediately //after// the ''project'' command.+Then we include the [[engineering:software:lofar-cmake:macros#lofargeneral|LofarGeneral]] macro file, which mainly performs a number of checks for the presence of system header files. This file //must// be included immediately //after// the ''project'' command.
 <code> <code>
 include(LofarGeneral) include(LofarGeneral)
Line 308: Line 311:
  
 == LofarPackage == == LofarPackage ==
-First, we need to include the file [[.lofar-cmake:macros#lofarpackage|LofarPackage]], which defines two important macros: ''lofar_package'' and ''lofar_add_package''.+First, we need to include the file [[engineering:software:lofar-cmake:macros#lofarpackage|LofarPackage]], which defines two important macros: ''lofar_package'' and ''lofar_add_package''.
 <code> <code>
 include(LofarPackage) include(LofarPackage)
Line 348: Line 351:
   * [[engineering:software:lofar-cmake:macros|LOFAR CMake Macros]]   * [[engineering:software:lofar-cmake:macros|LOFAR CMake Macros]]
   * [[engineering:software:lofar-cmake:cmake-equiv-autotools|CMake Equivalent of Autotools Commands and Options]]   * [[engineering:software:lofar-cmake:cmake-equiv-autotools|CMake Equivalent of Autotools Commands and Options]]
-  * [[engineering:software:lofarsvn|The LOFAR Subversion Repository]]+  * [[lofarsvn|The LOFAR Subversion Repository]]
  • Last modified: 2016-12-15 09:15
  • by Arno Schoenmakers