[geos-commits] [SCM] GEOS branch master updated. b15fd1171823d16195bee17f2c7b44778603258d
git at osgeo.org
git at osgeo.org
Thu May 16 19:47:20 PDT 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, master has been updated
via b15fd1171823d16195bee17f2c7b44778603258d (commit)
via 57a795ca9ab9e6f6469326c9b02f2d73462dd67c (commit)
via 952dc4f5c6fb76f6438f668bdf58a6d01973fda5 (commit)
via 1aedfca497d6de23bd3a857191da10b98b6b01f0 (commit)
from 2a6111a70dec2d31ff4fb133782783f7f857c4ee (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b15fd1171823d16195bee17f2c7b44778603258d
Merge: 2a6111a 57a795c
Author: pramsey <pramsey at cleverelephant.ca>
Date: Thu May 16 19:47:19 2019 -0700
Merge branch 'modern-cmake' of pramsey/geos into master
commit 57a795ca9ab9e6f6469326c9b02f2d73462dd67c
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Thu May 16 16:17:07 2019 -0500
Add moved tests to autotools build, fix cmake versions.txt filename
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e6c0ef..3a6ae79 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,7 +44,7 @@ mark_as_advanced(GEOS_BUILD_DEVELOPER)
#-----------------------------------------------------------------------------
# Version
#-----------------------------------------------------------------------------
-file(READ version.txt _version_txt)
+file(READ Version.txt _version_txt)
string(REGEX MATCH "GEOS_VERSION_MAJOR=([0-9]+)" _ ${_version_txt})
set(_version_major ${CMAKE_MATCH_1})
diff --git a/tests/xmltester/Makefile.am b/tests/xmltester/Makefile.am
index fc34b9d..ff96f47 100644
--- a/tests/xmltester/Makefile.am
+++ b/tests/xmltester/Makefile.am
@@ -117,11 +117,11 @@ INVALID_OUTPUT_XMLTESTS =
FAILING_XMLTESTS = \
$(srcdir)/tests/failure/TestOverlay.xml \
- $(srcdir)/tests/issue/issue-geos-488.xml \
- $(srcdir)/tests/issue/issue-geos-344.xml \
- $(srcdir)/tests/robust/TestRobustRelateFloat.xml \
- $(srcdir)/tests/misc/TestBigNastyBuffer.xml \
- $(srcdir)/tests/misc/TestSameDirection.xml
+ $(srcdir)/tests/failure/issue-geos-488.xml \
+ $(srcdir)/tests/failure/issue-geos-344.xml \
+ $(srcdir)/tests/failure/robust-TestRobustRelateFloat.xml \
+ $(srcdir)/tests/failure/misc-TestBigNastyBuffer.xml \
+ $(srcdir)/tests/failure/misc-TestSameDirection.xml
commit 952dc4f5c6fb76f6438f668bdf58a6d01973fda5
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Thu May 16 15:59:54 2019 -0500
Add new Cmake files to autoconf file list.
Remove deprecated Cmake files from autoconf.
diff --git a/Makefile.am b/Makefile.am
index de7728f..ee5c238 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,10 +26,10 @@ BUILT_SOURCES = geos_revision.h
EXTRA_DIST = acsite.m4 .editorconfig \
Version.txt CMakeLists.txt \
- cmake/modules/CheckPrototypeExists.cmake \
- cmake/modules/COPYING-CMAKE-SCRIPTS \
- cmake/modules/GenerateSourceGroups.cmake \
- cmake/cmake_uninstall.cmake.in geos_revision.h \
+ cmake/GenerateRevisionHeader.cmake \
+ cmake/GetGitRevision.cmake \
+ cmake/cmake_uninstall.cmake.in \
+ cmake/geos-config.cmake \
README.md
ACLOCAL_AMFLAGS = -I macros
commit 1aedfca497d6de23bd3a857191da10b98b6b01f0
Author: Mateusz Ĺoskot <mateusz at loskot.net>
Date: Sat Oct 20 11:59:15 2018 +0200
Modernize CMake configuration
Refactoring based on practices of the Modern CMake approach:
* Set project version based on `version.txt` spec.
* Build shared libraries by default.
* Build tools and `geos-config` script.
* Add make `check` target to run `ctest` (no dependencies).
* Move failing/overlarge tests into `failure` directory.
* Add target to deploy Config-module with installed targets:
`GEOS::geos`, `GEOS::geos_c`.
* Add basic uninstall target
* Add basic client example configured with CMake to use GEOS targets.
diff --git a/.editorconfig b/.editorconfig
index 9f4132e..4b4c95d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -37,6 +37,8 @@ end_of_line = crlf
[CMakeLists.txt]
indent_style = space
indent_size = 2
+trim_trailing_whitespace = true
+insert_final_newline = true
# CMake modules
[*.cmake]
diff --git a/.gitignore b/.gitignore
index 3539e0a..725d990 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
/*build*
+/*install*
aclocal.m4
Makefile.in
Makefile
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f00af5..9e6c0ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,336 +1,263 @@
-#################################################################################
+##############################################################################
+# Part of CMake configuration for GEOS
#
-# Main GEOS build configuration file for CMake build system
-#
-# Copyright (C) 2009 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018-2019 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-cmake_minimum_required(VERSION 3.1.3)
+##############################################################################
-if(NOT CMAKE_VERSION)
- set(CMAKE_VERSION
- "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
-endif()
+# Require CMake 3.8+ with support for meta-features that request compiler
+# modes for specific C/C++ language standard levels.
+cmake_minimum_required(VERSION 3.8)
-if(POLICY CMP0048)
- cmake_policy(SET CMP0048 NEW)
+# Require CMake 3.14+ with VS generator for complete support of VS versions.
+if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+ cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
endif()
-#################################################################################
-# Set GEOS project
-#################################################################################
-project(GEOS LANGUAGES C CXX)
-
-# Add custom GEOS modules for CMake
-list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
-
-#################################################################################
-# Set C++ standard
-#################################################################################
-set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-set(CMAKE_CXX_EXTENSIONS OFF)
-
-message(STATUS "Setting C++ requirement to C++${CMAKE_CXX_STANDARD}")
-
-#################################################################################
-# Setup GEOS version
-#################################################################################
-# READ GEOS VERSIONS FROM FILE
-file(READ "Version.txt" VERSION_TXT)
+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
-string(REGEX MATCH "GEOS_VERSION_MAJOR=([0-9]+)" _ ${VERSION_TXT})
-set(GEOS_VERSION_MAJOR ${CMAKE_MATCH_1})
-
-string(REGEX MATCH "GEOS_VERSION_MINOR=([0-9]+)" _ ${VERSION_TXT})
-set(GEOS_VERSION_MINOR ${CMAKE_MATCH_1})
-
-string(REGEX MATCH "GEOS_VERSION_PATCH=([0-9]+)" _ ${VERSION_TXT})
-set(GEOS_VERSION_PATCH ${CMAKE_MATCH_1})
+# TODO: Follow CMake detection of git and version tagging
+# https://gitlab.kitware.com/cmake/cmake/blob/master/Source/CMakeVersionSource.cmake
+if(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD)
+ set(GEOS_BUILD_FROM_GIT ON)
+endif()
+#-----------------------------------------------------------------------------
+# Options
+#-----------------------------------------------------------------------------
+include(CMakeDependentOption)
+
+## CMake global variables
+option(BUILD_SHARED_LIBS "Build GEOS with shared libraries" ON)
+set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard version to use (default is 11)")
+
+## GEOS custom variables
+cmake_dependent_option(GEOS_BUILD_DEVELOPER
+ "Build with compilation flags useful for development" ON
+ "GEOS_BUILD_FROM_GIT" OFF)
+mark_as_advanced(GEOS_BUILD_DEVELOPER)
+
+#-----------------------------------------------------------------------------
+# Version
+#-----------------------------------------------------------------------------
+file(READ version.txt _version_txt)
+
+string(REGEX MATCH "GEOS_VERSION_MAJOR=([0-9]+)" _ ${_version_txt})
+set(_version_major ${CMAKE_MATCH_1})
+string(REGEX MATCH "GEOS_VERSION_MINOR=([0-9]+)" _ ${_version_txt})
+set(_version_minor ${CMAKE_MATCH_1})
+string(REGEX MATCH "GEOS_VERSION_PATCH=([0-9]+)" _ ${_version_txt})
+set(_version_patch ${CMAKE_MATCH_1})
# OPTIONS: "", "dev", "rc1" etc.
-string(REGEX MATCH "GEOS_PATCH_WORD=([a-zA-Z0-9]+)" _ ${VERSION_TXT})
-set(GEOS_PATCH_WORD ${CMAKE_MATCH_1})
-
-string(REGEX MATCH "CAPI_INTERFACE_CURRENT=([0-9]+)" _ ${VERSION_TXT})
-set(CAPI_INTERFACE_CURRENT ${CMAKE_MATCH_1})
-
-string(REGEX MATCH "CAPI_INTERFACE_REVISION=([0-9]+)" _ ${VERSION_TXT})
-set(CAPI_INTERFACE_REVISION ${CMAKE_MATCH_1})
-
-string(REGEX MATCH "CAPI_INTERFACE_AGE=([0-9]+)" _ ${VERSION_TXT})
-set(CAPI_INTERFACE_AGE ${CMAKE_MATCH_1})
-
-# GEOS release version
-# GEOS C++ library SONAME will use these encoding ABI break at every release
-set(GEOS_VERSION "${GEOS_VERSION_MAJOR}.${GEOS_VERSION_MINOR}.${GEOS_VERSION_PATCH}${GEOS_PATCH_WORD}")
-set(VERSION "${GEOS_VERSION}")
+string(REGEX MATCH "GEOS_PATCH_WORD=([a-zA-Z0-9]+)" _ ${_version_txt})
+set(_version_patch_word ${CMAKE_MATCH_1})
-# Copy version components into different variable names to match those used
-# by autotools for *.h.in files
-set(VERSION_MAJOR "${GEOS_VERSION_MAJOR}")
-set(VERSION_MINOR "${GEOS_VERSION_MINOR}")
-set(VERSION_PATCH "${GEOS_VERSION_PATCH}${GEOS_PATCH_WORD}")
-
-# JTS_PORT is the version of JTS this release is bound to
-string(REGEX MATCH "JTS_PORT=([0-9a-zA-Z\.]+)" _ ${VERSION_TXT})
+# Version of JTS this release is bound to
+string(REGEX MATCH "JTS_PORT=([0-9a-zA-Z\.]+)" _ ${_version_txt})
set(JTS_PORT ${CMAKE_MATCH_1})
-message(STATUS "Setting GEOS version ${VERSION} as port of JTS ${JTS_PORT}")
-
-math(EXPR CAPI_VERSION_MAJOR "${CAPI_INTERFACE_CURRENT} - ${CAPI_INTERFACE_AGE}")
-set(CAPI_VERSION_MINOR ${CAPI_INTERFACE_AGE})
-set(CAPI_VERSION_PATCH ${CAPI_INTERFACE_REVISION})
-set(CAPI_VERSION "${CAPI_VERSION_MAJOR}.${CAPI_VERSION_MINOR}.${CAPI_VERSION_PATCH}")
-message(STATUS "Setting GEOS C API version ${CAPI_VERSION}")
-if (NOT WIN32)
- set(CAPI_SOVERSION ${CAPI_VERSION_MAJOR})
- message(STATUS "Setting GEOS C API soversion ${CAPI_SOVERSION}")
+# Version of public C API
+string(REGEX MATCH "CAPI_INTERFACE_CURRENT=([0-9]+)" _ ${_version_txt})
+set(_version_capi_current ${CMAKE_MATCH_1})
+string(REGEX MATCH "CAPI_INTERFACE_REVISION=([0-9]+)" _ ${_version_txt})
+set(_version_capi_revision ${CMAKE_MATCH_1})
+string(REGEX MATCH "CAPI_INTERFACE_AGE=([0-9]+)" _ ${_version_txt})
+set(_version_capi_age ${CMAKE_MATCH_1})
+
+unset(_version_txt)
+
+math(EXPR _version_capi_major "${_version_capi_current} - ${_version_capi_age}")
+set(CAPI_VERSION_MAJOR ${_version_capi_major})
+set(CAPI_VERSION_MINOR ${_version_capi_age})
+set(CAPI_VERSION_PATCH ${_version_capi_revision})
+set(CAPI_VERSION "${_version_capi_major}.${_version_capi_age}.${_version_capi_revision}")
+if(NOT WIN32)
+ set(CAPI_SOVERSION ${_version_capi_age})
endif()
-#################################################################################
-# Check custom global options
-#################################################################################
-
-option(GEOS_ENABLE_INLINE
- "Set to OFF|ON (default) to control GEOS compilation with small functions inlining" ON)
-
-if(NOT MSVC)
- option(GEOS_ENABLE_ASSERT
- "Set to ON|OFF (default) to build GEOS with assert() macro enabled" OFF)
-endif()
-
-option(GEOS_ENABLE_TESTS
- "Set to OFF|ON (default) to control build of GEOS tests package" ON)
-
-option(GEOS_ENABLE_TESTS_UNIT2_ONLY
- "Set to ON|OFF (default) to enable only new tests based on Catch (WIP: experimental)." OFF)
+unset(_version_capi_current)
+unset(_version_capi_major)
+unset(_version_capi_age)
+unset(_version_capi_revision)
-option(GEOS_BUILD_STATIC
- "Set to OFF|ON (default) to build GEOS static libraries" ON)
-
-option(GEOS_BUILD_SHARED
- "Set to OFF|ON (default) to build GEOS shared libraries" ON)
-
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
- option(GEOS_ENABLE_FLOATSTORE
- "Set to OFF|ON (default) to control IEEE754 conformance and remove extra precision" ON)
+#-----------------------------------------------------------------------------
+# Project
+#-----------------------------------------------------------------------------
+if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.9)
+ list(APPEND _project_info DESCRIPTION "GEOS - C++ port of the Java Topology Suite (JTS)")
endif()
-
-if(APPLE)
- option(GEOS_ENABLE_MACOSX_FRAMEWORK
- "Set to ON|OFF (default) to build GEOS as a Mac OS X framework" OFF)
- option(GEOS_ENABLE_MACOSX_FRAMEWORK_UNIXCOMPAT
- "Set to ON|OFF (default) to add Unix compatibility to the Mac OS X framework" OFF)
+if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
+ list(APPEND _project_info HOMEPAGE_URL "http://geos.osgeo.org")
endif()
-#################################################################################
-# Setup C/C++ compiler options
-#################################################################################
-if(NOT MSVC_IDE)
- if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Debug CACHE STRING
- "Choose the type of build, options are: None Debug Release" FORCE)
- endif()
- message(STATUS "Setting GEOS build type - ${CMAKE_BUILD_TYPE}")
-endif()
+project(GEOS VERSION "${_version_major}.${_version_minor}.${_version_patch}"
+ LANGUAGES C CXX
+ ${_project_info})
-if(CMAKE_BUILD_TYPE STREQUAL Debug)
- add_definitions(-D_DEBUG)
+if("${_version_patch_word}" STREQUAL "")
+ set(GEOS_VERSION_FULL "${GEOS_VERSION}")
+else()
+ set(GEOS_VERSION_FULL "${GEOS_VERSION}-${_version_patch_word}")
endif()
-add_definitions(-DUSE_UNSTABLE_GEOS_CPP_API)
-
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+unset(_version_major)
+unset(_version_minor)
+unset(_version_patch)
+unset(_version_patch_word)
- # General options
- set(CMAKE_C_FLAGS "-pedantic -ansi ${CMAKE_C_FLAGS}")
+message(STATUS "GEOS: Version ${GEOS_VERSION_FULL}")
+message(STATUS "GEOS: C API soversion ${CAPI_SOVERSION}")
+message(STATUS "GEOS: JTS port ${JTS_PORT}")
- # Numerical stability
- if(GEOS_ENABLE_FLOATSTORE)
- # Remove extra precision by forcing conformance to IEEE 754 rather than IEEE 854
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffloat-store")
- endif()
- message(STATUS
- "Forcing IEEE 754 using flag -ffloat-store - ${GEOS_ENABLE_FLOATSTORE}")
-
- # Warnings specification
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -fno-implicit-inline-templates -Wconversion -pedantic -W -Wunused -Wuninitialized -Wextra -Wdouble-promotion -Wshadow")
-
- # Turn on Position Independent Code generation for GEOS C shared library
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wconversion -pedantic -Wmissing-prototypes -W -Wunused -Wuninitialized -Wextra -Wdouble-promotion")
-
- # Enable glibc ISO C99 features (macros isfinite, isnan)
- set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_ISOC99_SOURCE=1")
-
- # For now, punt on ASM on MinGW (Windows+GCC)
- if(WIN32)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTTMATH_NOASM")
- message(STATUS "Setting TTMATH_NOASM")
- endif()
-
-elseif(MSVC)
+#-----------------------------------------------------------------------------
+# C++ language version and compilation flags
+#-----------------------------------------------------------------------------
+message(STATUS "GEOS: Require C++${CMAKE_CXX_STANDARD}")
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
- # Set pedantic mode by default
- #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
- string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+#-----------------------------------------------------------------------------
+# Target geos_cxx_flags: common compilation flags
+#-----------------------------------------------------------------------------
+add_library(geos_cxx_flags INTERFACE)
+target_compile_features(geos_cxx_flags INTERFACE cxx_std_11)
+
+#-----------------------------------------------------------------------------
+# Target geos_cxx_flags: common compilation flags
+#-----------------------------------------------------------------------------
+option(DISABLE_GEOS_INLINE "Disable inlining" OFF)
+if(NOT DISABLE_GEOS_INLINE)
+ target_compile_definitions(geos_cxx_flags INTERFACE GEOS_INLINE)
+endif()
- if(MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
-
- add_definitions(-D_SCL_SECURE_NO_WARNINGS)
- add_definitions(-D_CRT_SECURE_NO_WARNINGS)
- add_definitions(-DNOMINMAX)
- endif()
+#-----------------------------------------------------------------------------
+# Target geos_developer_cxx_flags: developer mode compilation flags
+#-----------------------------------------------------------------------------
+# Do NOT install this target for end-users!
+add_library(geos_developer_cxx_flags INTERFACE)
+if(GEOS_BUILD_DEVELOPER)
+ message(STATUS "GEOS: Developer mode enabled")
endif()
-if(GEOS_ENABLE_INLINE)
- add_definitions(-DGEOS_INLINE)
+# geos_cxx_flags inherits properties from geos_developer_cxx_flags when
+# building as part of the GEOS repository or on explicit request for
+# developer compilation mode, as GEOS contributor.
+# The flags are intended only for GEOS itself and are not part of
+# usage requirements needed by GEOS consumers.
+if(GEOS_BUILD_DEVELOPER)
+ target_link_libraries(geos_cxx_flags
+ INTERFACE
+ $<BUILD_INTERFACE:geos_developer_cxx_flags>)
endif()
-message(STATUS
- "Setting GEOS compilation with small functions inlining - ${GEOS_ENABLE_INLINE}")
-if(NOT MSVC)
- if(GEOS_ENABLE_ASSERT)
- string(REGEX REPLACE "[-/]D.*NDEBUG" "-U NDEBUG"
- CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
- endif()
- message(STATUS
- "Setting GEOS compilation with assert() macro enabled - ${GEOS_ENABLE_ASSERT}")
+target_compile_definitions(geos_developer_cxx_flags
+ INTERFACE
+ USE_UNSTABLE_GEOS_CPP_API)
+
+target_compile_definitions(geos_developer_cxx_flags
+ INTERFACE
+ $<$<CXX_COMPILER_ID:MSVC>:_CRT_NONSTDC_NO_DEPRECATE>
+ $<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_DEPRECATE>
+ $<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
+ $<$<CXX_COMPILER_ID:MSVC>:NOMINMAX>)
+
+target_compile_options(geos_developer_cxx_flags
+ INTERFACE
+ $<$<CXX_COMPILER_ID:MSVC>:-W4>
+ $<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>>:-pedantic -Wall -Wextra -Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wdouble-promotion -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wuninitialized -Wunused-parameter -fno-common>
+ $<$<CXX_COMPILER_ID:GNU>:-fno-implicit-inline-templates>)
+
+# Disable TTMath ASM support on MinGW (Windows+GCC)
+# due to build issues
+if(MINGW)
+ target_compile_definitions(geos_cxx_flags
+ INTERFACE TTMATH_NOASM)
endif()
-#################################################################################
-# Setup C/C++ library features
-#################################################################################
-if (false)
-# check header files
-include(CheckIncludeFiles)
-
-check_include_files(stdint.h HAVE_STDINT_H)
-check_include_files(inttypes.h HAVE_INTTYPES_H)
-check_include_files(ieeefp.h HAVE_IEEEFP_H)
-
-# check types and sizes
-include(CheckTypeSize)
+#-----------------------------------------------------------------------------
+# Target geos: C++ API library
+#-----------------------------------------------------------------------------
+add_library(geos "")
+target_link_libraries(geos PUBLIC geos_cxx_flags)
+add_subdirectory(include)
+add_subdirectory(src)
-if(MSVC)
- check_type_size("__int64" HAVE_INT64_T_64)
-else()
- if(HAVE_STDINT_H OR HAVE_INTTYPES_H)
- check_type_size("int64_t" HAVE_INT64_T_64)
- else()
- check_type_size("long long int" HAVE_LONG_LONG_INT_64)
+if(BUILD_SHARED_LIBS)
+ set_target_properties(geos PROPERTIES VERSION ${GEOS_VERSION})
+ if(NOT WIN32)
+ set_target_properties(geos PROPERTIES SOVERSION ${GEOS_VERSION_MAJOR})
endif()
endif()
-endif()
-################################################################################
-# Setup build directories
-#################################################################################
-
-# Put the libaries and binaries that get built into directories at the
-# top of the build tree rather than in hard-to-find leaf
-# directories. This simplifies manual testing and the use of the build
-# tree rather than installed Boost libraries.
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-
-################################################################################
-# Setup include directories
-#################################################################################
-
-# for including GEOS C++ API headers
-include_directories(${PROJECT_SOURCE_DIR}/include)
-
-# for including build-specific GEOS C API headers
-include_directories(${PROJECT_BINARY_DIR}/capi)
-
-# for including build-specific version.h and geos_c.h
-include_directories(${PROJECT_BINARY_DIR}/include)
-
-# for geos_ts.cpp which does #include "../geos_revision.h" whereas
-# CMake generates geos_revision.h in build directory,
-# to not to pollute source tree.
-include_directories(${PROJECT_BINARY_DIR})
-
-#################################################################################
-# Setup checks and generate config headers
-#################################################################################
-find_package(Git)
-
-message(STATUS "Generating GEOS ${PROJECT_BINARY_DIR}/geos_revision.h")
-file(WRITE ${CMAKE_BINARY_DIR}/geos_revision.h.in "\#define GEOS_REVISION \"@GEOS_REVISION@\"\n")
-
-file(WRITE ${CMAKE_BINARY_DIR}/geos_revision.cmake
-"
-execute_process(COMMAND \${GIT} describe --tags --always
- WORKING_DIRECTORY \${CWD}
- OUTPUT_VARIABLE GEOS_REVISION
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-configure_file(\${SRC} \${DST} @ONLY)
-")
-
-add_custom_target(geos_revision
- COMMAND ${CMAKE_COMMAND}
- -D CWD=${CMAKE_CURRENT_SOURCE_DIR}
- -D GIT=${GIT_EXECUTABLE}
- -D SRC=${PROJECT_BINARY_DIR}/geos_revision.h.in
- -D DST=${PROJECT_BINARY_DIR}/geos_revision.h
- -P ${PROJECT_BINARY_DIR}/geos_revision.cmake)
-
-message(STATUS "Generating GEOS ${PROJECT_BINARY_DIR}/include/geos/version.h")
-configure_file(${PROJECT_SOURCE_DIR}/include/geos/version.h.in
- ${PROJECT_BINARY_DIR}/include/geos/version.h @ONLY)
-
-message(STATUS "Generating GEOS ${PROJECT_BINARY_DIR}/capi/geos_c.h")
-configure_file(${PROJECT_SOURCE_DIR}/capi/geos_c.h.in
- ${PROJECT_BINARY_DIR}/capi/geos_c.h @ONLY)
-
-#################################################################################
-# Configure tests
-#################################################################################
-
-if(GEOS_ENABLE_TESTS OR GEOS_ENABLE_TESTS_UNIT2_ONLY)
- enable_testing()
- # Define "make check" as alias for "make test"
- add_custom_target(check COMMAND ctest)
-endif()
+#-----------------------------------------------------------------------------
+# Target geos_c: C API library
+#-----------------------------------------------------------------------------
+add_library(geos_c "")
+target_link_libraries(geos_c PRIVATE geos)
+add_subdirectory(capi)
-#################################################################################
-# IDE specifics
-#################################################################################
-if (MSVC_IDE)
- # Visual Studio 2017 supports .editorconfig, copy it next to generated .sln
- message(STATUS "Copying .editorconfig file to ${PROJECT_BINARY_DIR}")
- file(COPY "${PROJECT_SOURCE_DIR}/.editorconfig"
- DESTINATION "${PROJECT_BINARY_DIR}")
+if(BUILD_SHARED_LIBS)
+ set_target_properties(geos_c PROPERTIES VERSION ${GEOS_VERSION})
+ if(NOT WIN32)
+ set_target_properties(geos_c PROPERTIES SOVERSION ${GEOS_VERSION_MAJOR})
+ endif()
endif()
-include(GenerateSourceGroups)
+#-----------------------------------------------------------------------------
+# Tests
+#-----------------------------------------------------------------------------
+include(CTest)
+if(BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
-# Enable target debugging for CMake Tools in Visual Studio Code
-# https://github.com/vector-of-bool/vscode-cmake-tools
-include(CMakeToolsHelpers OPTIONAL)
+#-----------------------------------------------------------------------------
+# Install and export targets - support 'make install' or equivalent
+#-----------------------------------------------------------------------------
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/geos-config-version.cmake"
+ VERSION ${GEOS_VERSION}
+ COMPATIBILITY AnyNewerVersion)
+
+configure_file(cmake/geos-config.cmake
+ "${CMAKE_CURRENT_BINARY_DIR}/geos-config.cmake"
+ COPYONLY)
+
+install(TARGETS geos geos_c geos_cxx_flags
+ EXPORT geos-targets
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION bin
+ INCLUDES DESTINATION include)
+
+install(EXPORT geos-targets
+ FILE geos-targets.cmake
+ NAMESPACE GEOS::
+ DESTINATION lib/cmake/GEOS)
+
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/geos-config.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/geos-config-version.cmake"
+ DESTINATION lib/cmake/GEOS)
+install(DIRECTORY
+ "${CMAKE_CURRENT_LIST_DIR}/include/geos"
+ "${CMAKE_CURRENT_BINARY_DIR}/include/geos"
+ DESTINATION include
+ FILES_MATCHING PATTERN "*.h")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capi/geos_c.h"
+ DESTINATION include)
-#################################################################################
-# Configure subdirectories
-#################################################################################
-add_subdirectory(include)
-add_subdirectory(src)
-add_subdirectory(capi)
-add_subdirectory(tests)
add_subdirectory(tools)
-#################################################################################
-# Install/Uninstall
-#################################################################################
+#-----------------------------------------------------------------------------
+# Uninstall
+#-----------------------------------------------------------------------------
configure_file("${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${PROJECT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
@@ -339,11 +266,3 @@ configure_file("${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
-#################################################################################
-# DEBUG settings - TODO: make a summary
-
-message(STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator")
-
-#message(STATUS "XXX: CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
-#message(STATUS "XXX: CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}")
-#message(STATUS "XXX: CMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}")
diff --git a/appveyor.yml b/appveyor.yml
index c761223..d1d637e 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,81 +1,81 @@
-version: 1.0.{build}
-
-image: Visual Studio 2017
-
-platform: x64
-
-configuration: Release
-
-shallow_clone: true
-clone_depth: 5
-
-matrix:
- fast_finish: false # set this flag to immediately finish build once one of the jobs fails.
-
-environment:
- matrix:
- - PLATFORM: x64
- BUILDER: CMake
- GENERATOR: "Visual Studio 15 2017 Win64"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
-# - PLATFORM: x86
-# BUILDER: CMake
-# GENERATOR: "Visual Studio 15 2017"
-# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
-# - PLATFORM: x64
-# BUILDER: CMake
-# GENERATOR: "NMake Makefiles"
-# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
-# - PLATFORM: x86
-# BUILDER: CMake
-# GENERATOR: "NMake Makefiles"
-# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
-# - PLATFORM: x64
-# BUILDER: CMake
-# GENERATOR: "Visual Studio 14 2015 Win64"
-# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
-# - PLATFORM: x86
-# BUILDER: CMake
-# GENERATOR: "Visual Studio 14 2015"
-# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
-# - PLATFORM: x64
-# BUILDER: CMake
-# GENERATOR: "NMake Makefiles"
-# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- - PLATFORM: x86
- BUILDER: CMake
- GENERATOR: "NMake Makefiles"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
-
-init:
- - ps: 'Write-Host "Building GEOS branch: $env:APPVEYOR_REPO_BRANCH" -ForegroundColor Magenta'
- #- ps: |
- # Write-Host "Build worker environment variables:" -ForegroundColor Magenta
- # Get-ChildItem Env: | %{"{0}={1}" -f $_.Name,$_.Value}
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
-
-before_build:
- - ps: 'Write-Host "Running $env:BUILDER with $env:GENERATOR" -ForegroundColor Magenta'
- - if "%BUILDER%"=="CMake" cmake.exe -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% %APPVEYOR_BUILD_FOLDER%
- - if "%BUILDER%"=="NMake" .\autogen.bat
-
-build_script:
- - ps: 'Write-Host "Running $env:BUILDER:" -ForegroundColor Magenta'
- - if "%BUILDER%"=="CMake" cmake --build . --config %CONFIGURATION%
- - if "%BUILDER%"=="NMake" nmake /f makefile.vc
-
-test_script:
- - ps: 'Write-Host "Running tests:" -ForegroundColor Magenta'
- - if "%BUILDER%"=="CMake" ctest --output-on-failure -C %CONFIGURATION%
- - if "%BUILDER%"=="NMake" echo *** NMake does NOT build tests ***
-
-# If you need to debug AppVeyor session (https://www.appveyor.com/docs/how-to/rdp-to-build-worker), then:
-# 1. Uncomment the on_finish section below:
-#on_finish:
-# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
-# 2. Add this line to the init section below
-#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
+version: 1.0.{build}
+
+image: Visual Studio 2017
+
+platform: x64
+
+configuration: Release
+
+shallow_clone: true
+clone_depth: 5
+
+matrix:
+ fast_finish: false # set this flag to immediately finish build once one of the jobs fails.
+
+environment:
+ matrix:
+ - PLATFORM: x64
+ BUILDER: CMake
+ GENERATOR: "Visual Studio 15 2017 Win64"
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+# - PLATFORM: x86
+# BUILDER: CMake
+# GENERATOR: "Visual Studio 15 2017"
+# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+# - PLATFORM: x64
+# BUILDER: CMake
+# GENERATOR: "NMake Makefiles"
+# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+# - PLATFORM: x86
+# BUILDER: CMake
+# GENERATOR: "NMake Makefiles"
+# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+# - PLATFORM: x64
+# BUILDER: CMake
+# GENERATOR: "Visual Studio 14 2015 Win64"
+# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+# - PLATFORM: x86
+# BUILDER: CMake
+# GENERATOR: "Visual Studio 14 2015"
+# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+# - PLATFORM: x64
+# BUILDER: CMake
+# GENERATOR: "NMake Makefiles"
+# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ - PLATFORM: x86
+ BUILDER: CMake
+ GENERATOR: "NMake Makefiles"
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+
+init:
+ - ps: 'Write-Host "Building GEOS branch: $env:APPVEYOR_REPO_BRANCH" -ForegroundColor Magenta'
+ #- ps: |
+ # Write-Host "Build worker environment variables:" -ForegroundColor Magenta
+ # Get-ChildItem Env: | %{"{0}={1}" -f $_.Name,$_.Value}
+ - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
+ - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
+ - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
+ - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
+ - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
+
+before_build:
+ - ps: 'Write-Host "Running $env:BUILDER with $env:GENERATOR" -ForegroundColor Magenta'
+ - if "%BUILDER%"=="CMake" cmake.exe -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% %APPVEYOR_BUILD_FOLDER%
+ - if "%BUILDER%"=="NMake" .\autogen.bat
+
+build_script:
+ - ps: 'Write-Host "Running $env:BUILDER:" -ForegroundColor Magenta'
+ - if "%BUILDER%"=="CMake" cmake --build . --config %CONFIGURATION%
+ - if "%BUILDER%"=="NMake" nmake /f makefile.vc
+
+test_script:
+ - ps: 'Write-Host "Running tests:" -ForegroundColor Magenta'
+ - if "%BUILDER%"=="CMake" ctest --output-on-failure -C %CONFIGURATION%
+ - if "%BUILDER%"=="NMake" echo *** NMake does NOT build tests ***
+
+# If you need to debug AppVeyor session (https://www.appveyor.com/docs/how-to/rdp-to-build-worker), then:
+# 1. Uncomment the on_finish section below:
+#on_finish:
+# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
+# 2. Add this line to the init section below
+#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
diff --git a/capi/CMakeLists.txt b/capi/CMakeLists.txt
index b388b55..066b149 100644
--- a/capi/CMakeLists.txt
+++ b/capi/CMakeLists.txt
@@ -1,75 +1,47 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# GEOS C library build configuration for CMake build system
-#
-# Copyright (C) 2009 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-if(WIN32)
- add_definitions("-DGEOS_DLL_EXPORT=1")
-endif()
-
-set(geos_c_SOURCES
- geos_c.cpp
- geos_ts_c.cpp)
-
-file(GLOB geos_capi_HEADERS ${CMAKE_BINARY_DIR}/capi/*.h) # fix source_group issue
-
-if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK AND GEOS_BUILD_SHARED)
- # if building OS X framework or only building static libs, CAPI built into C++ library
- add_library(geos_c SHARED ${geos_c_SOURCES})
-
- target_link_libraries(geos_c geos)
-
- if (WIN32)
- set_target_properties(geos_c
- PROPERTIES
- VERSION ${CAPI_VERSION}
- CLEAN_DIRECT_OUTPUT 1)
- else()
- set_target_properties(geos_c
- PROPERTIES
- VERSION ${CAPI_VERSION}
- SOVERSION ${CAPI_SOVERSION}
- CLEAN_DIRECT_OUTPUT 1)
- endif()
-
- add_dependencies(geos_c geos_revision)
-
+################################################################################
+
+if(GEOS_BUILD_FROM_GIT)
+ add_custom_target(geos_revision_header
+ COMMAND ${CMAKE_COMMAND}
+ -D DST=${CMAKE_BINARY_DIR}/geos_revision.h
+ -D CMAKE_MODULE_PATH="${PROJECT_SOURCE_DIR}/cmake"
+ -P ${CMAKE_SOURCE_DIR}/cmake/GenerateRevisionHeader.cmake
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
else()
- add_library(geos_c INTERFACE)
- target_link_libraries(geos_c INTERFACE geos-static)
+ add_library(geos_revision_header INTERFACE)
endif()
+add_dependencies(geos_c geos_revision_header)
-#################################################################################
-# Installation
-#################################################################################
+file(GLOB_RECURSE _headers ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND)
+target_sources(geos_c PRIVATE ${_headers})
+unset(_headers)
-if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
- DESTINATION GEOS.framework/Versions/${VERSION_MAJOR}/Headers)
- install(CODE "execute_process(COMMAND sed -E -i \"\" \"s,# *include[[:space:]]+<geos/,#include <GEOS/,g\" \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/GEOS.framework/Versions/${VERSION_MAJOR}/Headers/geos_c.h\")")
-else()
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
- DESTINATION include)
-endif()
+target_include_directories(geos_c
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<INSTALL_INTERFACE:include/geos>)
-if(NOT GEOS_ENABLE_MACOSX_FRAMEWORK AND GEOS_BUILD_SHARED)
- install(TARGETS geos_c
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-endif()
+set(VERSION ${GEOS_VERSION})
+set(VERSION_MAJOR ${GEOS_VERSION_MAJOR})
+set(VERSION_MINOR ${GEOS_VERSION_MINOR})
+set(VERSION_PATCH ${GEOS_VERSION_PATCH})
-#################################################################################
-# Group source files for IDE source explorers (e.g. Visual Studio)
-#################################################################################
+configure_file(
+ ${CMAKE_CURRENT_LIST_DIR}/geos_c.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h
+ @ONLY)
-source_group("Header Files" FILES ${geos_capi_HEADERS})
+unset(VERSION)
+unset(VERSION_MAJOR)
+unset(VERSION_MINOR)
+unset(VERSION_PATCH)
diff --git a/cmake/GenerateRevisionHeader.cmake b/cmake/GenerateRevisionHeader.cmake
new file mode 100644
index 0000000..26072f9
--- /dev/null
+++ b/cmake/GenerateRevisionHeader.cmake
@@ -0,0 +1,26 @@
+################################################################################
+# Part of CMake configuration for GEOS
+#
+# Copyright (C) 2018 Daniel Baston <dbaston at gmail.com>
+#
+# This is free software; you can redistribute and/or modify it under
+# the terms of the GNU Lesser General Public Licence as published
+# by the Free Software Foundation.
+# See the COPYING file for more information.
+################################################################################
+include(GetGitRevision)
+
+get_git_revision(
+ HASH_LENGTH 7
+ HASH GEOS_GIT_HASH
+ DIRTY GEOS_GIT_IS_DIRTY)
+
+set(REV ${GEOS_GIT_HASH})
+if (${GEOS_GIT_IS_DIRTY})
+ set(REV "${REV} (dirty)")
+endif()
+
+message(STATUS "GEOS: GEOS_REVISION=${REV}")
+
+file(WRITE ${DST} "#define GEOS_REVISION \"${REV}\"
+")
diff --git a/cmake/GetGitRevision.cmake b/cmake/GetGitRevision.cmake
new file mode 100644
index 0000000..65b3fb2
--- /dev/null
+++ b/cmake/GetGitRevision.cmake
@@ -0,0 +1,40 @@
+# Adapted from https://gitlab.kitware.com/cmake/cmake/blob/aec06dd4922187ce5346d20a9f0d53f01b6ce9fc/Source/CMakeVersionSource.cmake
+
+# Try to identify the current development source version.
+function(get_git_revision)
+ cmake_parse_arguments("ARG" "" "HASH;HASH_LENGTH;DIRTY" "" "${ARGN}")
+
+ if(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD)
+ find_program(GIT_EXECUTABLE NAMES git git.cmd)
+ mark_as_advanced(GIT_EXECUTABLE)
+
+ if(GIT_EXECUTABLE)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=${ARG_HASH_LENGTH} HEAD
+ OUTPUT_VARIABLE head
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+ if(head)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD -- --ignore-space-at-eol
+ OUTPUT_VARIABLE dirty
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+ endif()
+ endif()
+ endif()
+
+ set(${ARG_HASH} "${head}" PARENT_SCOPE)
+
+ if(dirty)
+ set(${ARG_DIRTY} 1 PARENT_SCOPE)
+ else()
+ set("${ARG_DIRTY}" 0 PARENT_SCOPE)
+ endif()
+endfunction()
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
index 725ab7d..7c63427 100644
--- a/cmake/cmake_uninstall.cmake.in
+++ b/cmake/cmake_uninstall.cmake.in
@@ -4,12 +4,12 @@
#
# Defines commands used by make uninstall target of CMake build configuration.
#
-# Author: Credit to the CMake mailing list archives for providing this solution.
+# Author: Credit to the CMake mailing list archives for providing this solution.
# Modifications: Mateusz Loskot <mateusz at loskot.net>
#
#################################################################################
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
- message(FATAL_ERROR
+ message(FATAL_ERROR
"Cannot find install manifest:
@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
endif()
@@ -20,7 +20,7 @@ string(REGEX REPLACE "\n" ";" files "${files}")
set(GEOS_INCLUDE_DIR)
foreach(file ${files})
- if(${file} MATCHES "geos.h")
+ if(${file} MATCHES "geom.h")
get_filename_component(GEOS_INCLUDE_DIR ${file} PATH)
endif()
@@ -39,7 +39,7 @@ foreach(file ${files})
endforeach()
message(STATUS "Deleting ${GEOS_INCLUDE_DIR} directory")
-exec_program("@CMAKE_COMMAND@"
+exec_program("@CMAKE_COMMAND@"
ARGS "-E remove_directory \"${GEOS_INCLUDE_DIR}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval)
diff --git a/tests/perf/operation/CMakeLists.txt b/cmake/geos-config.cmake
similarity index 63%
copy from tests/perf/operation/CMakeLists.txt
copy to cmake/geos-config.cmake
index 9a23175..402c4c1 100644
--- a/tests/perf/operation/CMakeLists.txt
+++ b/cmake/geos-config.cmake
@@ -1,15 +1,11 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# CMake configuration for GEOS perf/operation tests
-#
-# Copyright (C) 2017 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-add_subdirectory(buffer)
-add_subdirectory(predicate)
+################################################################################
+include("${CMAKE_CURRENT_LIST_DIR}/geos-targets.cmake")
diff --git a/cmake/modules/COPYING-CMAKE-SCRIPTS b/cmake/modules/COPYING-CMAKE-SCRIPTS
deleted file mode 100644
index 4b41776..0000000
--- a/cmake/modules/COPYING-CMAKE-SCRIPTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cmake/modules/CheckPrototypeExists.cmake b/cmake/modules/CheckPrototypeExists.cmake
deleted file mode 100644
index 4b720c5..0000000
--- a/cmake/modules/CheckPrototypeExists.cmake
+++ /dev/null
@@ -1,43 +0,0 @@
-# - Check if the prototype for a function exists.
-# CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE)
-#
-# FUNCTION - the name of the function you are looking for
-# HEADER - the header(s) where the prototype should be declared
-# VARIABLE - variable to store the result
-#
-# The following variables may be set before calling this macro to
-# modify the way the check is run:
-#
-# CMAKE_REQUIRED_FLAGS = string of compile command line flags
-# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-# CMAKE_REQUIRED_INCLUDES = list of include directories
-
-# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-# Source: KDE/kdelibs
-# <http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/CheckPrototypeExists.cmake?pathrev=776742>
-#
-INCLUDE(CheckCXXSourceCompiles)
-
-MACRO(CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
- SET(_INCLUDE_FILES)
- FOREACH (it ${_HEADER})
- SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
- ENDFOREACH (it)
-
- SET(_CHECK_PROTO_EXISTS_SOURCE_CODE "
-${_INCLUDE_FILES}
-int main()
-{
-#ifndef ${_SYMBOL}
- int i = sizeof(&${_SYMBOL});
-#endif
- return 0;
-}
-")
- CHECK_CXX_SOURCE_COMPILES("${_CHECK_PROTO_EXISTS_SOURCE_CODE}" ${_RESULT})
-ENDMACRO(CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
-
diff --git a/cmake/modules/GenerateSourceGroups.cmake b/cmake/modules/GenerateSourceGroups.cmake
deleted file mode 100644
index 0366996..0000000
--- a/cmake/modules/GenerateSourceGroups.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Macro generates tree of IDE source groups based on folders structure
-# Source: http://www.cmake.org/pipermail/cmake/2013-November/056332.html
-#
-macro(GenerateSourceGroups curdir)
- file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir} ${PROJECT_SOURCE_DIR}/${curdir}/*)
- foreach(child ${children})
- if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
- GenerateSourceGroups(${curdir}/${child})
- else()
- string(REPLACE "/" "\\" groupname ${curdir})
- # I would like to call the src root folder in a different name, only in visual studio (not mandatory requirement)
- string(REPLACE "src" "Source Files" groupname ${groupname})
- source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
- endif()
- endforeach()
-endmacro()
\ No newline at end of file
diff --git a/examples/client/CMakeLists.txt b/examples/client/CMakeLists.txt
new file mode 100644
index 0000000..b6106c6
--- /dev/null
+++ b/examples/client/CMakeLists.txt
@@ -0,0 +1,20 @@
+################################################################################
+# Part of CMake configuration for GEOS
+#
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
+#
+# This is free software; you can redistribute and/or modify it under
+# the terms of the GNU Lesser General Public Licence as published
+# by the Free Software Foundation.
+# See the COPYING file for more information.
+################################################################################
+cmake_minimum_required(VERSION 3.12)
+
+project(GEOS VERSION 1.0.0 LANGUAGES C CXX)
+find_package(GEOS 3.8 REQUIRED)
+
+add_executable(geos_client geos_client.cpp)
+target_link_libraries(geos_client PRIVATE GEOS::geos)
+
+add_executable(geos_c_client geos_c_client.cpp)
+target_link_libraries(geos_c_client PRIVATE GEOS::geos_c)
diff --git a/examples/client/geos_c_client.cpp b/examples/client/geos_c_client.cpp
new file mode 100644
index 0000000..7b1be59
--- /dev/null
+++ b/examples/client/geos_c_client.cpp
@@ -0,0 +1,6 @@
+#include <geos_c.h>
+
+int main()
+{
+ finishGEOS();
+}
\ No newline at end of file
diff --git a/examples/client/geos_client.cpp b/examples/client/geos_client.cpp
new file mode 100644
index 0000000..d880ee0
--- /dev/null
+++ b/examples/client/geos_client.cpp
@@ -0,0 +1,8 @@
+#include <geos/geom/GeometryFactory.h>
+using namespace geos::geom;
+
+int main()
+{
+ GeometryFactory::Ptr factory = GeometryFactory::create();
+ (void)factory;
+}
\ No newline at end of file
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 293e5dc..df8cd4d 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,54 +1,33 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# GEOS C++ library build configuration for CMake build system
-#
-# Copyright (C) 2009 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-#################################################################################
-# Install/Uninstall
-#################################################################################
-
-# There is a builtin cmake way to get headers in the right location
-# for OS X framework, but it's not practical this complex tree
-
-if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- set(installdest GEOS.framework/Versions/${VERSION_MAJOR}/Headers)
-else()
- set(installdest include/geos)
-endif()
-
-
-install(FILES geos.h
- DESTINATION ${installdest})
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos/version.h
- DESTINATION ${installdest})
-
-install(DIRECTORY geos/
- DESTINATION ${installdest}
- FILES_MATCHING
- PATTERN "*.h"
- PATTERN "*.inl"
- PATTERN ".svn" EXCLUDE)
-
-# Some post-processing for the framework
-# luckily GEOS uses header subdir already, just need to change case
-if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- install(CODE
- "execute_process(COMMAND find \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${installdest}\" -name *.* -print0
- COMMAND xargs -0 sed -E -i \"\" \"s,# *include[[:space:]]+<geos/,#include <GEOS/,g\")")
- install(CODE
- "execute_process(COMMAND ln -sfh Versions/Current/Headers \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/GEOS.framework/Headers\")")
-endif()
-
-#################################################################################
-# Group source files for IDE source explorers (e.g. Visual Studio)
-#################################################################################
-GenerateSourceGroups(include)
+################################################################################
+file(GLOB_RECURSE _headers ${CMAKE_CURRENT_LIST_DIR}/*.h CONFIGURE_DEPEND)
+target_sources(geos PRIVATE ${_headers})
+unset(_headers)
+
+target_include_directories(geos
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<INSTALL_INTERFACE:include/geos>)
+
+set(VERSION ${GEOS_VERSION})
+set(VERSION_MAJOR ${GEOS_VERSION_MAJOR})
+set(VERSION_MINOR ${GEOS_VERSION_MINOR})
+set(VERSION_PATCH ${GEOS_VERSION_PATCH})
+
+configure_file(${CMAKE_CURRENT_LIST_DIR}/geos/version.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/geos/version.h
+ @ONLY)
+
+unset(VERSION)
+unset(VERSION_MAJOR)
+unset(VERSION_MINOR)
+unset(VERSION_PATCH)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5a7c7b5..6fbc982 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,125 +1,13 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# GEOS C++ library build configuration for CMake build system
-#
-# Copyright (C) 2009 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-file(GLOB_RECURSE geos_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
-file(GLOB_RECURSE geos_ALL_HEADERS ${CMAKE_SOURCE_DIR}/include/*.h) # fix source_group issue
-
-# Building with Visual C++ x86_64 needs to compile the asm utilities first
-if (MSVC AND (${CMAKE_SIZEOF_VOID_P} EQUAL 8))
- set(TTMATH_MSVC64_ASM ttmathuint_x86_64_msvc.asm)
- enable_language(ASM_MASM)
- message(STATUS "Enabled MASM to compile '${TTMATH_MSVC64_ASM}'")
- list(INSERT geos_SOURCES 0 ${CMAKE_SOURCE_DIR}/include/geos/algorithm/ttmath/${TTMATH_MSVC64_ASM})
-endif()
-
-# Include CAPI in OS X framework binary and in static libs
-set(geos_c_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/../capi/geos_c.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/../capi/geos_ts_c.cpp)
-
-if(GEOS_ENABLE_MACOSX_FRAMEWORK)
- # OS X frameworks don't have static libs
- # also 1 binary, so include CAPI here
- # and, make name all caps
-
- add_library(GEOS SHARED ${geos_SOURCES} ${geos_c_SOURCES})
-
- math(EXPR CVERSION "${VERSION_MAJOR} + 1")
- # VERSION = current version, SOVERSION = compatibility version
- set_target_properties(GEOS
- PROPERTIES
- CLEAN_DIRECT_OUTPUT 1
- FRAMEWORK 1
- VERSION "${CVERSION}.${VERSION_MINOR}.${VERSION_PATCH}"
- SOVERSION ${CVERSION}
- FRAMEWORK_VERSION ${VERSION_MAJOR}
- BUILD_WITH_INSTALL_RPATH TRUE
- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}"
- MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in"
- MACOSX_FRAMEWORK_BUNDLE_VERSION "GEOS ${VERSION}"
- MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION}
- MACOSX_FRAMEWORK_IDENTIFIER org.osgeo.geos)
-
- install(TARGETS GEOS FRAMEWORK DESTINATION .)
-
- if(GEOS_ENABLE_MACOSX_FRAMEWORK_UNIXCOMPAT)
- # Unix compatibility option, provides typical bin/lib/include folder
- # structure for framework-challenged projects
-
- set(GEOS_FWDIR "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/GEOS.framework")
- set(GEOS_FWDIR_VER "${GEOS_FWDIR}/Versions/${VERSION_MAJOR}")
- install(CODE "execute_process(COMMAND mkdir -p \"${GEOS_FWDIR_VER}/unix/bin\")")
- install(CODE "execute_process(COMMAND mkdir -p \"${GEOS_FWDIR_VER}/unix/include\")")
- install(CODE "execute_process(COMMAND mkdir -p \"${GEOS_FWDIR_VER}/unix/lib\")")
- install(CODE "execute_process(COMMAND ln -sfh ../../Headers \"${GEOS_FWDIR_VER}/unix/include/geos\")")
- install(CODE "execute_process(COMMAND ln -sf ../../Headers/geos_c.h \"${GEOS_FWDIR_VER}/unix/include/geos_c.h\")")
- install(CODE "execute_process(COMMAND ln -sf ../../GEOS \"${GEOS_FWDIR_VER}/unix/lib/libgeos.dylib\")")
- install(CODE "execute_process(COMMAND ln -sf ../../GEOS \"${GEOS_FWDIR_VER}/unix/lib/libgeos_c.dylib\")")
- install(CODE "execute_process(COMMAND ln -sfh Versions/Current/unix \"${GEOS_FWDIR}/unix\")")
- endif()
-
-else()
-
- if(GEOS_BUILD_SHARED)
- add_library(geos SHARED ${geos_SOURCES} ${geos_ALL_HEADERS})
-
- set_target_properties(geos
- PROPERTIES
- DEFINE_SYMBOL GEOS_DLL_EXPORT
- VERSION ${VERSION}
- CLEAN_DIRECT_OUTPUT 1)
-
- install(TARGETS geos
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
- endif()
-
- if(GEOS_BUILD_STATIC)
- file(GLOB geos_capi_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../capi/*.h) # fix source_group issue
- add_library(geos-static STATIC ${geos_SOURCES} ${geos_c_SOURCES} ${geos_ALL_HEADERS} ${geos_capi_HEADERS})
-
- set_target_properties(geos-static
- PROPERTIES
- OUTPUT_NAME "geos"
- PREFIX "lib"
- CLEAN_DIRECT_OUTPUT 1)
-
- add_dependencies(geos-static geos_revision)
-
- install(TARGETS geos-static
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-
- endif()
-
- if(NOT GEOS_BUILD_SHARED)
- add_library(geos INTERFACE)
- target_link_libraries(geos INTERFACE geos-static)
- endif()
-
-endif() # (GEOS_ENABLE_MACOSX_FRAMEWORK)
-
-# if(APPLE)
-# set_target_properties(geos
-# PROPERTIES
-# BUILD_WITH_INSTALL_RPATH TRUE
-# INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}")
-# endif()
-
-
-#################################################################################
-# Group source files for IDE source explorers (e.g. Visual Studio)
-#################################################################################
-GenerateSourceGroups(src)
+################################################################################
+file(GLOB_RECURSE _sources ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND)
+target_sources(geos PRIVATE ${_sources})
+unset(_sources)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 9138fe3..bb996be 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,15 +1,14 @@
- #################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# GEOS tests build configuration for CMake build system
-#
-# Copyright (C) 2009 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
+################################################################################
+add_custom_target(check COMMAND ctest)
add_subdirectory(unit)
add_subdirectory(xmltester)
diff --git a/tests/bigtest/CMakeLists.txt b/tests/bigtest/CMakeLists.txt
index d4e25fa..a809e5c 100644
--- a/tests/bigtest/CMakeLists.txt
+++ b/tests/bigtest/CMakeLists.txt
@@ -1,45 +1,20 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# CMake configuration for GEOS big test
-#
-# Copyright (C) 2011 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-set(STATUS_MESSAGE "Enable GEOS large geometry tests build")
-set(STATUS_RESULT "OFF")
-
-if(GEOS_ENABLE_TESTS)
-
- include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
- add_executable(test_bug234 bug234.cpp)
-
- if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- target_link_libraries(test_bug234 GEOS)
- else()
- target_link_libraries(test_bug234 geos)
- endif()
-
- add_executable(test_sweep_line_speed
- TestSweepLineSpeed.cpp
- GeometryTestFactory.cpp
- bigtest.h)
- if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- target_link_libraries(test_sweep_line_speed GEOS)
- else()
- target_link_libraries(test_sweep_line_speed geos)
- endif()
-
- add_test(test_bug234 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_bug234)
- add_test(test_sweep_line_speed ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_sweep_line_speed)
-
- set(STATUS_RESULT "ON")
-endif()
-
-message(STATUS "${STATUS_MESSAGE} - ${STATUS_RESULT}")
+################################################################################
+add_executable(test_bug234 bug234.cpp)
+target_link_libraries(test_bug234 PRIVATE geos)
+add_test(NAME test_bug234 COMMAND test_bug234)
+
+add_executable(test_sweep_line_speed)
+target_sources(test_sweep_line_speed
+ PRIVATE
+ TestSweepLineSpeed.cpp
+ GeometryTestFactory.cpp)
+target_link_libraries(test_sweep_line_speed PRIVATE geos)
diff --git a/tests/perf/CMakeLists.txt b/tests/perf/CMakeLists.txt
index 78c55ad..11dc524 100644
--- a/tests/perf/CMakeLists.txt
+++ b/tests/perf/CMakeLists.txt
@@ -1,34 +1,16 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# CMake configuration for GEOS perf tests
-#
-# Copyright (C) 2017 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-set(STATUS_MESSAGE "Enable GEOS performance tests build")
-set(STATUS_RESULT "OFF")
-
-if(GEOS_ENABLE_TESTS)
-
- include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
- add_executable(perf_class_sizes ClassSizes.cpp)
-
- target_link_libraries(perf_class_sizes geos)
-
-# add_test(perf_class_sizes ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perf_class_sizes)
-
- add_subdirectory(algorithm)
- add_subdirectory(operation)
- add_subdirectory(capi)
-
- set(STATUS_RESULT "ON")
-endif()
+################################################################################
+add_executable(test_perf_class_sizes ClassSizes.cpp)
+target_link_libraries(test_perf_class_sizes PRIVATE geos)
+add_test(NAME test_perf_class_sizes COMMAND test_perf_class_sizes)
-message(STATUS "${STATUS_MESSAGE} - ${STATUS_RESULT}")
+add_subdirectory(operation)
+add_subdirectory(capi)
diff --git a/tests/perf/capi/CMakeLists.txt b/tests/perf/capi/CMakeLists.txt
index f6d8315..3b85d89 100644
--- a/tests/perf/capi/CMakeLists.txt
+++ b/tests/perf/capi/CMakeLists.txt
@@ -1,18 +1,19 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# CMake configuration for GEOS perf/capi tests
-#
-# Copyright (C) 2017 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-add_executable(perf_memleak_mp_prep memleak_mp_prep.c)
-
-target_link_libraries(perf_memleak_mp_prep geos_c)
-
-#add_test(perf_memleak_mp_prep ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perf_memleak_mp_prep)
+################################################################################
+add_executable(test_perf_memleak_mp_prep memleak_mp_prep.c)
+# test_perf_memleak_mp_prep is not dependant against geos target,
+# but geos_c only, so need explicit include directories.
+target_include_directories(test_perf_memleak_mp_prep
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
+target_link_libraries(test_perf_memleak_mp_prep PRIVATE geos_c)
+add_test(NAME test_perf_memleak_mp_prep COMMAND test_perf_memleak_mp_prep)
diff --git a/tests/perf/operation/CMakeLists.txt b/tests/perf/operation/CMakeLists.txt
index 9a23175..10b0eb4 100644
--- a/tests/perf/operation/CMakeLists.txt
+++ b/tests/perf/operation/CMakeLists.txt
@@ -1,15 +1,12 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# CMake configuration for GEOS perf/operation tests
-#
-# Copyright (C) 2017 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
+################################################################################
add_subdirectory(buffer)
add_subdirectory(predicate)
diff --git a/tests/perf/operation/buffer/CMakeLists.txt b/tests/perf/operation/buffer/CMakeLists.txt
index 57d2bd4..de937de 100644
--- a/tests/perf/operation/buffer/CMakeLists.txt
+++ b/tests/perf/operation/buffer/CMakeLists.txt
@@ -1,18 +1,13 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# CMake configuration for GEOS perf/operation/buffer tests
-#
-# Copyright (C) 2017 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-add_executable(perf_iterated_buffer IteratedBufferStressTest.cpp)
-
-target_link_libraries(perf_iterated_buffer geos)
-
-#add_test(perf_iterated_buffer ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perf_iterated_buffer)
+################################################################################
+add_executable(test_perf_iterated_buffer IteratedBufferStressTest.cpp)
+target_link_libraries(test_perf_iterated_buffer PRIVATE geos)
+add_test(NAME test_perf_iterated_buffer COMMAND test_perf_iterated_buffer)
diff --git a/tests/perf/operation/predicate/CMakeLists.txt b/tests/perf/operation/predicate/CMakeLists.txt
index 4260149..2ce3624 100644
--- a/tests/perf/operation/predicate/CMakeLists.txt
+++ b/tests/perf/operation/predicate/CMakeLists.txt
@@ -1,19 +1,13 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# CMake configuration for GEOS perf/operation/predicate tests
-#
-# Copyright (C) 2017 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-
-add_executable(perf_rectangle_intersects RectangleIntersectsPerfTest.cpp)
-
-target_link_libraries(perf_rectangle_intersects geos)
-
-#add_test(perf_rectangle_intersects ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perf_rectangle_intersects)
+################################################################################
+add_executable(test_perf_rectangle_intersects RectangleIntersectsPerfTest.cpp)
+target_link_libraries(test_perf_rectangle_intersects PRIVATE geos)
+add_test(NAME test_perf_rectangle_intersects COMMAND test_perf_rectangle_intersects)
diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt
index 8bfc898..307b561 100644
--- a/tests/unit/CMakeLists.txt
+++ b/tests/unit/CMakeLists.txt
@@ -1,41 +1,20 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# GEOS unit tests build configuration for CMake build system
-#
-# Copyright (C) 2009 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-set(STATUS_MESSAGE "Enable GEOS unit tests build")
-set(STATUS_RESULT "OFF")
-
-if(GEOS_ENABLE_TESTS)
- include_directories(${CMAKE_SOURCE_DIR}/capi)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
- file(GLOB_RECURSE geos_unit_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
-
- add_executable(test_geos_unit ${geos_unit_SOURCES})
-
- if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- target_link_libraries(test_geos_unit GEOS)
- else()
- target_link_libraries(test_geos_unit geos geos_c)
- endif()
-
- add_test(test_geos_unit ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_geos_unit)
-
- set(STATUS_RESULT "ON")
-endif()
+################################################################################
+file(GLOB_RECURSE _sources ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND)
+add_executable(test_geos_unit ${_sources})
+unset(_sources)
-message(STATUS "${STATUS_MESSAGE} - ${STATUS_RESULT}")
+target_link_libraries(test_geos_unit PRIVATE geos geos_c)
+target_include_directories(test_geos_unit
+ PRIVATE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)
-#################################################################################
-# Group source files for IDE source explorers (e.g. Visual Studio)
-#################################################################################
-GenerateSourceGroups(tests/unit)
+add_test(NAME test_geos_unit COMMAND test_geos_unit)
diff --git a/tests/xmltester/CMakeLists.txt b/tests/xmltester/CMakeLists.txt
index 9d1c9c9..9fea5aa 100644
--- a/tests/xmltester/CMakeLists.txt
+++ b/tests/xmltester/CMakeLists.txt
@@ -1,163 +1,31 @@
-#################################################################################
+################################################################################
+# Part of CMake configuration for GEOS
#
-# GEOS XML tests runner build configuration for CMake build system
-#
-# Copyright (C) 2009 Mateusz Loskot <mateusz at loskot.net>
+# Copyright (C) 2018 Mateusz Loskot <mateusz at loskot.net>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU Lesser General Public Licence as published
# by the Free Software Foundation.
# See the COPYING file for more information.
-#
-#################################################################################
-
-set(STATUS_MESSAGE "Enable GEOS XML tests build")
-set(STATUS_RESULT "OFF")
-
-if(GEOS_ENABLE_TESTS)
+################################################################################
- include_directories(${CMAKE_CURRENT_SOURCE_DIR})
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2)
+add_executable(test_simplewkttester SimpleWKTTester.cpp)
+target_link_libraries(test_simplewkttester PRIVATE geos)
- set(simplewkttester_SOURCES SimpleWKTTester.cpp)
-
- set(xmltester_SOURCES
+add_executable(test_xmltester)
+target_sources(test_xmltester
+ PRIVATE
XMLTester.cpp
- tinyxml2/tinyxml2.h
- tinyxml2/tinyxml2.cpp
BufferResultMatcher.cpp
- SingleSidedBufferResultMatcher.cpp)
-
- add_executable(test_simplewkttester ${simplewkttester_SOURCES})
-
- if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- target_link_libraries(test_simplewkttester GEOS)
- else()
- target_link_libraries(test_simplewkttester geos)
- endif()
-
- add_executable(test_xmltester ${xmltester_SOURCES})
-
- if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- target_link_libraries(test_xmltester GEOS)
- else()
- target_link_libraries(test_xmltester geos)
- endif()
-
- set(XMLTESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
- set(SAVE_XMLTESTS
- ${XMLTESTS_DIR}/general/TestBoundary.xml
- ${XMLTESTS_DIR}/general/TestBuffer.xml
- ${XMLTESTS_DIR}/general/TestBufferMitredJoin.xml
- ${XMLTESTS_DIR}/general/TestCentroid.xml
- ${XMLTESTS_DIR}/general/TestConvexHull-big.xml
- ${XMLTESTS_DIR}/general/TestConvexHull.xml
- ${XMLTESTS_DIR}/general/TestDensify.xml
- ${XMLTESTS_DIR}/general/TestDistance.xml
- ${XMLTESTS_DIR}/general/TestEqualsExact.xml
- ${XMLTESTS_DIR}/general/TestFunctionAA.xml
- ${XMLTESTS_DIR}/general/TestFunctionAAPrec.xml
- ${XMLTESTS_DIR}/general/TestFunctionLA.xml
- ${XMLTESTS_DIR}/general/TestFunctionLAPrec.xml
- ${XMLTESTS_DIR}/general/TestFunctionLL.xml
- ${XMLTESTS_DIR}/general/TestFunctionLLPrec.xml
- ${XMLTESTS_DIR}/general/TestFunctionPA.xml
- ${XMLTESTS_DIR}/general/TestFunctionPL.xml
- ${XMLTESTS_DIR}/general/TestFunctionPLPrec.xml
- ${XMLTESTS_DIR}/general/TestFunctionPP.xml
- ${XMLTESTS_DIR}/general/TestInteriorPoint.xml
- ${XMLTESTS_DIR}/general/TestMinimumClearance.xml
- ${XMLTESTS_DIR}/general/TestPreparedPointPredicate.xml
- ${XMLTESTS_DIR}/general/TestPreparedPolygonPredicate.xml
- ${XMLTESTS_DIR}/general/TestPreparedPredicatesWithGeometryCollection.xml
- ${XMLTESTS_DIR}/general/TestRectanglePredicate.xml
- ${XMLTESTS_DIR}/general/TestRelateAA.xml
- ${XMLTESTS_DIR}/general/TestRelateAC.xml
- ${XMLTESTS_DIR}/general/TestRelateLA.xml
- ${XMLTESTS_DIR}/general/TestRelateLC.xml
- ${XMLTESTS_DIR}/general/TestRelateLL.xml
- ${XMLTESTS_DIR}/general/TestRelatePA.xml
- ${XMLTESTS_DIR}/general/TestRelatePL.xml
- ${XMLTESTS_DIR}/general/TestRelatePP.xml
- ${XMLTESTS_DIR}/general/TestSimple.xml
- ${XMLTESTS_DIR}/general/TestUnaryUnion.xml
- ${XMLTESTS_DIR}/general/TestUnaryUnionFloating.xml
- ${XMLTESTS_DIR}/general/TestValid.xml
- ${XMLTESTS_DIR}/general/TestValid2-big.xml
- ${XMLTESTS_DIR}/general/TestValid2.xml
- ${XMLTESTS_DIR}/general/TestWithinDistance.xml
- ${XMLTESTS_DIR}/misc/Buffer-1.xml
- ${XMLTESTS_DIR}/misc/Buffer-2.xml
- ${XMLTESTS_DIR}/misc/InvalidRelates.xml
- ${XMLTESTS_DIR}/misc/Segfaults.xml
- ${XMLTESTS_DIR}/misc/TestBufferExternal-1.xml
- ${XMLTESTS_DIR}/misc/TestBufferExternal-2.xml
- ${XMLTESTS_DIR}/misc/TestIsValid.xml
- ${XMLTESTS_DIR}/misc/buildarea.xml
- ${XMLTESTS_DIR}/misc/fme.xml
- ${XMLTESTS_DIR}/misc/heisenbugs.xml
- ${XMLTESTS_DIR}/misc/hexwkb.xml
- ${XMLTESTS_DIR}/misc/hole_from_shell.xml
- ${XMLTESTS_DIR}/misc/hole_red.xml
- ${XMLTESTS_DIR}/misc/linemerge.xml
- ${XMLTESTS_DIR}/misc/makevalid.xml
- ${XMLTESTS_DIR}/misc/robustness.xml
- ${XMLTESTS_DIR}/misc/safe-16595.xml
- ${XMLTESTS_DIR}/misc/safe-16596.xml
- ${XMLTESTS_DIR}/misc/safe-TestBufferJagged.xml
- ${XMLTESTS_DIR}/misc/singlesidedbuffer.xml
- ${XMLTESTS_DIR}/misc/stmlf-20061020-invalid-output.xml
- ${XMLTESTS_DIR}/misc/stmlf-20061020.xml
- ${XMLTESTS_DIR}/misc/stmlf-20070119.xml
- ${XMLTESTS_DIR}/misc/split.xml
- ${XMLTESTS_DIR}/robust/TestRobustOverlayFixed.xml
- ${XMLTESTS_DIR}/robust/TestRobustRelate.xml
- ${XMLTESTS_DIR}/issue/issue-geos-176.xml
- ${XMLTESTS_DIR}/issue/issue-geos-188.xml
- ${XMLTESTS_DIR}/issue/issue-geos-244.xml
- ${XMLTESTS_DIR}/issue/issue-geos-275.xml
- ${XMLTESTS_DIR}/issue/issue-geos-350.xml
- ${XMLTESTS_DIR}/issue/issue-geos-356.xml
- ${XMLTESTS_DIR}/issue/issue-geos-358.xml
- ${XMLTESTS_DIR}/issue/issue-geos-360.xml
- ${XMLTESTS_DIR}/issue/issue-geos-366.xml
- ${XMLTESTS_DIR}/issue/issue-geos-392.xml
- ${XMLTESTS_DIR}/issue/issue-geos-398.xml
- ${XMLTESTS_DIR}/issue/issue-geos-434.xml
- ${XMLTESTS_DIR}/issue/issue-geos-459.xml
- ${XMLTESTS_DIR}/issue/issue-geos-527.xml
- ${XMLTESTS_DIR}/issue/issue-geos-569.xml
- ${XMLTESTS_DIR}/issue/issue-geos-582.xml
- ${XMLTESTS_DIR}/issue/issue-geos-586.xml
- ${XMLTESTS_DIR}/issue/issue-geos-599.xml
- ${XMLTESTS_DIR}/issue/issue-geos-605.xml
- ${XMLTESTS_DIR}/issue/issue-geos-615.xml
- ${XMLTESTS_DIR}/issue/issue-geos-716.xml
- ${XMLTESTS_DIR}/issue/issue-geos-837.xml
- ${XMLTESTS_DIR}/issue/issue-geos-838.xml
- ${XMLTESTS_DIR}/validate/TestRelateAA-big.xml
- ${XMLTESTS_DIR}/validate/TestRelateAA.xml
- ${XMLTESTS_DIR}/validate/TestRelateAC.xml
- ${XMLTESTS_DIR}/validate/TestRelateLA.xml
- ${XMLTESTS_DIR}/validate/TestRelateLC.xml
- ${XMLTESTS_DIR}/validate/TestRelateLL.xml
- ${XMLTESTS_DIR}/validate/TestRelatePA.xml
- ${XMLTESTS_DIR}/validate/TestRelatePL.xml
- ${XMLTESTS_DIR}/validate/TestRelatePP.xml
- )
-
- set(FAILING_XMLTESTS
- ${XMLTESTS_DIR}/issue/issue-geos-488.xml
- ${XMLTESTS_DIR}/issue/issue-geos-344.xml
- ${XMLTESTS_DIR}/robust/TestRobustRelateFloat.xml
- ${XMLTESTS_DIR}/failure/TestOverlay.xml
- ${XMLTESTS_DIR}/misc/TestBigNastyBuffer.xml
- ${XMLTESTS_DIR}/misc/TestSameDirection.xml
- )
-
- add_test(test_xmltester ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_xmltester -v --test-valid-output ${SAVE_XMLTESTS})
-
- set(STATUS_RESULT "ON")
-endif()
-
-message(STATUS "${STATUS_MESSAGE} - ${STATUS_RESULT}")
+ SingleSidedBufferResultMatcher.cpp
+ tinyxml2/tinyxml2.h
+ tinyxml2/tinyxml2.cpp)
+target_link_libraries(test_xmltester PRIVATE geos)
+target_include_directories(test_xmltester
+ PRIVATE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/tinyxml)
+
+file(GLOB_RECURSE _tests ${CMAKE_CURRENT_LIST_DIR}/tests/*.xml CONFIGURE_DEPEND)
+list(FILTER _tests EXCLUDE REGEX failure)
+add_test(NAME test_xmltester COMMAND test_xmltester --test-valid-output ${_tests})
+unset(_tests)
diff --git a/tests/xmltester/tests/issue/issue-geos-344.xml b/tests/xmltester/tests/failure/issue-geos-344.xml
similarity index 100%
rename from tests/xmltester/tests/issue/issue-geos-344.xml
rename to tests/xmltester/tests/failure/issue-geos-344.xml
diff --git a/tests/xmltester/tests/issue/issue-geos-488.xml b/tests/xmltester/tests/failure/issue-geos-488.xml
similarity index 100%
rename from tests/xmltester/tests/issue/issue-geos-488.xml
rename to tests/xmltester/tests/failure/issue-geos-488.xml
diff --git a/tests/xmltester/tests/misc/TestBigNastyBuffer.xml b/tests/xmltester/tests/failure/misc-TestBigNastyBuffer.xml
similarity index 100%
rename from tests/xmltester/tests/misc/TestBigNastyBuffer.xml
rename to tests/xmltester/tests/failure/misc-TestBigNastyBuffer.xml
diff --git a/tests/xmltester/tests/misc/TestSameDirection.xml b/tests/xmltester/tests/failure/misc-TestSameDirection.xml
similarity index 100%
rename from tests/xmltester/tests/misc/TestSameDirection.xml
rename to tests/xmltester/tests/failure/misc-TestSameDirection.xml
diff --git a/tests/xmltester/tests/robust/TestRobustRelateFloat.xml b/tests/xmltester/tests/failure/robust-TestRobustRelateFloat.xml
similarity index 100%
rename from tests/xmltester/tests/robust/TestRobustRelateFloat.xml
rename to tests/xmltester/tests/failure/robust-TestRobustRelateFloat.xml
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index c5356e3..62393e0 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -11,31 +11,43 @@
#
#################################################################################
-if(UNIX OR MINGW)
-
- if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK AND GEOS_ENABLE_MACOSX_FRAMEWORK_UNIXCOMPAT)
- set(installdest GEOS.framework/Versions/${VERSION_MAJOR}/unix/bin)
- set(prefix ${CMAKE_INSTALL_PREFIX}/GEOS.framework/Versions/${VERSION_MAJOR}/unix)
- elseif(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
- # just a dummy so installdest not set
- # want geos-config only for Mac unix build or framework+unixcompat
- else()
- set(installdest bin)
- set(prefix ${CMAKE_INSTALL_PREFIX})
- endif()
-
- set(exec_prefix ${prefix}/bin)
- set(libdir ${prefix}/lib)
-
- if(installdest)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/geos-config.in
- ${CMAKE_CURRENT_BINARY_DIR}/geos-config @ONLY)
-
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos-config
- DESTINATION ${installdest}
- PERMISSIONS
- OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-endif()
-
-endif()
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/geos-config.in
+ ${CMAKE_CURRENT_BINARY_DIR}/geos-config)
+
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos-config
+ DESTINATION bin
+ PERMISSIONS
+ OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+
add_subdirectory(astyle)
+
+# if(UNIX OR MINGW)
+
+# if(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK AND GEOS_ENABLE_MACOSX_FRAMEWORK_UNIXCOMPAT)
+# set(installdest GEOS.framework/Versions/${VERSION_MAJOR}/unix/bin)
+# set(prefix ${CMAKE_INSTALL_PREFIX}/GEOS.framework/Versions/${VERSION_MAJOR}/unix)
+# elseif(APPLE AND GEOS_ENABLE_MACOSX_FRAMEWORK)
+# # just a dummy so installdest not set
+# # want geos-config only for Mac unix build or framework+unixcompat
+# else()
+# set(installdest bin)
+# set(prefix ${CMAKE_INSTALL_PREFIX})
+# endif()
+
+# set(exec_prefix ${prefix}/bin)
+# set(libdir ${prefix}/lib)
+
+# if(installdest)
+# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/geos-config.in
+# ${CMAKE_CURRENT_BINARY_DIR}/geos-config @ONLY)
+
+# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geos-config
+# DESTINATION ${installdest}
+# PERMISSIONS
+# OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+# endif()
+
+# endif()
+
diff --git a/tools/astyle/CMakeLists.txt b/tools/astyle/CMakeLists.txt
index e6ea8dc..a8bb0e2 100644
--- a/tools/astyle/CMakeLists.txt
+++ b/tools/astyle/CMakeLists.txt
@@ -14,7 +14,3 @@ file(GLOB_RECURSE astyle_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
add_executable(astyle ${astyle_SOURCES})
# message(STATUS "Enable AStyle")
-#################################################################################
-# Group source files for IDE source explorers (e.g. Visual Studio)
-#################################################################################
-GenerateSourceGroups(tools/astyle)
diff --git a/tools/geos-config.in b/tools/geos-config.in
index e6bef57..412ee67 100644
--- a/tools/geos-config.in
+++ b/tools/geos-config.in
@@ -1,7 +1,8 @@
#!/bin/sh
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
+
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@/bin
+libdir=@CMAKE_INSTALL_PREFIX@/lib
usage()
{
@@ -22,9 +23,11 @@ Options:
EOF
exit $1
}
+
if test $# -eq 0; then
usage 1 1>&2
fi
+
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
@@ -32,36 +35,34 @@ case "$1" in
esac
case $1 in
--prefix)
- echo ${prefix}
- ;;
+ echo @CMAKE_INSTALL_PREFIX@
+ ;;
--version)
- echo @VERSION@
- ;;
+ echo @GEOS_VERSION@
+ ;;
--cflags)
- echo -I${prefix}/include
+ echo -I at CMAKE_INSTALL_PREFIX@/include
;;
--libs)
- # TODO: make an alias for --clibs
- # see http://trac.osgeo.org/geos/ticket/497
- echo -L${libdir} -lgeos- at VERSION_RELEASE@
+ echo -L at CMAKE_INSTALL_PREFIX@/lib -lgeos- at GEOS_VERSION_MAJOR@
;;
--clibs)
- echo -L${libdir} -lgeos_c
+ echo -L at CMAKE_INSTALL_PREFIX@/lib -lgeos_c
;;
--cclibs)
- echo -L${libdir} -lgeos
+ echo -L at CMAKE_INSTALL_PREFIX@/lib -lgeos
;;
--static-clibs)
- echo -L${libdir} -lgeos_c -lgeos -lm
+ echo -L at CMAKE_INSTALL_PREFIX@/lib -lgeos_c -lgeos -lm
;;
--static-cclibs)
- echo -L${libdir} -lgeos -lm
+ echo -L at CMAKE_INSTALL_PREFIX@/lib -lgeos -lm
;;
--ldflags)
- echo -L${libdir}
+ echo -L at CMAKE_INSTALL_PREFIX@/lib -lgeos
;;
--includes)
- echo ${prefix}/include
+ echo @CMAKE_INSTALL_PREFIX@/include
;;
--jtsport)
echo @JTS_PORT@
-----------------------------------------------------------------------
Summary of changes:
.editorconfig | 2 +
.gitignore | 1 +
CMakeLists.txt | 507 +++++++++------------
Makefile.am | 8 +-
appveyor.yml | 162 +++----
capi/CMakeLists.txt | 94 ++--
cmake/GenerateRevisionHeader.cmake | 26 ++
cmake/GetGitRevision.cmake | 40 ++
cmake/cmake_uninstall.cmake.in | 8 +-
.../CMakeLists.txt => cmake/geos-config.cmake | 14 +-
cmake/modules/COPYING-CMAKE-SCRIPTS | 22 -
cmake/modules/CheckPrototypeExists.cmake | 43 --
cmake/modules/GenerateSourceGroups.cmake | 17 -
examples/client/CMakeLists.txt | 20 +
examples/client/geos_c_client.cpp | 6 +
examples/client/geos_client.cpp | 8 +
include/CMakeLists.txt | 75 ++-
src/CMakeLists.txt | 126 +----
tests/CMakeLists.txt | 11 +-
tests/bigtest/CMakeLists.txt | 53 +--
tests/perf/CMakeLists.txt | 36 +-
tests/perf/capi/CMakeLists.txt | 25 +-
tests/perf/operation/CMakeLists.txt | 11 +-
tests/perf/operation/buffer/CMakeLists.txt | 19 +-
tests/perf/operation/predicate/CMakeLists.txt | 20 +-
tests/unit/CMakeLists.txt | 45 +-
tests/xmltester/CMakeLists.txt | 174 +------
tests/xmltester/Makefile.am | 10 +-
.../tests/{issue => failure}/issue-geos-344.xml | 0
.../tests/{issue => failure}/issue-geos-488.xml | 0
.../misc-TestBigNastyBuffer.xml} | 0
.../misc-TestSameDirection.xml} | 0
.../robust-TestRobustRelateFloat.xml} | 0
tools/CMakeLists.txt | 66 +--
tools/astyle/CMakeLists.txt | 4 -
tools/geos-config.in | 35 +-
36 files changed, 631 insertions(+), 1057 deletions(-)
create mode 100644 cmake/GenerateRevisionHeader.cmake
create mode 100644 cmake/GetGitRevision.cmake
copy tests/perf/operation/CMakeLists.txt => cmake/geos-config.cmake (63%)
delete mode 100644 cmake/modules/COPYING-CMAKE-SCRIPTS
delete mode 100644 cmake/modules/CheckPrototypeExists.cmake
delete mode 100644 cmake/modules/GenerateSourceGroups.cmake
create mode 100644 examples/client/CMakeLists.txt
create mode 100644 examples/client/geos_c_client.cpp
create mode 100644 examples/client/geos_client.cpp
rename tests/xmltester/tests/{issue => failure}/issue-geos-344.xml (100%)
rename tests/xmltester/tests/{issue => failure}/issue-geos-488.xml (100%)
rename tests/xmltester/tests/{misc/TestBigNastyBuffer.xml => failure/misc-TestBigNastyBuffer.xml} (100%)
rename tests/xmltester/tests/{misc/TestSameDirection.xml => failure/misc-TestSameDirection.xml} (100%)
rename tests/xmltester/tests/{robust/TestRobustRelateFloat.xml => failure/robust-TestRobustRelateFloat.xml} (100%)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list