From f84a48543b2471121d36334e094e0f85f9b9c431 Mon Sep 17 00:00:00 2001 From: gregory guy Date: Mon, 12 Oct 2020 15:43:57 +0200 Subject: Conversion to the cmake building system. Added man pages taken from the Debian packaging system. Move the ktechlab.desktop file into XDG_APPS_INSTALL_DIR directory, see TDE/tde#26 and bug 2408. Signed-off-by: gregory guy (cherry picked from commit a9c86866c380e503dd75797b5c2d129bfb622a9e) --- CMakeLists.txt | 83 +++++++++++++ ConfigureChecks.cmake | 124 +++++++++++++++++++ config.h.cmake | 26 ++++ doc/CMakeLists.txt | 34 ++++++ doc/man/CMakeLists.txt | 7 ++ doc/man/ktechlab.1 | 151 +++++++++++++++++++++++ doc/man/microbe.1 | 162 +++++++++++++++++++++++++ icons/CMakeLists.txt | 6 + icons/pics/CMakeLists.txt | 8 ++ microbe/CMakeLists.txt | 31 +++++ po/CMakeLists.txt | 14 +++ src/CMakeLists.txt | 100 +++++++++++++++ src/circuitview.cpp | 5 +- src/core/CMakeLists.txt | 31 +++++ src/core/main.cpp | 10 +- src/debugmanager.cpp | 2 + src/debugmanager.h | 2 + src/documentiface.h | 2 + src/drawparts/CMakeLists.txt | 25 ++++ src/electronics/CMakeLists.txt | 36 ++++++ src/electronics/components/CMakeLists.txt | 49 ++++++++ src/electronics/components/piccomponent.cpp | 2 + src/electronics/components/piccomponent.h | 2 + src/electronics/components/piccomponentpin.cpp | 2 + src/electronics/components/piccomponentpin.h | 2 + src/electronics/gpsimprocessor.cpp | 19 ++- src/electronics/gpsimprocessor.h | 2 + src/electronics/simulation/CMakeLists.txt | 29 +++++ src/flowparts/CMakeLists.txt | 35 ++++++ src/flowparts/sub.cpp | 3 - src/gui/CMakeLists.txt | 44 +++++++ src/gui/newfiledlg.cpp | 3 + src/gui/projectdlgs.cpp | 2 + src/gui/symbolviewer.h | 2 + src/itemdocument.cpp | 4 + src/itemdocumentdata.cpp | 2 + src/itemgroup.cpp | 1 + src/itemlibrary.cpp | 2 + src/ktechlab.cpp | 5 +- src/languages/CMakeLists.txt | 32 +++++ src/languages/asmparser.cpp | 5 +- src/mechanics/CMakeLists.txt | 25 ++++ src/micro/CMakeLists.txt | 23 ++++ src/microsettings.cpp | 2 + src/oscilloscopedata.cpp | 2 + src/textdocument.h | 3 + src/textview.cpp | 5 +- src/textview.h | 3 + src/variablelabel.cpp | 2 + src/variablelabel.h | 2 + 50 files changed, 1160 insertions(+), 13 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 ConfigureChecks.cmake create mode 100644 config.h.cmake create mode 100644 doc/CMakeLists.txt create mode 100644 doc/man/CMakeLists.txt create mode 100644 doc/man/ktechlab.1 create mode 100644 doc/man/microbe.1 create mode 100644 icons/CMakeLists.txt create mode 100644 icons/pics/CMakeLists.txt create mode 100644 microbe/CMakeLists.txt create mode 100644 po/CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/core/CMakeLists.txt create mode 100644 src/drawparts/CMakeLists.txt create mode 100644 src/electronics/CMakeLists.txt create mode 100644 src/electronics/components/CMakeLists.txt create mode 100644 src/electronics/simulation/CMakeLists.txt create mode 100644 src/flowparts/CMakeLists.txt create mode 100644 src/gui/CMakeLists.txt create mode 100644 src/languages/CMakeLists.txt create mode 100644 src/mechanics/CMakeLists.txt create mode 100644 src/micro/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..247022e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,83 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( ktechlab ) +set( VERSION R14.0.10 ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckFunctionExists ) +include( CheckSymbolExists ) +include( CheckIncludeFile ) +include( CheckIncludeFileCXX ) +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} ) +option( WITH_GPSIM "Enable gpsim support" ${WITH_ALL_OPTIONS} ) +option( WITH_MECHANICS "Enable mechanics support" OFF ) + + +##### user requested modules + +option( BUILD_ALL "Build all" ON ) +option( BUILD_DOC "Build documentation" ${BUILD_ALL} ) +option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} ) + + +##### configure checks + +include( ConfigureChecks.cmake ) + + +###### global compiler settings + +add_definitions( -DHAVE_CONFIG_H -UQT_NO_ASCII_CAST ) + +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) +set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) +set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ) + + +##### directories + +add_subdirectory( src ) +add_subdirectory( icons ) +add_subdirectory( microbe ) +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..c6003b0 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,124 @@ +########################################### +# # +# 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) + +tde_setup_largefiles( ) + + +##### check for gcc visibility support + +if( WITH_GCC_VISIBILITY ) + tde_setup_gcc_visibility( ) +endif( WITH_GCC_VISIBILITY ) + + +##### look for gpsim + +if( NOT WITH_GPSIM ) + set( NO_GPSIM 1 ) + else() + find_path( HAVE_GPSIM_INCLUDE "gpsim/cod.h" ) + find_library( HAVE_GPSIM_LIBRARY gpsim) + + if( (NOT HAVE_GPSIM_INCLUDE) OR (NOT HAVE_GPSIM_LIBRARY) ) + tde_message_fatal( "gpsim support have been requested but was not found on your system" ) + else() + set( GPSIM_INCLUDE_DIRS ${HAVE_GPSIM_INCLUDE} ) + set( GPSIM_LIBRARIES gpsim;gpsimcli ) + +##### glib-1.2 or glib-2.0 + + pkg_search_module( GLIB glib-2.0 glib ) + message( STATUS "glib version: ${GLIB_VERSION}" ) + + if( NOT GLIB_FOUND ) + tde_message_fatal( "glib is required but was not found on your system" ) + endif() + + tde_save( CMAKE_REQUIRED_INCLUDES ) + set( CMAKE_REQUIRED_INCLUDES ${GLIB_INCLUDE_DIRS} ${GPSIM_INCLUDE_DIRS}) + +##### check for gpsim version + + check_cxx_source_compiles( " + #include + #include + #include + #include + void func() + { + (void)cycles; + (void)initialize_gpsim_core(); + (void)load_symbol_file(0,0); + } + int main() + { + return 0; + } " + GPSIM_0_21_4 + ) + + check_cxx_source_compiles( " + #include + #include + #include + #include + #include + #include + void func() + { + (void)cycles; + (void)initialize_gpsim_core(); + } + int main() + { + return 0; + } " + GPSIM_0_21_11 + ) + + check_cxx_source_compiles( " + #include + int main() + { + return 0; + } " + GPSIM_0_21_12 + ) + + check_cxx_source_compiles( " + #include + void func() + { + pic_processor *Processor; + sizeof(Processor->Wreg); + } + int main() + { + return 0; + } " + GPSIM_0_27_0 + ) + tde_restore( CMAKE_REQUIRED_INCLUDES ) + endif((NOT HAVE_GPSIM_INCLUDE) OR (NOT HAVE_GPSIM_LIBRARY)) +endif( NOT WITH_GPSIM ) + + +##### mechanics + +if( WITH_MECHANICS ) + set( MECHANICS 1 ) +endif() diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..5a37c00 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,26 @@ +#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@ + +/* build with gpsim-0.21.4 support */ +#cmakedefine GPSIM_0_21_4 1 + +/* build with gpsim-0.21.11 support */ +#cmakedefine GPSIM_0_21_11 1 + +/* build with gpsim-0.21.12 support */ +#cmakedefine GPSIM_0_21_12 1 + +/* build with gpsim-0.27 support */ +#cmakedefine GPSIM_0_27_0 1 + +/* build without gpsim support */ +#cmakedefine NO_GPSIM 1 + +/* build with mechanics support */ +#cmakedefine MECHANICS 1 diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..f6eec15 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,34 @@ +file( GLOB _dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} * ) +list( REMOVE_ITEM _dirs html man ) + +string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" ) + +foreach( _dir IN LISTS _dirs ) + if( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} + AND ( "${_dir}" STREQUAL "en" OR + "${_linguas}" MATCHES "^;*$" OR + ";${_linguas};" MATCHES ";${_dir};" )) + file( GLOB _doc_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${_dir} ${_dir}/*.docbook ) + if( _doc_files ) + list( FIND _doc_files "index.docbook" _find_index ) + if( -1 EQUAL _find_index ) + set( _noindex "NOINDEX" ) + else() + unset( _noindex ) + endif() + tde_create_handbook( + SOURCE_BASEDIR ${_dir} + ${_noindex} + LANG ${_dir} + DESTINATION ${PROJECT_NAME} + ) + endif() + endif() +endforeach() + +if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/html/CMakeLists.txt ) + add_subdirectory( html ) +endif() +if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/man/CMakeLists.txt ) + add_subdirectory( man ) +endif() diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt new file mode 100644 index 0000000..5c8c2e4 --- /dev/null +++ b/doc/man/CMakeLists.txt @@ -0,0 +1,7 @@ +##### man pages + +INSTALL( + FILES ${PROJECT_NAME}.1 microbe.1 + DESTINATION ${MAN_INSTALL_DIR}/man1 + COMPONENT doc +) diff --git a/doc/man/ktechlab.1 b/doc/man/ktechlab.1 new file mode 100644 index 0000000..bb49c1d --- /dev/null +++ b/doc/man/ktechlab.1 @@ -0,0 +1,151 @@ +.\" This file was generated by kdemangen.pl +.TH KTECHLAB 1 "Jan 2006" "Trinity Desktop Environment" "An IDE for microcontrollers and electronics" +.SH NAME +ktechlab +\- An IDE for microcontrollers and electronics +.SH SYNOPSIS +ktechlab [Qt\-options] [TDE\-options] [URL] +.SH DESCRIPTION +An IDE for microcontrollers and electronics +.SH OPTIONS +.SS +.SS Arguments: +.TP +.B URL +Document to open. +.SS Generic options: +.TP +.B \-\-help +Show help about options +.TP +.B \-\-help\-qt +Show Qt specific options +.TP +.B \-\-help\-tde +Show TDE specific options +.TP +.B \-\-help\-all +Show all options +.TP +.B \-\-author +Show author information +.TP +.B \-v, \-\-version +Show version information +.TP +.B \-\-license +Show license information +.TP +.B \-\- +End of options +.SS +.SS TDE options: +.TP +.B \-\-caption +Use 'caption' as name in the titlebar +.TP +.B \-\-icon +Use 'icon' as the application icon +.TP +.B \-\-miniicon +Use 'icon' as the icon in the titlebar +.TP +.B \-\-config +Use alternative configuration file +.TP +.B \-\-dcopserver +Use the DCOP Server specified by 'server' +.TP +.B \-\-nocrashhandler +Disable crash handler, to get core dumps +.TP +.B \-\-waitforwm +Waits for a WM_NET compatible windowmanager +.TP +.B \-\-style