Skip to content

Commit eabcd37

Browse files
anaselliConan-Kudo
authored andcommitted
Built against new libyui tree
1 parent df4d5ef commit eabcd37

File tree

4 files changed

+191
-3
lines changed

4 files changed

+191
-3
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Makefile.in
3939
# CMake
4040
CMakeCache.txt
4141
CMakeFiles
42-
CMakeLists.txt
4342
Makefile
4443
cmake_install.cmake
4544
install_manifest.txt

CMakeLists.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# CMakeLists.txt for libyui-mga-ncurses
2+
#
3+
# Usage:
4+
#
5+
# mkdir build
6+
# cd build
7+
# cmake ..
8+
#
9+
# make
10+
# sudo make install
11+
#
12+
# Restart with a clean build environment:
13+
# rm -rf build
14+
#
15+
# Show the complete compiler commands with all arguments:
16+
# make VERBOSE=1
17+
18+
cmake_minimum_required( VERSION 3.17 )
19+
project( libyui-mga-ncurses )
20+
21+
# Options usage:
22+
#
23+
# cmake -DBUILD_DOC=on -DBUILD_EXAMPLES=off ..
24+
25+
option( BUILD_SRC "Build in src/ subdirectory" on )
26+
option( BUILD_DOC "Build class documentation" off )
27+
option( WERROR "Treat all compiler warnings as errors" off )
28+
29+
# Non-boolean options
30+
set( DOC_DESTDIR "" CACHE STRING "Destination directory prefix for installing docs" )
31+
32+
#----------------------------------------------------------------------
33+
34+
35+
set( CMAKE_INSTALL_MESSAGE LAZY ) # Suppress "up-to-date" messages during "make install"
36+
37+
add_compile_options( "-Wall" )
38+
IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
39+
# Initialize compiler flags for all targets in all subdirectories
40+
add_compile_options( "-Os" ) # Optimize for size (overrides CMake's -O3 in RELEASE builds)
41+
endif()
42+
43+
if ( WERROR )
44+
add_compile_options( "-Werror" )
45+
endif()
46+
47+
48+
#
49+
# Descend into subdirectories
50+
#
51+
52+
if ( BUILD_SRC )
53+
add_subdirectory( src )
54+
endif()
55+
56+
# TODO
57+
#if ( BUILD_DOC )
58+
# add_subdirectory( doc )
59+
#endif()

src/CMakeLists.txt

