2008-06-19 22:49:26 +02:00
|
|
|
SET(PROJECT_AWE_NAME awesome)
|
|
|
|
SET(PROJECT_AWECLIENT_NAME awesome-client)
|
|
|
|
SET(VERSION 3)
|
|
|
|
SET(VERSION_MAJOR ${VERSION})
|
|
|
|
SET(VERSION_MINOR 0)
|
|
|
|
SET(VERSION_PATCH 0)
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-19 22:49:26 +02:00
|
|
|
PROJECT(${PROJECT_AWE_NAME})
|
2008-06-19 04:41:46 +02:00
|
|
|
|
2008-06-19 22:49:26 +02:00
|
|
|
SET(CMAKE_BUILD_TYPE RELEASE)
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-20 12:15:43 +02:00
|
|
|
OPTION(WITH_DBUS "build with D-BUS" ON)
|
2008-06-20 14:46:45 +02:00
|
|
|
OPTION(WITH_IMLIB2 "build with Imlib2" ON)
|
2008-06-20 18:49:58 +02:00
|
|
|
OPTION(GENERATE_MANPAGES "generate manpages" ON)
|
2008-06-20 12:15:43 +02:00
|
|
|
|
2008-06-20 19:59:09 +02:00
|
|
|
# {{{ CFLAGS
|
2008-06-19 23:18:10 +02:00
|
|
|
ADD_DEFINITIONS(-std=gnu99 -ggdb3 -fno-strict-aliasing -Wall -Wextra
|
|
|
|
-Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings
|
|
|
|
-Wsign-compare -Wunused -Wno-unused-parameter -Wuninitialized -Winit-self
|
|
|
|
-Wpointer-arith -Wredundant-decls -Wformat-nonliteral
|
2008-06-20 14:49:37 +02:00
|
|
|
-Wno-format-zero-length -Wmissing-format-attribute)
|
2008-06-20 19:59:09 +02:00
|
|
|
# }}}
|
2008-06-19 23:18:10 +02:00
|
|
|
|
2008-06-20 18:49:58 +02:00
|
|
|
# {{{ Find external utilities
|
2008-06-20 18:01:42 +02:00
|
|
|
FIND_PROGRAM(CAT_EXECUTABLE cat)
|
2008-06-21 15:10:51 +02:00
|
|
|
FIND_PROGRAM(GREP_EXECUTABLE grep)
|
2008-06-20 18:01:42 +02:00
|
|
|
FIND_PROGRAM(GIT_EXECUTABLE git)
|
|
|
|
FIND_PROGRAM(LUA_EXECUTABLE lua)
|
|
|
|
# programs needed for man pages
|
|
|
|
FIND_PROGRAM(ASCIIDOC_EXECUTABLE asciidoc)
|
|
|
|
FIND_PROGRAM(XMLTO_EXECUTABLE xmlto)
|
|
|
|
FIND_PROGRAM(GZIP_EXECUTABLE gzip)
|
|
|
|
# doxygen
|
|
|
|
INCLUDE(FindDoxygen)
|
|
|
|
# pkg-config
|
|
|
|
INCLUDE(FindPkgConfig)
|
|
|
|
# }}}
|
|
|
|
|
2008-06-20 18:49:58 +02:00
|
|
|
# {{{ Check if manpages can be build
|
|
|
|
IF(GENERATE_MANPAGES)
|
|
|
|
IF(NOT ASCIIDOC_EXECUTABLE OR NOT XMLTO_EXECUTABLE OR NOT GZIP_EXECUTABLE)
|
|
|
|
IF(NOT ASCIIDOC_EXECUTABLE)
|
|
|
|
SET(missing "asciidoc")
|
|
|
|
ENDIF()
|
|
|
|
IF(NOT XMLTO_EXECUTABLE)
|
|
|
|
SET(missing ${missing} " xmlto")
|
|
|
|
ENDIF()
|
|
|
|
IF(NOT GZIP_EXECUTABLE)
|
|
|
|
SET(missing ${missing} " gzip")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
MESSAGE(STATUS "Not generating manpages. Missing: " ${missing})
|
|
|
|
SET(GENERATE_MANPAGES OFF)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
# }}}
|
|
|
|
|
2008-06-17 16:41:49 +02:00
|
|
|
# If this is a git repository...
|
2008-06-19 22:49:26 +02:00
|
|
|
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/HEAD)
|
|
|
|
# ...update version
|
|
|
|
IF(GIT_EXECUTABLE)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} describe
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE VERSION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2008-06-17 16:41:49 +02:00
|
|
|
|
2008-06-20 19:36:26 +02:00
|
|
|
# {{{ Required libraries
|
|
|
|
#
|
|
|
|
# this sets up:
|
|
|
|
# AWESOME_REQUIRED_LIBRARIES
|
|
|
|
# AWESOME_REQUIRED_INCLUDE_DIRS
|
2008-06-16 08:44:12 +02:00
|
|
|
|
|
|
|
# Use pkgconfig to get most of the libraries
|
2008-06-20 19:36:26 +02:00
|
|
|
pkg_check_modules(AWESOME_REQUIRED REQUIRED
|
2008-06-19 22:49:26 +02:00
|
|
|
glib-2.0
|
|
|
|
cairo
|
|
|
|
pango
|
|
|
|
gdk-2.0>=2.2
|
|
|
|
gdk-pixbuf-2.0>=2.2
|
|
|
|
xcb
|
|
|
|
xcb-event
|
|
|
|
xcb-randr
|
|
|
|
xcb-xinerama
|
|
|
|
xcb-shape
|
|
|
|
xcb-aux
|
|
|
|
xcb-atom
|
|
|
|
xcb-keysyms
|
|
|
|
xcb-render
|
|
|
|
xcb-icccm
|
2008-06-20 12:15:43 +02:00
|
|
|
cairo-xcb)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2008-06-20 20:29:47 +02:00
|
|
|
MACRO(a_find_library variable library)
|
|
|
|
FIND_LIBRARY(${variable} ${library})
|
|
|
|
IF(NOT ${variable})
|
|
|
|
MESSAGE(FATAL_ERROR ${library} " library not found.")
|
|
|
|
ENDIF()
|
|
|
|
ENDMACRO()
|
|
|
|
|
2008-06-20 12:15:43 +02:00
|
|
|
# Check for readline, ncurse and libev
|
2008-06-20 20:29:47 +02:00
|
|
|
a_find_library(LIB_READLINE readline)
|
|
|
|
a_find_library(LIB_NCURSES ncurses)
|
|
|
|
a_find_library(LIB_EV ev)
|
2008-06-17 17:48:00 +02:00
|
|
|
|
2008-06-16 08:44:12 +02:00
|
|
|
# Check for lua5.1
|
|
|
|
FIND_PATH(LUA_INC_DIR lua.h
|
|
|
|
/usr/include
|
|
|
|
/usr/include/lua5.1
|
2008-06-19 22:49:26 +02:00
|
|
|
/usr/local/include/lua5.1)
|
2008-06-16 08:44:12 +02:00
|
|
|
|
|
|
|
FIND_LIBRARY(LUA_LIB NAMES lua5.1 lua
|
|
|
|
/usr/lib
|
|
|
|
/usr/lib/lua
|
2008-06-19 22:49:26 +02:00
|
|
|
/usr/local/lib)
|
2008-06-16 08:44:12 +02:00
|
|
|
|
|
|
|
# Error check
|
2008-06-19 22:49:26 +02:00
|
|
|
IF(NOT LUA_LIB)
|
|
|
|
MESSAGE(FATAL_ERROR "lua library not found")
|
|
|
|
ENDIF()
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-20 19:36:26 +02:00
|
|
|
SET(AWESOME_REQUIRED_LIBRARIES ${AWESOME_REQUIRED_LIBRARIES}
|
|
|
|
${LIB_READLINE}
|
|
|
|
${LIB_NCURSES}
|
|
|
|
${LIB_EV}
|
|
|
|
${LUA_LIB})
|
|
|
|
|
|
|
|
SET(AWESOME_REQUIRED_INCLUDE_DIRS ${AWESOME_REQUIRED_INCLUDE_DIRS} ${LUA_INC_DIR})
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
# {{{ Optional libraries.
|
|
|
|
#
|
|
|
|
# this sets up:
|
|
|
|
# AWESOME_OPTIONAL_LIBRARIES
|
|
|
|
# AWESOME_OPTIONAL_INCLUDE_DIRS
|
|
|
|
|
|
|
|
IF(WITH_DBUS)
|
|
|
|
pkg_check_modules(DBUS dbus-1)
|
|
|
|
IF(DBUS_FOUND)
|
|
|
|
SET(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${DBUS_LIBRARIES})
|
|
|
|
SET(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${DBUS_INCLUDE_DIRS})
|
|
|
|
ELSE()
|
|
|
|
SET(WITH_DBUS OFF)
|
|
|
|
MESSAGE(STATUS "DBUS not found. Disabled.")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
IF(WITH_IMLIB2)
|
|
|
|
pkg_check_modules(IMLIB2 imlib2)
|
|
|
|
IF(IMLIB2_FOUND)
|
|
|
|
SET(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${IMLIB2_LIBRARIES})
|
|
|
|
SET(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} ${IMLIB2_INCLUDE_DIRS})
|
|
|
|
ELSE()
|
|
|
|
SET(WITH_IMLIB2 OFF)
|
|
|
|
MESSAGE(STATUS "Imlib2 not found. Disabled.")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
# }}}
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-20 19:59:09 +02:00
|
|
|
# {{{ Install path and configuration variables.
|
2008-06-20 12:42:46 +02:00
|
|
|
IF(DEFINED PREFIX)
|
|
|
|
SET(CMAKE_INSTALL_PREFIX ${PREFIX})
|
|
|
|
ENDIF()
|
2008-06-19 22:49:26 +02:00
|
|
|
SET(AWESOME_VERSION_INTERNAL devel )
|
|
|
|
SET(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} )
|
|
|
|
SET(AWESOME_COMPILE_HOSTNAME $ENV{HOSTNAME} )
|
|
|
|
SET(AWESOME_COMPILE_BY $ENV{USER} )
|
|
|
|
SET(AWESOME_RELEASE ${VERSION} )
|
|
|
|
SET(AWESOME_ETC etc )
|
|
|
|
SET(AWESOME_SHARE share )
|
2008-06-20 02:23:51 +02:00
|
|
|
SET(AWESOME_LUA_LIB_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib )
|
|
|
|
SET(AWESOME_ICON_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_SHARE}/${PROJECT_AWE_NAME}/icons )
|
|
|
|
SET(AWESOME_CONF_PATH ${CMAKE_INSTALL_PREFIX}/${AWESOME_ETC}/${PROJECT_AWE_NAME} )
|
2008-06-19 22:49:26 +02:00
|
|
|
SET(AWESOME_MAN1_PATH ${AWESOME_SHARE}/man/man1 )
|
|
|
|
SET(AWESOME_MAN5_PATH ${AWESOME_SHARE}/man/man5 )
|
2008-06-20 02:23:51 +02:00
|
|
|
SET(AWESOME_REL_LUA_LIB_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib )
|
|
|
|
SET(AWESOME_REL_CONF_PATH ${AWESOME_ETC}/${PROJECT_AWE_NAME} )
|
|
|
|
SET(AWESOME_REL_ICON_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME} )
|
2008-06-21 01:43:35 +02:00
|
|
|
SET(AWESOME_REL_DOC_PATH ${AWESOME_SHARE}/doc/${PROJECT_AWE_NAME})
|
2008-06-20 19:59:09 +02:00
|
|
|
# }}}
|
2008-06-20 02:23:51 +02:00
|
|
|
|
2008-06-20 19:59:09 +02:00
|
|
|
# {{{ Configure files.
|
2008-06-20 12:40:01 +02:00
|
|
|
SET (AWESOME_CONFIGURE_FILES config.h.in
|
|
|
|
awesomerc.lua.in
|
|
|
|
awesome-version-internal.h.in
|
|
|
|
awesome.doxygen.in)
|
|
|
|
|
|
|
|
MACRO(a_configure_file file)
|
|
|
|
STRING(REGEX REPLACE ".in\$" "" outfile ${file})
|
|
|
|
MESSAGE(STATUS "Configuring ${outfile}")
|
|
|
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}
|
2008-06-22 03:00:42 +02:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${outfile}
|
2008-06-20 12:40:01 +02:00
|
|
|
ESCAPE_QUOTE
|
|
|
|
@ONLY)
|
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
FOREACH(file ${AWESOME_CONFIGURE_FILES})
|
|
|
|
a_configure_file(${file})
|
|
|
|
ENDFOREACH()
|
2008-06-20 19:59:09 +02:00
|
|
|
#}}}
|
2008-06-16 20:39:22 +02:00
|
|
|
|
2008-06-20 19:59:09 +02:00
|
|
|
# {{{ CPack configuration
|
2008-06-19 22:56:00 +02:00
|
|
|
SET(CPACK_PACKAGE_NAME "${PROJECT_AWE_NAME}")
|
|
|
|
SET(CPACK_GENERATOR "TBZ2")
|
|
|
|
SET(CPACK_SOURCE_GENERATOR "TBZ2")
|
2008-06-22 04:43:22 +02:00
|
|
|
SET(CPACK_SOURCE_IGNORE_FILES
|
|
|
|
".git;.*.swp$;.*~;.*patch;.gitignore;${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
|
|
|
FOREACH(file ${AWESOME_CONFIGURE_FILES})
|
|
|
|
STRING(REPLACE ".in" "" confheader ${file})
|
|
|
|
SET( CPACK_SOURCE_IGNORE_FILES
|
|
|
|
";${CPACK_SOURCE_IGNORE_FILES};${confheader}$;" )
|
|
|
|
ENDFOREACH()
|
|
|
|
|
2008-06-19 22:56:00 +02:00
|
|
|
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A dynamic floating and tiling window manager")
|
|
|
|
SET(CPACK_PACKAGE_VENDOR "awesome development team")
|
|
|
|
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
|
|
|
|
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
|
|
|
SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
|
|
|
|
SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
|
|
|
|
SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
|
2008-06-19 22:49:26 +02:00
|
|
|
|
|
|
|
INCLUDE(CPack)
|
2008-06-20 19:59:09 +02:00
|
|
|
#}}}
|
2008-06-19 04:41:46 +02:00
|
|
|
|
2008-06-19 14:30:39 +02:00
|
|
|
# vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|