Conversion to CMake

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/2/head
Slávek Banko 10 years ago
parent 29fade027e
commit bead6a36fc

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "cmake"]
path = cmake
url = http://system@scm.trinitydesktop.org/scm/git/tde-common-cmake

@ -0,0 +1,104 @@
#################################################
#
# (C) 2014 Slávek Banko
# slavek (DOT) banko (AT) axis.cz
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
cmake_minimum_required( VERSION 2.6 )
##### general package setup #####################
project( libr )
set( PACKAGE libr )
set( VERSION 0.6.0 )
##### include essential cmake modules ###########
include( FindPkgConfig )
include( CheckIncludeFile )
##### include our cmake modules #################
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
##### setup install paths #######################
include( TDESetupPaths )
tde_setup_paths( )
##### optional stuff ############################
option( WITH_BACKEND_LIBBFD "Build with libbfd backend" "ON" )
option( WITH_BACKEND_LIBELF "Build with libelf backend" "OFF" )
option( WITH_BACKEND_READONLY "Build with read-only backend" "OFF" )
#### configure checks ###########################
if( WITH_BACKEND_LIBBFD )
check_include_file( bfd.h HAVE_BFD_H )
if( NOT HAVE_BFD_H )
tde_message_fatal( "Could not find libbfd header file (bfd.h)!\nThis file is usually included in the package binutils-dev." )
endif( NOT HAVE_BFD_H )
set( BACKEND_LIBRARIES "-lbfd" )
set( LIBR_BACKEND "bfd" )
set( BACKEND_NAME "libbfd" )
elseif( WITH_BACKEND_LIBELF )
# Is libelf 0.8.2 safe enough? testing is currently on 0.8.6
pkg_search_module( BACKEND libelf >= 0.8.2 )
if( NOT BACKEND_FOUND )
tde_message_fatal( "libelf >= 0.8.2 are required, but not found on your system" )
endif( NOT BACKEND_FOUND )
set( LIBR_BACKEND "elf" )
set( BACKEND_NAME "libelf" )
elseif( WITH_BACKEND_READONLY )
set( BACKEND_NAME "readonly" )
set( LIBR_BACKEND "ro" )
else( )
tde_message_fatal( "Backend is not selected, cannot build." )
endif( )
find_package( ZLIB )
if( NOT ZLIB_FOUND )
tde_message_fatal( "zlib are required, but not found on your system" )
endif( NOT ZLIB_FOUND )
pkg_search_module( LIBGLADE libglade-2.0>=2.0.0 )
if( NOT LIBGLADE_FOUND )
tde_message_fatal( "libglade-2.0 are required, but not found on your system" )
endif( NOT LIBGLADE_FOUND )
message( STATUS "Ready to build with backend ${BACKEND_NAME}" )
#### pkg-config #################################
set( prefix ${CMAKE_INSTALL_PREFIX} )
set( exec_prefix ${EXEC_INSTALL_PREFIX} )
set( libdir ${LIB_INSTALL_DIR} )
set( includedir ${INCLUDE_INSTALL_DIR}/libr )
configure_file( libr.pc.in libr.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libr.pc
DESTINATION ${PKGCONFIG_INSTALL_DIR} )
##### build #####################################
tde_auto_add_subdirectories()

@ -0,0 +1 @@
Subproject commit 1994b808819fd74446cb8f1a0491b3e10244f463

@ -0,0 +1,26 @@
#################################################
#
# (C) 2014 Slávek Banko
# slavek (DOT) banko (AT) axis.cz
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
add_custom_target( man ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/man3 )
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/man3
COMMAND doxygen ../doc/libr.cfg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generate manpages"
)
install(
DIRECTORY man3
DESTINATION ${MAN_INSTALL_DIR}
PATTERN "_*" EXCLUDE
)

@ -0,0 +1,69 @@
#################################################
#
# (C) 2014 Slávek Banko
# slavek (DOT) banko (AT) axis.cz
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
include_directories(
${CMAKE_INSTALL_INCLUDEDIR}/libr
${BACKEND_INCLUDE_DIRS}
${LIBGLADE_INCLUDE_DIRS}
)
add_definitions(
-D__LIBR_BACKEND_${BACKEND_NAME}__
-D__LIBR_BUILD__
)
set( target r )
##### library ###################################
set( ${target}_SRCS
libr-${LIBR_BACKEND}.c
tempfiles.c
onecanvas.c
libr-icons.c
libr-i18n.c
libr-gtk.c
libr.c
)
tde_add_library(
${target} SHARED
VERSION 0.0.0
SOURCES ${${target}_SRCS}
LINK ${BACKEND_LIBS}
DESTINATION ${LIB_INSTALL_DIR}
)
tde_add_library(
${target} STATIC
VERSION 0.0.0
SOURCES ${${target}_SRCS}
LINK ${BACKEND_LIBS}
DESTINATION ${LIB_INSTALL_DIR}
)
##### headers ###################################
set( ${target}_INCLUDES
gettext.h
libr-icons.h
libr-i18n.h
libr-gtk.h
libr.h
)
install(
FILES ${${target}_INCLUDES}
DESTINATION ${INCLUDE_INSTALL_DIR}/libr
)
Loading…
Cancel
Save