#317 closed task (fixed)
Add configuration for CMake build system
Reported by: | mloskot | Owned by: | mloskot |
---|---|---|---|
Priority: | major | Milestone: | 3.3.0 |
Component: | Build/Install | Version: | main |
Severity: | Idea | Keywords: | cmake |
Cc: |
Description
The aim of this task is to add build configure for CMake - a modern cross-platform fast build system, a meta-builder.
One of many reasons is that maintenance of the Visual C++ solutions and projects is usually a big hassle. My aim is to replace it (msvc80, msvc90 and msvc10 in trunk/build) with CMake configuration. Then users will be able to generate Visual Studio projects or other build configurations of their wish which are supported by CMake.
Requirements:
- CMake 2.6+
- One of the build toolsets supported by GEOS and also by CMake generators (i.e. GCC 4.x, Visual Studio 2003+, XCode 2.8+)
Resources:
- CMake Documentation (read manual for CMake 2.6 or newer)
- Really Cool CMake Features
- CMake Language Syntax
- CMake FAQ
- Introduction to Using CMake GUI on Windows
- CMake/CPack/CTest/CDash Open Source Tools to Build Test and Deploy C++ Software - video lecture
Change History (38)
comment:1 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 14 years ago
Added platform.h.cmake file used by build configuration for CMake build system (r2856)
comment:3 by , 14 years ago
Added generation of build-specific platform.h file from platform.h.cmake (r2858)
comment:4 by , 14 years ago
Added checks of C/C++ headers and library features like 64-bit integer type (r2859)
comment:6 by , 14 years ago
- Now CMake can generates geos_c.h (r2861).
- Removed include/geos/version.h.cmake as no longer needed - CMake can subsitute variables of Autoconf-style @VAR@ very well.
comment:7 by , 14 years ago
Updated CMake configuration (r2862):
- CMake generates config headers in build tree.
- Added generation of geos-config script.
- Refined include directories settings.
- Added unit tests package to the configuration.
- Status: GEOS core + GEOS C library + unit tests build and run successfully.
comment:8 by , 14 years ago
Added simplewkttester and xmltester tests to CMake configuration (r2863)
comment:9 by , 14 years ago
Configured make install target for GEOS C++ static library archive and headers (r2865)
comment:10 by , 14 years ago
Configured make install target for GEOS C shared library and headers (r2866)
comment:11 by , 14 years ago
Configured make install for tools to install geos-config program on Unix platforms (r2867)
comment:12 by , 14 years ago
Cleaned redundant include for <cmath> and <math.h> from platform.h.cmake (r2871)
comment:13 by , 14 years ago
Example of how to build GEOS with CMake on Linux:
- Check if you have cmake program installed (I installed CMake from sources):
mloskot@dog:~/dev/geos/_svn/build$ which cmake /usr/local/bin/cmake mloskot@dog:~/dev/geos/_svn/build$ cmake --version cmake version 2.8.0
- Prepare build directory
mloskot@dog:~/dev/geos/_svn/trunk$ mkdir ../build mloskot@dog:~/dev/geos/_svn/trunk$ cd ../build/
- Configure build, optionally, with custom installation prefix
mloskot@dog:~/dev/geos/_svn/build$ cmake ../trunk -DCMAKE_INSTALL_PREFIX=$HOME/usr -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Setting GEOS version 3.3.0 as port of JTS 1.10.0 -- Setting GEOS C API version 1.6.1 -- Looking for include files HAVE_STDINT_H -- Looking for include files HAVE_STDINT_H - found -- Looking for include files HAVE_INTTYPES_H -- Looking for include files HAVE_INTTYPES_H - found -- Looking for include files HAVE_IEEEFP_H -- Looking for include files HAVE_IEEEFP_H - not found. -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of int64_t -- Check size of int64_t - done -- Looking for std::isnan -- Looking for std::isnan - not found. -- Looking for isnan -- Looking for isnan - found -- Looking for std::isfinite -- Looking for std::isfinite - not found. -- Looking for isfinite -- Looking for isfinite - found -- Configuring done -- Generating done -- Build files have been written to: /home/mloskot/dev/geos/_svn/build mloskot@dog:~/dev/geos/_svn/build$
- Build
mloskot@dog:~/dev/geos/_svn/build$ make Scanning dependencies of target geos [ 0%] Building CXX object src/CMakeFiles/geos.dir/operation/valid/RepeatedPointTester.cpp.o ... [ 95%] Building CXX object tests/unit/CMakeFiles/geos_unit.dir/linearref/LengthIndexedLineTest.cpp.o Linking CXX executable geos_unit [ 97%] Built target geos_unit Scanning dependencies of target simplewkttester [ 97%] Building CXX object tests/xmltester/CMakeFiles/simplewkttester.dir/SimpleWKTTester.cpp.o Linking CXX executable simplewkttester [ 97%] Built target simplewkttester Scanning dependencies of target xmltester [ 98%] Building CXX object tests/xmltester/CMakeFiles/xmltester.dir/XMLTester.cpp.o [ 98%] Building CXX object tests/xmltester/CMakeFiles/xmltester.dir/tinyxml/tinyxml.cpp.o [ 98%] Building CXX object tests/xmltester/CMakeFiles/xmltester.dir/tinyxml/tinystr.cpp.o [ 99%] Building CXX object tests/xmltester/CMakeFiles/xmltester.dir/tinyxml/tinyxmlerror.cpp.o [ 99%] Building CXX object tests/xmltester/CMakeFiles/xmltester.dir/tinyxml/tinyxmlparser.cpp.o [ 99%] Building CXX object tests/xmltester/CMakeFiles/xmltester.dir/BufferResultMatcher.cpp.o [100%] Building CXX object tests/xmltester/CMakeFiles/xmltester.dir/SingleSidedBufferResultMatcher.cpp.o Linking CXX executable xmltester [100%] Built target xmltester mloskot@dog:~/dev/geos/_svn/build$
- Install GEOS binaries, headers and geos-config script
mloskot@dog:~/dev/geos/_svn/build$ make install [ 78%] Built target geos [ 78%] Built target geos_c [ 97%] Built target geos_unit [ 97%] Built target simplewkttester [100%] Built target xmltester Install the project... -- Install configuration: "" -- Installing: /home/mloskot/usr/include/geos/geos.h -- Installing: /home/mloskot/usr/include/geos/platform.h -- Installing: /home/mloskot/usr/include/geos/version.h -- Installing: /home/mloskot/usr/include/geos -- Installing: /home/mloskot/usr/include/geos/profiler.h -- Installing: /home/mloskot/usr/include/geos/inline.h ... -- Installing: /home/mloskot/usr/include/geos/planargraph.h -- Installing: /home/mloskot/usr/lib/libgeos.a -- Installing: /home/mloskot/usr/include/geos/geos_c.h -- Installing: /home/mloskot/usr/lib/libgeos_c.so -- Installing: /home/mloskot/usr/bin/geos-config mloskot@dog:~/dev/geos/_svn/build$
Feedback welcome!
comment:14 by , 14 years ago
Updated MSVC specifics (r2875):
- Added CXX flags specific to Visual C++ compiler
- Added ENABLE_MSVC_MP option to allow setting Visual C++ /MP flag that enables multi-process compilation:
cmake ..\trunk -DENABLE_MSVC_MP=ON
comment:16 by , 14 years ago
Fixed related ticket #318
Addd extra test for STL classes in std namespace using TestForANSIForScope macro (r2879)
comment:18 by , 14 years ago
- Added trunk/cmake directory for custom CMake modules (r2882)
- Added CheckPrototypeExists.cmake module - imported from KDE/kdelibs tree (r2883)
- Tweaked detection isfinite and isnan declared as functions in C++ (r2884)
comment:19 by , 14 years ago
Disabled GEOS_ENABLE_ASSERT option for Visual Studio builds - not supported, no sense and causes conflicts with /MD vs /MDd (r2885)
comment:20 by , 14 years ago
- Configured shared library target for C++ API (r2887)
- Added library version information and TODO comment about SOVERSION
comment:21 by , 14 years ago
- Hopefully, fixed the problem about unavailable C99 features if -std=c99 is not specified for GCC 4.3.3 on Ubuntu 9.04. Thanks to Sandro for reporting and testing.
- This is inconsistent behaviour with GCC 4.4.1. Bug reported to Ubuntu 9.04: isfinite macro defined for 4.4.1 but not for 4.3.3
comment:22 by , 14 years ago
- Configured shared library target for C++ API (r2887)
- Added library version information and TODO comment about SOVERSION (r2887)
- GEOS C++ static library was missing from installation targets (r2888)
- Configured make test target for CMake build currently executing only geos_test (r2892)
- Solved problem with repeated definition of getMachineByteOrder function (r2893)
comment:24 by , 14 years ago
Added two new builders to GEOS Buildbot for CMake configuration testing:
comment:25 by , 14 years ago
comment:28 by , 14 years ago
Regarding last fix, here is what I get now after rebuilding and installing geos-config with CMake:
mloskot@dog:~/dev/geos/_svn/build$ cmake ../trunk -DCMAKE_INSTALL_PREFIX=${HOME}/usr ... mloskot@dog:~/dev/geos/_svn/build$ make ... mloskot@dog:~/dev/geos/_svn/build$ make install ... -- Installing: /home/mloskot/usr/bin/geos-config mloskot@dog:~/dev/geos/_svn/build$ ~/usr/bin/geos-config --version --prefix --libs --cflags --ldflags --includes --jtsport 3.3.0 /home/mloskot/usr -L/home/mloskot/usr/lib -lgeos -I/home/mloskot/usr/include -L/home/mloskot/usr/lib /home/mloskot/usr/include 1.10.0
comment:29 by , 14 years ago
Fixed problem in CMake version comparison to disable platform.h (r2905)
There is a problem on Debian 5.0 which includes very early version of CMake 2.6, but I wanted to use more recent features.
comment:30 by , 14 years ago
Ported list of SAVE_XMLTESTS to CMake configuration of XMLTester (r2906)
mloskot@dog:~/dev/geos/_svn/build$ make check Test project /home/mloskot/dev/geos/_svn/build Start 1: geos_unit 1/2 Test #1: geos_unit ........................ Passed 0.10 sec Start 2: xmltester 2/2 Test #2: xmltester ........................ Passed 19.45 sec 100% tests passed, 0 tests failed out of 2 Total Test time (real) = 19.56 sec Built target check
comment:31 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed related ticket #330
comment:32 by , 14 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:33 by , 14 years ago
Patch from Gavin Heavyside that enables CMake to build GEOS as a dependency of user-defined project (r2916)
comment:34 by , 14 years ago
Added cmake/cmake_uninstall.cmake.in script and configured make uninstall target for CMake configuration (r2934)
comment:36 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
I think it's reasonable to consider this task completed. Closing.
Added first straps of configuration for CMake build system (r2852)