Skip to content

Commit

Permalink
Fixed qt-graph example building
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Jan 28, 2021
1 parent ffcdce7 commit 91c106c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 38 deletions.
36 changes: 14 additions & 22 deletions examples/CMakeLists.txt
Expand Up @@ -6,40 +6,32 @@ include( FindPkgConfig ) # pkg_check_modules()
set( PKG_NAME libyui-qt-graph${SONAME_MAJOR} )
set( EXAMPLES_INSTALL_DIR ${DESTDIR}/usr/share/doc/packages/${PKG_NAME}/examples )

set( USE_FRESHLY_BUILT_LIBYUI off )

if ( USE_FRESHLY_BUILT_LIBYUI )
# Use the freshly built libyui from ../build/src, not the system libyui from
# /usr/lib64; also set rpath.
#
# FIXME: This will still load the UI plug-ins from the system, not the
# freshly built ones.
set( LIBYUI ${CMAKE_BINARY_DIR}/src/libyui.so )
else()
# Link against the system libyui in /usr/lib64. No rpath.
set( LIBYUI yui )
endif()

# Check for the libgvc (from the libgraphviz package) via pkg-config;
# this sets LIBGVC_LIBRARIES (and more).
pkg_check_modules( LIBGVC REQUIRED libgvc )


set( EXAMPLES_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include )

# Symlink ../../libyui/src to build/examples/include/yui
# so the headers there can be included as <yui/YFoo.h>
add_custom_target( examples-include-dir
COMMAND rm -rf ${EXAMPLES_INCLUDE_DIR}
COMMAND mkdir ${EXAMPLES_INCLUDE_DIR}
COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR}/../../libyui/src ${EXAMPLES_INCLUDE_DIR}/yui )


# Build a simple example named EXAMPLE from one source file EXAMPLE.cc
# and install the source to the package's doc directory
#
function( add_example EXAMPLE )
add_executable( ${EXAMPLE} ${EXAMPLE}.cc )
target_link_libraries( ${EXAMPLE} ${LIBYUI} ${LIBGVC_LIBRARIES} )

# Add a dependency to the libyui-qt-graph CMake target so ../src/ is built first
add_dependencies( ${EXAMPLE} libyui-qt-graph )
target_link_libraries( ${EXAMPLE} yui ${LIBGVC_LIBRARIES} )
add_dependencies( ${EXAMPLE} libyui-qt-graph examples-include-dir )

if ( USE_FRESHLY_BUILT_LIBYUI )
# Enable including headers like <yui/YFoo.h> from ../../libyui/include
# which has a symlink yui -> ../src
target_include_directories( ${EXAMPLE} BEFORE PUBLIC ../../libyui/include )
endif()
# Prefer the headers in ../../libyui/src over those in /usr/include
target_include_directories( ${EXAMPLE} BEFORE PUBLIC ${EXAMPLES_INCLUDE_DIR} )

install( FILES ${EXAMPLE}.cc DESTINATION ${EXAMPLES_INSTALL_DIR} )
endfunction()
Expand Down
16 changes: 8 additions & 8 deletions examples/SimpleCreate.cc
Expand Up @@ -21,14 +21,14 @@
#include <string.h>
#include <graphviz/gvc.h>

#include "yui/YUI.h"
#include "yui/YWidgetFactory.h"
#include "yui/YOptionalWidgetFactory.h"
#include "yui/YDialog.h"
#include "yui/YLayoutBox.h"
#include "yui/YGraph.h"
#include "yui/YPushButton.h"
#include "yui/YEvent.h"
#include <yui/YUI.h>
#include <yui/YWidgetFactory.h>
#include <yui/YOptionalWidgetFactory.h>
#include <yui/YDialog.h>
#include <yui/YLayoutBox.h>
#include <yui/YGraph.h>
#include <yui/YPushButton.h>
#include <yui/YEvent.h>


int
Expand Down
16 changes: 8 additions & 8 deletions examples/SimpleLoad.cc
Expand Up @@ -20,14 +20,14 @@

#include <iostream>

#include "yui/YUI.h"
#include "yui/YWidgetFactory.h"
#include "yui/YOptionalWidgetFactory.h"
#include "yui/YDialog.h"
#include "yui/YLayoutBox.h"
#include "yui/YGraph.h"
#include "yui/YPushButton.h"
#include "yui/YEvent.h"
#include <yui/YUI.h>
#include <yui/YWidgetFactory.h>
#include <yui/YOptionalWidgetFactory.h>
#include <yui/YDialog.h>
#include <yui/YLayoutBox.h>
#include <yui/YGraph.h>
#include <yui/YPushButton.h>
#include <yui/YEvent.h>


int
Expand Down

0 comments on commit 91c106c

Please sign in to comment.