* Added CMake-based build system necessary files

This commit is contained in:
Felix C. Morency 2008-06-15 23:44:12 -07:00 committed by Julien Danjou
parent b04ccd38bb
commit 26a91507a0
4 changed files with 290 additions and 0 deletions

131
CMakeLists.txt Normal file
View File

@ -0,0 +1,131 @@
IF( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/awesomeConfig.cmake )
MESSAGE( FATAL "Please provide awesomeConfig.cmake" )
ENDIF( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/awesomeConfig.cmake )
CMAKE_MINIMUM_REQUIRED( VERSION 2.4 )
INCLUDE( awesomeConfig.cmake )
INCLUDE_DIRECTORIES( ${AWE_INC_DIR} )
SET( AWE_LUA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tabulous.lua
${CMAKE_CURRENT_SOURCE_DIR}/awful.lua
)
SET( AWE_CONF_FILES ${CMAKE_CURRENT_SOURCE_DIR}/awesomerc.lua
)
SET( AWE_ICON_PATH ${CMAKE_CURRENT_SOURCE_DIR}/icons )
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
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/configopts.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/draw.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/markup.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/socket.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/swindow.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/util.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/version.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/xembed.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/xscreen.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/xutil.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_LAYOUT_DIR}/fibonacci.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_LAYOUT_DIR}/floating.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_LAYOUT_DIR}/magnifier.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_LAYOUT_DIR}/max.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_LAYOUT_DIR}/tile.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_WIDGET_DIR}/graph.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_WIDGET_DIR}/iconbox.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_WIDGET_DIR}/progressbar.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_WIDGET_DIR}/taglist.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_WIDGET_DIR}/tasklist.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_WIDGET_DIR}/textbox.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_WIDGET_DIR}/systray.c
)
SET( AWE_CLIENT_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/awesome-client.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/configopts.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/draw.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/markup.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/socket.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/swindow.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/util.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/version.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/xscreen.c
${CMAKE_CURRENT_SOURCE_DIR}/${AWE_COMMON_DIR}/xutil.c
)
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
)
IF( AWESOME_GENERATE_MAN )
FOREACH( txtfile ${AWE_MAN_SRCS})
STRING( REGEX REPLACE ".txt\$" ".xml" xmlfile ${txtfile} )
STRING( REGEX REPLACE ".xml\$" "" manfile ${xmlfile} )
ADD_CUSTOM_COMMAND( OUTPUT ${xmlfile}
COMMAND ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} ${txtfile}
DEPENDS ${txtfile}
)
ADD_CUSTOM_COMMAND( OUTPUT ${manfile}
COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile}
DEPENDS ${xmlfile}
)
SET( AWE_MAN_FILES ${AWE_MAN_FILES} ${manfile} )
ENDFOREACH( txtfile)
ADD_CUSTOM_TARGET( man ALL DEPENDS ${AWE_MAN_FILES} )
ENDIF( AWESOME_GENERATE_MAN )
ADD_EXECUTABLE( ${PROJECT_AWE_NAME} ${AWE_SRCS} )
ADD_EXECUTABLE( ${PROJECT_AWECLIENT_NAME} ${AWE_CLIENT_SRCS} )
TARGET_LINK_LIBRARIES( ${PROJECT_AWE_NAME} ${AWE_MOD_LIBRARIES}
${LUA_LIB}
${LIB_READLINE}
${LIB_NCURSES}
)
TARGET_LINK_LIBRARIES( ${PROJECT_AWECLIENT_NAME} ${AWE_MOD_LIBRARIES}
${LIB_READLINE}
${LIB_NCURSES}
)
INSTALL( TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
)
INSTALL( FILES ${AWE_LUA_FILES}
DESTINATION ${AWESOME_LUA_LIB_PATH}
)
INSTALL( FILES ${AWE_CONF_FILES}
DESTINATION ${AWESOME_CONF_PATH}
)
INSTALL( DIRECTORY ${AWE_ICON_PATH}
DESTINATION ${AWESOME_ICON_PATH}
)

View File

@ -0,0 +1,10 @@
#ifndef _AWE_VERSION_INTERNAL_H_
#define _AWE_VERSION_INTERNAL_H_
#define AWESOME_VERSION_INTERNAL "@AWESOME_VERSION_INTERNAL@"
#define AWESOME_COMPILE_MACHINE "@AWESOME_COMPILE_MACHINE@"
#define AWESOME_COMPILE_BY "@AWESOME_COMPILE_BY@"
#define AWESOME_COMPILE_HOSTNAME "@AWESOME_COMPILE_HOSTNAME@"
#define AWESOME_RELEASE "@AWESOME_RELEASE@"
#endif //_AWE_VERSION_INTERNAL_H_

140
awesomeConfig.cmake Normal file
View File

