make-rules/cmake.mk
changeset 5125 34cc580c62c2
child 5597 bcd66d6b1f98
equal deleted inserted replaced
5124:3a6b9e3809f7 5125:34cc580c62c2
       
     1 #
       
     2 # CDDL HEADER START
       
     3 #
       
     4 # The contents of this file are subject to the terms of the
       
     5 # Common Development and Distribution License (the "License").
       
     6 # You may not use this file except in compliance with the License.
       
     7 #
       
     8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 # or http://www.opensolaris.org/os/licensing.
       
    10 # See the License for the specific language governing permissions
       
    11 # and limitations under the License.
       
    12 #
       
    13 # When distributing Covered Code, include this CDDL HEADER in each
       
    14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 # If applicable, add the following below this CDDL HEADER, with the
       
    16 # fields enclosed by brackets "[]" replaced with your own identifying
       
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 #
       
    19 # CDDL HEADER END
       
    20 #
       
    21 # Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
       
    22 #
       
    23 
       
    24 #
       
    25 # This file sets up the default options and base requirements for GNOME
       
    26 # components.
       
    27 #
       
    28 include $(WS_MAKE_RULES)/prep.mk
       
    29 # Most cmake-based components require intltools.
       
    30 include $(WS_MAKE_RULES)/intltool.mk
       
    31 # cmake components don't generally use autoconf.
       
    32 include $(WS_MAKE_RULES)/justmake.mk
       
    33 
       
    34 # Ensure correct version of libraries are linked to.
       
    35 LDFLAGS += "$(CC_BITS)"
       
    36 
       
    37 # This component uses cmake to generate Makefiles and so has no configure
       
    38 CMAKE = $(shell which cmake)
       
    39 CMAKE_BUILD_TYPE ?= RelWithDebInfo
       
    40 
       
    41 CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER="$(CXX)"
       
    42 CMAKE_OPTIONS += -DCMAKE_CXX_FLAGS="$(CXXFLAGS)"
       
    43 CMAKE_OPTIONS += -DCMAKE_C_COMPILER="$(CC)"
       
    44 CMAKE_OPTIONS += -DCMAKE_C_FLAGS="$(CFLAGS)"
       
    45 CMAKE_OPTIONS += -DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)"
       
    46 
       
    47 # Must start install paths with a leading '/' or files will be installed into
       
    48 # wrong location!
       
    49 CMAKE_OPTIONS += -DCMAKE_INSTALL_PREFIX="$(USRDIR)"
       
    50 CMAKE_OPTIONS += -DCMAKE_MODULE_LINKER_FLAGS="$(LDFLAGS)"
       
    51 CMAKE_OPTIONS += -DCMAKE_SHARED_LINKER_FLAGS="$(LDFLAGS)"
       
    52 CMAKE_OPTIONS += -DGETTEXT_MSGFMT_EXECUTABLE="$(GNUBIN)/msgfmt"
       
    53 CMAKE_OPTIONS += -DBIN_INSTALL_DIR="$(USRBIN)"
       
    54 CMAKE_OPTIONS += -DEXEC_INSTALL_DIR="$(USRBIN)"
       
    55 
       
    56 # Some components use LIB_INSTALL_DIR, as-is, others forcibly ignore it and set
       
    57 # based on CMAKE_INSTALL_PREFIX.  Those usually instead offer a LIB_SUFFIX
       
    58 # variable that we can generally use to accomplish the same result.  Setting
       
    59 # them both shouldn't harm anything.
       
    60 CMAKE_OPTIONS += -DLIB_INSTALL_DIR="$(USRLIB)"
       
    61 CMAKE_OPTIONS.64 += -DLIB_SUFFIX="/$(MACH64)"
       
    62 CMAKE_OPTIONS += -DLIBEXEC_INSTALL_DIR="$(USRLIB)"
       
    63 
       
    64 # Required to ensure expected defines are set; also, ensures project's
       
    65 # optimisation level set appropriately.
       
    66 CMAKE_OPTIONS += -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
       
    67 
       
    68 CMAKE_OPTIONS += $(CMAKE_OPTIONS.$(BITS))
       
    69 
       
    70 COMPONENT_PRE_BUILD_ACTION += cd $(@D);
       
    71 COMPONENT_PRE_BUILD_ACTION += echo Running cmake with $(CMAKE_OPTIONS);
       
    72 COMPONENT_PRE_BUILD_ACTION += $(CMAKE) . $(CMAKE_OPTIONS);
       
    73 
       
    74 # Ensure cmake finds the matching 32/64-bit version of dependencies.
       
    75 COMPONENT_BUILD_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"
       
    76 
       
    77 REQUIRED_PACKAGES += developer/build/cmake
       
    78 REQUIRED_PACKAGES += developer/build/pkg-config
       
    79 REQUIRED_PACKAGES += developer/gnu-binutils
       
    80 REQUIRED_PACKAGES += developer/intltool
       
    81 REQUIRED_PACKAGES += system/library
       
    82 REQUIRED_PACKAGES += system/linker
       
    83 # Most cmake-based components expect GNU versions of these.
       
    84 REQUIRED_PACKAGES += text/gawk
       
    85 REQUIRED_PACKAGES += text/gnu-grep
       
    86 REQUIRED_PACKAGES += text/gnu-sed