User Tools

Site Tools


cmake

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
cmake [2012/12/19 15:35] – [Linux] bpcmake [2013/03/01 17:10] – [Windows (Visual Studio)] mikael.ohman
Line 26: Line 26:
 ===== Linux ===== ===== Linux =====
 Install CMake from the package system of your choice. Install CMake from the package system of your choice.
-Create out-of-tree build directory +Create an out-of-tree build directory:
  
   mkdir -p ~/build/debug/   mkdir -p ~/build/debug/
Line 34: Line 34:
   ctest   ctest
  
-Instead of ''cmake'' can use ''ccmake'' which uses an ncurses interface, or ''cmake-gui'' for a GUI.+Instead of ''cmake'' you can use ''ccmake'' which uses an ncurses interface, or ''cmake-gui'' for a GUI.
 Use the command ''make help'' for a list of all targets. Use the command ''make help'' for a list of all targets.
  
Line 48: Line 48:
 //**Note:** After initial configuration, you cannot change compiler. If you install a new version of GCC, you will need to remove the build directory and do the configuration again. Just doing ''make clean'' isn't enough.// //**Note:** After initial configuration, you cannot change compiler. If you install a new version of GCC, you will need to remove the build directory and do the configuration again. Just doing ''make clean'' isn't enough.//
  
-== Tips: ==+=== Tips: ===
 * The build process usually hides the compiler command lines, to show them, use * The build process usually hides the compiler command lines, to show them, use
  
Line 78: Line 78:
  
 {{:kdevelop_cmake.png}} {{:kdevelop_cmake.png}}
 +
 +==== Python bindings ====
 +With CMake, it is also possible to create shared library loadable as Python module. You need CMake version at least 2.8.8 and two additional cmake parameters ( ''-DUSE_SHARED_LIB=ON'' and ''-DUSE_PYTHON_BINDINGS=ON'' ). After standard ''make'' procedure, ''liboofem.so'' file is created in ''build'' directory. From python it can be loaded and use like this:
 +  import sys
 +  sys.path.append("/path/to/build/directory") # path where liboofem.so was created
 +  import liboofem
 +  
 +  a = liboofem.FloatArray(2)
 +  a[1] = 15.0
 +  a[0] = 10.0
 +  print a[0], a[1]
 +
      
 ===== Windows (Visual Studio) ===== ===== Windows (Visual Studio) =====
Line 85: Line 97:
   - Press generate to produce project files for VS.   - Press generate to produce project files for VS.
  
-To run the test suite, open the solution explorer in VS and "build" the ''test'' target to run through the test suite.+To run the test suite, open the solution explorer in VS and "build" the ''tests'' or ''benchmarks'' targets to run through the test suite or benchmark suite respectively.
  
 //**Note:** The build types (debug, release) are handled internally by Visual Studio, so no configuration option for this is presented in CMake// //**Note:** The build types (debug, release) are handled internally by Visual Studio, so no configuration option for this is presented in CMake//
  
 //**Note:** PETSc isn't easily built on windows, so support for parallel builds is still lacking// //**Note:** PETSc isn't easily built on windows, so support for parallel builds is still lacking//
- 
cmake.txt · Last modified: 2017/01/25 17:34 by smilauer