2014-09-07 19:33:18 +02:00
|
|
|
cmake_minimum_required(VERSION 3.0.0)
|
2017-07-09 16:23:56 +02:00
|
|
|
project(awesome C)
|
2017-05-24 21:06:27 +02:00
|
|
|
|
|
|
|
# Require an out-of-source build. We generate an awesomerc.lua in the build dir
|
|
|
|
# from the one in the source dir and this does not work otherwise.
|
|
|
|
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
|
|
|
message(SEND_ERROR "\
|
|
|
|
You appear to be doing an in-source build, which means that the binaries are \
|
|
|
|
generated in the same directory where the source code is. This is currently not \
|
|
|
|
supported. Instead, do, for example, the following:\n\
|
|
|
|
mkdir build && cd build && cmake ..\n\
|
|
|
|
Beware that CMake likely already generated a CMakeCache.txt in the source \
|
|
|
|
directory which you first have to delete. \
|
|
|
|
")
|
|
|
|
message(FATAL_ERROR "In-source builds are not supported")
|
|
|
|
endif()
|
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
|
2008-06-20 23:38:33 +02:00
|
|
|
|
2008-06-25 01:45:41 +02:00
|
|
|
if(COMMAND cmake_policy)
|
|
|
|
cmake_policy(VERSION 2.6)
|
|
|
|
endif()
|
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
2008-06-23 13:16:57 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
if(NOT EXISTS ${SOURCE_DIR}/awesomeConfig.cmake)
|
|
|
|
message(FATAL_ERROR "Please provide awesomeConfig.cmake")
|
|
|
|
endif()
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2016-03-10 05:45:22 +01:00
|
|
|
# Define many variables
|
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
include(awesomeConfig.cmake)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2008-06-23 13:57:30 +02:00
|
|
|
include_directories(
|
|
|
|
${BUILD_DIR}
|
2008-08-27 17:14:47 +02:00
|
|
|
${AWESOME_COMMON_REQUIRED_INCLUDE_DIRS}
|
2008-06-23 13:57:30 +02:00
|
|
|
${AWESOME_REQUIRED_INCLUDE_DIRS}
|
|
|
|
${AWESOME_OPTIONAL_INCLUDE_DIRS})
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2016-10-10 19:54:05 +02:00
|
|
|
set(CHECK_TARGETS check-integration)
|
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(AWE_ICON_DIR ${SOURCE_DIR}/icons)
|
2008-08-05 22:21:22 +02:00
|
|
|
set(AWE_THEMES_DIR ${SOURCE_DIR}/themes)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2014-05-26 21:26:52 +02:00
|
|
|
set(AWE_DOC_DIR ${BUILD_DIR}/docs)
|
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(AWE_DOC_FILES
|
2014-05-26 21:26:52 +02:00
|
|
|
${AWE_DOC_DIR}/00-authors.md
|
|
|
|
${AWE_DOC_DIR}/01-readme.md
|
|
|
|
${AWE_DOC_DIR}/02-contributing.md
|
2008-06-23 13:16:57 +02:00
|
|
|
${SOURCE_DIR}/LICENSE)
|
2008-06-21 01:43:35 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(AWE_SRCS
|
2015-03-27 17:45:59 +01:00
|
|
|
${BUILD_DIR}/awesome.c
|
|
|
|
${BUILD_DIR}/banning.c
|
|
|
|
${BUILD_DIR}/color.c
|
|
|
|
${BUILD_DIR}/dbus.c
|
|
|
|
${BUILD_DIR}/draw.c
|
|
|
|
${BUILD_DIR}/event.c
|
|
|
|
${BUILD_DIR}/ewmh.c
|
|
|
|
${BUILD_DIR}/keygrabber.c
|
|
|
|
${BUILD_DIR}/luaa.c
|
|
|
|
${BUILD_DIR}/mouse.c
|
|
|
|
${BUILD_DIR}/mousegrabber.c
|
|
|
|
${BUILD_DIR}/property.c
|
|
|
|
${BUILD_DIR}/root.c
|
|
|
|
${BUILD_DIR}/selection.c
|
|
|
|
${BUILD_DIR}/spawn.c
|
|
|
|
${BUILD_DIR}/stack.c
|
|
|
|
${BUILD_DIR}/strut.c
|
|
|
|
${BUILD_DIR}/systray.c
|
|
|
|
${BUILD_DIR}/xwindow.c
|
|
|
|
${BUILD_DIR}/xkb.c
|
2015-05-14 22:57:22 +02:00
|
|
|
${BUILD_DIR}/xrdb.c
|
2015-03-27 17:45:59 +01:00
|
|
|
${BUILD_DIR}/common/atoms.c
|
|
|
|
${BUILD_DIR}/common/backtrace.c
|
|
|
|
${BUILD_DIR}/common/buffer.c
|
|
|
|
${BUILD_DIR}/common/luaclass.c
|
|
|
|
${BUILD_DIR}/common/lualib.c
|
|
|
|
${BUILD_DIR}/common/luaobject.c
|
|
|
|
${BUILD_DIR}/common/util.c
|
|
|
|
${BUILD_DIR}/common/version.c
|
|
|
|
${BUILD_DIR}/common/xcursor.c
|
|
|
|
${BUILD_DIR}/common/xembed.c
|
|
|
|
${BUILD_DIR}/common/xutil.c
|
|
|
|
${BUILD_DIR}/objects/button.c
|
|
|
|
${BUILD_DIR}/objects/client.c
|
|
|
|
${BUILD_DIR}/objects/drawable.c
|
|
|
|
${BUILD_DIR}/objects/drawin.c
|
|
|
|
${BUILD_DIR}/objects/key.c
|
|
|
|
${BUILD_DIR}/objects/screen.c
|
|
|
|
${BUILD_DIR}/objects/tag.c
|
|
|
|
${BUILD_DIR}/objects/window.c)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
set(AWE_MAN_SRCS
|
2009-04-11 16:11:43 +02:00
|
|
|
${SOURCE_DIR}/manpages/awesome.1.txt
|
|
|
|
${SOURCE_DIR}/manpages/awesome-client.1.txt
|
|
|
|
${SOURCE_DIR}/manpages/awesomerc.5.txt)
|
2011-12-01 11:18:05 +01:00
|
|
|
set(AWE_MAN_LANGS it es fr de ru)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2012-08-24 04:12:03 +02:00
|
|
|
# Don't strip RPATH if compiling on Solaris
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
|
|
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
|
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
|
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
|
|
endif()
|
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
add_executable(${PROJECT_AWE_NAME}
|
2010-09-02 19:24:39 +02:00
|
|
|
${AWE_SRCS})
|
2008-06-23 12:41:40 +02:00
|
|
|
|
2015-09-15 04:34:58 +02:00
|
|
|
# CFLAGS
|
|
|
|
set(AWESOME_C_FLAGS
|
|
|
|
-O1 -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 -Wformat-nonliteral
|
|
|
|
-Wno-format-zero-length -Wmissing-format-attribute -Wmissing-prototypes
|
|
|
|
-Wstrict-prototypes
|
|
|
|
CACHE STRING "CFLAGS used to compile ${PROJECT_AWE_NAME}")
|
|
|
|
mark_as_advanced(AWESOME_C_FLAGS)
|
|
|
|
target_compile_options(${PROJECT_AWE_NAME} PRIVATE ${AWESOME_C_FLAGS})
|
|
|
|
|
2016-10-04 05:39:14 +02:00
|
|
|
# Make sure awesomerc.lua is generated
|
|
|
|
add_dependencies(${PROJECT_AWE_NAME} generate_awesomerc)
|
|
|
|
|
2015-09-15 04:34:58 +02:00
|
|
|
# Linux w/ GCC requires -rdynamic to get backtrace to fully work.
|
|
|
|
#
|
|
|
|
# For "historical reasons", CMake adds the option to the linker flags
|
|
|
|
# unnoticeably for Linux w/ GCC through its modules Linux-GNU.cmake
|
|
|
|
# and Linux-GNU-C.cmake. Our build system has counted on that. But
|
|
|
|
# just in case CMake should do away with the convention suddenly...
|
|
|
|
if(DEFINED CMAKE_SHARED_LIBRARY_LINK_C_FLAGS AND
|
|
|
|
NOT CMAKE_SHARED_LIBRARY_LINK_C_FLAGS MATCHES "-rdynamic")
|
|
|
|
target_link_libraries(${PROJECT_AWE_NAME}
|
|
|
|
$<$<AND:$<PLATFORM_ID:Linux>,$<C_COMPILER_ID:GNU>>:-rdynamic>)
|
|
|
|
endif()
|
|
|
|
|
2012-08-27 23:27:15 +02:00
|
|
|
# FreeBSD requires dynamic linking
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
set_target_properties(${PROJECT_AWE_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
LINK_FLAGS -export-dynamic)
|
|
|
|
endif()
|
2008-08-22 17:40:36 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
target_link_libraries(${PROJECT_AWE_NAME}
|
2010-08-23 11:33:47 +02:00
|
|
|
${AWESOME_COMMON_REQUIRED_LDFLAGS}
|
|
|
|
${AWESOME_REQUIRED_LDFLAGS}
|
|
|
|
${AWESOME_OPTIONAL_LDFLAGS})
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2014-08-23 17:23:03 +02:00
|
|
|
# {{{ Generated sources
|
2008-06-30 20:05:53 +02:00
|
|
|
# atoms
|
2008-06-23 13:31:18 +02:00
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/common)
|
2008-06-30 20:05:53 +02:00
|
|
|
add_custom_command(
|
|
|
|
COMMAND ${SOURCE_DIR}/build-utils/atoms-ext.sh ${SOURCE_DIR}/common/atoms.list
|
|
|
|
ARGS > ${BUILD_DIR}/common/atoms-extern.h
|
|
|
|
OUTPUT ${BUILD_DIR}/common/atoms-extern.h
|
|
|
|
WORKING_DIRECTORY ${SOURCE_DIR}
|
|
|
|
DEPENDS ${SOURCE_DIR}/common/atoms.list
|
|
|
|
COMMENT "Generating atoms-extern.h"
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
COMMAND ${SOURCE_DIR}/build-utils/atoms-int.sh ${SOURCE_DIR}/common/atoms.list
|
|
|
|
ARGS > ${BUILD_DIR}/common/atoms-intern.h
|
|
|
|
OUTPUT ${BUILD_DIR}/common/atoms-intern.h
|
|
|
|
WORKING_DIRECTORY ${SOURCE_DIR}
|
|
|
|
DEPENDS ${SOURCE_DIR}/common/atoms.list
|
|
|
|
COMMENT "Generating atoms-intern.h"
|
|
|
|
VERBATIM)
|
2008-06-23 12:41:40 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
add_custom_target(generated_sources
|
2009-06-17 15:57:10 +02:00
|
|
|
DEPENDS ${BUILD_DIR}/common/atoms-intern.h
|
2010-09-02 19:24:39 +02:00
|
|
|
${BUILD_DIR}/common/atoms-extern.h)
|
2008-06-23 12:41:40 +02:00
|
|
|
|
2008-11-10 11:57:20 +01:00
|
|
|
# Default theme directory
|
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/themes/default)
|
2008-11-10 08:58:20 +01:00
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/themes/sky)
|
2009-08-30 03:02:54 +02:00
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/themes/zenburn)
|
2015-05-14 22:57:22 +02:00
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/themes/xresources)
|
2008-06-23 13:31:18 +02:00
|
|
|
add_dependencies(${PROJECT_AWE_NAME} generated_sources)
|
2008-06-21 00:24:12 +02:00
|
|
|
# }}}
|
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# {{{ Version stamp
|
2008-06-23 13:31:18 +02:00
|
|
|
if(BUILD_FROM_GIT)
|
|
|
|
add_custom_target(version_stamp ALL
|
2008-06-23 13:57:30 +02:00
|
|
|
COMMAND ${SOURCE_DIR}/build-utils/git-version-stamp.sh
|
|
|
|
${VERSION_STAMP_FILE}
|
|
|
|
${BUILD_DIR}/awesome-version-internal.h
|
|
|
|
WORKING_DIRECTORY ${SOURCE_DIR})
|
2008-06-22 20:42:07 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
add_dependencies(${PROJECT_AWE_NAME} version_stamp)
|
|
|
|
endif()
|
2008-06-22 20:42:07 +02:00
|
|
|
# }}}
|
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# {{{ Manpages
|
2008-06-23 13:31:18 +02:00
|
|
|
if(GENERATE_MANPAGES)
|
2009-04-11 16:11:43 +02:00
|
|
|
if(NOT BUILD_DIR STREQUAL SOURCE_DIR)
|
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/manpages)
|
|
|
|
endif()
|
2008-06-21 17:49:56 +02:00
|
|
|
|
2010-04-09 00:42:27 +02:00
|
|
|
# add the default translation to the list of languages
|
|
|
|
set(AWE_MAN_LANGS default ${AWE_MAN_LANGS})
|
|
|
|
|
|
|
|
foreach(lang ${AWE_MAN_LANGS})
|
|
|
|
|
|
|
|
foreach(txtfile ${AWE_MAN_SRCS})
|
|
|
|
# figure the base name of the file (ie "awesome.1")
|
|
|
|
GET_FILENAME_COMPONENT(tmpname ${txtfile} NAME)
|
|
|
|
string(REGEX REPLACE ".txt\$" "" basename ${tmpname})
|
|
|
|
|
|
|
|
# figure the relative path of the file
|
|
|
|
GET_FILENAME_COMPONENT(tmppath ${txtfile} PATH)
|
|
|
|
string(REPLACE ${SOURCE_DIR}/ "" relpath ${tmppath})
|
|
|
|
|
|
|
|
# figure the manpage section to install to from filename
|
|
|
|
string(REGEX REPLACE "^.*\\.([0-9])$" "\\1" section ${basename})
|
|
|
|
|
|
|
|
# construct the language specific versions of the basename and path
|
|
|
|
if (lang STREQUAL default)
|
|
|
|
set(basename2 ${basename})
|
|
|
|
set(relpath2 ${relpath}/man${section})
|
|
|
|
else()
|
|
|
|
set(basename2 ${basename}.${lang})
|
|
|
|
set(relpath2 ${relpath}/${lang}/man${section})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# create the build directory (if it does not exist)
|
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/${relpath2})
|
|
|
|
|
|
|
|
# set the final filenames
|
|
|
|
set(txtfile ${SOURCE_DIR}/${relpath}/${basename2}.txt)
|
|
|
|
set(gzfile ${BUILD_DIR}/${relpath2}/${basename}.gz)
|
|
|
|
set(manfile ${BUILD_DIR}/${relpath2}/${basename})
|
2008-06-21 17:49:56 +02:00
|
|
|
|
2018-01-22 03:20:33 +01:00
|
|
|
if (lang STREQUAL default)
|
|
|
|
set(asciilang en)
|
|
|
|
else()
|
|
|
|
set(asciilang ${lang})
|
|
|
|
endif()
|
2009-12-28 10:43:52 +01:00
|
|
|
add_custom_command(
|
2019-01-04 16:15:44 +01:00
|
|
|
COMMAND ${ASCIIDOCTOR_EXECUTABLE} -a lang=${asciilang} -d manpage -b manpage -o ${manfile} ${txtfile}
|
2010-04-09 00:42:27 +02:00
|
|
|
WORKING_DIRECTORY ${BUILD_DIR}/${relpath2}
|
2018-04-04 11:28:50 +02:00
|
|
|
OUTPUT ${manfile}
|
2010-04-09 00:42:27 +02:00
|
|
|
DEPENDS ${txtfile}
|
2009-12-28 10:43:52 +01:00
|
|
|
VERBATIM)
|
2010-04-09 00:42:27 +02:00
|
|
|
|
|
|
|
if(COMPRESS_MANPAGES)
|
|
|
|
add_custom_command(
|
|
|
|
COMMAND ${GZIP_EXECUTABLE} < ${manfile} > ${gzfile}
|
|
|
|
OUTPUT ${gzfile}
|
|
|
|
WORKING_DIRECTORY ${BUILD_DIR}/${relpath2}
|
|
|
|
DEPENDS ${manfile}
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
set(MAN_FILES ${MAN_FILES} ${gzfile})
|
|
|
|
else()
|
|
|
|
set(MAN_FILES ${MAN_FILES} ${manfile})
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2009-12-28 10:43:52 +01:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
endforeach()
|
2008-06-21 17:49:56 +02:00
|
|
|
|
2008-06-23 13:31:18 +02:00
|
|
|
add_custom_target(man ALL DEPENDS ${MAN_FILES})
|
|
|
|
endif()
|
2008-06-21 02:36:10 +02:00
|
|
|
# }}}
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2008-06-23 16:29:51 +02:00
|
|
|
# {{{ Lua API Documentation
|
2012-11-19 14:57:47 +01:00
|
|
|
if(GENERATE_DOC)
|
2008-06-23 18:19:39 +02:00
|
|
|
if(NOT BUILD_DIR STREQUAL SOURCE_DIR)
|
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/lib)
|
2016-03-10 05:45:22 +01:00
|
|
|
file(MAKE_DIRECTORY ${BUILD_DIR}/doc)
|
2008-06-23 18:19:39 +02:00
|
|
|
endif()
|
|
|
|
|
2015-02-27 00:24:23 +01:00
|
|
|
file(GLOB_RECURSE AWE_LUA_FILES ${BUILD_DIR}/lib/*.lua)
|
2014-05-26 21:26:52 +02:00
|
|
|
file(GLOB_RECURSE AWE_MD_FILES ${AWE_DOC_DIR}/*.md)
|
2016-10-22 11:21:27 +02:00
|
|
|
file(GLOB_RECURSE AWE_MD_LUA_FILES RELATIVE "${SOURCE_DIR}/docs" docs/*.md.lua)
|
|
|
|
foreach(file ${AWE_MD_LUA_FILES})
|
|
|
|
# Remove .lua file extensions
|
|
|
|
string(REPLACE ".lua" "" file ${file})
|
|
|
|
list(APPEND AWE_MD_FILES "${AWE_DOC_DIR}/${file}")
|
|
|
|
endforeach()
|
2008-06-23 16:29:51 +02:00
|
|
|
|
2016-02-05 04:42:54 +01:00
|
|
|
# Copy the images to the build directory
|
2016-02-13 08:04:14 +01:00
|
|
|
file(COPY ${SOURCE_DIR}/docs/images DESTINATION ${BUILD_DIR}/doc)
|
2016-02-05 04:42:54 +01:00
|
|
|
|
2016-04-15 03:31:19 +02:00
|
|
|
# Copy the aliases to the build directory
|
|
|
|
file(COPY ${SOURCE_DIR}/docs/aliases DESTINATION ${BUILD_DIR}/docs)
|
2019-01-04 14:19:21 +01:00
|
|
|
|
|
|
|
# Copy ldoc files.
|
|
|
|
configure_file(${SOURCE_DIR}/docs/ldoc.css ${BUILD_DIR}/docs COPYONLY)
|
|
|
|
configure_file(${SOURCE_DIR}/docs/ldoc.ltp ${BUILD_DIR}/docs COPYONLY)
|
2016-04-15 03:31:19 +02:00
|
|
|
|
2017-10-21 20:19:00 +02:00
|
|
|
add_custom_target(ldoc ALL
|
2019-01-04 14:19:21 +01:00
|
|
|
DEPENDS ${BUILD_DIR}/doc/index.html
|
2018-10-12 20:01:11 +02:00
|
|
|
)
|
|
|
|
|
2017-09-11 14:20:43 +02:00
|
|
|
if (STRICT_TESTS)
|
|
|
|
set(ldoc_args --fatalwarnings .)
|
|
|
|
set(ldoc_desc_suffix " (fatal warnings)")
|
|
|
|
else()
|
|
|
|
set(ldoc_args .)
|
|
|
|
endif()
|
2017-07-09 18:45:14 +02:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${BUILD_DIR}/doc/index.html
|
2017-09-11 14:20:43 +02:00
|
|
|
COMMAND ${LDOC_EXECUTABLE} ${ldoc_args}
|
2016-10-10 19:54:05 +02:00
|
|
|
WORKING_DIRECTORY ${AWE_DOC_DIR}
|
2019-01-04 14:19:21 +01:00
|
|
|
DEPENDS
|
|
|
|
${AWE_SRCS}
|
|
|
|
${AWE_LUA_FILES}
|
|
|
|
${AWE_MD_FILES}
|
|
|
|
${BUILD_DIR}/docs/config.ld
|
|
|
|
${BUILD_DIR}/docs/ldoc.css
|
|
|
|
${BUILD_DIR}/docs/ldoc.ltp
|
|
|
|
generate_awesomerc
|
|
|
|
generate-examples
|
2017-09-11 14:20:43 +02:00
|
|
|
COMMENT "Generating API documentation${ldoc_desc_suffix}")
|
2008-06-23 16:29:51 +02:00
|
|
|
endif()
|
|
|
|
# }}}
|
|
|
|
|
2009-05-16 16:27:00 +02:00
|
|
|
# {{{ Theme icons
|
2017-08-10 11:54:41 +02:00
|
|
|
file(GLOB_RECURSE icon_sources RELATIVE ${SOURCE_DIR} ${SOURCE_DIR}/themes/*.png)
|
2009-05-16 16:27:00 +02:00
|
|
|
|
2010-09-13 16:36:26 +02:00
|
|
|
foreach(icon ${icon_sources})
|
|
|
|
# Copy all icons to the build dir to simplify the following code.
|
|
|
|
# Source paths are interpreted relative to ${SOURCE_DIR}, target paths
|
|
|
|
# relative to ${BUILD_DIR}.
|
|
|
|
get_filename_component(icon_path ${icon} PATH)
|
2011-02-21 17:58:04 +01:00
|
|
|
get_filename_component(icon_name ${icon} NAME)
|
2010-09-13 16:36:26 +02:00
|
|
|
file(COPY ${icon} DESTINATION ${icon_path})
|
2011-02-21 17:58:04 +01:00
|
|
|
set(ALL_ICONS ${ALL_ICONS} "${icon_path}/${icon_name}")
|
2010-09-13 16:36:26 +02:00
|
|
|
endforeach()
|
|
|
|
|
2009-05-16 16:27:00 +02:00
|
|
|
macro(a_icon_convert match replacement input)
|
|
|
|
string(REPLACE ${match} ${replacement} output ${input})
|
|
|
|
|
2015-07-29 14:32:30 +02:00
|
|
|
if(NOT ${input} STREQUAL ${output} AND NOT ";${ALL_ICONS};" MATCHES ";${output};")
|
2009-05-16 16:27:00 +02:00
|
|
|
set(ALL_ICONS ${ALL_ICONS} ${output})
|
|
|
|
|
|
|
|
add_custom_command(
|
2016-03-20 16:22:52 +01:00
|
|
|
COMMAND ${CONVERT_EXECUTABLE} ${input} -strip ${ARGN} ${output}
|
2009-05-16 16:27:00 +02:00
|
|
|
OUTPUT ${output}
|
|
|
|
DEPENDS ${input}
|
|
|
|
VERBATIM)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
foreach(icon ${ALL_ICONS})
|
|
|
|
# Make unfocused icons translucent
|
|
|
|
a_icon_convert("_focus" "_normal" ${icon}
|
2012-10-24 18:09:55 +02:00
|
|
|
-colorspace rgb -gamma 0.6 -channel A -evaluate Multiply 0.4)
|
2009-05-16 16:27:00 +02:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(icon ${ALL_ICONS})
|
|
|
|
# Make inactive icons grayscale
|
|
|
|
a_icon_convert("_active" "_inactive" ${icon}
|
|
|
|
-colorspace Gray)
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
add_custom_target(generated_icons ALL DEPENDS ${ALL_ICONS})
|
|
|
|
# }}}
|
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# {{{ Dist tarball
|
2008-06-23 23:07:28 +02:00
|
|
|
if(BUILD_FROM_GIT)
|
|
|
|
add_custom_target(dist
|
|
|
|
COMMAND ${SOURCE_DIR}/build-utils/dist.sh ${VERSION}
|
|
|
|
WORKING_DIRECTORY ${SOURCE_DIR})
|
|
|
|
endif()
|
|
|
|
# }}}
|
|
|
|
|
2008-06-30 20:05:53 +02:00
|
|
|
# {{{ Installation
|
2009-04-08 17:48:52 +02:00
|
|
|
install(TARGETS ${PROJECT_AWE_NAME} RUNTIME DESTINATION bin)
|
|
|
|
install(FILES "utils/awesome-client" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
2009-12-22 12:46:29 +01:00
|
|
|
install(DIRECTORY ${BUILD_DIR}/lib DESTINATION ${AWESOME_DATA_PATH}
|
|
|
|
PATTERN "*.in" EXCLUDE)
|
2017-01-25 09:18:15 +01:00
|
|
|
install(FILES ${BUILD_DIR}/awesomerc.lua DESTINATION ${AWESOME_SYSCONFDIR}
|
|
|
|
RENAME rc.lua)
|
2008-06-23 13:31:18 +02:00
|
|
|
if(GENERATE_MANPAGES)
|
2010-04-09 00:42:27 +02:00
|
|
|
if(COMPRESS_MANPAGES)
|
2010-05-20 19:57:10 +02:00
|
|
|
set(regex "\\.(xml|txt|[0-9])$")
|
2010-04-09 00:42:27 +02:00
|
|
|
else()
|
2010-05-20 19:57:10 +02:00
|
|
|
set(regex "\\.(xml|txt|gz)$")
|
2010-04-09 00:42:27 +02:00
|
|
|
endif()
|
|
|
|
install(DIRECTORY ${BUILD_DIR}/${relpath}/ DESTINATION ${AWESOME_MAN_PATH}
|
|
|
|
REGEX ${regex} EXCLUDE )
|
2008-06-23 13:31:18 +02:00
|
|
|
endif()
|
2008-06-25 04:00:19 +02:00
|
|
|
install(DIRECTORY ${AWE_ICON_DIR} DESTINATION ${AWESOME_DATA_PATH})
|
2010-09-14 22:14:38 +02:00
|
|
|
install(DIRECTORY ${SOURCE_DIR}/themes DESTINATION ${AWESOME_DATA_PATH}
|
2015-06-22 12:09:54 +02:00
|
|
|
PATTERN "*.lua" EXCLUDE)
|
|
|
|
install(DIRECTORY ${BUILD_DIR}/themes DESTINATION ${AWESOME_DATA_PATH}
|
|
|
|
PATTERN "*.lua")
|
2016-02-05 04:42:54 +01:00
|
|
|
install(FILES ${AWE_DOC_FILES} DESTINATION ${AWESOME_DOC_PATH})
|
2008-08-12 11:36:11 +02:00
|
|
|
install(FILES "awesome.desktop" DESTINATION ${AWESOME_XSESSION_PATH})
|
2012-11-19 14:57:47 +01:00
|
|
|
if(GENERATE_DOC)
|
|
|
|
install(DIRECTORY ${BUILD_DIR}/doc DESTINATION ${AWESOME_DOC_PATH})
|
2008-06-23 16:29:51 +02:00
|
|
|
endif()
|
2008-06-21 01:43:35 +02:00
|
|
|
# }}}
|
2008-06-16 08:44:12 +02:00
|
|
|
|
2015-07-25 17:24:14 +02:00
|
|
|
# {{{ Tests
|
2017-05-13 23:28:45 +02:00
|
|
|
add_executable(test-gravity tests/test-gravity.c)
|
|
|
|
target_link_libraries(test-gravity
|
|
|
|
${AWESOME_COMMON_REQUIRED_LDFLAGS} ${AWESOME_REQUIRED_LDFLAGS})
|
2016-02-07 15:29:04 +01:00
|
|
|
add_custom_target(check-integration
|
2017-08-14 13:38:49 +02:00
|
|
|
${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' ./tests/run.sh \$\${TEST_RUN_ARGS:--W}
|
2016-02-07 15:29:04 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
COMMENT "Running integration tests"
|
2017-10-24 20:59:51 +02:00
|
|
|
DEPENDS ${PROJECT_AWE_NAME}
|
2017-08-14 13:38:49 +02:00
|
|
|
USES_TERMINAL)
|
2017-05-13 23:28:45 +02:00
|
|
|
add_dependencies(check-integration test-gravity)
|
2017-08-10 12:16:27 +02:00
|
|
|
add_custom_target(check-themes
|
2017-08-16 13:27:49 +02:00
|
|
|
${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' ./tests/themes/run.sh
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2017-08-10 12:16:27 +02:00
|
|
|
COMMENT "Testing themes"
|
|
|
|
USES_TERMINAL
|
2017-08-16 13:27:49 +02:00
|
|
|
DEPENDS generated_icons generate_awesomerc ${PROJECT_AWE_NAME})
|
2017-08-14 17:18:46 +02:00
|
|
|
list(APPEND CHECK_TARGETS check-themes)
|
2017-08-10 12:16:27 +02:00
|
|
|
|
2017-02-06 18:35:20 +01:00
|
|
|
add_custom_target(check-requires
|
|
|
|
lua "${CMAKE_SOURCE_DIR}/build-utils/check_for_invalid_requires.lua"
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
COMMENT "Checking use of require()"
|
|
|
|
USES_TERMINAL
|
|
|
|
VERBATIM)
|
|
|
|
list(APPEND CHECK_QA_TARGETS check-requires)
|
2016-04-17 16:10:18 +02:00
|
|
|
a_find_program(BUSTED_EXECUTABLE busted FALSE)
|
2014-08-23 21:57:52 +02:00
|
|
|
if(BUSTED_EXECUTABLE)
|
2019-01-10 13:30:58 +01:00
|
|
|
if(DO_COVERAGE)
|
|
|
|
set(BUSTED_ARGS "--coverage")
|
|
|
|
else()
|
|
|
|
set(BUSTED_ARGS)
|
|
|
|
endif()
|
2017-06-25 20:04:32 +02:00
|
|
|
add_custom_target(check-unit
|
2019-01-10 13:30:58 +01:00
|
|
|
COMMAND ${BUSTED_EXECUTABLE} ${BUSTED_ARGS}
|
2014-08-23 21:57:52 +02:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2015-07-25 17:29:43 +02:00
|
|
|
COMMENT "Running unit tests"
|
2014-08-23 21:57:52 +02:00
|
|
|
VERBATIM)
|
2016-02-07 15:29:04 +01:00
|
|
|
list(APPEND CHECK_TARGETS check-unit)
|
2017-07-01 22:32:14 +02:00
|
|
|
else()
|
|
|
|
add_custom_target(check-unit true
|
|
|
|
COMMENT "Skipping check-unit, since busted was not found"
|
|
|
|
VERBATIM)
|
2014-08-23 21:57:52 +02:00
|
|
|
endif()
|
2016-04-17 16:10:18 +02:00
|
|
|
a_find_program(LUACHECK_EXECUTABLE luacheck FALSE)
|
2016-02-07 15:29:04 +01:00
|
|
|
if(LUACHECK_EXECUTABLE)
|
|
|
|
add_custom_target(luacheck
|
|
|
|
${LUACHECK_EXECUTABLE} lib spec tests themes awesomerc.lua
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
COMMENT "Running Luacheck"
|
|
|
|
VERBATIM)
|
2016-11-27 15:24:04 +01:00
|
|
|
list(APPEND CHECK_QA_TARGETS luacheck)
|
2015-07-25 17:24:14 +02:00
|
|
|
endif()
|
2016-11-27 15:24:04 +01:00
|
|
|
add_custom_target(check-qa DEPENDS ${CHECK_QA_TARGETS})
|
|
|
|
add_custom_target(check DEPENDS ${CHECK_TARGETS} check-qa)
|
2014-08-23 21:57:52 +02:00
|
|
|
# }}}
|
|
|
|
|
2015-01-19 01:20:33 +01:00
|
|
|
INCLUDE(${CMAKE_SOURCE_DIR}/Packaging.cmake)
|
|
|
|
|
2014-05-26 21:26:52 +02:00
|
|
|
# vim: filetype=cmake:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80:foldmethod=marker
|