summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-10-31 22:50:43 +0900
committerMichele Calgaro <[email protected]>2024-11-12 08:45:45 +0900
commit2c316e3037228223164adf5cd3446cf47f1744a4 (patch)
treeaf6e77666ad71fef428f47d93c45bc8d5893308d
parent83ad5951652a1e115427d48ceaa6a2885740b4e8 (diff)
downloadkrecipes-2c316e3037228223164adf5cd3446cf47f1744a4.tar.gz
krecipes-2c316e3037228223164adf5cd3446cf47f1744a4.zip
CMake conversion
Signed-off-by: Michele Calgaro <[email protected]>
-rw-r--r--CMakeLists.txt91
-rw-r--r--ConfigureChecks.cmake116
-rw-r--r--config.h.cmake17
-rw-r--r--data/CMakeLists.txt9
-rw-r--r--icons/CMakeLists.txt1
-rw-r--r--icons/actions/CMakeLists.txt1
-rw-r--r--icons/mime/CMakeLists.txt1
-rw-r--r--layouts/CMakeLists.txt4
-rw-r--r--pics/CMakeLists.txt6
-rw-r--r--src/CMakeLists.txt61
-rw-r--r--src/backends/CMakeLists.txt31
-rw-r--r--src/backends/MySQL/CMakeLists.txt12
-rw-r--r--src/backends/PostgreSQL/CMakeLists.txt16
-rw-r--r--src/backends/SQLite/CMakeLists.txt13
-rw-r--r--src/datablocks/CMakeLists.txt16
-rw-r--r--src/dialogs/CMakeLists.txt38
-rw-r--r--src/exporters/CMakeLists.txt14
-rw-r--r--src/importers/CMakeLists.txt13
-rw-r--r--src/widgets/CMakeLists.txt22
19 files changed, 482 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..e79b122
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,91 @@
+############################################
+# #
+# Improvements and feedbacks are welcome #
+# #
+# This file is released under GPL >= 3 #
+# #
+############################################
+
+
+##### set project version ########################
+
+include( TDEVersion )
+cmake_minimum_required( VERSION ${TDE_CMAKE_MINIMUM_VERSION} )
+tde_set_project_version( )
+
+
+#### general package setup
+
+project( krecipes )
+
+
+#### include essential cmake modules
+
+include( FindPkgConfig )
+include( CheckSymbolExists )
+include( CheckIncludeFile )
+include( CheckLibraryExists )
+include( CheckCSourceCompiles )
+include( CheckCXXSourceCompiles )
+
+
+#### include our 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_MYSQL "Build MySQL backend support" ${WITH_ALL_OPTIONS} )
+option( WITH_POSTGRESQL "Build PostgreSQL backend support" ${WITH_ALL_OPTIONS} )
+option( WITH_SQLITE3 "Build SQLite3 backend support" ${WITH_ALL_OPTIONS} )
+
+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} )
+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 "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
+set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
+
+
+##### directories
+
+add_subdirectory( data )
+add_subdirectory( icons )
+add_subdirectory( layouts )
+add_subdirectory( pics )
+add_subdirectory( src )
+
+
+##### other data ################################
+
+tde_conditional_add_project_docs( BUILD_DOC )
+tde_conditional_add_project_translations( BUILD_TRANSLATIONS )
+
+
+##### 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..689831d
--- /dev/null
+++ b/ConfigureChecks.cmake
@@ -0,0 +1,116 @@
+###########################################
+# #
+# 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 )
+
+
+##### Make sure at least a DB backend is selected
+
+if ( NOT WITH_MYSQL AND NOT WITH_POSTGRESQL AND NOT WITH_SQLITE3 )
+ tde_message_fatal( "No DB backend selected. Building cannot continue" )
+endif( )
+
+
+#### check for MySQL or MariaDB
+
+if( WITH_MYSQL )
+
+ message( STATUS "Check for MariaDB or MySQL" )
+ find_program( MYSQL_CONFIG NAMES mariadb_config mysql_config )
+ if( NOT MYSQL_CONFIG )
+ tde_message_fatal( "MySQL support was requested but neither MySQL nor MariaDB have been found on your system" )
+ endif()
+
+ macro( _mysql_config __type __var )
+ execute_process(
+ COMMAND ${MYSQL_CONFIG} --${__type}
+ OUTPUT_VARIABLE ${__var}
+ RESULT_VARIABLE __result
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+ if( _result )
+ tde_message_fatal( "Unable to run ${MYSQL_CONFIG}!" )
+ endif()
+ endmacro()
+
+ _mysql_config( include MYSQL_INCLUDE_DIRS )
+ _mysql_config( libs MYSQL_LIBRARIES )
+
+ if( MYSQL_INCLUDE_DIRS )
+ string( REGEX REPLACE "(^| +)-I" ";" MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" )
+ endif()
+
+ if( MYSQL_LIBRARIES )
+ string( REGEX REPLACE "(^| +)-l" ";" MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" )
+ endif( )
+
+ set( MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
+ set( MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" CACHE INTERNAL "" FORCE )
+
+ message( STATUS " includes ${MYSQL_INCLUDE_DIRS}")
+ message( STATUS " libraries ${MYSQL_LIBRARIES}")
+ set( HAVE_MYSQL 1 )
+
+endif( WITH_MYSQL )
+
+
+##### check for PostgreSQL
+if( WITH_POSTGRESQL )
+
+ message( STATUS "Check for PostgreSQL" )
+ find_package( PostgreSQL )
+
+ if( PostgreSQL_INCLUDE_DIR AND PostgreSQL_LIBRARY )
+ message( STATUS " includes ${PostgreSQL_INCLUDE_DIR}")
+ message( STATUS " library ${PostgreSQL_LIBRARY}")
+ set( HAVE_POSTGRESQL 1 )
+ else()
+ pkg_search_module( LIBPQ libpq )
+
+ if( NOT LIBPQ_FOUND )
+ tde_message_fatal( "PostgreSQL support was requested but Postgresql was not found on your system." )
+ endif()
+
+ set( PostgreSQL_INCLUDE_DIR "${LIBPQ_INCLUDE_DIRS}" )
+ set( PostgreSQL_LIBRARY "${LIBPQ_LIBRARIES}" )
+ set( PostgreSQL_LIBRARY_DIRS "${LIBPQ_LIBRARY_DIRS}" )
+ set( HAVE_POSTGRESQL 1 )
+ endif()
+
+endif( WITH_POSTGRESQL )
+
+
+##### check for SQLite3
+
+if( WITH_SQLITE3 )
+
+ pkg_search_module( SQLITE3 sqlite3 )
+ if( NOT SQLITE3_FOUND )
+ tde_message_fatal( "SQLite3 was requested but not found on your system" )
+ endif( )
+
+ message( STATUS "sqlite3 linking: ${SQLITE3_LIBRARIES}" )
+ set( HAVE_SQLITE3 1 )
+
+endif( WITH_SQLITE3 )
diff --git a/config.h.cmake b/config.h.cmake
new file mode 100644
index 0000000..d531dac
--- /dev/null
+++ b/config.h.cmake
@@ -0,0 +1,17 @@
+#define VERSION "@VERSION@"
+
+// Defined if you have fvisibility and fvisibility-inlines-hidden support.
+#cmakedefine __TDE_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@
+
+// Define if MySQL or MariaDB was found
+#cmakedefine HAVE_MYSQL 1
+
+// Define if Postgresql was found
+#cmakedefine HAVE_POSTGRESQL 1
+
+// Define if SQLite3 was found
+#cmakedefine HAVE_SQLITE3 1
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
new file mode 100644
index 0000000..a6b993a
--- /dev/null
+++ b/data/CMakeLists.txt
@@ -0,0 +1,9 @@
+install(
+ FILES abbrev.txt data.sql samples-cs_CZ.kreml samples-en_US.kreml weight.txt
+ DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/data
+)
+
+tde_create_translated_desktop(
+ SOURCE x-krecipes-backup.desktop x-krecipes-recipes.desktop
+ DESTINATION ${MIME_INSTALL_DIR}/application
+)
diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt
new file mode 100644
index 0000000..42b186a
--- /dev/null
+++ b/icons/CMakeLists.txt
@@ -0,0 +1 @@
+tde_auto_add_subdirectories()
diff --git a/icons/actions/CMakeLists.txt b/icons/actions/CMakeLists.txt
new file mode 100644
index 0000000..e1d311b
--- /dev/null
+++ b/icons/actions/CMakeLists.txt
@@ -0,0 +1 @@
+tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/icons )
diff --git a/icons/mime/CMakeLists.txt b/icons/mime/CMakeLists.txt
new file mode 100644
index 0000000..4326a2c
--- /dev/null
+++ b/icons/mime/CMakeLists.txt
@@ -0,0 +1 @@
+tde_install_icons( DESTINATION ${SHARE_INSTALL_PREFIX}/icons )
diff --git a/layouts/CMakeLists.txt b/layouts/CMakeLists.txt
new file mode 100644
index 0000000..25b5172
--- /dev/null
+++ b/layouts/CMakeLists.txt
@@ -0,0 +1,4 @@
+install(
+ FILES Blue.klo Default.klo Default.template Two_Column.template
+ DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/layouts
+)
diff --git a/pics/CMakeLists.txt b/pics/CMakeLists.txt
new file mode 100644
index 0000000..8f904f3
--- /dev/null
+++ b/pics/CMakeLists.txt
@@ -0,0 +1,6 @@
+file( GLOB _pics *.png )
+
+install(
+ FILES ${_pics}
+ DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/pics
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..5634bb3
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,61 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${TQT_INCLUDE_DIRS}
+ ${TDE_INCLUDE_DIR}
+)
+
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+ ${TDE_LIB_DIR}
+)
+
+##### subfolders
+
+add_subdirectory( backends )
+add_subdirectory( datablocks )
+add_subdirectory( dialogs )
+add_subdirectory( exporters )
+add_subdirectory( importers )
+add_subdirectory( widgets )
+
+
+##### krecipes (executable)
+
+tde_add_executable( krecipes AUTOMOC
+ SOURCES
+ main.cpp krecipes.cpp krecipesview.cpp pref.cpp
+ krecipesiface.skel krecipesdbiface.skel
+ propertycalculator.cpp setupwizard.cpp
+ shoppingcalculator.cpp kstartuplogo.cpp
+ recipeactionshandler.cpp recipefilter.cpp
+ convert_sqlite3.cpp klomanager.cpp
+ LINK
+ krecipesdbs-static krecipesexporters-static krecipesimporters-static
+ krecipesdialogs-static krecipeswidgets-static datablocks-static
+ tdecore-shared tdeui-shared tdeio-shared tdeparts-shared
+ tdefx-shared tdehtml-shared DCOP-shared
+ DESTINATION ${BIN_INSTALL_DIR}
+)
+
+
+##### other files
+
+install(
+ FILES krecipes.xpm
+ DESTINATION ${SHARE_INSTALL_PREFIX}/pixmaps
+)
+
+install(
+ FILES krecipesui.rc
+ DESTINATION ${DATA_INSTALL_DIR}/krecipes
+)
+
+tde_create_translated_desktop(
+ SOURCE krecipes.desktop
+ DESTINATION ${XDG_APPS_INSTALL_DIR}
+)
+
+tde_install_icons( DESTINATION ${SHARE_INSTALL_PREFIX}/icons )
diff --git a/src/backends/CMakeLists.txt b/src/backends/CMakeLists.txt
new file mode 100644
index 0000000..42ba0e8
--- /dev/null
+++ b/src/backends/CMakeLists.txt
@@ -0,0 +1,31 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+##### subfolders
+
+tde_conditional_add_subdirectory( WITH_MYSQL MySQL )
+tde_conditional_add_subdirectory( WITH_POSTGRESQL PostgreSQL )
+tde_conditional_add_subdirectory( WITH_SQLITE3 SQLite )
+
+
+##### krecipesdbs (static)
+
+# backend libraries list
+set( BACKEND_LIBRARIES "" )
+if( WITH_MYSQL )
+ list( APPEND BACKEND_LIBRARIES "krecmysql-static" )
+endif( )
+if( WITH_POSTGRESQL )
+ list( APPEND BACKEND_LIBRARIES "krecpsql-static" )
+endif( )
+if( WITH_SQLITE3 )
+ list( APPEND BACKEND_LIBRARIES "krecsqlite-static" )
+endif( )
+
+tde_add_library( krecipesdbs STATIC_PIC AUTOMOC
+ SOURCES recipedb.cpp qsqlrecipedb.cpp progressinterface.cpp
+ LINK ${BACKEND_LIBRARIES}
+)
diff --git a/src/backends/MySQL/CMakeLists.txt b/src/backends/MySQL/CMakeLists.txt
new file mode 100644
index 0000000..60d9a0c
--- /dev/null
+++ b/src/backends/MySQL/CMakeLists.txt
@@ -0,0 +1,12 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+##### krecmysql (static)
+
+tde_add_library( krecmysql STATIC_PIC AUTOMOC
+ SOURCES mysqlrecipedb.cpp
+ LINK krecipesdbs-static ${MYSQL_LIBRARIES}
+)
diff --git a/src/backends/PostgreSQL/CMakeLists.txt b/src/backends/PostgreSQL/CMakeLists.txt
new file mode 100644
index 0000000..fa825e0
--- /dev/null
+++ b/src/backends/PostgreSQL/CMakeLists.txt
@@ -0,0 +1,16 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+link_directories(
+ ${LIBPQ_LIBRARY_DIRS}
+)
+
+##### krecpsql (static)
+
+tde_add_library( krecpsql STATIC_PIC AUTOMOC
+ SOURCES psqlrecipedb.cpp
+ LINK krecipesdbs-static ${LIBPQ_LIBRARIES}
+)
+
diff --git a/src/backends/SQLite/CMakeLists.txt b/src/backends/SQLite/CMakeLists.txt
new file mode 100644
index 0000000..c039413
--- /dev/null
+++ b/src/backends/SQLite/CMakeLists.txt
@@ -0,0 +1,13 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+##### krecsqlite (static)
+
+tde_add_library( krecsqlite STATIC_PIC AUTOMOC
+ SOURCES literecipedb.cpp
+ LINK krecipesdbs-static ${SQLITE3_LIBRARIES}
+)
+
diff --git a/src/datablocks/CMakeLists.txt b/src/datablocks/CMakeLists.txt
new file mode 100644
index 0000000..73612f2
--- /dev/null
+++ b/src/datablocks/CMakeLists.txt
@@ -0,0 +1,16 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+##### datablocks (static)
+
+tde_add_library( datablocks STATIC_PIC AUTOMOC
+ SOURCES
+ recipelist.cpp constraintlist.cpp categorytree.cpp kreborder.cpp
+ recipe.cpp ingredient.cpp ingredientlist.cpp elementlist.cpp
+ element.cpp ingredientproperty.cpp ingredientpropertylist.cpp
+ unit.cpp unitratio.cpp unitratiolist.cpp mixednumber.cpp rating.cpp
+ weight.cpp
+)
diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt
new file mode 100644
index 0000000..cc48e9c
--- /dev/null
+++ b/src/dialogs/CMakeLists.txt
@@ -0,0 +1,38 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+##### krecipesdialogs (static)
+
+tde_add_library( krecipesdialogs STATIC_PIC AUTOMOC
+ SOURCES
+ advancedsearchdialog.cpp recipeimportdialog.cpp
+ dietwizarddialog.cpp recipeinputdialog.cpp
+ recipeviewdialog.cpp selectrecipedialog.cpp
+ ingredientsdialog.cpp selectunitdialog.cpp
+ createelementdialog.cpp propertiesdialog.cpp
+ createpropertydialog.cpp selectpropertydialog.cpp
+ unitsdialog.cpp dependanciesdialog.cpp
+ shoppinglistdialog.cpp shoppinglistviewdialog.cpp
+ selectcategoriesdialog.cpp categorieseditordialog.cpp
+ authorsdialog.cpp selectauthorsdialog.cpp
+ resizerecipedialog.cpp
+ dietviewdialog.cpp ingredientmatcherdialog.cpp
+ usdadatadialog.cpp prepmethodsdialog.cpp
+ createcategorydialog.cpp borderdialog.cpp
+ refineshoppinglistdialog.cpp pagesetupdialog.cpp
+ dbimportdialog.cpp createunitdialog.cpp
+ setupdisplay.cpp
+ ingredientparserdialog.cpp ingredientgroupsdialog.cpp
+ editratingdialog.cpp similarcategoriesdialog.cpp
+ conversiondialog.cpp createingredientweightdialog.cpp
+ recipeprintpreview.cpp
+)
+
+set_property(
+ SOURCE recipeinputdialog.cpp
+ APPEND PROPERTY OBJECT_DEPENDS
+ ${CMAKE_BINARY_DIR}/src/widgets/ratingdisplaywidget.h
+)
diff --git a/src/exporters/CMakeLists.txt b/src/exporters/CMakeLists.txt
new file mode 100644
index 0000000..4a747e7
--- /dev/null
+++ b/src/exporters/CMakeLists.txt
@@ -0,0 +1,14 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+##### krecipesexporters (static)
+
+tde_add_library( krecipesexporters STATIC_PIC AUTOMOC
+ SOURCES
+ kreexporter.cpp baseexporter.cpp cookmlexporter.cpp
+ recipemlexporter.cpp mmfexporter.cpp htmlexporter.cpp plaintextexporter.cpp
+ rezkonvexporter.cpp htmlbookexporter.cpp
+)
diff --git a/src/importers/CMakeLists.txt b/src/importers/CMakeLists.txt
new file mode 100644
index 0000000..65eb42a
--- /dev/null
+++ b/src/importers/CMakeLists.txt
@@ -0,0 +1,13 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+##### krecipesimporters (static)
+
+tde_add_library( krecipesimporters STATIC_PIC AUTOMOC
+ SOURCES
+ mx2importer.cpp mmfimporter.cpp mxpimporter.cpp nycgenericimporter.cpp recipemlimporter.cpp
+ baseimporter.cpp kreimporter.cpp rezkonvimporter.cpp kredbimporter.cpp
+)
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
new file mode 100644
index 0000000..36d8229
--- /dev/null
+++ b/src/widgets/CMakeLists.txt
@@ -0,0 +1,22 @@
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+
+##### krecipeswidgets (static)
+
+tde_add_library( krecipeswidgets STATIC_PIC AUTOMOC
+ SOURCES
+ krelistview.cpp kremenu.cpp
+ paneldeco.cpp ingredientlistview.cpp unitlistview.cpp
+ propertylistview.cpp prepmethodlistview.cpp categorylistview.cpp
+ authorlistview.cpp recipelistview.cpp categorycombobox.cpp
+ kretextedit.cpp dblistviewbase.cpp
+ conversiontable.cpp fractioninput.cpp ingredientcombobox.cpp
+ headercombobox.cpp prepmethodcombobox.cpp
+ inglistviewitem.cpp kdateedit.cpp kdatepickerpopup.cpp
+ headerlistview.cpp ratingwidget.cpp kwidgetlistbox.cpp
+ ratingdisplaywidget.ui criteriacombobox.cpp ingredientinputwidget.cpp
+ unitcombobox.cpp amountunitinput.cpp weightinput.cpp
+)