summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2022-09-05 22:29:25 +0200
committerSlávek Banko <slavek.banko@axis.cz>2022-09-05 22:29:25 +0200
commit49ce296ac51321833c363cc65176070971c5f539 (patch)
treec7d0f569ddb4653843169a1d8b3986d083e1c7f9
parentb61c1a1003b5784bbc54033bf13b0453bd7f10c9 (diff)
downloadgtk-qt-engine-49ce296ac51321833c363cc65176070971c5f539.tar.gz
gtk-qt-engine-49ce296ac51321833c363cc65176070971c5f539.zip
Housekeeping of CMake rules.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--CMakeLists.txt83
-rw-r--r--ConfigureChecks.cmake35
-rw-r--r--config.h.cmake11
-rw-r--r--kcm_gtk/CMakeLists.txt25
-rw-r--r--src/CMakeLists.txt29
-rw-r--r--src/qt_theme_draw.c4
6 files changed, 113 insertions, 74 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a338b6..f2a0869 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,11 @@
+############################################
+# #
+# Improvements and feedbacks are welcome #
+# #
+# This file is released under GPL >= 2 #
+# #
+############################################
+
cmake_minimum_required( VERSION 3.1 )
@@ -5,8 +13,6 @@ cmake_minimum_required( VERSION 3.1 )
project( gtk-qt-engine )
-set( PACKAGE gtk-qt-engine )
-
##### include essential cmake modules ###########
@@ -62,63 +68,24 @@ set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined"
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
-INCLUDE (UsePkgConfig)
-
-# Find GTK
-PKGCONFIG(gtk+-2.0 GTK_INCLUDE_DIR GTK_LIB_DIR GTK_LINK_FLAGS GTK_CFLAGS)
-IF (NOT GTK_INCLUDE_DIR)
- MESSAGE(FATAL_ERROR "GTK was not found. Ensure you have the GTK development libraries installed, and GTK's pkgconfig files are in your pkgconfig search path.")
-ENDIF (NOT GTK_INCLUDE_DIR)
-MESSAGE(STATUS "Found GTK include dir: ${GTK_INCLUDE_DIR}")
-MESSAGE(STATUS "Found GTK library dir: ${GTK_LIB_DIR}")
-
-# Find Bonobo
-PKGCONFIG(libbonoboui-2.0 BONOBO_INCLUDE_DIR BONOBO_LIB_DIR BONOBO_LINK_FLAGS BONOBO_CFLAGS)
-IF (NOT BONOBO_INCLUDE_DIR)
- MESSAGE(STATUS "bonoboui not found. Some features of the theme engine will not work as intended.")
-ELSE (NOT BONOBO_INCLUDE_DIR)
- MESSAGE(STATUS "Found Bonobo include dir: ${BONOBO_INCLUDE_DIR}")
- MESSAGE(STATUS "Found Bonobo library dir: ${BONOBO_LIB_DIR}")
- SET(BONOBO_DEFINITIONS -D HAVE_BONOBO)
-ENDIF (NOT BONOBO_INCLUDE_DIR)
-
-
-# Work out where to install stuff
-EXEC_PROGRAM(
- ${PKGCONFIG_EXECUTABLE}
- ARGS --variable=gtk_binary_version gtk+-2.0
- OUTPUT_VARIABLE GTK_VERSION)
-SET(INSTALL_PATH_GTK_ENGINES "${GTK_LIB_DIR}/gtk-2.0/${GTK_VERSION}/engines" CACHE PATH "The directory in which to install the theme engine library (eg. /usr/lib/gtk-2.0/2.4.0/engines)")
-MESSAGE(STATUS "Installing the GTK theme engine library to: ${INSTALL_PATH_GTK_ENGINES}")
-
-EXEC_PROGRAM(
- ${PKGCONFIG_EXECUTABLE}
- ARGS --variable=prefix gtk+-2.0
- OUTPUT_VARIABLE GTK_PREFIX)
-SET(INSTALL_PATH_GTK_THEMES "${GTK_PREFIX}/share/themes" CACHE PATH "The directory in which to install the theme data (eg. /usr/share/themes)")
-MESSAGE(STATUS "Installing the GTK theme engine data to: ${INSTALL_PATH_GTK_THEMES}")
-
-SET(INSTALL_PATH_KCONTROL_MODULES "${TDE_LIB_DIR}" CACHE PATH "The directory in which to install KControl plugins (eg. /usr/lib)")
-MESSAGE(STATUS "Installing the KControl plugins to: ${INSTALL_PATH_KCONTROL_MODULES}")
-
-MESSAGE(STATUS "Installing everything else to: ${CMAKE_INSTALL_PREFIX}")
-
-# Setup definitions and directories to be used in all subdirectories
-ADD_DEFINITIONS(${QT_DEFINITIONS} ${TDE_DEFINITIONS} ${BONOBO_DEFINITIONS})
-LINK_DIRECTORIES(${TDE_LIB_DIR} ${GTK_LIB_DIR} ${BONOBO_LIB_DIR} ${TQT_LIBRARY_DIRS})
-INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIR} ${BONOBO_INCLUDE_DIR} ${TDE_INCLUDE_DIR} ${TQT_INCLUDE_DIRS})
-
-# Subdirectories
-ADD_SUBDIRECTORY(src)
-ADD_SUBDIRECTORY(kcm_gtk)
+##### directories
+
+add_subdirectory( src )
+add_subdirectory( kcm_gtk )
tde_conditional_add_project_docs( BUILD_DOC )
tde_conditional_add_project_translations( BUILD_TRANSLATIONS )
-# Uninstall support
-CONFIGURE_FILE(
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
- IMMEDIATE @ONLY)
-ADD_CUSTOM_TARGET(uninstall
- "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+##### write configure files
+
+configure_file( config.h.cmake config.h @ONLY )
+
+
+##### uninstall support
+
+if( NOT TARGET uninstall )
+ configure_file( "cmake_uninstall.cmake.in" "cmake_uninstall.cmake" IMMEDIATE @ONLY )
+ add_custom_target( uninstall
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ )
+endif()
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index c9ca45a..a9df6dc 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -12,8 +12,41 @@ find_package( TQt )
find_package( TDE )
-##### check for gcc visibility support #########
+##### check for gcc visibility support
if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( )
endif( )
+
+
+#### gtk+-2.0
+
+pkg_search_module( GTK gtk+-2.0 )
+
+if( NOT GTK_FOUND )
+ tde_message_fatal( "gtk2 is required but was not found on your system" )
+endif( )
+
+execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE}
+ gtk+-2.0 --variable=gtk_binary_version
+ OUTPUT_VARIABLE GTK_BIN_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+set( INSTALL_PATH_GTK_ENGINES "${GTK_LIBDIR}/gtk-2.0/${GTK_BIN_VERSION}/engines"
+ CACHE PATH "The directory in which to install the theme engine library" )
+message( STATUS " theme engine lib directory: ${INSTALL_PATH_GTK_ENGINES}" )
+set( INSTALL_PATH_GTK_THEMES "${GTK_PREFIX}/share/themes"
+ CACHE PATH "The directory in which to install the theme data" )
+MESSAGE( STATUS " theme engine data directory: ${INSTALL_PATH_GTK_THEMES}" )
+
+
+#### libbonoboui-2.0
+
+pkg_search_module( BONOBO libbonoboui-2.0 )
+
+if( NOT BONOBO_FOUND )
+ message( STATUS "bonoboui not found. Some features of the theme engine will not work as intended." )
+else( )
+ set( HAVE_BONOBO 1 )
+endif( )
diff --git a/config.h.cmake b/config.h.cmake
new file mode 100644
index 0000000..c5045ac
--- /dev/null
+++ b/config.h.cmake
@@ -0,0 +1,11 @@
+#define VERSION "@VERSION@"
+
+// Defined if you have fvisibility and fvisibility-inlines-hidden support.
+#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
+
+/* Defined if libbonoboui is available */
+#cmakedefine HAVE_BONOBO 1
diff --git a/kcm_gtk/CMakeLists.txt b/kcm_gtk/CMakeLists.txt
index 87a0b4e..278bba5 100644
--- a/kcm_gtk/CMakeLists.txt
+++ b/kcm_gtk/CMakeLists.txt
@@ -1,25 +1,30 @@
-include( TDEMacros )
-
- include_directories(
+include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
- )
+)
- link_directories(
+link_directories(
${TQT_LIBRARY_DIRS}
- )
+)
+
+
+##### kcm_kcmgtk (part)
- tde_add_kpart( kcm_kcmgtk AUTOMOC
- SOURCES kcmgtk.cpp
+tde_add_kpart( kcm_kcmgtk AUTOMOC
+ SOURCES
+ kcmgtk.cpp
kcmgtkwidget.ui
mozillaprofile.ui
emacsdetails.ui
searchpaths.ui
- LINK ${TQT_LIBRARIES} -ltdecore -ltdeui
+ LINK tdecore-shared tdeui-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
- )
+)
+
+
+##### other data
tde_create_translated_desktop( kcmgtk.desktop )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 195eaab..0f4025b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,3 +1,23 @@
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+ ${GTK_INCLUDE_DIRS}
+ ${BONOBO_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+ ${TDE_LIB_DIR}
+ ${GTK_LIBDIR}
+ ${BONOBO_LIBDIR}
+)
+
+
+##### qtengine (shared)
+
set( target qtengine )
set( ${target}_SRCS
@@ -9,15 +29,14 @@ set( ${target}_SRCS
tde_add_library( ${target} SHARED AUTOMOC
SOURCES ${${target}_SRCS}
- LINK ${GTK_LINK_FLAGS} ${BONOBO_LINK_FLAGS} ${TQT_LIBRARIES} -lX11 -ltdecore
+ LINK ${GTK_LIBRARIES} ${BONOBO_LIBRARIES} X11 tdecore-shared
DESTINATION ${INSTALL_PATH_GTK_ENGINES}
)
-# Add GTK's cflags
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GTK_CFLAGS} ${BONOBO_CFLAGS}")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GTK_CFLAGS} ${BONOBO_CFLAGS}")
-INSTALL(
+##### other data
+
+install(
FILES gtkrc
DESTINATION "${INSTALL_PATH_GTK_THEMES}/Qt/gtk-2.0"
)
diff --git a/src/qt_theme_draw.c b/src/qt_theme_draw.c
index c7992d5..6473c9c 100644
--- a/src/qt_theme_draw.c
+++ b/src/qt_theme_draw.c
@@ -1,3 +1,7 @@
+#if defined( HAVE_CONFIG_H )
+# include "config.h"
+#endif
+
#include <math.h>
#include <string.h>
#include <gtk/gtkprogressbar.h>