From 8a2e76e9d039c7738c33f18f25342084f7458e5c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Nov 2011 20:25:58 -0600 Subject: [PATCH] Initial conversion to standard CMake system (cherry picked from commit b939a1459ef0e4eec6d8dd111baf8e022d1b46a0) --- CMakeLists.txt | 76 +++++++++++++++++++++++++++++ ConfigureChecks.cmake | 30 ++++++++++++ config.h.cmake | 6 +++ icons/CMakeLists.txt | 12 +++++ {src => icons}/hi64-app-abakus.png | Bin po/CMakeLists.txt | 17 +++++++ src/CMakeLists.txt | 49 +++++++++++++++++++ 7 files changed, 190 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 ConfigureChecks.cmake create mode 100644 config.h.cmake create mode 100644 icons/CMakeLists.txt rename {src => icons}/hi64-app-abakus.png (100%) create mode 100644 po/CMakeLists.txt create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..53b078d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,76 @@ +################################################# +# +# (C) 2011 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +cmake_minimum_required( VERSION 2.8 ) + + +##### general package setup ##################### + +project( abakus ) + + +##### include essential cmake modules ########### + +include( CheckCXXSourceCompiles ) +include( CheckFunctionExists ) +include( CheckIncludeFileCXX ) +include( CheckLibraryExists ) +include( CheckStructHasMember ) +include( CheckSymbolExists ) +include( CheckTypeSize ) +include( FindPkgConfig ) + + +##### include our cmake modules ################# + +set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) +include( TDEMacros ) + + +##### setup install paths ####################### + +include( TDESetupPaths ) +tde_setup_paths( ) + + +##### user requested modules #################### + +option( BUILD_ALL "Build all" OFF ) +option( BUILD_DOC "Build doc" ${BUILD_ALL} ) +option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} ) + + +##### configure checks ########################## + +include( ConfigureChecks.cmake ) + + +###### global compiler settings ################# + +add_definitions( + -DHAVE_CONFIG_H +) + +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) +set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) +set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" ) + + +##### source directories ######################## + +add_subdirectory( src ) +tde_conditional_add_subdirectory( BUILD_DOC doc ) +tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po ) + + +##### write configure files ##################### + +configure_file( config.h.cmake config.h @ONLY ) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100644 index 0000000..16f316d --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,30 @@ +################################################# +# +# (C) 2011 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +if( BUILD_TRANSLATIONS AND NOT DEFINED MSGFMT_EXECUTABLE ) + find_program( MSGFMT_EXECUTABLE msgfmt ) + if( NOT MSGFMT_EXECUTABLE ) + tde_message_fatal( "msgfmt program is required, but was not found on your system" ) + endif( ) +endif( ) + +check_type_size( "int" SIZEOF_INT BUILTIN_TYPES_ONLY ) +check_type_size( "long" SIZEOF_LONG BUILTIN_TYPES_ONLY ) + +check_include_file( stdint.h HAVE_STDINT_H ) +check_include_file( systems.h HAVE_SYSTEMS_H ) +check_include_file( linux/inotify.h HAVE_INOTIFY ) + +check_function_exists( statvfs HAVE_STATVFS ) + +# common required stuff +find_package( TQt ) +find_package( TDE ) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..5d4c19d --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,6 @@ +#cmakedefine SIZEOF_INT @SIZEOF_INT@ +#cmakedefine SIZEOF_LONG @SIZEOF_LONG@ +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_SYSTEMS_H 1 +#cmakedefine HAVE_STATVFS 1 +#cmakedefine HAVE_MPFR 1 \ No newline at end of file diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt new file mode 100644 index 0000000..fcacb7e --- /dev/null +++ b/icons/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################# +# +# (C) 2011 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_install_icons( ) diff --git a/src/hi64-app-abakus.png b/icons/hi64-app-abakus.png similarity index 100% rename from src/hi64-app-abakus.png rename to icons/hi64-app-abakus.png diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..23c62d8 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,17 @@ +################################################# +# +# (C) 2011 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} abakus.po ) + +foreach( _po ${po_files} ) + get_filename_component( _lang ${_po} PATH ) + tde_create_translation( FILES ${_po} LANG ${_lang} ) +endforeach( ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..e9581b3 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,49 @@ +################################################# +# +# (C) 2011 Timothy Pearson +# kb9vqf (AT) pearsoncomputing.net +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${TQT_INCLUDE_DIRS} + ${TDE_INCLUDE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/src + ${CMAKE_SOURCE_DIR}/src +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES abakus.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( FILES abakusui.rc DESTINATION ${DATA_INSTALL_DIR} ) + +##### abakus (executable) ####################### + +if( HAVE_MPFR ) + MPFR_SOURCES="hmath.cpp number.c" + MPFR_LIBRARIES="mpfr gmp" +endif( HAVE_MPFR ) + +tde_add_executable( abakus AUTOMOC + SOURCES abakus.cpp abakuslistview.cpp + dragsupport.cpp editor.cpp + evaluator.cpp function.cpp + lexer_lex.cpp mainwindow.cpp + node.cpp numerictypes.cpp + parser_yacc.cpp result.cpp + resultlistview.cpp resultlistviewtext.cpp + rpnmuncher.cpp valuemanager.cpp dcopIface.skel + ${MPFR_SOURCES} + LINK kio-shared kdecore-shared kdeprint-shared kdeui-shared DCOP-shared ${MPFR_LIBRARIES} + DESTINATION ${BIN_INSTALL_DIR} +)