From 08e08ddd20884087fa7b706d2d6856bd7d8df671 Mon Sep 17 00:00:00 2001 From: gregory guy Date: Sun, 21 Oct 2018 13:49:33 +0200 Subject: conversion to the cmake building system Signed-off-by: gregory guy --- CMakeLists.txt | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ ConfigureChecks.cmake | 45 +++++++++++++++++++++++++++++ config.h.cmake | 8 ++++++ doc/CMakeLists.txt | 1 + doc/en/CMakeLists.txt | 1 + src/CMakeLists.txt | 68 +++++++++++++++++++++++++++++++++++++++++++ src/commonwidget.cpp | 2 ++ src/compoundwidget.cpp | 2 ++ src/htmlwidget.cpp | 2 ++ src/indexwidget.cpp | 2 ++ src/loggingoptions.cpp | 2 ++ src/mainwidget.cpp | 2 ++ src/outputwidget.cpp | 2 ++ src/pandsoptions.cpp | 2 ++ src/profiledialog.cpp | 2 ++ src/scannamedialog.cpp | 2 ++ src/scanstack.cpp | 2 ++ src/scanwidget.cpp | 2 ++ src/simpleoptions.cpp | 2 ++ src/stylesheetdialog.cpp | 2 ++ src/timingwidget.cpp | 2 ++ src/whatsthis.cpp | 2 ++ 22 files changed, 230 insertions(+) create mode 100755 CMakeLists.txt create mode 100755 ConfigureChecks.cmake create mode 100755 config.h.cmake create mode 100644 doc/CMakeLists.txt create mode 100644 doc/en/CMakeLists.txt create mode 100644 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..f9df110 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,75 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( knmap ) +set( VERSION R14.1.0 ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckFunctionExists ) +include( CheckIncludeFile ) +include( CheckLibraryExists ) +include( CheckCSourceCompiles ) +include( CheckCXXSourceCompiles ) + + +#### 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_ALL_OPTIONS "Enable all optional support" OFF ) +option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) + + +##### user requested modules + +option( BUILD_ALL "Build all" ON ) +option( BUILD_DOC "Build documentation" ${BUILD_ALL} ) + + +##### configure checks + +include( ConfigureChecks.cmake ) + + +###### global compiler settings + +add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST -UTQT_NO_COMPAT ) + +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" ) + + +##### directories + +add_subdirectory( src ) +tde_conditional_add_subdirectory( BUILD_DOC doc ) + + +##### write configure files + +configure_file( config.h.cmake config.h @ONLY ) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100755 index 0000000..7733a2a --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,45 @@ +########################################### +# # +# Improvements and feedback are welcome # +# # +# This file is released under GPL >= 3 # +# # +########################################### + + +# required stuff +find_package( TQt ) +find_package( TDE ) + +tde_setup_architecture_flags( ) + +include(TestBigEndian) +test_big_endian(WORDS_BIGENDIAN) + + +##### check for gcc visibility support + +if( WITH_GCC_VISIBILITY ) + if( NOT UNIX ) + tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" ) + endif( NOT UNIX ) + set( __KDE_HAVE_GCC_VISIBILITY 1 ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") +endif( WITH_GCC_VISIBILITY ) + + +##### gettext + +if( BUILD_TRANSLATIONS ) + include( FindGettext ) + if( GETTEXT_FOUND ) + set( MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT_EXECUTABLE} + CACHE FILEPATH "path to msgfmt executable" ) + endif( GETTEXT_FOUND ) + + if( NOT MSGFMT_EXECUTABLE ) + tde_message_fatal( "msgfmt is required but was not found on your system." ) + endif( NOT MSGFMT_EXECUTABLE ) +endif( BUILD_TRANSLATIONS ) + diff --git a/config.h.cmake b/config.h.cmake new file mode 100755 index 0000000..61ede3a --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,8 @@ +#define VERSION "@VERSION@" + +// Defined if you have fvisibility and fvisibility-inlines-hidden support. +#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..c938175 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( en ) diff --git a/doc/en/CMakeLists.txt b/doc/en/CMakeLists.txt new file mode 100644 index 0000000..ba3ef3e --- /dev/null +++ b/doc/en/CMakeLists.txt @@ -0,0 +1 @@ +tde_create_handbook( DESTINATION ${PROJECT_NAME} ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..bf1ca8a --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,68 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### knmap (executable) + +tde_add_executable( ${PROJECT_NAME} AUTOMOC + + SOURCES + main.cpp + knmap.cpp + mainwidget.cpp + outputwidget.cpp + commonwidget.cpp + timingwidget.cpp + compoundwidget.cpp + htmlwidget.cpp + stylesheetdialog.cpp + profiledialog.cpp + loggingoptions.cpp + simpleoptions.cpp + pandsoptions.cpp + whatsthis.cpp + tabwidgetptrlist.cpp + tabwidgetdata.cpp + scanwidget.cpp + indexwidget.cpp + scannamedialog.cpp + scanstack.cpp + scanmonitor.cpp + scanmonitorevent.cpp + nmapoutputbuffer.cpp + LINK + tdeio-shared + tdehtml-shared + tdeui-shared + tdecore-shared + + DESTINATION ${BIN_INSTALL_DIR} +) + + +##### icons + +tde_install_icons( ) + + +##### other data + +install( + FILES knmapui.rc nmap_manpage.html nmap_manpage.html.diff + DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME} +) + +install( + FILES ${PROJECT_NAME}.desktop + DESTINATION ${APPS_INSTALL_DIR}/Internet +) diff --git a/src/commonwidget.cpp b/src/commonwidget.cpp index 7a5eaf7..2ce9253 100644 --- a/src/commonwidget.cpp +++ b/src/commonwidget.cpp @@ -653,3 +653,5 @@ bool CommonWidget::validatePortRangeText( TQString& text, uint& portFirst, uint& return true; } + +#include "commonwidget.moc" diff --git a/src/compoundwidget.cpp b/src/compoundwidget.cpp index 40b16fc..66ba7b7 100644 --- a/src/compoundwidget.cpp +++ b/src/compoundwidget.cpp @@ -680,3 +680,5 @@ void CompoundWidget::slotWhatsThisClicked( ) else if( m_ttlSpinBox->hasMouse( )) emit( displayHelp( "--ttl" )); else emit( displayUnknown( )); } + +#include "compoundwidget.moc" diff --git a/src/htmlwidget.cpp b/src/htmlwidget.cpp index 689f363..670de85 100644 --- a/src/htmlwidget.cpp +++ b/src/htmlwidget.cpp @@ -364,3 +364,5 @@ void HTMLWidget::zoomOut( ) m_htmlPart->setZoomFactor( int( m_zoomFactor )); emit( optionsDirty( )); } + +#include "htmlwidget.moc" diff --git a/src/indexwidget.cpp b/src/indexwidget.cpp index c223186..18cfa7e 100644 --- a/src/indexwidget.cpp +++ b/src/indexwidget.cpp @@ -271,3 +271,5 @@ void IndexWidget::slotScanStopped( ScanWidget* scanWidget ) delete m_blinkTimer; m_blinkTimer = NULL; } + +#include "indexwidget.moc" diff --git a/src/loggingoptions.cpp b/src/loggingoptions.cpp index 33ba892..6c36ccc 100644 --- a/src/loggingoptions.cpp +++ b/src/loggingoptions.cpp @@ -458,3 +458,5 @@ void LoggingOptions::slotXMLLogCheckBoxClicked( ) { m_xmlLogButton->setEnabled( m_xmlLogCheckBox->isChecked( )); m_xmlLogLineEdit->setEnabled( m_xmlLogCheckBox->isChecked( )); } + +#include "loggingoptions.moc" diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index 6f235e2..a6edc9d 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -461,3 +461,5 @@ void MainWidget::slotZoomIn( ) void MainWidget::slotZoomOut( ) { m_htmlWidget->zoomOut( ); } + +#include "mainwidget.moc" diff --git a/src/outputwidget.cpp b/src/outputwidget.cpp index 3fe0d02..d5a5399 100644 --- a/src/outputwidget.cpp +++ b/src/outputwidget.cpp @@ -172,3 +172,5 @@ void OutputWidget::slotUpdateStatusBarText( ) emit( statusBarText( TQString( "Output: %1 lines (%2)" ).arg( TQString::number( paragraphs( ) - 1 )).arg( dataBytes ))); } + +#include "outputwidget.moc" diff --git a/src/pandsoptions.cpp b/src/pandsoptions.cpp index 5b663b6..b98e39f 100644 --- a/src/pandsoptions.cpp +++ b/src/pandsoptions.cpp @@ -413,3 +413,5 @@ void PAndSOptions::slotWhatsThisClicked( ) else if( m_timestampCheckBox->hasMouse( )) emit( displayHelp( "-PP" )); else emit( displayUnknown( )); } + +#include "pandsoptions.moc" diff --git a/src/profiledialog.cpp b/src/profiledialog.cpp index 40eb2dd..2842c6d 100644 --- a/src/profiledialog.cpp +++ b/src/profiledialog.cpp @@ -323,3 +323,5 @@ void ProfileDialog::slotRename( ) TQString ProfileDialog::stripPrefix( const TQString& profileName ) const { return profileName.right( profileName.length( ) - strlen( PROFILE_PREFIX )); } + +#include "profiledialog.moc" diff --git a/src/scannamedialog.cpp b/src/scannamedialog.cpp index 1af3d80..65e05cd 100644 --- a/src/scannamedialog.cpp +++ b/src/scannamedialog.cpp @@ -100,3 +100,5 @@ void ScanNameDialog::slotUseHostNameToggled( bool on ) if( !on ) m_scanNameEdit->setFocus( ); } + +#include "scannamedialog.moc" diff --git a/src/scanstack.cpp b/src/scanstack.cpp index f3fbdce..12d623c 100644 --- a/src/scanstack.cpp +++ b/src/scanstack.cpp @@ -192,3 +192,5 @@ void ScanStack::wrapText( const bool wrap ) for( resetScanWidgets( i ); moreScanWidgets( i ); nextScanWidget( i )) currentScanWidget( i )->wrapText( wrap ); } + +#include "scanstack.moc" diff --git a/src/scanwidget.cpp b/src/scanwidget.cpp index 7f8c382..d8fe67c 100644 --- a/src/scanwidget.cpp +++ b/src/scanwidget.cpp @@ -1059,3 +1059,5 @@ void ScanWidget::useTargetHost( const bool b ) void ScanWidget::wrapText( const bool wrap ) { m_outputWidget->setWordWrap( wrap ? TQTextEdit::WidgetWidth : TQTextEdit::NoWrap ); } + +#include "scanwidget.moc" diff --git a/src/simpleoptions.cpp b/src/simpleoptions.cpp index 547ce1f..08980b2 100644 --- a/src/simpleoptions.cpp +++ b/src/simpleoptions.cpp @@ -245,3 +245,5 @@ void SimpleOptions::slotWhatsThisClicked( ) else if( m_verboseCheckBox->hasMouse( )) emit( displayHelp( "-v" )); else emit( displayUnknown( )); } + +#include "simpleoptions.moc" diff --git a/src/stylesheetdialog.cpp b/src/stylesheetdialog.cpp index da242a0..3e3a6cf 100644 --- a/src/stylesheetdialog.cpp +++ b/src/stylesheetdialog.cpp @@ -126,3 +126,5 @@ void StylesheetDialog::slotURLListBoxDoubleClicked( TQListBoxItem* item ) { m_urlLineEdit->setText( item->text( )); slotOk( ); } + +#include "stylesheetdialog.moc" diff --git a/src/timingwidget.cpp b/src/timingwidget.cpp index 3defb03..a864b99 100644 --- a/src/timingwidget.cpp +++ b/src/timingwidget.cpp @@ -662,3 +662,5 @@ void TimingWidget::slotWhatsThisClicked( ) else if( m_sneakyRadio->hasMouse( )) emit( displayHelp( "-T" )); else emit( displayUnknown( )); } + +#include "timingwidget.moc" diff --git a/src/whatsthis.cpp b/src/whatsthis.cpp index cb0e540..d9fa073 100644 --- a/src/whatsthis.cpp +++ b/src/whatsthis.cpp @@ -40,3 +40,5 @@ TQString WhatsThis::text( const TQPoint& /*pos */) { emit( clicked( )); return ""; } + +#include "whatsthis.moc" -- cgit v1.2.3