diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f5d79d6 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,81 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( kchmviewer ) +set( VERSION R14.1.0 ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckFunctionExists ) +include( CheckSymbolExists ) +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} ) +option( WITH_TDE "Build with TDE itegration instead of standalone TQt" ${WITH_ALL_OPTIONS} ) +option( WITH_CHMLIB "Build with external chmlib" ${WITH_ALL_OPTIONS} ) + + +##### 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 -UTQT_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( lib ) +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..7ec4f10 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,51 @@ +########################################### +# # +# Improvements and feedback are welcome # +# # +# This file is released under GPL >= 3 # +# # +########################################### + +# required stuff +find_package( TQt ) +if( WITH_TDE ) + find_package( TDE ) +endif( ) + +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 ) + + +##### build with TDE integration + +if( WITH_TDE ) + set( USE_KDE 1 ) +endif( ) + + +##### check for chmlib + +if( WITH_CHMLIB ) + check_include_file( "chm_lib.h" CHMLIB_INCLUDE ) + find_library( CHMLIB_LIBRARIES NAMES chm ) + + if( NOT CHMLIB_LIBRARIES ) + tde_message_fatal( "extern chmlib has been requested but was not found on your system" ) + endif( NOT CHMLIB_LIBRARIES ) + set( USE_BUILTIN_CHMLIB 0 ) +else( ) + set( CHMLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/lib/chmlib ) + set( CHMLIB_LIBRARIES chm-static ) + set( USE_BUILTIN_CHMLIB 1 ) +endif( WITH_CHMLIB ) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..6ec66d5 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,16 @@ +#define VERSION "@VERSION@" +#define APP_NAME "@PROJECT_NAME@" +#define APP_VERSION "3.1" + +// 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@ + +/* Defined if build with TDE integration */ +#cmakedefine USE_KDE @USE_KDE@ + +/* Defined if you use the builtin chmlib */ +#cmakedefine USE_BUILTIN_CHMLIB @USE_BUILTIN_CHMLIB@ diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..185eab9 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory( man ) +tde_conditional_add_subdirectory( WITH_TDE en ) +tde_conditional_add_subdirectory( WITH_TDE tdeioslave ) 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/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt new file mode 100644 index 0000000..8512250 --- /dev/null +++ b/doc/man/CMakeLists.txt @@ -0,0 +1,5 @@ +INSTALL( + FILES ${PROJECT_NAME}.1 + DESTINATION ${MAN_INSTALL_DIR}/man1 + COMPONENT doc +) diff --git a/doc/man/kchmviewer.1 b/doc/man/kchmviewer.1 new file mode 100644 index 0000000..5994f53 --- /dev/null +++ b/doc/man/kchmviewer.1 @@ -0,0 +1,34 @@ +.\" Author: Jose Luis Tallon +.\" +.\" This is free software; you may redistribute it and/or modify +.\" it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2, +.\" or (at your option) any later version. +.\" +.\" This is distributed in the hope that it will be useful, but +.\" WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with the Debian GNU/Linux system; if not, write to the Free +.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +.\" 02111-1307 USA +.TH kchmviwer "1" "December 2005" +.SH NAME +kchmviewer \- Windows CHM viewer for TDE +.SH SYNOPSIS +kchmviewer +.SH DESCRIPTION +.B kchmviewer +makes it possible to browse native Windows CHM files under TDE. +.PP +Complete documentation can be found in docbook format in +/usr/share/doc/tde/HTML//kchmviewer/ on this system. +.SH AUTHOR + George Yunaev +.PP +This manual page was written by Jose Luis Tallon +.nh + +for the \fBDebian\fP system (but may be used by others). diff --git a/doc/tdeioslave/CMakeLists.txt b/doc/tdeioslave/CMakeLists.txt new file mode 100644 index 0000000..c938175 --- /dev/null +++ b/doc/tdeioslave/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( en ) diff --git a/doc/tdeioslave/en/CMakeLists.txt b/doc/tdeioslave/en/CMakeLists.txt new file mode 100644 index 0000000..a91f2c1 --- /dev/null +++ b/doc/tdeioslave/en/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( msits ) diff --git a/doc/tdeioslave/en/msits/CMakeLists.txt b/doc/tdeioslave/en/msits/CMakeLists.txt new file mode 100644 index 0000000..fcbaa9b --- /dev/null +++ b/doc/tdeioslave/en/msits/CMakeLists.txt @@ -0,0 +1 @@ +tde_create_handbook( DESTINATION tdeioslave/msits ) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000..bc085ac --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory( libchmfile ) +tde_conditional_add_subdirectory( USE_BUILTIN_CHMLIB chmlib ) +tde_conditional_add_subdirectory( WITH_TDE tdeio-msits ) diff --git a/lib/chmlib/CMakeLists.txt b/lib/chmlib/CMakeLists.txt new file mode 100644 index 0000000..738a4b5 --- /dev/null +++ b/lib/chmlib/CMakeLists.txt @@ -0,0 +1,22 @@ +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} +) + + +##### chm (static) + +tde_add_library( chm STATIC_PIC + + SOURCES + chm_lib.c + lzx.c +) diff --git a/lib/libchmfile/CMakeLists.txt b/lib/libchmfile/CMakeLists.txt new file mode 100644 index 0000000..b56565f --- /dev/null +++ b/lib/libchmfile/CMakeLists.txt @@ -0,0 +1,28 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CHMLIB_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### chmfile (static) + +tde_add_library( chmfile STATIC_PIC + + SOURCES + libchmfile.cpp + libchmfile_search.cpp + libchmfileimpl.cpp + libchmtextencoding.cpp + libchmtocimage.cpp + + DESTINATION ${LIB_INSTALL_DIR} +) diff --git a/lib/libchmfile/libchmfileimpl.cpp b/lib/libchmfile/libchmfileimpl.cpp index c8e8801..39268b0 100644 --- a/lib/libchmfile/libchmfileimpl.cpp +++ b/lib/libchmfile/libchmfileimpl.cpp @@ -27,7 +27,11 @@ #include #include "config.h" +#if USE_BUILTIN_CHMLIB #include "chm_lib.h" +#else +#include +#endif #include "bitfiddle.h" #include "libchmfile.h" #include "libchmurlfactory.h" diff --git a/lib/libchmfile/libchmfileimpl.h b/lib/libchmfile/libchmfileimpl.h index c6558f7..c0a606f 100644 --- a/lib/libchmfile/libchmfileimpl.h +++ b/lib/libchmfile/libchmfileimpl.h @@ -19,9 +19,11 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ - +#if USE_BUILTIN_CHMLIB #include "chm_lib.h" - +#else +#include +#endif #include "libchmfile.h" #include "libchmtocimage.h" diff --git a/lib/tdeio-msits/CMakeLists.txt b/lib/tdeio-msits/CMakeLists.txt new file mode 100644 index 0000000..3f61de2 --- /dev/null +++ b/lib/tdeio-msits/CMakeLists.txt @@ -0,0 +1,42 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CHMLIB_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/lib/libchmfile +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### tdeio_msits (kpart) + +tde_add_kpart( tdeio_msits + + SOURCES + msits.cpp + LINK + tdeio-shared + tdecore-shared + ${CHMLIB_LIBRARIES} + + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### other data + +install( + FILES msits.protocol + DESTINATION ${SERVICES_INSTALL_DIR} +) + +install( + FILES ${PROJECT_NAME}.desktop + DESTINATION ${APPS_INSTALL_DIR} +) diff --git a/lib/tdeio-msits/msits.cpp b/lib/tdeio-msits/msits.cpp index 28d2821..5a31c6c 100644 --- a/lib/tdeio-msits/msits.cpp +++ b/lib/tdeio-msits/msits.cpp @@ -40,7 +40,7 @@ using namespace TDEIO; extern "C" { - int kdemain( int argc, char **argv ) +KDE_EXPORT int kdemain( int argc, char **argv ) { kdDebug() << "*** tdeio_msits Init" << endl; diff --git a/lib/tdeio-msits/msits.h b/lib/tdeio-msits/msits.h index 4248908..6fb92f9 100644 --- a/lib/tdeio-msits/msits.h +++ b/lib/tdeio-msits/msits.h @@ -30,8 +30,11 @@ #include #include "config.h" +#if USE_BUILTIN_CHMLIB #include "chm_lib.h" - +#else +#include +#endif class ProtocolMSITS : public TDEIO::SlaveBase { diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..ad36a01 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,5 @@ +file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) + +if( _srcs ) + tde_create_translation( LANG auto OUTPUT_NAME ${PROJECT_NAME} ) +endif( ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..39704dd --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,77 @@ +add_subdirectory( pics ) +tde_conditional_add_subdirectory( WITH_TDE tde ) + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CHMLIB_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/lib/libchmfile + ${CMAKE_SOURCE_DIR}/src +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### kchmviewer (executable) + +if( WITH_TDE ) + set( BASE_LIBRARIES + tdecore-shared + tdeui-shared + tdeio-shared + tdehtml-shared + tdeparts-shared + ) + set( TDEEXTRA_LIBRARIES kdeextra-static ) +else( ) + set( BASE_LIBRARIES ${TQT_LIBRARIES} ) + set( TDEEXTRA_LIBRARIES "" ) +endif( ) + +tde_add_executable( ${PROJECT_NAME} AUTOMOC + + SOURCES + kchmsetupdialog.ui + iconstorage.cpp + kchmbookmarkwindow.cpp + kchmconfig.cpp + kchmindexwindow.cpp + kchmmainwindow.cpp + kchmsearchtoolbar.cpp + kchmsearchwindow.cpp + kchmsettings.cpp + kchmsourcefactory.cpp + kchmtreeviewitem.cpp + kchmviewwindow.cpp + main.cpp + kchmdialogchooseurlfromlist.cpp + tde-tqt.cpp + kchmviewwindow_qtextbrowser.cpp + kqtempfile.cpp + kchmnavtoolbar.cpp + kchmviewwindowmgr.cpp + kchmkeyeventfilter.cpp + kchmcontentswindow.cpp + kchmsearchengine_impl.cpp + kchmsearchengine.cpp + kchmsetupdialog_impl.cpp + LINK + ${BASE_LIBRARIES} + ${TDEEXTRA_LIBRARIES} + chmfile-static + ${CHMLIB_LIBRARIES} + + DESTINATION ${BIN_INSTALL_DIR} +) + + +##### icons + +tde_install_icons( ) + diff --git a/src/kchmsearchengine_impl.cpp b/src/kchmsearchengine_impl.cpp index 89db7e7..b57e029 100644 --- a/src/kchmsearchengine_impl.cpp +++ b/src/kchmsearchengine_impl.cpp @@ -570,3 +570,4 @@ bool Index::searchForPhrases( const TQStringList &phrases, const TQStringList &w }; +#include "kchmsearchengine_impl.moc" diff --git a/src/pics/CMakeLists.txt b/src/pics/CMakeLists.txt new file mode 100644 index 0000000..63f765b --- /dev/null +++ b/src/pics/CMakeLists.txt @@ -0,0 +1 @@ +tde_install_icons( ) diff --git a/src/tde/CMakeLists.txt b/src/tde/CMakeLists.txt new file mode 100644 index 0000000..9370944 --- /dev/null +++ b/src/tde/CMakeLists.txt @@ -0,0 +1,27 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/lib/libchmfile +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### kdeextra (static) + +tde_add_library( kdeextra STATIC_PIC AUTOMOC + + SOURCES + kchmdcopiface.skel + kchmdcopiface.cpp + kchmviewwindow_tdehtmlpart.cpp + + DESTINATION ${LIB_INSTALL_DIR} +)