Skip to content

Commit

Permalink
Merge pull request #78 from anaselli/NewLibyuiTree
Browse files Browse the repository at this point in the history
Building against new libyui tree
  • Loading branch information
anaselli authored Jun 7, 2021
2 parents 2cddf10 + 00b708f commit 5e1757e
Show file tree
Hide file tree
Showing 108 changed files with 377 additions and 2,430 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
# Show the complete compiler commands with all arguments:
# make VERBOSE=1

cmake_minimum_required( VERSION 3.10 )
project( libyui-qt )
cmake_minimum_required( VERSION 3.17 )
project( libyui-gtk )

# Options usage:
#
# cmake -DBUILD_DOC=on -DBUILD_EXAMPLES=off ..

option( BUILD_SRC "Build in src/ subdirectory" on )
option( BUILD_PKGCONFIG "Build pkg-config support files" on )
option( BUILD_DOC "Build class documentation" off )
option( WERROR "Treat all compiler warnings as errors" off )

Expand Down Expand Up @@ -53,6 +54,10 @@ if ( BUILD_SRC )
add_subdirectory( src )
endif()

if ( BUILD_PKGCONFIG )
add_subdirectory( pkgconfig )
endif()

if ( BUILD_DOC )
add_subdirectory( doc )
endif()
17 changes: 0 additions & 17 deletions PROJECTINFO.cmake

This file was deleted.

68 changes: 0 additions & 68 deletions SOURCECONF.cmake

This file was deleted.

8 changes: 1 addition & 7 deletions VERSION.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
SET( VERSION_MAJOR "2" )
SET( VERSION_MINOR "51" )
SET( VERSION_MINOR "52" )
SET( VERSION_PATCH "0" )
SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SHA1}" )

##### This is need for the libyui core, ONLY.
##### These will be overridden from exports in LibyuiConfig.cmake
SET( SONAME_MAJOR "0" )
SET( SONAME_MINOR "0" )
SET( SONAME_PATCH "0" )
SET( SONAME "${SONAME_MAJOR}.${SONAME_MINOR}.${SONAME_PATCH}" )
24 changes: 24 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# CMakeLists.txt for libyui*/doc

include( ../VERSION.cmake )

find_package( Doxygen REQUIRED dot )


#
# Doxygen-generated autodocs
#

if ( DOXYGEN_FOUND )

set( DOXYGEN_GENERATE_TREEVIEW yes ) # Enable views tree HTML frame
set( DOXYGEN_QUIET yes ) # Less verbose output
set( DOXYGEN_WARN_LOGFILE doxygen-warnings.log )
# See build/CMakeDoxyfile.in for more supported variables

doxygen_add_docs( doc ../src )

else()
message( WARNING "Missing doxygen package" )
endif()

38 changes: 38 additions & 0 deletions pkgconfig/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# CMakeLists.txt for libyui-gtk/pkgconfig
#
# Support for pkg-config:
#
# Generate a libyui-gtk.pc file from libyui-gtk.pc.in and install it to
# /usr/lib64/pkgconfig.
#
# A .pc file specifies how to use a development package, in particular linker
# flags (-lyui-gtk), compiler flags (including include directories) and paths.
# See man pkg-config.
#
# This .pc file is intended for extensions of the Gtk UI plug-in, not for
# applications using libyui.

include( ../VERSION.cmake )
include( GNUInstallDirs ) # set CMAKE_INSTALL_LIBDIR

FIND_PACKAGE(PkgConfig REQUIRED)

PKG_CHECK_MODULES(YUI REQUIRED libyui)
pkg_get_variable(YUI_SO_VERSION libyui soversion)
pkg_get_variable(YUI_SO_MAJOR libyui soversion_major)
pkg_get_variable(YUI_SO_MINOR libyui soversion_minor)
pkg_get_variable(YUI_SO_PATCH libyui soversion_patch)

##### This is needed to be set for the libyui core
SET( SONAME ${YUI_SO_VERSION} )
SET( SONAME_MAJOR ${YUI_SO_MAJOR} )
SET( SONAME_MINOR ${YUI_SO_MINOR} )
SET( SONAME_PATCH ${YUI_SO_PATCH} )

set( PKGCONFIG_INSTALL_DIR ${DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig )

# Generate libyui-gtk.pc where some CMake variables are expanded from libyui-gtk.pc.in,
# but only expand @VARIABLE@, not ${VARIABLE}
configure_file( libyui-gtk.pc.in libyui-gtk.pc @ONLY )

install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libyui-gtk.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
26 changes: 26 additions & 0 deletions pkgconfig/libyui-gtk.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Pkg-Config file for libyui-gtk
#
# Generated by CMake from libyui-gtk.pc.in
#

prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}

datarootdir=${exec_prefix}/share
datadir=${datarootdir}/libyui
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${exec_prefix}/include
plugindir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@/yui

soversion_major=@SONAME_MAJOR@
soversion_minor=@SONAME_MINOR@
soversion_patch=@SONAME_PATCH@
soversion=@SONAME@

