summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2014-12-30 20:07:51 +0100
committerSlávek Banko <slavek.banko@axis.cz>2014-12-30 20:07:51 +0100
commitbead6a36fc5329a7e1ef3d138d5e2b29481b380d (patch)
tree03fcc3315cff824f68dfc8e96240df62fc368d12
parent29fade027e4c46443d47ebaa93024f0441a7a550 (diff)
downloadlibr-bead6a36fc5329a7e1ef3d138d5e2b29481b380d.tar.gz
libr-bead6a36fc5329a7e1ef3d138d5e2b29481b380d.zip
Conversion to CMake
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--.gitmodules3
-rw-r--r--CMakeLists.txt104
m---------cmake0
-rw-r--r--man/CMakeLists.txt26
-rw-r--r--src/CMakeLists.txt69
5 files changed, 202 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..5b98c56
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "cmake"]
+ path = cmake
+ url = http://system@scm.trinitydesktop.org/scm/git/tde-common-cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..6be35a1
--- /dev/null
+++ b/CMakeLists.txt
@@ -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()
+
diff --git a/cmake b/cmake
new file mode 160000
+Subproject 1994b808819fd74446cb8f1a0491b3e10244f46
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
new file mode 100644
index 0000000..599ee96
--- /dev/null
+++ b/man/CMakeLists.txt
@@ -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
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..7d54add
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -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
+)