2008-06-23 13:31:18 +02:00
|
|
|
set(PROJECT_AWE_NAME awesome)
|
|
|
|
set(PROJECT_AWECLIENT_NAME awesome-client)
|
2008-06-22 17:00:40 +02:00
|
|
|
|
2008-06-23 23:07:28 +02:00
|
|
|
# If ${SOURCE_DIR} is a git repository VERSION is set to
|
|
|
|
# `git-describe` later.
|
|
|
|
set(VERSION 3-devel)
|
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(VERSION_MAJOR ${VERSION})
|
|
|
|
set(VERSION_MINOR 0)
|
|
|
|
set(VERSION_PATCH 0)
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(CODENAME "Productivity Breaker")
|
2008-06-22 17:00:40 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
project(${PROJECT_AWE_NAME})
|
2008-06-19 04:41:46 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(CMAKE_BUILD_TYPE RELEASE)
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
option(WITH_DBUS "build with D-BUS" ON)
|
2008-06-24 20:28:45 +02:00
|
|
|
option(WITH_IMLIB2 "build with Imlib2" OFF)
|
2008-06-23 13:31:18 +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-23 13:31:18 +02:00
|
|
|
add_definitions(-std=gnu99 -ggdb3 -fno-strict-aliasing -Wall -Wextra
|
2008-06-19 23:18:10 +02:00
|
|
|
-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-23 13:31:18 +02:00
|
|
|
find_program(CAT_EXECUTABLE cat)
|
2008-06-23 18:19:39 +02:00
|
|
|
find_program(LN_EXECUTABLE ln)
|
2008-06-23 13:31:18 +02:00
|
|
|
find_program(GREP_EXECUTABLE grep)
|
|
|
|
find_program(GIT_EXECUTABLE git)
|
2008-06-23 21:15:58 +02:00
|
|
|
find_program(HOSTNAME_EXECUTABLE hostname)
|
2008-06-23 13:31:18 +02:00
|
|
|
find_program(GPERF_EXECUTABLE gperf)
|
2008-06-20 18:01:42 +02:00
|
|
|
# programs needed for man pages
|
2008-06-23 13:31:18 +02:00
|
|
|
find_program(ASCIIDOC_EXECUTABLE asciidoc)
|
|
|
|
find_program(XMLTO_EXECUTABLE xmlto)
|
|
|
|
find_program(GZIP_EXECUTABLE gzip)
|
2008-06-23 16:29:51 +02:00
|
|
|
# lua documentation
|
|
|
|
find_program(LUA_EXECUTABLE lua)
|
|
|
|
find_program(LUADOC_EXECUTABLE luadoc)
|
2008-06-20 18:01:42 +02:00
|
|
|
# doxygen
|
2008-06-23 13:31:18 +02:00
|
|
|
include(FindDoxygen)
|
2008-06-20 18:01:42 +02:00
|
|
|
# pkg-config
|
2008-06-23 13:31:18 +02:00
|
|
|
include(FindPkgConfig)
|
2008-06-20 18:01:42 +02:00
|
|
|
# }}}
|
|
|
|
|
2008-06-20 18:49:58 +02:00
|
|
|
# {{{ Check if manpages can be build
|
2008-06-23 13:31:18 +02:00
|
|
|
if(GENERATE_MANPAGES)
|
|
|
|
if(NOT ASCIIDOC_EXECUTABLE OR NOT XMLTO_EXECUTABLE OR NOT GZIP_EXECUTABLE)
|
|
|
|
if(NOT ASCIIDOC_EXECUTABLE)
|
2008-06-20 18:49:58 +02:00
|
|
|
SET(missing "asciidoc")
|
2008-06-23 13:31:18 +02:00
|
|
|
endif()
|
|
|
|
if(NOT XMLTO_EXECUTABLE)
|
2008-06-20 18:49:58 +02:00
|
|
|
SET(missing ${missing} " xmlto")
|
2008-06-23 13:31:18 +02:00
|
|
|
endif()
|
|
|
|
if(NOT GZIP_EXECUTABLE)
|
2008-06-20 18:49:58 +02:00
|
|
|
SET(missing ${missing} " gzip")
|
2008-06-23 13:31:18 +02:00
|
|
|
endif()
|
2008-06-20 18:49:58 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
message(STATUS "Not generating manpages. Missing: " ${missing})
|
|
|
|
set(GENERATE_MANPAGES OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
2008-06-20 18:49:58 +02:00
|
|
|
# }}}
|
|
|
|
|
2008-06-23 23:07:28 +02:00
|
|
|
# {{{ version stamp
|
|
|
|
if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
|
|
|
|
# get current version
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${GIT_EXECUTABLE} describe
|
|
|
|
WORKING_DIRECTORY ${SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE VERSION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
# file the git-version-stamp.sh script will look into
|
|
|
|
set(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp)
|
|
|
|
file(WRITE ${VERSION_STAMP_FILE} ${VERSION})
|
|
|
|
# create a version_stamp target later
|
|
|
|
set(BUILD_FROM_GIT TRUE)
|
|
|
|
else()
|
|
|
|
# get version from version stamp
|
2008-06-24 18:49:37 +02:00
|
|
|
file(READ ${SOURCE_DIR}/.version_stamp VERSION)
|
2008-06-23 13:31:18 +02:00
|
|
|
endif()
|
2008-06-22 20:42:07 +02:00
|
|
|
# }}}
|
2008-06-17 16:41:49 +02:00
|
|
|
|
2008-06-23 21:15:58 +02:00
|
|
|
# {{{ Get hostname
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${HOSTNAME_EXECUTABLE} -f
|
|
|
|
WORKING_DIRECTORY ${SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE BUILDHOSTNAME
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
2008-06-20 19:36:26 +02:00
|
|
|
# {{{ Required libraries
|
|
|
|
#
|
|
|
|
# this sets up:
|
|
|
|
# AWESOME_REQUIRED_LIBRARIES
|
|
|
|
# AWESOME_REQUIRED_INCLUDE_DIRS
|
2008-06-24 14:44:08 +02:00
|
|
|
# AWESOMECLIENT_LIBRARIES
|
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-23 13:31:18 +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 20:29:47 +02:00
|
|
|
|
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
|
2008-06-23 13:31:18 +02:00
|
|
|
find_path(LUA_INC_DIR lua.h
|
2008-06-16 08:44:12 +02:00
|
|
|
/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
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
find_library(LUA_LIB NAMES lua5.1 lua
|
2008-06-16 08:44:12 +02:00
|
|
|
/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-23 13:31:18 +02:00
|
|
|
if(NOT LUA_LIB)
|
|
|
|
message(FATAL_ERROR "lua library not found")
|
|
|
|
endif()
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(AWESOME_REQUIRED_LIBRARIES ${AWESOME_REQUIRED_LIBRARIES}
|
2008-06-23 13:57:30 +02:00
|
|
|
${LIB_EV}
|
|
|
|
${LUA_LIB})
|
2008-06-20 19:36:26 +02:00
|
|
|
|
2008-06-23 13:57:30 +02:00
|
|
|
set(AWESOME_REQUIRED_INCLUDE_DIRS ${AWESOME_REQUIRED_INCLUDE_DIRS}
|
|
|
|
${LUA_INC_DIR})
|
2008-06-24 14:44:08 +02:00
|
|
|
|
|
|
|
set(AWESOMECLIENT_LIBRARIES
|
|
|
|
${LIB_READLINE}
|
|
|
|
${LIB_NCURSES})
|
2008-06-20 19:36:26 +02:00
|
|
|
# }}}
|
|
|
|
|
|
|
|
# {{{ Optional libraries.
|
|
|
|
#
|
|
|
|
# this sets up:
|
|
|
|
# AWESOME_OPTIONAL_LIBRARIES
|
|
|
|
# AWESOME_OPTIONAL_INCLUDE_DIRS
|
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
if(WITH_DBUS)
|
2008-06-20 19:36:26 +02:00
|
|
|
pkg_check_modules(DBUS dbus-1)
|
2008-06-23 13:31:18 +02:00
|
|
|
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)
|
2008-06-20 19:36:26 +02:00
|
|
|
pkg_check_modules(IMLIB2 imlib2)
|
2008-06-23 13:31:18 +02:00
|
|
|
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-20 19:36:26 +02:00
|
|
|
# }}}
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-20 19:59:09 +02:00
|
|
|
# {{{ Install path and configuration variables.
|
2008-06-23 13:31:18 +02:00
|
|
|
if(DEFINED PREFIX)
|
|
|
|
set(CMAKE_INSTALL_PREFIX ${PREFIX})
|
|
|
|
endif()
|
2008-06-23 21:15:58 +02:00
|
|
|
set(AWESOME_VERSION ${VERSION})
|
|
|
|
set(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
|
|
|
|
set(AWESOME_COMPILE_HOSTNAME ${BUILDHOSTNAME})
|
|
|
|
set(AWESOME_COMPILE_BY $ENV{USER})
|
|
|
|
set(AWESOME_RELEASE ${CODENAME})
|
|
|
|
set(AWESOME_ETC etc)
|
|
|
|
set(AWESOME_SHARE share)
|
|
|
|
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})
|
|
|
|
set(AWESOME_MAN1_PATH ${AWESOME_SHARE}/man/man1)
|
|
|
|
set(AWESOME_MAN5_PATH ${AWESOME_SHARE}/man/man5)
|
|
|
|
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-24 00:45:57 +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-23 13:57:30 +02:00
|
|
|
set(AWESOME_CONFIGURE_FILES
|
|
|
|
config.h.in
|
|
|
|
awesomerc.lua.in
|
|
|
|
awesome-version-internal.h.in
|
|
|
|
awesome.doxygen.in)
|
2008-06-20 12:40:01 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
macro(a_configure_file file)
|
|
|
|
string(REGEX REPLACE ".in\$" "" outfile ${file})
|
|
|
|
message(STATUS "Configuring ${outfile}")
|
|
|
|
configure_file(${SOURCE_DIR}/${file}
|
2008-06-23 13:16:57 +02:00
|
|
|
${BUILD_DIR}/${outfile}
|
2008-06-20 12:40:01 +02:00
|
|
|
ESCAPE_QUOTE
|
|
|
|
@ONLY)
|
2008-06-23 13:31:18 +02:00
|
|
|
endmacro()
|
2008-06-20 12:40:01 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
foreach(file ${AWESOME_CONFIGURE_FILES})
|
2008-06-20 12:40:01 +02:00
|
|
|
a_configure_file(${file})
|
2008-06-23 13:31:18 +02:00
|
|
|
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-25 01:42:32 +02:00
|
|
|
SET(CPACK_SET_DESTDIR TRUE)
|
2008-06-23 13:31:18 +02:00
|
|
|
set(CPACK_PACKAGE_NAME "${PROJECT_AWE_NAME}")
|
|
|
|
set(CPACK_GENERATOR "TBZ2")
|
|
|
|
set(CPACK_SOURCE_GENERATOR "TBZ2")
|
|
|
|
set(CPACK_SOURCE_IGNORE_FILES
|
2008-06-23 13:16:57 +02:00
|
|
|
".git;.*.swp$;.*~;.*patch;.gitignore;${BUILD_DIR}")
|
2008-06-23 13:31:18 +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 "${SOURCE_DIR}/README")
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${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
|
|
|
|
2008-06-23 13:31:18 +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
|