2008-06-20 23:38:33 +02:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
|
|
|
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
|
|
|
|
|
2008-06-19 22:49:26 +02:00
|
|
|
IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/awesomeConfig.cmake)
|
2008-06-20 23:38:33 +02:00
|
|
|
MESSAGE(FATAL_ERROR "Please provide awesomeConfig.cmake")
|
2008-06-19 22:49:26 +02:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
INCLUDE(awesomeConfig.cmake)
|
|
|
|
|
2008-06-20 19:36:26 +02:00
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
|
2008-06-22 03:00:42 +02:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2008-06-20 19:36:26 +02:00
|
|
|
${AWESOME_REQUIRED_INCLUDE_DIRS}
|
|
|
|
${AWESOME_OPTIONAL_INCLUDE_DIRS})
|
2008-06-19 22:49:26 +02:00
|
|
|
|
|
|
|
SET(AWE_LUA_FILES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lib/tabulous.lua
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lib/awful.lua)
|
|
|
|
|
2008-06-22 03:00:42 +02:00
|
|
|
SET(AWE_CONF_FILES ${CMAKE_CURRENT_BINARY_DIR}/awesomerc.lua)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
|
|
|
SET(AWE_ICON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/icons)
|
|
|
|
|
2008-06-21 01:43:35 +02:00
|
|
|
SET(AWE_DOC_FILES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/AUTHORS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/BUGS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/README
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
|
|
|
|
|
2008-06-19 22:49:26 +02:00
|
|
|
SET(AWE_SRCS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/awesome.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/client.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cnode.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/dbus.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/event.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/ewmh.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/focus.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/keybinding.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/keygrabber.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/layout.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lua.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/mouse.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/placement.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/screen.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/stack.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/statusbar.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/systray.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tag.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/titlebar.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/widget.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/window.c
|
2008-06-22 14:59:45 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/buffer.c
|
2008-06-20 18:59:39 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/configopts.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/draw.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/markup.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/socket.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/swindow.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/util.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/version.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/xembed.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/xscreen.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/xutil.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/layouts/fibonacci.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/layouts/floating.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/layouts/magnifier.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/layouts/max.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/layouts/tile.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/widgets/graph.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/widgets/iconbox.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/widgets/progressbar.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/widgets/taglist.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/widgets/tasklist.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/widgets/textbox.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/widgets/systray.c)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
|
|
|
SET(AWE_CLIENT_SRCS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/awesome-client.c
|
2008-06-20 18:59:39 +02:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/socket.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/util.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/common/version.c)
|
2008-06-19 22:49:26 +02:00
|
|
|
|
|
|
|
SET(AWE_MAN_SRCS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/awesome.1.txt
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/awesome-client.1.txt
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/awesomerc.5.txt)
|
|
|
|
|
|
|
|
ADD_EXECUTABLE(${PROJECT_AWE_NAME} ${AWE_SRCS})
|
|
|
|
ADD_EXECUTABLE(${PROJECT_AWECLIENT_NAME} ${AWE_CLIENT_SRCS})
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES(${PROJECT_AWE_NAME}
|
2008-06-20 19:36:26 +02:00
|
|
|
${AWESOME_REQUIRED_LIBRARIES}
|
|
|
|
${AWESOME_OPTIONAL_LIBRARIES})
|
2008-06-19 22:49:26 +02:00
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES(${PROJECT_AWECLIENT_NAME}
|
|
|
|
${LIB_READLINE}
|
|
|
|
${LIB_NCURSES})
|
|
|
|
|
2008-06-21 00:24:12 +02:00
|
|
|
# {{{ Generated headers
|
|
|
|
FILE(GLOB LAYOUTGEN_DEPS ${CMAKE_CURRENT_SOURCE_DIR}/layouts/*.h)
|
|
|
|
ADD_CUSTOM_COMMAND(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-utils/layoutgen.sh
|
2008-06-22 03:00:42 +02:00
|
|
|
ARGS > ${CMAKE_CURRENT_BINARY_DIR}/layoutgen.h
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/layoutgen.h
|
2008-06-21 20:44:54 +02:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
2008-06-21 00:24:12 +02:00
|
|
|
DEPENDS ${LAYOUTGEN_DEPS}
|
|
|
|
COMMENT "Generating layoutgen.h."
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
ADD_CUSTOM_COMMAND(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-utils/widgetgen.sh
|
2008-06-22 03:00:42 +02:00
|
|
|
ARGS > ${CMAKE_CURRENT_BINARY_DIR}/widgetgen.h
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/widgetgen.h
|
2008-06-21 20:44:54 +02:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
2008-06-21 00:24:12 +02:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/widget.h
|
|
|
|
COMMENT "Generating widgetgen.h."
|
|
|
|
VERBATIM)
|
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(generated_headers
|
2008-06-22 03:00:42 +02:00
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/widgetgen.h
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/layoutgen.h)
|
2008-06-21 00:24:12 +02:00
|
|
|
|
|
|
|
ADD_DEPENDENCIES(${PROJECT_AWE_NAME} generated_headers)
|
|
|
|
# }}}
|
|
|
|
|
2008-06-21 02:36:10 +02:00
|
|
|
# {{{ Manpages.
|
2008-06-20 18:49:58 +02:00
|
|
|
IF(GENERATE_MANPAGES)
|
2008-06-21 02:36:10 +02:00
|
|
|
|
2008-06-21 17:49:56 +02:00
|
|
|
# {{{ Lua API documentation.
|
2008-06-22 03:00:42 +02:00
|
|
|
SET(LUADOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/apidocgen.txt)
|
|
|
|
|
2008-06-21 02:36:10 +02:00
|
|
|
MACRO(a_file_match infile regex result_var)
|
2008-06-21 15:10:51 +02:00
|
|
|
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6)
|
|
|
|
# cmake < 2.6 doesn't know FILE(STRINGS ...)
|
|
|
|
EXECUTE_PROCESS(COMMAND ${GREP_EXECUTABLE} -l ${regex} ${infile}
|
|
|
|
RESULT_VARIABLE exit_code
|
|
|
|
OUTPUT_QUIET)
|
|
|
|
IF(exit_code EQUAL 0)
|
|
|
|
SET(${result_var} TRUE)
|
|
|
|
ELSE()
|
|
|
|
SET(${result_var} FALSE)
|
|
|
|
ENDIF()
|
2008-06-21 02:36:10 +02:00
|
|
|
ELSE()
|
2008-06-21 15:10:51 +02:00
|
|
|
FILE(STRINGS ${infile} match REGEX ${regex} LIMIT_COUNT 1)
|
|
|
|
IF(match)
|
|
|
|
SET(${result_var} TRUE)
|
|
|
|
ELSE()
|
|
|
|
SET(${result_var} FALSE)
|
|
|
|
ENDIF()
|
2008-06-21 02:36:10 +02:00
|
|
|
ENDIF()
|
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
# find .c files exporting lua functions
|
|
|
|
FOREACH(cfile ${AWE_SRCS})
|
|
|
|
a_file_match(${cfile} "const struct luaL_reg" result)
|
|
|
|
IF(result)
|
|
|
|
SET(LUA_APIDOC_SRCS ${LUA_APIDOC_SRCS} ${cfile})
|
|
|
|
ENDIF()
|
|
|
|
ENDFOREACH()
|
|
|
|
|
2008-06-21 16:59:36 +02:00
|
|
|
# luadoc target
|
|
|
|
ADD_CUSTOM_COMMAND(COMMAND ${CAT_EXECUTABLE} ${LUA_APIDOC_SRCS}
|
|
|
|
| ${LUA_EXECUTABL} ${CMAKE_CURRENT_SOURCE_DIR}/build-utils/gendoc.lua
|
2008-06-22 03:00:42 +02:00
|
|
|
> ${LUADOC_FILE}
|
|
|
|
OUTPUT ${LUADOC_FILE}
|
2008-06-21 16:59:36 +02:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
DEPENDS ${LUA_APIDOC_SRCS}
|
|
|
|
COMMENT "Generating Lua API documentation."
|
|
|
|
VERBATIM)
|
|
|
|
|
2008-06-22 03:00:42 +02:00
|
|
|
ADD_CUSTOM_TARGET(luadoc DEPENDS ${LUADOC_FILE})
|
2008-06-21 17:49:56 +02:00
|
|
|
# }}}
|
2008-06-21 16:59:36 +02:00
|
|
|
|
2008-06-19 22:49:26 +02:00
|
|
|
FOREACH(txtfile ${AWE_MAN_SRCS})
|
2008-06-19 22:53:29 +02:00
|
|
|
STRING(REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile})
|
2008-06-22 03:00:42 +02:00
|
|
|
STRING(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR} xmlfile ${xmlfile})
|
2008-06-21 17:49:56 +02:00
|
|
|
STRING(REGEX REPLACE ".xml\$" ".gz" gzfile ${xmlfile})
|
|
|
|
STRING(REGEX REPLACE ".gz\$" "" manfile ${gzfile})
|
|
|
|
|
|
|
|
# TODO: This is still not 100% right. Actually only
|
2008-06-22 03:00:42 +02:00
|
|
|
# awesomerc.5.xml should depend on ${LUADOC_FILE}.
|
|
|
|
ADD_CUSTOM_COMMAND(COMMAND ${CAT_EXECUTABLE} ${txtfile}
|
|
|
|
| ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} -
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
2008-06-21 17:49:56 +02:00
|
|
|
OUTPUT ${xmlfile}
|
2008-06-22 03:00:42 +02:00
|
|
|
DEPENDS ${txtfile} ${LUADOC_FILE}
|
|
|
|
VERBATIM)
|
2008-06-21 17:49:56 +02:00
|
|
|
ADD_CUSTOM_COMMAND(COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile}
|
|
|
|
OUTPUT ${manfile}
|
|
|
|
DEPENDS ${xmlfile})
|
2008-06-21 18:13:34 +02:00
|
|
|
ADD_CUSTOM_COMMAND(COMMAND ${CAT_EXECUTABLE} ${manfile}
|
|
|
|
| ${GZIP_EXECUTABLE}
|
|
|
|
> ${gzfile}
|
2008-06-21 17:49:56 +02:00
|
|
|
OUTPUT ${gzfile}
|
2008-06-21 18:13:34 +02:00
|
|
|
DEPENDS ${manfile}
|
|
|
|
VERBATIM)
|
2008-06-21 17:49:56 +02:00
|
|
|
|
|
|
|
SET(MAN_FILES ${MAN_FILES} ${gzfile})
|
2008-06-21 19:14:26 +02:00
|
|
|
|
2008-06-22 03:00:42 +02:00
|
|
|
# figure out in what section to install to from filename
|
2008-06-21 19:14:26 +02:00
|
|
|
STRING(REGEX REPLACE "^.*\\.([0-9])\\.gz\$" "\\1" section ${gzfile})
|
|
|
|
SET(AWE_MAN${section}_FILES ${AWE_MAN${section}_FILES} ${gzfile})
|
2008-06-19 22:49:26 +02:00
|
|
|
ENDFOREACH()
|
2008-06-21 17:49:56 +02:00
|
|
|
|
|
|
|
ADD_CUSTOM_TARGET(man ALL DEPENDS ${MAN_FILES})
|
2008-06-19 22:49:26 +02:00
|
|
|
ENDIF()
|
2008-06-21 02:36:10 +02:00
|
|
|
# }}}
|
2008-06-19 22:49:26 +02:00
|
|
|
|
2008-06-22 03:00:42 +02:00
|
|
|
# {{{ Doxygen
|
2008-06-20 18:06:45 +02:00
|
|
|
IF(DOXYGEN_EXECUTABLE)
|
2008-06-22 03:00:42 +02:00
|
|
|
ADD_CUSTOM_TARGET(doc
|
|
|
|
COMMAND ${DOXYGEN_EXECUTABLE} awesome.doxygen
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
2008-06-20 18:06:45 +02:00
|
|
|
ENDIF()
|
2008-06-22 03:00:42 +02:00
|
|
|
# }}}
|
2008-06-20 18:06:45 +02:00
|
|
|
|
2008-06-21 01:43:35 +02:00
|
|
|
# {{{ Installation.
|
2008-06-19 22:49:26 +02:00
|
|
|
INSTALL(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin)
|
2008-06-20 02:23:51 +02:00
|
|
|
INSTALL(FILES ${AWE_LUA_FILES} DESTINATION ${AWESOME_REL_LUA_LIB_PATH})
|
|
|
|
INSTALL(FILES ${AWE_CONF_FILES} DESTINATION ${AWESOME_REL_CONF_PATH})
|
2008-06-20 18:49:58 +02:00
|
|
|
IF(GENERATE_MANPAGES)
|
2008-06-21 19:14:26 +02:00
|
|
|
INSTALL(FILES ${AWE_MAN1_FILES} DESTINATION ${AWESOME_MAN1_PATH})
|
|
|
|
INSTALL(FILES ${AWE_MAN5_FILES} DESTINATION ${AWESOME_MAN5_PATH})
|
2008-06-20 18:49:58 +02:00
|
|
|
ENDIF()
|
2008-06-20 02:23:51 +02:00
|
|
|
INSTALL(DIRECTORY ${AWE_ICON_DIR} DESTINATION ${AWESOME_REL_ICON_PATH})
|
2008-06-21 01:43:35 +02:00
|
|
|
INSTALL(FILES ${AWE_DOC_FILES} DESTINATION ${AWESOME_REL_DOC_PATH})
|
|
|
|
# }}}
|
2008-06-16 08:44:12 +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
|