summaryrefslogtreecommitdiff
path: root/cmake/FindGMock.cmake
diff options
context:
space:
mode:
authorManojkiran Eda <manojkiran.eda@gmail.com>2020-05-27 06:21:32 +0300
committerEd Tanous <ed@tanous.net>2020-10-03 02:35:34 +0300
commitaf6298daa55d41d5a47459215b96ca5ec079dfb4 (patch)
tree065ee19c718f8697d98490fd722446b0408e4c15 /cmake/FindGMock.cmake
parent65176d3908b27393d81b72284dbebc47055e517c (diff)
downloadbmcweb-af6298daa55d41d5a47459215b96ca5ec079dfb4.tar.xz
Enable Meson Build System & remove cmake support
- This commit enables the support for meson build system for bmcweb and also remove the cmake support - The inital thought of migrating to meson build system was based on [link](https://mesonbuild.com/Simple-comparison.html) - Other things to praise about meson are its simplicity and userfriendly ness. It also have native support for modern tools such as precompiled headers, coverage, Valgrind , unity builds e.t.c - This commit also support the automatic download and setup of dependencies if they are not found in usual places using meson wraps that are already available in [wrap db](https://wrapdb.mesonbuild.com/) - For few dependencies like boost, boost-url which does not have meson wrap support yet, i have misused the meson subproject command to download boost & boot-url and build against them if they are not found in usual places. - For boost & boost-url the subproject command will always fail as meson supports other meson projects as subprojects but it will always download the source, and since we dont actually build boost/boost-url but just use the the source headers this should not be a problem. - Cmake options removed: - BUILD_STATIC_LIBS has been removed as it is not being used any where as per the review comments. - By default the meson wraps are enabled and it downloads the dependencies if they are not found, and via bitbake this behaviour is disabled by default as download fallback feature is disabled. - This commit also adds the README, changes for bmcweb as well. - The meta-* layer changes are also pushed and marked as WIP under bmcweb_meson_port topic. Tested By : =========== 1. Compilation is passed without error or warning in both arm & x86 sdks that are populated by yocto. 2. The unittests are also passed on both x86 & arm machines. 3. Compilation passed with various build types supported by meson (debug,debugoptimized, relase) 4. modified the meta-phosphor & meta-ibm to leverage meson build for bmcweb, and loaded the resulted image on qemu & real machine, checked the bmcweb status and was also able to pull the web-gui on both. 5. Tested few common commands related to session service & network service manually on a real machine and also also had run a CT regression bucket, and it looked clean. The binary sizes when bmcweb is compiled via bitbake(using meta-ibm) are : cmake: 3100080 bytes approx (3 MB) meson: 2822596 bytes approx (2.7 MB) 1:1 equivalent hash is not possible due to couple of things: 1. The build types in meson does not have a 1:1 mapping with cmake build types. 2. Meson adds below mentioned compiler & linker flags than cmake as a part of warning_level & build types CXXFLAGS :' -O2 -pipe -g -feliminate-unused-debug-types -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Winvalid-pch -DNDEBUG' LDFLAGS : ' -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,--no-undefined,-Wl,--end-group' Tried to match the compile commands in both cmake & meson as much as possible and this is what i could get.I have attached the compile_commands.json for both duing an yocto full build in the [link](https://gofile.io/d/gM80fw) for reference. Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com> Change-Id: Ia65689fdacb8c398dd0a019258369b2442fad2f3
Diffstat (limited to 'cmake/FindGMock.cmake')
-rw-r--r--cmake/FindGMock.cmake129
1 files changed, 0 insertions, 129 deletions
diff --git a/cmake/FindGMock.cmake b/cmake/FindGMock.cmake
deleted file mode 100644
index ec76d4b6a9..0000000000
--- a/cmake/FindGMock.cmake
+++ /dev/null
@@ -1,129 +0,0 @@
-# Locate the Google C++ Mocking Framework.
-# (This file is almost an identical copy of the original FindGTest.cmake file,
-# feel free to use it as it is or modify it for your own needs.)
-#
-#
-# Defines the following variables:
-#
-# GMOCK_FOUND - Found the Google Testing framework
-# GMOCK_INCLUDE_DIRS - Include directories
-#
-# Also defines the library variables below as normal
-# variables. These contain debug/optimized keywords when
-# a debugging library is found.
-#
-# GMOCK_BOTH_LIBRARIES - Both libgmock & libgmock-main
-# GMOCK_LIBRARIES - libgmock
-# GMOCK_MAIN_LIBRARIES - libgmock-main
-#
-# Accepts the following variables as input:
-#
-# GMOCK_ROOT - (as a CMake or environment variable)
-# The root directory of the gmock install prefix
-#
-# GMOCK_MSVC_SEARCH - If compiling with MSVC, this variable can be set to
-# "MD" or "MT" to enable searching a gmock build tree
-# (defaults: "MD")
-#
-#-----------------------
-# Example Usage:
-#
-# find_package(GMock REQUIRED)
-# include_directories(${GMOCK_INCLUDE_DIRS})
-#
-# add_executable(foo foo.cc)
-# target_link_libraries(foo ${GMOCK_BOTH_LIBRARIES})
-#
-#=============================================================================
-# This file is released under the MIT licence:
-#
-# Copyright (c) 2011 Matej Svec
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#=============================================================================
-
-
-function(_gmock_append_debugs _endvar _library)
- if(${_library} AND ${_library}_DEBUG)
- set(_output optimized ${${_library}} debug ${${_library}_DEBUG})
- else()
- set(_output ${${_library}})
- endif()
- set(${_endvar} ${_output} PARENT_SCOPE)
-endfunction()
-
-function(_gmock_find_library _name)
- find_library(${_name}
- NAMES ${ARGN}
- HINTS
- $ENV{GMOCK_ROOT}
- ${GMOCK_ROOT}
- PATH_SUFFIXES ${_gmock_libpath_suffixes}
- )
- mark_as_advanced(${_name})
-endfunction()
-
-
-if(NOT DEFINED GMOCK_MSVC_SEARCH)
- set(GMOCK_MSVC_SEARCH MD)
-endif()
-
-set(_gmock_libpath_suffixes lib)
-if(MSVC)
- if(GMOCK_MSVC_SEARCH STREQUAL "MD")
- list(APPEND _gmock_libpath_suffixes
- msvc/gmock-md/Debug
- msvc/gmock-md/Release)
- elseif(GMOCK_MSVC_SEARCH STREQUAL "MT")
- list(APPEND _gmock_libpath_suffixes
- msvc/gmock/Debug
- msvc/gmock/Release)
- endif()
-endif()
-
-find_path(GMOCK_INCLUDE_DIR gmock/gmock.h
- HINTS
- $ENV{GMOCK_ROOT}/include
- ${GMOCK_ROOT}/include
-)
-mark_as_advanced(GMOCK_INCLUDE_DIR)
-
-if(MSVC AND GMOCK_MSVC_SEARCH STREQUAL "MD")
- # The provided /MD project files for Google Mock add -md suffixes to the
- # library names.
- _gmock_find_library(GMOCK_LIBRARY gmock-md gmock)
- _gmock_find_library(GMOCK_LIBRARY_DEBUG gmock-mdd gmockd)
- _gmock_find_library(GMOCK_MAIN_LIBRARY gmock_main-md gmock_main)
- _gmock_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_main-mdd gmock_maind)
-else()
- _gmock_find_library(GMOCK_LIBRARY gmock)
- _gmock_find_library(GMOCK_LIBRARY_DEBUG gmockd)
- _gmock_find_library(GMOCK_MAIN_LIBRARY gmock_main)
- _gmock_find_library(GMOCK_MAIN_LIBRARY_DEBUG gmock_maind)
-endif()
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMock DEFAULT_MSG GMOCK_LIBRARY GMOCK_INCLUDE_DIR GMOCK_MAIN_LIBRARY)
-
-if(GMOCK_FOUND)
- set(GMOCK_INCLUDE_DIRS ${GMOCK_INCLUDE_DIR})
- _gmock_append_debugs(GMOCK_LIBRARIES GMOCK_LIBRARY)
- _gmock_append_debugs(GMOCK_MAIN_LIBRARIES GMOCK_MAIN_LIBRARY)
- set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARIES} ${GMOCK_MAIN_LIBRARIES})
-endif()