Lines changed: 131 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,131 @@
1-
PROCESS_SOURCES()
1+
# CMakeLists.txt for libyui-qt/src
2+
3+
include( ../VERSION.cmake )
4+
include( GNUInstallDirs ) # set CMAKE_INSTALL_INCLUDEDIR, ..._LIBDIR
5+
6+
# Use the package PkgConfig to detect GTK+ headers/library files
7+
FIND_PACKAGE(PkgConfig REQUIRED)
8+
9+
PKG_CHECK_MODULES(YUI REQUIRED libyui)
10+
pkg_get_variable(YUI_SO_VERSION libyui soversion)
11+
pkg_get_variable(YUI_SO_MAJOR libyui soversion_major)
12+
#pkg_get_variable(YUI_SO_MINOR libyui soversion_minor)
13+
#pkg_get_variable(YUI_SO_PATCH libyui soversion_patch)
14+
15+
# Check if the libs we link against are available.
16+
# They are all part of package ncurses-devel.
17+
18+
find_library( NCURSESW_LIB NAMES ncursesw REQUIRED )
19+
find_library( TINFO_LIB NAMES tinfo REQUIRED )
20+
21+
set( NCURSES_LIBS ${NCURSESW_LIB} ${TINFO_LIB} )
22+
23+
message (STATUS "Using ${YUI_LIBRARY_DIRS}/libyui.so.${YUI_SO_VERSION}")
24+
25+
##### This is needed to be set for the libyui core
26+
SET( SONAME_MAJOR ${YUI_SO_MAJOR} )
27+
SET( SONAME ${YUI_SO_VERSION} )
28+
29+
PKG_CHECK_MODULES(YUIMGA REQUIRED libyui-mga)
30+
PKG_CHECK_MODULES(YUI_NCURSES REQUIRED libyui-ncurses)
31+
32+
#
33+
# libyui plugin specific
34+
#
35+
36+
set( TARGETLIB libyui-mga-ncurses )
37+
set( TARGETLIB_BASE yui-mga-ncurses )
38+
39+
set( HEADERS_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/yui/mga/ncurses )
40+
set( PLUGIN_DIR ${CMAKE_INSTALL_LIBDIR}/yui ) # /usr/lib64/yui
41+
42+
# if DESTDIR is set, CMAKE_INSTALL_INCLUDEDIR already contains it
43+
# during "make install" (but not for other make targets!):
44+
#
45+
# sudo make install DESTDIR=/work/foo
46+
# or
47+
# DESTDIR=/work/foo sudo make install
48+
#
49+
# -> the include files are installed to /work/foo/usr/include/...
50+
# We need that for RPM builds to install everything to $RPM_BUILD_ROOT.
51+
52+
53+
set( SOURCES
54+
NCMenu.cc
55+
NCMGAPopupMenu.cc
56+
YNCWE.cc
57+
YMGA_NCCBTable.cc
58+
YMGANCMenuBar.cc
59+
YMGANCWidgetFactory.cc
60+
)
61+
62+
63+
set( HEADERS
64+
NCMenu.h
65+
NCMGAPopupMenu.h
66+
YNCWE.h
67+
YMGA_NCCBTable.h
68+
YMGANCMenuBar.h
69+
YMGANCWidgetFactory.h
70+
)
71+
72+
73+
# Add shared lib to be built
74+
add_library( ${TARGETLIB} SHARED
75+
${SOURCES}
76+
${HEADERS}
77+
)
78+
79+
80+
# Include directories and compile options
81+
#
82+
83+
# Setup CMake to use GTK+, tell the compiler where to look for headers
84+
# and to the linker where to look for libraries
85+
INCLUDE_DIRECTORIES(${YUI_NCURSES_INCLUDE_DIRS} ${YUI_INCLUDE_DIRS} ${YUIMGA_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
86+
87+
88+
# Make the version from ../../VERSION.cmake available as a #define
89+
target_compile_definitions( ${TARGETLIB} PUBLIC VERSION="${VERSION}" )
90+
91+
92+
#
93+
# Linking
94+
#
95+
96+
# https://cmake.org/cmake/help/latest/command/link_directories.html suggests to use target_link_libraries
97+
# and anyway LINK_DIRECTORIES command will apply only to targets created after it is called, so must be set
98+
# before add_library in the case.
99+
target_link_directories( ${TARGETLIB}
100+
PUBLIC ${YUI_LIBRARY_DIRS}
101+
PUBLIC ${YUIMGA_LIBRARY_DIRS}
102+
PUBLIC ${YUI_NCURSES_LIBRARY_DIRS}
103+
)
104+
105+
106+
# Libraries that are needed to build this shared lib
107+
#
108+
# If in doubt what is really needed, check with "ldd -u" which libs are unused.
109+
target_link_libraries( ${TARGETLIB}
110+
${YUI_LIBRARIES}
111+
${YUIMGA_LIBRARIES}
112+
${YUI_NCURSES_LIBRARIES}
113+
${NCURSES_LIBS}
114+
)
115+
116+
117+
# https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#target-properties
118+
set_target_properties( ${TARGETLIB} PROPERTIES
119+
VERSION ${SONAME} # From ../../VERSION.cmake
120+
SOVERSION ${SONAME_MAJOR} # From ../../VERSION.cmake
121+
OUTPUT_NAME ${TARGETLIB_BASE}
122+
)
123+
124+
125+
#
126+
# Install
127+
#
128+
129+
# Install the headers first so the message about the lib does not scroll away
130+
install( FILES ${HEADERS} DESTINATION ${HEADERS_INSTALL_DIR} )
131+
install( TARGETS ${TARGETLIB} LIBRARY DESTINATION ${PLUGIN_DIR} )

src/NCMenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#include <yui/YTree.h>
3333
#include <yui/YMenuItem.h>
34-
#include "NCPadWidget.h"
34+
#include <yui/ncurses/NCPadWidget.h>
3535
#include <yui/ncurses/NCTreePad.h>
3636
#include <yui/ncurses/NCTablePad.h>
3737

0 commit comments

Comments
 (0)