Warning, /plasma/oxygen-gtk/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 project( oxygen-gtk )
0002 
0003 cmake_minimum_required(VERSION 3.16)
0004 
0005 ###########################
0006 # Define package generation
0007 ###########################
0008 
0009 set( CPACK_PACKAGE_NAME "oxygen-gtk2" )
0010 set( CPACK_SOURCE_PACKAGE_NAME "oxygen-gtk2" )
0011 set( CPACK_SOURCE_GENERATOR TBZ2 )
0012 set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Oxygen Gtk2 theme" )
0013 set( CPACK_PACKAGE_VENDOR "hugo.pereira@free.fr" )
0014 set( CPACK_PACKAGE_VERSION_MAJOR "1" )
0015 set( CPACK_PACKAGE_VERSION_MINOR "4" )
0016 set( CPACK_PACKAGE_VERSION_PATCH "50" )
0017 set( CPACK_SOURCE_IGNORE_FILES "build" "^${PROJECT_SOURCE_DIR}.*/.git/" )
0018 
0019 ##################################
0020 # Define oxygen-gtk version string
0021 ##################################
0022 if( EXISTS "${CMAKE_SOURCE_DIR}/.git" )
0023     execute_process(COMMAND sh -c "cd ${CMAKE_SOURCE_DIR} && git describe 2>/dev/null"
0024         OUTPUT_VARIABLE OXYGEN_VERSION
0025         OUTPUT_STRIP_TRAILING_WHITESPACE)
0026 endif( EXISTS "${CMAKE_SOURCE_DIR}/.git" )
0027 STRING(COMPARE NOTEQUAL "${OXYGEN_VERSION}" "" OXYGEN_VERSION_DETECTED )
0028 if( NOT OXYGEN_VERSION_DETECTED )
0029     set( OXYGEN_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH} )
0030 endif( NOT OXYGEN_VERSION_DETECTED )
0031 message( "Detected oxygen version string: ${OXYGEN_VERSION}" )
0032 
0033 set( CPACK_SOURCE_PACKAGE_FILE_NAME "oxygen-gtk2-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" )
0034 include( CPack )
0035 ########################
0036 # Package specific flags
0037 ########################
0038 
0039 option(ENABLE_DEMO "Build the demo." ON)
0040 
0041 # Set to 1 to enable debugging information
0042 if( NOT DEFINED OXYGEN_DEBUG )
0043     set( OXYGEN_DEBUG 0 )
0044 endif( NOT DEFINED OXYGEN_DEBUG )
0045 
0046 # Set to 1 to disable all signal hooks used for various features
0047 if( NOT DEFINED DISABLE_SIGNAL_HOOKS )
0048     set( DISABLE_SIGNAL_HOOKS 0 )
0049 endif( NOT DEFINED DISABLE_SIGNAL_HOOKS )
0050 
0051 # Set to 1 to enable debug logs regarding inner shadows
0052 if( NOT DEFINED OXYGEN_DEBUG_INNERSHADOWS )
0053     set( OXYGEN_DEBUG_INNERSHADOWS 0 )
0054 endif( NOT DEFINED OXYGEN_DEBUG_INNERSHADOWS )
0055 
0056 # Set to 1 to build windeco test app (normal users rarely need this)
0057 if( NOT DEFINED BUILD_DECO_TEST )
0058     set( BUILD_DECO_TEST 0 )
0059 endif( NOT DEFINED BUILD_DECO_TEST )
0060 
0061 # Set to 1 to replace gtk stock icons
0062 # with oxygen-icons
0063 if( NOT DEFINED OXYGEN_ICON_HACK )
0064     set( OXYGEN_ICON_HACK 1 )
0065 endif( NOT DEFINED OXYGEN_ICON_HACK )
0066 
0067 # Set to 1 to force KDE icons and fonts when running in non-KDE
0068 if( NOT DEFINED OXYGEN_FORCE_KDE_ICONS_AND_FONTS )
0069     set( OXYGEN_FORCE_KDE_ICONS_AND_FONTS 1 )
0070 endif( NOT DEFINED OXYGEN_FORCE_KDE_ICONS_AND_FONTS )
0071 
0072 # Set to 1 to resize combobox list to compensate for combobox button glow width
0073 # (may result in flicker on combo popup)
0074 if( NOT DEFINED ENABLE_COMBOBOX_LIST_RESIZE )
0075     set( ENABLE_COMBOBOX_LIST_RESIZE 1 )
0076 endif( NOT DEFINED ENABLE_COMBOBOX_LIST_RESIZE )
0077 
0078 # Set to 0 to disable inner shadows hack
0079 # Note this flag is automatically set to 0 if GTK version is too old (< 2.24.2)
0080 if( NOT DEFINED ENABLE_INNER_SHADOWS_HACK )
0081     set( ENABLE_INNER_SHADOWS_HACK 1 )
0082 endif( NOT DEFINED ENABLE_INNER_SHADOWS_HACK )
0083 
0084 # set to 0 to disable groupbox hack
0085 if( NOT DEFINED ENABLE_GROUPBOX_HACK )
0086     set( ENABLE_GROUPBOX_HACK 1 )
0087 endif( NOT DEFINED ENABLE_GROUPBOX_HACK )
0088 
0089 ##############
0090 # Requirements
0091 ##############
0092 
0093 # install prefix
0094 include( FindPkgConfig )
0095 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
0096 
0097     exec_program(
0098         ${PKG_CONFIG_EXECUTABLE}
0099         ARGS --variable=prefix gtk+-2.0
0100         OUTPUT_VARIABLE GTK_PREFIX )
0101 
0102     message( "Info: using PKG_CONFIG_EXECUTABLE to set the installation prefix" )
0103     set(CMAKE_INSTALL_PREFIX
0104         ${GTK_PREFIX} CACHE PATH "GTK install prefix" FORCE
0105         )
0106 endif()
0107 
0108 # X11
0109 find_package( X11 REQUIRED )
0110 
0111 # PKG_CONFIG
0112 find_package(PkgConfig REQUIRED )
0113 
0114 # GTK
0115 pkg_check_modules( GTK REQUIRED gtk+-2.0 )
0116 add_definitions( ${GTK_CFLAGS_OTHER} )
0117 
0118 # Cairo
0119 pkg_check_modules( CAIRO REQUIRED cairo )
0120 add_definitions( ${CAIRO_CFLAGS_OTHER} )
0121 
0122 ##########################
0123 # installation directories
0124 ##########################
0125 exec_program(
0126     ${PKG_CONFIG_EXECUTABLE}
0127     ARGS --variable=gtk_binary_version gtk+-2.0
0128     OUTPUT_VARIABLE GTK_BIN_VERSION )
0129 
0130 if( DEFINED LIB_SUFFIX OR NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
0131 
0132     message( "Info: using LIB_SUFFIX to set the theme engine installation path" )
0133     set( INSTALL_PATH_GTK_ENGINES "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/gtk-2.0/${GTK_BIN_VERSION}/engines" CACHE PATH "The directory in which to install the theme engine library( eg. /usr/lib/gtk-2.0/2.4.0/engines )" )
0134 
0135 else()
0136 
0137     exec_program(
0138         ${PKG_CONFIG_EXECUTABLE}
0139         ARGS --variable=libdir gtk+-2.0
0140         OUTPUT_VARIABLE GTK_LIBDIR_PREFIX )
0141 
0142     message( "Info: using PKG_CONFIG_EXECUTABLE to set the theme engine installation path" )
0143     set( INSTALL_PATH_GTK_ENGINES "${GTK_LIBDIR_PREFIX}/gtk-2.0/${GTK_BIN_VERSION}/engines" CACHE PATH "The directory in which to install the theme engine library( eg. /usr/lib/gtk-2.0/2.4.0/engines )" )
0144 
0145 endif()
0146 
0147 set( INSTALL_PATH_GTK_THEMES "${CMAKE_INSTALL_PREFIX}/share/themes" CACHE PATH "The directory in which to install the theme data( eg. /usr/share/themes )" )
0148 set( GTK_THEME_DIR ${INSTALL_PATH_GTK_THEMES}/oxygen-gtk )
0149 
0150 # First emit all warnings in one place
0151 # Adjust flags based on gtk version and warn user if needed
0152 if( ENABLE_INNER_SHADOWS_HACK AND GTK_VERSION VERSION_LESS 2.24.2 )
0153     message( "Warning: disabling inner shadows hack because GTK version is too old (needed 2.24.2, found ${GTK_VERSION})" )
0154     set( ENABLE_INNER_SHADOWS_HACK 0 )
0155 endif( ENABLE_INNER_SHADOWS_HACK AND GTK_VERSION VERSION_LESS 2.24.2 )
0156 
0157 #########
0158 # summary
0159 #########
0160 message( "Flags: " )
0161 message( "  OXYGEN_DEBUG ${OXYGEN_DEBUG}" )
0162 message( "  DISABLE_SIGNAL_HOOKS ${DISABLE_SIGNAL_HOOKS}" )
0163 message( "  BUILD_DECO_TEST ${BUILD_DECO_TEST}" )
0164 message( "  OXYGEN_DEBUG_INNERSHADOWS ${OXYGEN_DEBUG_INNERSHADOWS}" )
0165 message( "  OXYGEN_ICON_HACK ${OXYGEN_ICON_HACK}" )
0166 message( "  OXYGEN_FORCE_KDE_ICONS_AND_FONTS ${OXYGEN_FORCE_KDE_ICONS_AND_FONTS}" )
0167 message( "  ENABLE_COMBOBOX_LIST_RESIZE ${ENABLE_COMBOBOX_LIST_RESIZE}" )
0168 message( "  ENABLE_INNER_SHADOWS_HACK ${ENABLE_INNER_SHADOWS_HACK}" )
0169 message( "  ENABLE_GROUPBOX_HACK ${ENABLE_GROUPBOX_HACK}" )
0170 message( "" )
0171 message( "Paths: " )
0172 message( "  Installing the GTK theme engine library to: ${INSTALL_PATH_GTK_ENGINES}" )
0173 message( "  Installing the GTK theme engine data to: ${GTK_THEME_DIR}" )
0174 message( "" )
0175 
0176 ##################
0177 # uninstall target
0178 ##################
0179 configure_file(
0180     "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
0181     "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
0182     IMMEDIATE @ONLY)
0183 
0184 add_custom_target(uninstall
0185     COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
0186 
0187 
0188 ######################################################################
0189 # Setup definitions and directories to be used for linking and include
0190 ######################################################################
0191 link_directories( ${GTK_LIBRARY_DIRS} ${CAIRO_LIBRARY_DIRS} )
0192 include_directories( ${GTK_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS} ${X11_X11_INCLUDE_PATH} )
0193 
0194 #############################
0195 # generate configuration file
0196 #############################
0197 configure_file( config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
0198 
0199 ################
0200 # Subdirectories
0201 ################
0202 add_subdirectory( src )
0203 add_subdirectory( rc )
0204 add_subdirectory( special-icons )
0205 if( ENABLE_DEMO )
0206     add_subdirectory( demo )
0207 endif( ENABLE_DEMO )
0208