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
|
2008-08-29 11:35:34 +02:00
|
|
|
# `git describe` later.
|
|
|
|
set(VERSION devel)
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2009-05-08 15:14:17 +02:00
|
|
|
set(CODENAME "Bad Boyfriend")
|
2008-06-22 17:00:40 +02:00
|
|
|
|
2008-07-10 03:59:43 +02:00
|
|
|
project(${PROJECT_AWE_NAME} C)
|
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)
|
|
|
|
option(GENERATE_MANPAGES "generate manpages" ON)
|
2008-06-25 03:00:12 +02:00
|
|
|
option(GENERATE_LUADOC "generate luadoc" ON)
|
2008-06-20 12:15:43 +02:00
|
|
|
|
2008-08-22 17:41:41 +02:00
|
|
|
link_directories(/usr/local/lib)
|
|
|
|
|
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-30 22:49:12 +02:00
|
|
|
-Wno-format-zero-length -Wmissing-format-attribute -Wmissing-prototypes
|
|
|
|
-Wstrict-prototypes)
|
2008-06-20 19:59:09 +02:00
|
|
|
# }}}
|
2008-06-19 23:18:10 +02:00
|
|
|
|
2009-04-27 12:06:24 +02:00
|
|
|
# {{{ Endianness
|
|
|
|
include(TestBigEndian)
|
|
|
|
TEST_BIG_ENDIAN(AWESOME_IS_BIG_ENDIAN)
|
|
|
|
# }}}
|
|
|
|
|
2008-06-20 18:49:58 +02:00
|
|
|
# {{{ Find external utilities
|
2008-07-18 22:24:05 +02:00
|
|
|
macro(a_find_program var prg req)
|
|
|
|
set(required ${req})
|
|
|
|
find_program(${var} ${prg})
|
|
|
|
if(NOT ${var})
|
|
|
|
message(STATUS "${prg} not found.")
|
|
|
|
if(required)
|
|
|
|
message(FATAL_ERROR "${prg} is required to build awesome")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(STATUS "${prg} -> ${${var}}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
a_find_program(CAT_EXECUTABLE cat TRUE)
|
|
|
|
a_find_program(LN_EXECUTABLE ln TRUE)
|
|
|
|
a_find_program(GREP_EXECUTABLE grep TRUE)
|
|
|
|
a_find_program(GIT_EXECUTABLE git FALSE)
|
|
|
|
a_find_program(HOSTNAME_EXECUTABLE hostname FALSE)
|
|
|
|
a_find_program(GPERF_EXECUTABLE gperf TRUE)
|
2008-06-20 18:01:42 +02:00
|
|
|
# programs needed for man pages
|
2008-07-18 22:24:05 +02:00
|
|
|
a_find_program(ASCIIDOC_EXECUTABLE asciidoc FALSE)
|
|
|
|
a_find_program(XMLTO_EXECUTABLE xmlto FALSE)
|
|
|
|
a_find_program(GZIP_EXECUTABLE gzip FALSE)
|
2008-06-23 16:29:51 +02:00
|
|
|
# lua documentation
|
2008-07-18 22:24:05 +02:00
|
|
|
a_find_program(LUA_EXECUTABLE lua FALSE)
|
|
|
|
a_find_program(LUADOC_EXECUTABLE luadoc FALSE)
|
2009-05-16 16:27:00 +02:00
|
|
|
# theme graphics
|
|
|
|
a_find_program(CONVERT_EXECUTABLE convert TRUE)
|
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-08-13 21:12:12 +02:00
|
|
|
# lua 5.1
|
|
|
|
include(FindLua51) #Due to a cmake bug, you will see Lua50 on screen
|
2008-06-20 18:01:42 +02:00
|
|
|
# }}}
|
|
|
|
|
2008-06-25 03:00:12 +02:00
|
|
|
# {{{ Check if documentation 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-25 03:00:12 +02:00
|
|
|
|
|
|
|
if(GENERATE_LUADOC)
|
|
|
|
if(NOT LUADOC_EXECUTABLE)
|
|
|
|
message(STATUS "Not generating luadoc. Missing: luadoc")
|
|
|
|
set(GENERATE_LUADOC OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
2008-06-20 18:49:58 +02:00
|
|
|
# }}}
|
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# {{{ Version stamp
|
2008-06-23 23:07:28 +02:00
|
|
|
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)
|
2008-07-01 17:40:54 +02:00
|
|
|
elseif( EXISTS ${SOURCE_DIR}/.version_stamp )
|
2008-06-23 23:07:28 +02:00
|
|
|
# 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(
|
2008-08-17 17:35:34 +02:00
|
|
|
COMMAND ${HOSTNAME_EXECUTABLE}
|
2008-06-23 21:15:58 +02:00
|
|
|
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-16 08:44:12 +02:00
|
|
|
|
|
|
|
# Use pkgconfig to get most of the libraries
|
2008-08-27 17:14:47 +02:00
|
|
|
pkg_check_modules(AWESOME_COMMON_REQUIRED REQUIRED
|
2008-11-13 19:44:04 +01:00
|
|
|
xcb>=1.1)
|
2008-08-27 17:14:47 +02:00
|
|
|
|
2008-06-20 19:36:26 +02:00
|
|
|
pkg_check_modules(AWESOME_REQUIRED REQUIRED
|
2009-04-27 20:18:39 +02:00
|
|
|
glib-2.0
|
2008-06-19 22:49:26 +02:00
|
|
|
cairo
|
2009-04-02 17:33:55 +02:00
|
|
|
x11
|
2008-12-27 01:00:46 +01:00
|
|
|
pango>=1.19.3
|
|
|
|
pangocairo>=1.19.3
|
2008-06-19 22:49:26 +02:00
|
|
|
xcb-randr
|
2008-12-29 17:03:17 +01:00
|
|
|
xcb-xtest
|
2008-06-19 22:49:26 +02:00
|
|
|
xcb-xinerama
|
2009-04-14 11:49:55 +02:00
|
|
|
xcb-event>=0.3.4
|
2008-09-09 16:14:36 +02:00
|
|
|
xcb-aux>=0.3.0
|
|
|
|
xcb-atom>=0.3.0
|
2009-04-11 18:02:31 +02:00
|
|
|
xcb-keysyms>=0.3.4
|
2009-01-31 16:03:06 +01:00
|
|
|
xcb-icccm>=0.3.3
|
2008-12-29 15:21:00 +01:00
|
|
|
xcb-image>=0.3.0
|
2008-12-29 17:32:32 +01:00
|
|
|
xcb-property>=0.3.0
|
2008-09-28 15:52:43 +02:00
|
|
|
cairo-xcb
|
2009-04-03 16:30:18 +02:00
|
|
|
libstartup-notification-1.0>=0.10
|
2009-04-29 18:34:07 +02:00
|
|
|
xproto>=7.0.15
|
2009-04-07 17:57:01 +02:00
|
|
|
imlib2
|
2009-04-18 18:50:55 +02:00
|
|
|
libxdg-basedir>=1.0.0)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2008-08-27 17:14:47 +02:00
|
|
|
if(NOT AWESOME_REQUIRED_FOUND OR NOT AWESOME_COMMON_REQUIRED_FOUND)
|
2008-07-18 08:24:09 +02:00
|
|
|
message(FATAL_ERROR)
|
|
|
|
endif()
|
|
|
|
|
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
|
|
|
|
2009-04-08 20:07:45 +02:00
|
|
|
# Check for libev
|
2008-06-20 20:29:47 +02:00
|
|
|
a_find_library(LIB_EV ev)
|
2008-06-17 17:48:00 +02:00
|
|
|
|
2008-06-16 08:44:12 +02:00
|
|
|
# Error check
|
2009-01-06 22:21:40 +01:00
|
|
|
if(NOT LUA51_FOUND AND NOT LUA50_FOUND) # This is a workaround to a cmake bug
|
2008-06-23 13:31:18 +02:00
|
|
|
message(FATAL_ERROR "lua library not found")
|
|
|
|
endif()
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-08-27 17:14:47 +02:00
|
|
|
set(AWESOME_REQUIRED_LIBRARIES
|
2009-05-09 19:59:27 +02:00
|
|
|
${AWESOME_COMMON_REQUIRED_LDFLAGS}
|
2008-08-27 17:14:47 +02:00
|
|
|
${AWESOME_REQUIRED_LIBRARIES}
|
2008-06-23 13:57:30 +02:00
|
|
|
${LIB_EV}
|
2008-08-13 21:12:12 +02:00
|
|
|
${LUA_LIBRARIES})
|
2008-06-20 19:36:26 +02:00
|
|
|
|
2008-08-27 17:14:47 +02:00
|
|
|
set(AWESOME_REQUIRED_INCLUDE_DIRS
|
|
|
|
${AWESOME_COMMON_REQUIRED_INCLUDE_DIRS}
|
|
|
|
${AWESOME_REQUIRED_INCLUDE_DIRS}
|
2008-08-13 21:12:12 +02:00
|
|
|
${LUA_INCLUDE_DIR})
|
2008-06-20 19:36:26 +02:00
|
|
|
# }}}
|
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# {{{ Optional libraries
|
2008-06-20 19:36:26 +02:00
|
|
|
#
|
|
|
|
# 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)
|
2009-05-09 19:59:27 +02:00
|
|
|
set(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} ${DBUS_LDFLAGS})
|
2008-06-23 13:31:18 +02:00
|
|
|
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()
|
2008-06-20 19:36:26 +02:00
|
|
|
# }}}
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# {{{ Install path and configuration variables
|
2008-06-23 13:31:18 +02:00
|
|
|
if(DEFINED PREFIX)
|
2008-06-26 15:47:24 +02:00
|
|
|
set(PREFIX ${PREFIX} CACHE PATH "install prefix")
|
2008-06-26 15:50:18 +02:00
|
|
|
set(CMAKE_INSTALL_PREFIX ${PREFIX})
|
2008-06-26 15:47:24 +02:00
|
|
|
else()
|
|
|
|
set(PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "install prefix")
|
2008-06-23 13:31:18 +02:00
|
|
|
endif()
|
2008-06-25 01:43:16 +02:00
|
|
|
|
|
|
|
#If a sysconfdir is specified, use it instead
|
|
|
|
#of the default configuration dir.
|
|
|
|
if(DEFINED SYSCONFDIR)
|
2008-06-26 15:47:24 +02:00
|
|
|
set(SYSCONFDIR ${SYSCONFDIR} CACHE PATH "config directory")
|
2008-06-25 01:43:16 +02:00
|
|
|
else()
|
2009-04-01 17:56:02 +02:00
|
|
|
set(SYSCONFDIR ${PREFIX}/etc CACHE PATH "config directory")
|
2008-06-26 15:47:24 +02:00
|
|
|
endif()
|
2008-06-25 01:43:16 +02:00
|
|
|
|
2008-07-18 07:51:47 +02:00
|
|
|
#If an XDG Config Dir is specificed, use it instead
|
|
|
|
#of the default XDG configuration dir.
|
|
|
|
if(DEFINED XDG_CONFIG_DIR)
|
2009-04-01 17:56:02 +02:00
|
|
|
set(XDG_CONFIG_DIR ${XDG_CONFIG_DIR} CACHE PATH "xdg config directory")
|
2008-07-18 07:51:47 +02:00
|
|
|
else()
|
|
|
|
set(XDG_CONFIG_DIR ${SYSCONFDIR}/xdg CACHE PATH "xdg config directory")
|
|
|
|
endif()
|
|
|
|
|
2008-08-11 18:30:21 +02:00
|
|
|
# setting AWESOME_DOC_PATH
|
|
|
|
if(DEFINED AWESOME_DOC_PATH)
|
|
|
|
set(AWESOME_DOC_PATH ${AWESOME_DOC_PATH} CACHE PATH "awesome docs directory")
|
|
|
|
else()
|
|
|
|
set(AWESOME_DOC_PATH ${PREFIX}/share/doc/${PROJECT_AWE_NAME} CACHE PATH "awesome docs directory")
|
|
|
|
endif()
|
|
|
|
|
2008-08-12 14:14:25 +02:00
|
|
|
# setting AWESOME_XSESSION_PATH
|
|
|
|
if(DEFINED AWESOME_XSESSION_PATH)
|
|
|
|
set(AWESOME_XSESSION_PATH ${AWESOME_XSESSION_PATH} CACHE PATH "awesome xsessions directory")
|
|
|
|
else()
|
|
|
|
set(AWESOME_XSESSION_PATH ${PREFIX}/share/xsessions CACHE PATH "awesome xsessions directory")
|
|
|
|
endif()
|
|
|
|
|
2008-08-12 16:26:29 +02:00
|
|
|
# set man path
|
|
|
|
if(DEFINED AWESOME_MAN_PATH)
|
|
|
|
set(AWESOME_MAN_PATH ${AWESOME_MAN_PATH} CACHE PATH "awesome manpage directory")
|
|
|
|
else()
|
|
|
|
set(AWESOME_MAN_PATH ${PREFIX}/share/man CACHE PATH "awesome manpage directory")
|
|
|
|
endif()
|
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# Hide to avoid confusion
|
2008-06-26 15:52:11 +02:00
|
|
|
mark_as_advanced(CMAKE_INSTALL_PREFIX)
|
|
|
|
|
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})
|
2008-07-18 07:51:47 +02:00
|
|
|
set(AWESOME_SYSCONFDIR ${XDG_CONFIG_DIR}/${PROJECT_AWE_NAME})
|
2008-06-26 15:50:18 +02:00
|
|
|
set(AWESOME_DATA_PATH ${PREFIX}/share/${PROJECT_AWE_NAME})
|
2008-06-25 04:00:19 +02:00
|
|
|
set(AWESOME_LUA_LIB_PATH ${AWESOME_DATA_PATH}/lib)
|
|
|
|
set(AWESOME_ICON_PATH ${AWESOME_DATA_PATH}/icons)
|
2008-08-05 22:21:22 +02:00
|
|
|
set(AWESOME_THEMES_PATH ${AWESOME_DATA_PATH}/themes)
|
2008-06-20 19:59:09 +02:00
|
|
|
# }}}
|
2008-06-20 02:23:51 +02:00
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# {{{ Configure files
|
2009-04-28 19:40:14 +02:00
|
|
|
file(GLOB_RECURSE awesome_lua_configure_files RELATIVE ${SOURCE_DIR} ${SOURCE_DIR}/lib/*.lua.in ${SOURCE_DIR}/themes/*/*.lua.in)
|
2008-09-29 16:49:18 +02:00
|
|
|
set(AWESOME_CONFIGURE_FILES
|
|
|
|
${awesome_lua_configure_files}
|
2008-06-23 13:57:30 +02:00
|
|
|
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-19 14:30:39 +02:00
|
|
|
# vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|