cmake
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| cmake [2012/11/05 16:14] – [Windows (Visual Studio)] mikael.ohman | cmake [2024/10/11 13:56] (current) – [CMake tutorial] 212.87.237.27 | ||
|---|---|---|---|
| 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 | + | Create |
| mkdir -p ~/ | mkdir -p ~/ | ||
| Line 34: | Line 34: | ||
| ctest | ctest | ||
| - | Instead of '' | + | Instead of '' |
| Use the command '' | Use the command '' | ||
| Line 47: | Line 47: | ||
| ctest | ctest | ||
| //**Note:** After initial configuration, | //**Note:** After initial configuration, | ||
| + | |||
| + | === Tips: === | ||
| + | * The build process usually hides the compiler command lines, to show them, use | ||
| + | |||
| + | $ make VERBOSE=1 | ||
| + | |||
| ==== CTest ==== | ==== CTest ==== | ||
| Some useful options for ctest include running the tests in parallel; | Some useful options for ctest include running the tests in parallel; | ||
| Line 72: | Line 78: | ||
| {{: | {{: | ||
| + | |||
| + | ==== 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 ( '' | ||
| + | import sys | ||
| + | sys.path.append("/ | ||
| + | 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 79: | 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 " | + | To run the test suite, open the solution explorer in VS and " |
| //**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// | ||
| Line 85: | Line 103: | ||
| //**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// | ||
| + | ===== Windows (MinGW) ===== | ||
| + | - Install CMake (tested with version 3.3.2) | ||
| + | - Install a new mingw-w64 (tested with version 5.2.0). It has support for 32-bit if necessary. MinGW-w64 version is selected from a [[http:// | ||
| + | - Run $ mingw32-make.exe -v | ||
| + | - Run a batch e.g. C:\Program Files (x86)\mingw-w64\i686-5.2.0-posix-dwarf-rt_v4-rev1\mingw-w64.bat which opens a new terminal. In that terminal, we have already PATH to mingw32-make.exe. If the PATH is already set up, any terminal would work. | ||
| + | - Create directory, e.g. mkdir C: | ||
| + | - Run cmake with flags, e.g. $ cmake.exe -G" | ||
| + | - Run mingw32-make.exe -j 3 to compile | ||
| + | - If you want smooth transfer of oofem.exe to another windows computer, you need to put all *.dll from C:\Program Files (x86)\mingw-w64\i686-5.2.0-posix-dwarf-rt_v4-rev1\mingw32\bin in the same directory as oofem.exe. | ||
| + | - Run $ctest for checking OOFEM tests | ||
cmake.1352128465.txt.gz · Last modified: 2012/11/05 16:14 by mikael.ohman