Permalink
Browse files

Migration from autotools to cmake (RFC92) (#4617)

  • Loading branch information...
1 parent 41ddacf commit 45b7dd0d44112f41a04362516ba6406702b50470 @tbonfort tbonfort committed Mar 11, 2013
View
Oops, something went wrong.
View
@@ -6,6 +6,7 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
bindir = @bindir@
+includedir = @includedir@
srcdir = @srcdir@
top_builddir = @top_builddir@
SHELL = @SHELL@
@@ -290,7 +291,7 @@ OBJS= $(AGG_OBJ) mapgeomutil.$(OBJ_SUFFIX) mapdummyrenderer.$(OBJ_SUFFIX) mapogl
mapregex.$(OBJ_SUFFIX) mappluginlayer.$(OBJ_SUFFIX) mapogcsos.$(OBJ_SUFFIX) mappostgresql.$(OBJ_SUFFIX) mapcrypto.$(OBJ_SUFFIX) mapowscommon.$(OBJ_SUFFIX) \
maplibxml2.$(OBJ_SUFFIX) mapdebug.$(OBJ_SUFFIX) mapchart.$(OBJ_SUFFIX) maptclutf.$(OBJ_SUFFIX) mapxml.$(OBJ_SUFFIX) mapkml.$(OBJ_SUFFIX) mapkmlrenderer.$(OBJ_SUFFIX) \
mapogroutput.$(OBJ_SUFFIX) mapwcs20.$(OBJ_SUFFIX) mapogcfiltercommon.$(OBJ_SUFFIX) mapunion.$(OBJ_SUFFIX) mapcluster.$(OBJ_SUFFIX) mapxmp.$(OBJ_SUFFIX) \
- mapuvraster.$(OBJ_SUFFIX) mapcontour.$(OBJ_SUFFIX) mapservutil.$(OBJ_SUFFIX) maptile.$(OBJ_SUFFIX)
+ mapuvraster.$(OBJ_SUFFIX) mapcontour.$(OBJ_SUFFIX) mapservutil.$(OBJ_SUFFIX) maptile.$(OBJ_SUFFIX) mapserver-api.$(OBJ_SUFFIX)
HEADERS= cgiutil.h mapgml.h mapoglcontext.h mapregex.h\
maptile.h dxfcolor.h maphash.h mapoglrenderer.h mapresample.h\
@@ -448,7 +449,7 @@ python_mapscript_clean:
python_mapscript_install:
test -z "$(PYTHON_MAPSCRIPT)" || (cd mapscript/python; $(MAKE) install DESTDIR=$(DESTDIR);)
-install: install-lib install-bin install-cgibin php_mapscript_install python_mapscript_install
+install: install-headers install-lib install-bin install-cgibin php_mapscript_install python_mapscript_install
install-cgibin: install-lib mapserv
$(LTINSTALL) $(INSTALL) mapserv $(DESTDIR)$(bindir)/mapserv
@@ -461,7 +462,7 @@ install-cgibin: install-lib mapserv
@echo ""
install-dirs:
- $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)
+ $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)
install-bin: install-dirs install-lib $(EXE_LIST)
@list='$(EXE_LIST)'; for p in $$list; do \
@@ -470,6 +471,9 @@ install-bin: install-dirs install-lib $(EXE_LIST)
else :; fi; \
done
+install-headers: install-dirs mapserver-api.h
+ $(INSTALL) mapserver-api.h $(DESTDIR)$(includedir)/mapserver-api.h; \
+
install-lib: install-dirs $(LIBMAP)
$(LTINSTALL) $(INSTALL) $(LIBMAP) $(DESTDIR)$(libdir)/$(LIBMAP); \
View
@@ -0,0 +1,45 @@
+add_library(mod_mapserver MODULE mod_mapserver.c)
+target_link_libraries(mod_mapserver ${MAPSERVER_LIBMAPSERVER})
+set_target_properties(mod_mapserver PROPERTIES PREFIX "")
+
+IF(APPLE)
+ if(HTTPD_EXECUTABLE)
+ if(XCODE)
+ SET(CMAKE_C_LINK_FLAGS
+ "${CMAKE_C_LINK_FLAGS} -bundle_loader ${HTTPD_EXECUTABLE}")
+ else(XCODE)
+ SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
+ "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -bundle_loader ${HTTPD_EXECUTABLE}")
+ endif(XCODE)
+ else(HTTPD_EXECUTABLE)
+ if(XCODE)
+ SET(CMAKE_C_LINK_FLAGS
+ "${CMAKE_C_LINK_FLAGS} -undefined dynamic_lookup")
+ else(XCODE)
+ SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
+ "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-undefined,dynamic_lookup")
+ endif(XCODE)
+ endif(HTTPD_EXECUTABLE)
+ENDIF(APPLE)
+
+find_package(APACHE)
+if(APACHE_FOUND)
+ include_directories(${APACHE_INCLUDE_DIR})
+else(APACHE_FOUND)
+ report_mandatory_not_found(APACHE)
+endif(APACHE_FOUND)
+
+find_package(APR)
+if(APR_FOUND)
+ include_directories(${APR_INCLUDE_DIR})
+ target_link_libraries(mod_mapserver ${APR_LIBRARY})
+ if(DEFINED APR_CPPFLAGS)
+ add_definitions("${APR_CPPFLAGS}")
+ endif(DEFINED APR_CPPFLAGS)
+else(APR_FOUND)
+ report_mandatory_not_found(APR)
+endif(APR_FOUND)
+
+if(APACHE_MODULE_DIR)
+ INSTALL(TARGETS mod_mapserver DESTINATION ${APACHE_MODULE_DIR})
+endif(APACHE_MODULE_DIR)
@@ -12,9 +12,9 @@
#include "apr_tables.h"
#include "apr_file_info.h"
-#include "mapserver.h" /* for mapObj */
-#include "cgiutil.h"
-#include "mapserv.h"
+#include "../mapserver.h" /* for mapObj */
+#include "../cgiutil.h"
+#include "../mapserv.h"
module AP_MODULE_DECLARE_DATA mapserver_module;
@@ -0,0 +1,36 @@
+#
+# APACHE_FOUND - System has APACHE
+# APACHE_INCLUDE_DIR - The APACHE include directory
+#
+# APACHE_LOCATION
+# setting this enables search for apache libraries / headers in this location
+
+#
+# Include directories
+#
+find_path(APACHE_INCLUDE_DIR
+ NAMES httpd.h
+ PATH_SUFFIXES httpd apache apache2
+)
+
+find_program(APXS_BIN NAMES apxs apxs2
+ PATH_SUFFIXES httpd apache apache2
+)
+
+find_program(HTTPD_EXECUTABLE NAMES httpd
+ PATHS
+ /usr/sbin
+ PATH_SUFFIXES httpd apache apache2
+)
+
+if(APXS_BIN)
+ EXEC_PROGRAM(${APXS_BIN}
+ ARGS -q LIBEXECDIR
+ OUTPUT_VARIABLE APACHE_MODULE_DIR )
+endif(APXS_BIN)
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set APACHE_FOUND to TRUE if
+# all listed variables are TRUE
+find_package_handle_standard_args(APACHE DEFAULT_MSG APACHE_INCLUDE_DIR )
+mark_as_advanced(APACHE_INCLUDE_DIR)
View
@@ -0,0 +1,78 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# - Find Apache Portable Runtime
+# Find the APR includes and libraries
+# This module defines
+# APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc.
+# APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR.
+# APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR.
+# also defined, but not for general use are
+# APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library.
+
+# APR first.
+
+FIND_PROGRAM(APR_CONFIG_BIN
+ NAMES apr-config apr-1-config )
+
+if(APR_CONFIG_BIN)
+ execute_process(
+ COMMAND ${APR_CONFIG_BIN} --includedir
+ OUTPUT_VARIABLE HINT_APR_INCLUDE_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ execute_process(
+ COMMAND ${APR_CONFIG_BIN} --cppflags
+ OUTPUT_VARIABLE APR_CPPFLAGS
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+endif(APR_CONFIG_BIN)
+
+FIND_PATH(APR_INCLUDE_DIR
+ NAMES apr.h
+ HINTS ${HINT_APR_INCLUDE_DIR}
+ PATH_SUFFIXES apr-1 apr-1.0 apr
+)
+
+FIND_LIBRARY(APR_LIBRARY
+ NAMES apr-1 apr
+ PATH_SUFFIXES apr-1 apr-1.0 apr
+)
+
+set(APR_INCLUDE_DIRS ${APR_INCLUDE_DIR})
+set(APR_LIBRARIES ${APR_LIBRARY})
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(APR DEFAULT_MSG APR_LIBRARY APR_INCLUDE_DIR)
+mark_as_advanced(APR_LIBRARY APR_INCLUDE_DIR)
+
+# Next, APRUTIL.
+
+FIND_PATH(APU_INCLUDE_DIR
+ NAMES apu.h
+ PATH_SUFFIXES apr-1 apr-1.0 apr
+)
+
+FIND_LIBRARY(APU_LIBRARY
+ NAMES aprutil-1 aprutil
+ PATH_SUFFIXES apr-1 apr-1.0 apr
+)
+
+
+set(APU_INCLUDE_DIRS ${APU_INCLUDE_DIR})
+set(APU_LIBRARIES ${APU_LIBRARY})
+find_package_handle_standard_args(APU DEFAULT_MSG APU_LIBRARY APU_INCLUDE_DIR)
+mark_as_advanced(APU_LIBRARY APU_INCLUDE_DIR)
View
@@ -0,0 +1,68 @@
+# - Try to find Cairo
+# Once done, this will define
+#
+# CAIRO_FOUND - system has Cairo
+# CAIRO_INCLUDE_DIR - the Cairo include directories
+# CAIRO_LIBRARY - link these to use Cairo
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+#
+# 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 above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``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 COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS 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.
+
+FIND_PACKAGE(PkgConfig)
+PKG_CHECK_MODULES(PC_CAIRO cairo) # FIXME: After we require CMake 2.8.2 we can pass QUIET to this call.
+
+FIND_PATH(CAIRO_INCLUDE_DIR
+ NAMES cairo.h
+ HINTS ${PC_CAIRO_INCLUDEDIR}
+ ${PC_CAIRO_INCLUDE_DIR}
+ PATH_SUFFIXES cairo
+)
+
+FIND_LIBRARY(CAIRO_LIBRARY
+ NAMES cairo
+ HINTS ${PC_CAIRO_LIBDIR}
+ ${PC_CAIRO_LIBRARY_DIRS}
+)
+
+IF (CAIRO_INCLUDE_DIR)
+ IF (EXISTS "${CAIRO_INCLUDE_DIR}/cairo-version.h")
+ FILE(READ "${CAIRO_INCLUDE_DIR}/cairo-version.h" CAIRO_VERSION_CONTENT)
+
+ STRING(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
+ SET(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}")
+
+ STRING(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
+ SET(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}")
+
+ STRING(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
+ SET(CAIRO_VERSION_MICRO "${CMAKE_MATCH_1}")
+
+ SET(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}")
+ ENDIF ()
+ENDIF ()
+
+set(CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR})
+set(CAIRO_LIBRARIES ${CAIRO_LIBRARY})
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CAIRO DEFAULT_MSG CAIRO_LIBRARY CAIRO_INCLUDE_DIR)
+mark_as_advanced(CAIRO_LIBRARY CAIRO_INCLUDE_DIR)
@@ -0,0 +1,11 @@
+# Look for the header file.
+find_path(LIBEXEMPI_INCLUDE_DIR NAMES xmp.h
+ PATH_SUFFIXES exempi-2.0 exempi-2.0/exempi exempi
+)
+find_library(LIBEXEMPI_LIBRARY NAMES exempi)
+
+set(LIBEXEMPI_LIBRARIES ${LIBEXEMPI_LIBRARY})
+set(LIBEXEMPI_INCLUDE_DIRS ${LIBEXEMPI_INCLUDE_DIR})
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LIBEXEMPI DEFAULT_MSG LIBEXEMPI_LIBRARY LIBEXEMPI_INCLUDE_DIR)
+mark_as_advanced(LIBEXEMPI_INCLUDE_DIR LIBEXEMPI_LIBRARY)
View
@@ -0,0 +1,11 @@
+# Look for the header file.
+find_path(FCGI_INCLUDE_DIR NAMES fastcgi.h)
+
+# Look for the library.
+find_library(FCGI_LIBRARY NAMES fcgi)
+
+set(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
+set(FCGI_LIBRARIES ${FCGI_LIBRARY})
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
+mark_as_advanced(FCGI_LIBRARY FCGI_INCLUDE_DIR)
Oops, something went wrong.

0 comments on commit 45b7dd0

Please sign in to comment.