Name: libyui-gtk
Version: @VERSION@
Description: libyui-gtk - Gtk plugin for libyui GUI-abstraction library
Libs: -L${plugindir} -lyui-gtk
Libs.private: -ldl -lpthread
Cflags: -I${includedir}/yui/gtk -I${includedir}/yui -I${includedir}
50 changes: 18 additions & 32 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CMakeLists.txt for libyui-qt/src
# CMakeLists.txt for libyui-gtk/src

include( ../VERSION.cmake )
include( GNUInstallDirs ) # set CMAKE_INSTALL_INCLUDEDIR, ..._LIBDIR
Expand All @@ -8,10 +8,17 @@ FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)

PKG_CHECK_MODULES(YUI REQUIRED libyui)
pkg_get_variable(YUI_SO_VERSION libyui soversion)
pkg_get_variable(YUI_SO_MAJOR libyui soversion_major)
#pkg_get_variable(YUI_SO_MINOR libyui soversion_minor)
#pkg_get_variable(YUI_SO_PATCH libyui soversion_patch)

message("YUI include: " ${YUI_INCLUDE_DIRS} " YUI library: " ${YUI_LIBRARY_DIRS})
message (STATUS "Using ${YUI_LIBRARY_DIRS}/libyui.so.${YUI_SO_VERSION}")
find_package(Boost COMPONENTS system filesystem REQUIRED)

find_library(YUYU libyui)
##### This is needed to be set for the libyui core
SET( SONAME_MAJOR ${YUI_SO_MAJOR} )
SET( SONAME ${YUI_SO_VERSION} )


#
Expand Down Expand Up @@ -116,26 +123,9 @@ add_library( ${TARGETLIB} SHARED
# Include directories and compile options
#

set( LOCAL_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include )

# Symlink ${YUI_INCLUDE_DIRS}
# so the headers there can be included as <yui/YFoo.h>
add_custom_target( local-include-dir
# check if the symlink already exists
COMMAND if [ ! -L "${LOCAL_INCLUDE_DIR}/yui" ]\; then
rm -rf ${LOCAL_INCLUDE_DIR}\;
mkdir ${LOCAL_INCLUDE_DIR}\;
ln -s ${YUI_INCLUDE_DIRS} ${LOCAL_INCLUDE_DIR}/yui\;
fi
)

add_dependencies( ${TARGETLIB} local-include-dir )
target_include_directories( ${TARGETLIB} BEFORE PUBLIC ${LOCAL_INCLUDE_DIR} )

# Setup CMake to use GTK+, tell the compiler where to look for headers
# and to the linker where to look for libraries
INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS} ${YUI_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS} ${YUI_LIBRARY_DIRS})


# Make the version from ../../VERSION.cmake available as a #define
Expand All @@ -146,28 +136,24 @@ target_compile_definitions( ${TARGETLIB} PUBLIC VERSION="${VERSION}" )
# Linking
#

# Find yui during a combined build
target_link_directories( ${TARGETLIB} BEFORE PUBLIC ../../libyui/build/src )
# https://cmake.org/cmake/help/latest/command/link_directories.html suggests to use target_link_libraries
# and anyway LINK_DIRECTORIES command will apply only to targets created after it is called, so must be set
# before add_library in the case.
target_link_directories( ${TARGETLIB}
PUBLIC ${YUI_LIBRARY_DIRS}
PUBLIC ${GTK3_LIBRARY_DIRS}
)


# Libraries that are needed to build this shared lib
#
# If in doubt what is really needed, check with "ldd -u" which libs are unused.
target_link_libraries( ${TARGETLIB}
# yui
${YUI_LIBRARIES}
${GTK3_LIBRARIES}
${Boost_FILESYSTEM_LIBRARY}
)

# Notice that we don't link against Qt5::Svg, but we need it at runtime:
#
# It's a plugin for Qt and will be used to load SVGs (like our icons) if
# libQt5Svg is available. But we don't use it directly here, only via Qt
# classes like QPixmap and QIcon. Qt loads the SVG plugin as needed.

pkg_get_variable(SONAME libyui soversion)
pkg_get_variable(SONAME_MAJOR libyui soversion_major)

# https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#target-properties
set_target_properties( ${TARGETLIB} PROPERTIES
VERSION ${SONAME}
Expand Down
2 changes: 1 addition & 1 deletion src/Y2CCGtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/

#include <yui/Libyui_config.h>

#include <YGUI.h>
#include <YGi18n.h>

Expand Down
2 changes: 1 addition & 1 deletion src/YGBarGraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/

#include <yui/Libyui_config.h>

#include "YGUI.h"
#include "YGWidget.h"
#include "ygtkbargraph.h"
Expand Down
2 changes: 1 addition & 1 deletion src/YGComboBox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
********************************************************************/

#define YUILogComponent "gtk"
#include <yui/Libyui_config.h>

#include <YGUI.h>
#include "YGUtils.h"
#include "YComboBox.h"
Expand Down
Loading

0 comments on commit 5e1757e

Please sign in to comment.