@ -0,0 +1,140 @@
SET( PROJECT_AWE_NAME awesome )
SET( PROJECT_AWECLIENT_NAME awesome-client )
SET( VERSION 3 )
PROJECT( ${PROJECT_AWE_NAME} )
SET( CMAKE_BUILD_TYPE RELEASE )
# Check for doxygen
INCLUDE( FindDoxygen )
INCLUDE( FindPkgConfig )
INCLUDE( UsePkgConfig )
SET( AWE_COMMON_DIR common )
SET( AWE_LAYOUT_DIR layouts )
SET( AWE_WIDGET_DIR widgets )
MESSAGE( "Checking for REQUIRED modules: " )
# Use pkgconfig to get most of the libraries
pkg_check_modules( AWE_MOD REQUIRED glib-2.0
cairo
pango
gtk+-2.0>=2.2
xcb
xcb-event
xcb-randr
xcb-xinerama
xcb-shape
xcb-aux
xcb-atom
xcb-keysyms
xcb-render
xcb-icccm
cairo-xcb
dbus-1
imlib2
)
# Check for readline and ncurse
FIND_LIBRARY( LIB_READLINE readline )
FIND_LIBRARY( LIB_NCURSES ncurses )
# Check for lua5.1
FIND_PATH(LUA_INC_DIR lua.h
/usr/include
/usr/include/lua5.1
/usr/local/include/lua5.1
../libs/lua-5.1.3/src)
FIND_LIBRARY(LUA_LIB NAMES lua5.1 lua
/usr/lib
/usr/lib/lua
/usr/local/lib
../libs/lua-5.1.3/lib)
# Error check
IF( NOT LIB_READLINE )
MESSAGE( FATAL_ERROR "readline library not found" )
ENDIF( NOT LIB_READLINE )
IF( NOT LIB_NCURSES )
MESSAGE( FATAL_ERROR "ncurse library not found" )
ENDIF( NOT LIB_NCURSES )
IF( NOT LUA_LIB )
MESSAGE( FATAL_ERROR "lua library not found" )
ELSE( LUA_LIB AND LUA_INC_DIR )
MESSAGE( "lua 5.1 found: " ${LUA_LIB} )
ENDIF( NOT LUA_LIB )
# Add awesome defines
ADD_DEFINITIONS( -DWITH_DBUS
-DWITH_IMLIB
)
IF ( DOXYGEN_EXECUTABLE )
ADD_CUSTOM_TARGET( doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/awesome.doxygen )
ENDIF ( DOXYGEN_EXECUTABLE )
# Check for programs needed for man pages
FIND_PROGRAM( ASCIIDOC_EXECUTABLE asciidoc )
FIND_PROGRAM( XMLTO_EXECUTABLE xmlto )
IF( ASCIIDOC_EXECUTABLE )
IF( XMLTO_EXECUTABLE )
SET( AWESOME_GENERATE_MAN TRUE )
ENDIF( XMLTO_EXECUTABLE )
ENDIF( ASCIIDOC_EXECUTABLE )
# Set awesome informations and path
SET( AWESOME_VERSION_INTERNAL devel )
SET( AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} )
SET( AWESOME_COMPILE_HOSTNAME ${CMAKE_SYSTEM_NAME} )
SET( AWESOME_COMPILE_BY ${CMAKE_C_COMPILER} )
SET( AWESOME_RELEASE ${VERSION} )
SET( AWESOME_ETC ${CMAKE_INSTALL_PREFIX}/etc )
SET( AWESOME_SHARE ${CMAKE_INSTALL_PREFIX}/share )
SET( AWESOME_LUA_LIB_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME}/lib )
SET( AWESOME_ICON_PATH ${AWESOME_SHARE}/${PROJECT_AWE_NAME}/icons )
SET( AWESOME_CONF_PATH ${AWESOME_ETC}/${PROJECT_AWE_NAME} )
# Configure awesome config.h from template
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_SOURCE_DIR}/config.h
ESCAPE_QUOTE
@ONLY
)
# Confiure awesomerc.lua.in
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/awesomerc.lua.in
${CMAKE_CURRENT_SOURCE_DIR}/awesomerc.lua
ESCAPE_QUOTE
@ONLY
)
# Configure awesome awesome-version-internal.h from template
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/awesome-version-internal.h.in
${CMAKE_CURRENT_SOURCE_DIR}/awesome-version-internal.h
ESCAPE_QUOTE
@ONLY
)
# Execute some header generator
EXECUTE_PROCESS( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-utils/layoutgen.sh
OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/layoutgen.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
EXECUTE_PROCESS( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-utils/widgetgen.sh
OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/widgetgen.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# Set the awesome include dir
SET( AWE_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}
${AWE_MOD_INCLUDE_DIRS}
${LUA_INC_DIR}
)

9
config.h.in Normal file
View File

@ -0,0 +1,9 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
#define AWESOME_RELEASE "@AWESOME_RELEASE@"
#define AWESOME_LUA_LIB_PATH "@AWESOME_LUA_LIB_PATH@"
#define AWESOME_CONF_PATH "@AWESOME_CONF_PATH@"
#define VERSION "@VERSION@"
#endif //_CONFIG_H_