Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing option GTK3 induces an error as findGTK3.cmake is not in path (OpenSUSE) #9

Open
dominig opened this issue Aug 27, 2020 · 2 comments

Comments

@dominig
Copy link
Contributor

dominig commented Aug 27, 2020

@Rasbats
@jongough

When force the selection of GTK3 (as auto selection still complains of missing gtk2) by the option in make cmake command and fails to complete the configuration.

BUILD_GTK3="true";\
cmake -DCMAKE_SKIP_RPATH=ON \
      -DOCPN_FORCE_GTK3=ON  \
      -DCMAKE_INSTALL_PREFIX=%{_prefix} \
      -DCFLAGS="-O2 -march=native" \
      ../
make

I still get an configuration error (see details bellow).
The following patch corrects the GTK3 issue.

diff --git a/cmake/PluginConfigure.cmake b/cmake/PluginConfigure.cmake
index 069bfd7..03e1fe6 100644
--- a/cmake/PluginConfigure.cmake
+++ b/cmake/PluginConfigure.cmake
@@ -393,7 +393,8 @@ if(NOT WIN32
         set(GTK_LIBRARIES ${GTK2_LIBRARIES})
         message(STATUS "${CMLOC}Building against GTK2...")
     else(GTK2_FOUND)
-        find_package(GTK3)
+       find_package(PkgConfig)
+        pkg_check_modules(GTK3 gtk+-3.0)
         include_directories(${GTK3_INCLUDE_DIRS})
         set(GTK_LIBRARIES ${GTK3_LIBRARIES})
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__WXGTK3__")

---------- configuration error log extract without the patch----------------

[    5s] CMake Warning at cmake/PluginConfigure.cmake:396 (find_package):
[    5s]   By not providing "FindGTK3.cmake" in CMAKE_MODULE_PATH this project has
[    5s]   asked CMake to find a package configuration file provided by "GTK3", but
[    5s]   CMake did not find one.
[    5s] 
[    5s]   Could not find a package configuration file provided by "GTK3" with any of
[    5s]   the following names:
[    5s] 
[    5s]     GTK3Config.cmake
[    5s]     gtk3-config.cmake
[    5s] 
[    5s]   Add the installation prefix of "GTK3" to CMAKE_PREFIX_PATH or set
[    5s]   "GTK3_DIR" to a directory containing one of the above files.  If "GTK3"
[    5s]   provides a separate development package or SDK, be sure it has been
[    5s]   installed.
[    5s] Call Stack (most recent call first):
[    5s]   CMakeLists.txt:123 (include)
@Rasbats
Copy link
Owner

Rasbats commented Aug 27, 2020

Thanks Dominiq. This stuff is beyond my skills but Alec Leamas has been looking at this in relation to another plugin. I will copy him in on this.

@leamas
Copy link
Contributor

leamas commented Aug 27, 2020

Welll, it's says what it is. It wants a cmake/FindGTK3.cmake file, and it cannot find it. There is one available on main openCPN with the following contents:

# - Try to find GTK+ 3
# Once done, this will define
#
#  GTK3_FOUND - system has GTK+ 3.
#  GTK3_INCLUDE_DIRS - the GTK+ 3. include directories
#  GTK3_LIBRARIES - link these to use GTK+ 3.
#
# Copyright (C) 2012 Raphael Kubo da Costa <[email protected]>
# Copyright (C) 2013 Igalia S.L.
#
# 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(GTK3 gtk+-3.0)
set(VERSION_OK TRUE)
if (GTK3_VERSION)
    if (GTK3_FIND_VERSION_EXACT)
        if (NOT("${GTK3_FIND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}"))
            set(VERSION_OK FALSE)
        endif ()
    else ()
        if ("${GTK3_VERSION}" VERSION_LESS "${GTK3_FIND_VERSION}")
            set(VERSION_OK FALSE)
        endif ()
    endif ()
endif ()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)

I guess dropping this file in the cmake/ dir should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants