diff options
author | gregory guy <g-gregory@gmx.fr> | 2019-06-27 16:35:25 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-06-28 13:45:47 +0200 |
commit | aca01d5a8b7d3de53fa34696e18c91db720a5ab6 (patch) | |
tree | 6b9b83c599cc5db58df8041ca5cf812e00bbd25e /kalzium | |
parent | 88af19c041ad4f1139f6f0a35cd1a4fe2018425f (diff) | |
download | tdeedu-aca01d5a8b7d3de53fa34696e18c91db720a5ab6.tar.gz tdeedu-aca01d5a8b7d3de53fa34696e18c91db720a5ab6.zip |
Conversion to the cmake building system.
Add includes to UI files to resolve FTBFS.
Signed-off-by: gregory guy <g-gregory@gmx.fr>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit d4a1613e9f119ae68c695ab60f8d9856d1a54a52)
Diffstat (limited to 'kalzium')
-rw-r--r-- | kalzium/CMakeLists.txt | 8 | ||||
-rw-r--r-- | kalzium/ConfigureChecks.cmake | 75 | ||||
-rw-r--r-- | kalzium/src/CMakeLists.txt | 109 | ||||
-rw-r--r-- | kalzium/src/data/CMakeLists.txt | 9 | ||||
-rw-r--r-- | kalzium/src/data/toolpics/CMakeLists.txt | 6 | ||||
-rw-r--r-- | kalzium/src/elementpics/CMakeLists.txt | 6 | ||||
-rw-r--r-- | kalzium/src/icons/CMakeLists.txt | 6 | ||||
-rw-r--r-- | kalzium/src/icons/htmlview/CMakeLists.txt | 6 | ||||
-rw-r--r-- | kalzium/src/molcalcwidgetbase.ui | 8 | ||||
-rw-r--r-- | kalzium/src/plotsetupwidget.ui | 8 | ||||
-rw-r--r-- | kalzium/src/settings_colors.ui | 34 | ||||
-rw-r--r-- | kalzium/src/solver/CMakeLists.txt | 118 | ||||
-rw-r--r-- | kalzium/src/somwidget.ui | 6 | ||||
-rw-r--r-- | kalzium/src/spectrumview.ui | 8 | ||||
-rw-r--r-- | kalzium/src/timewidget.ui | 6 |
15 files changed, 364 insertions, 49 deletions
diff --git a/kalzium/CMakeLists.txt b/kalzium/CMakeLists.txt new file mode 100644 index 00000000..9acff430 --- /dev/null +++ b/kalzium/CMakeLists.txt @@ -0,0 +1,8 @@ +##### configure checks + +include( ConfigureChecks.cmake ) + + +##### subdirectories + +add_subdirectory( src ) diff --git a/kalzium/ConfigureChecks.cmake b/kalzium/ConfigureChecks.cmake new file mode 100644 index 00000000..a51abf1b --- /dev/null +++ b/kalzium/ConfigureChecks.cmake @@ -0,0 +1,75 @@ +########################################### +# # +# Improvements and feedback are welcome # +# # +# This file is released under GPL >= 3 # +# # +########################################### + + +##### check for ocaml/facile + +if( WITH_OCAML_SOLVER ) + + if( NOT DEFINED HAVE_OCAML ) + message( STATUS "Search for ocaml" ) + + foreach( _exec ocamlc ocamldep ocamlopt ) + string( TOUPPER "${_exec}_EXECUTABLE" _exec_var ) + if( NOT DEFINED ${_exec_var} ) + find_program( ${_exec_var} NAMES ${_exec} ) + if( NOT ${_exec_var} ) + tde_message_fatal( "${_exec} is requested, but was not found on your system" ) + endif( ) + endif( ) + endforeach( ) + + if( NOT DEFINED OCAML_BASEDIR ) + execute_process( + COMMAND ${OCAMLOPT_EXECUTABLE} -where + OUTPUT_VARIABLE OCAML_BASEDIR + ERROR_VARIABLE OCAML_BASEDIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if( EXISTS ${OCAML_BASEDIR} AND IS_DIRECTORY ${OCAML_BASEDIR} ) + set( OCAML_BASEDIR ${OCAML_BASEDIR} CACHE PATH "Ocaml base directory" ) + set( OCAML_LIBRARY_DIR ${OCAML_BASEDIR} CACHE PATH "Ocaml libraries directory" ) + else( ) + tde_message_fatal( "Ocaml is requested, but was not found on your system" ) + endif( ) + endif( ) + + set( HAVE_OCAML 1 CACHE INTERNAL "" ) + message( STATUS "Search for ocaml - found" ) + endif( ) + + + if( NOT DEFINED HAVE_FACILE ) + message( STATUS "Search for facile" ) + + if( NOT DEFINED FACILE_LIBRARIES ) + find_library( FACILE_LIBRARIES + NAMES facile.a + HINTS ${OCAML_BASEDIR} + PATH_SUFFIXES facile ocaml/facile + ) + endif( ) + + if( NOT DEFINED FACILE_INCLUDE_DIR ) + find_path( FACILE_INCLUDE_DIR + NAMES facile.cmi + HINTS ${OCAML_BASEDIR} + PATH_SUFFIXES facile lib/ocaml/facile + ) + endif( ) + + if( NOT DEFINED FACILE_LIBRARIES OR NOT DEFINED FACILE_INCLUDE_DIR ) + tde_message_fatal( "Facile is requested, but was not found on your system" ) + endif( ) + + set( HAVE_FACILE 1 CACHE INTERNAL "Enable build with ocaml/facile" ) + message( STATUS "Search for facile - found" ) + endif( ) + +endif( WITH_OCAML_SOLVER ) diff --git a/kalzium/src/CMakeLists.txt b/kalzium/src/CMakeLists.txt new file mode 100644 index 00000000..b0b0cac2 --- /dev/null +++ b/kalzium/src/CMakeLists.txt @@ -0,0 +1,109 @@ +add_subdirectory( icons ) +add_subdirectory( elementpics ) +add_subdirectory( data ) +tde_conditional_add_subdirectory( WITH_OCAML_SOLVER solver ) + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/libtdeedu/tdeeduplot + ${CMAKE_SOURCE_DIR}/libtdeedu/tdeeduui +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} + ${OCAML_LIBRARY_DIR} +) + +if( WITH_OCAML_SOLVER ) + set( OCAML_LIBRARIES asmrun nums m ${CMAKE_DL_LIBS} ) + set( OCAML_SOLVER + ${CMAKE_CURRENT_BINARY_DIR}/solver/modwrap.o + ${CMAKE_CURRENT_BINARY_DIR}/solver/solver.o + ) +else( ) + add_custom_target( kalzium_solver COMMENT "Empty kalzium solver" ) +endif( ) + + +##### kalzium (executable) + +tde_add_executable( kalzium AUTOMOC + + SOURCES + prefs.kcfgc + settings_colors.ui + settings_misc.ui + settings_units.ui + plotsetupwidget.ui + molcalcwidgetbase.ui + timewidget.ui + somwidget.ui + spectrumview.ui + eqresult.cpp + eqchemview.cpp + kalzium.cpp + main.cpp + periodictableview.cpp + element.cpp + detailinfodlg.cpp + orbitswidget.cpp + plotwidget.cpp + elementdataviewer.cpp + detailedgraphicaloverview.cpp + molcalcwidget.cpp + timewidget_impl.cpp + somwidget_impl.cpp + kalziumtip.cpp + spectrum.cpp + isotope.cpp + kalziumdataobject.cpp + spectrumwidget.cpp + exporter.cpp + spectrumviewimpl.cpp + kalziumutils.cpp + parser.cpp + moleculeparser.cpp + tempunit.cpp + LINK + tdecore-shared + tdeui-shared + tdeio-shared + tdehtml-shared + tdeeduplot-shared + tdeeduui-shared + ${OCAML_SOLVER} + ${OCAML_LIBRARIES} + + DEPENDENCIES + kalzium_solver + + DESTINATION ${BIN_INSTALL_DIR} +) + + +##### icons + +tde_install_icons( ) + + +##### other data + +install( + FILES kalziumui.rc + DESTINATION ${DATA_INSTALL_DIR}/kalzium +) + +install( + FILES kalzium.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) + +install( + FILES kalzium.kcfg + DESTINATION ${KCFG_INSTALL_DIR} +) diff --git a/kalzium/src/data/CMakeLists.txt b/kalzium/src/data/CMakeLists.txt new file mode 100644 index 00000000..a2229e0f --- /dev/null +++ b/kalzium/src/data/CMakeLists.txt @@ -0,0 +1,9 @@ +add_subdirectory( toolpics ) + + +##### other data + +install( + FILES bg.jpg data.xml knowledge.xml tools.xml + DESTINATION ${DATA_INSTALL_DIR}/kalzium/data +) diff --git a/kalzium/src/data/toolpics/CMakeLists.txt b/kalzium/src/data/toolpics/CMakeLists.txt new file mode 100644 index 00000000..f1189d0d --- /dev/null +++ b/kalzium/src/data/toolpics/CMakeLists.txt @@ -0,0 +1,6 @@ +file( GLOB _pics RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.jpg *.png ) + +install( + FILES ${_pics} + DESTINATION ${DATA_INSTALL_DIR}/kalzium/data/toolpics +) diff --git a/kalzium/src/elementpics/CMakeLists.txt b/kalzium/src/elementpics/CMakeLists.txt new file mode 100644 index 00000000..924eed7b --- /dev/null +++ b/kalzium/src/elementpics/CMakeLists.txt @@ -0,0 +1,6 @@ +file( GLOB _jpgs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.jpg ) + +install( + FILES ${_jpgs} + DESTINATION ${DATA_INSTALL_DIR}/kalzium/elempics +) diff --git a/kalzium/src/icons/CMakeLists.txt b/kalzium/src/icons/CMakeLists.txt new file mode 100644 index 00000000..8fcaaaaa --- /dev/null +++ b/kalzium/src/icons/CMakeLists.txt @@ -0,0 +1,6 @@ +tde_auto_add_subdirectories( htmlview ) + + +##### icons + +tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/kalzium/icons ) diff --git a/kalzium/src/icons/htmlview/CMakeLists.txt b/kalzium/src/icons/htmlview/CMakeLists.txt new file mode 100644 index 00000000..0bbc208e --- /dev/null +++ b/kalzium/src/icons/htmlview/CMakeLists.txt @@ -0,0 +1,6 @@ +file( GLOB _pngs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.png ) + +install( + FILES ${_pngs} icons.svg style.css + DESTINATION ${DATA_INSTALL_DIR}/kalzium/data/htmlview +) diff --git a/kalzium/src/molcalcwidgetbase.ui b/kalzium/src/molcalcwidgetbase.ui index d643dfe7..79a6074e 100644 --- a/kalzium/src/molcalcwidgetbase.ui +++ b/kalzium/src/molcalcwidgetbase.ui @@ -128,8 +128,8 @@ <slot access="protected">slotCalcButtonClicked()</slot> </Q_SLOTS> <layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>klineedit.h</includehint> - <includehint>kpushbutton.h</includehint> -</includehints> +<includes> + <include location="global" impldecl="in implementation">klineedit.h</include> + <include location="global" impldecl="in implementation">kpushbutton.h</include> +</includes> </UI> diff --git a/kalzium/src/plotsetupwidget.ui b/kalzium/src/plotsetupwidget.ui index b777713c..b8972882 100644 --- a/kalzium/src/plotsetupwidget.ui +++ b/kalzium/src/plotsetupwidget.ui @@ -249,8 +249,8 @@ <customwidgets> </customwidgets> <layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>knuminput.h</includehint> - <includehint>kcombobox.h</includehint> -</includehints> +<includes> + <include location="global" impldecl="in implementation">knuminput.h</include> + <include location="global" impldecl="in implementation">kcombobox.h</include> +</includes> </UI> diff --git a/kalzium/src/settings_colors.ui b/kalzium/src/settings_colors.ui index cd9316cb..46168417 100644 --- a/kalzium/src/settings_colors.ui +++ b/kalzium/src/settings_colors.ui @@ -902,35 +902,7 @@ <customwidgets> </customwidgets> <layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> - <includehint>kcolorbutton.h</includehint> -</includehints> +<includes> + <include location="global" impldecl="in implementation">kcolorbutton.h</include> +</includes> </UI> diff --git a/kalzium/src/solver/CMakeLists.txt b/kalzium/src/solver/CMakeLists.txt new file mode 100644 index 00000000..aef745d4 --- /dev/null +++ b/kalzium/src/solver/CMakeLists.txt @@ -0,0 +1,118 @@ +##### macro to build ocaml sources + +macro( tde_add_ocaml_source _target _ml ) + + get_filename_component( basename "${_ml}" NAME_WE ) + + if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${basename}.mli ) + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/${basename}.cmi + + COMMENT "Compile ${basename}.mli" + + COMMAND ${OCAMLC_EXECUTABLE} + -o ${CMAKE_CURRENT_BINARY_DIR}/${basename}.cmi + -I ${FACILE_INCLUDE_DIR} + -c ${CMAKE_CURRENT_SOURCE_DIR}/${basename}.mli + + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/${basename}.ml + ${ARGN} + + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + set( _build_cmi ${CMAKE_CURRENT_BINARY_DIR}/${basename}.cmi ) + else( ) + set( _build_cmi "" ) + endif( ) + + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/${basename}.cmx + + COMMENT "Compile ${basename}.ml" + + COMMAND ${OCAMLOPT_EXECUTABLE} + -o ${CMAKE_CURRENT_BINARY_DIR}/${basename}.cmx + -I ${FACILE_INCLUDE_DIR} + -c ${CMAKE_CURRENT_SOURCE_DIR}/${basename}.ml + + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/${basename}.ml + ${_build_cmi} + ${ARGN} + + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + + list( APPEND ${_target}-ocaml + ${CMAKE_CURRENT_BINARY_DIR}/${basename}.cmx + ) +endmacro( ) + + +# build kalzium ocaml solver + +tde_add_ocaml_source( kalzium_solver chemset.ml ) + +tde_add_ocaml_source( kalzium_solver datastruct.ml + ${CMAKE_CURRENT_BINARY_DIR}/chemset.cmi +) + +tde_add_ocaml_source( kalzium_solver chem.ml + ${CMAKE_CURRENT_BINARY_DIR}/chemset.cmi + ${CMAKE_CURRENT_BINARY_DIR}/datastruct.cmi +) + +tde_add_ocaml_source( kalzium_solver parser.ml + ${CMAKE_CURRENT_BINARY_DIR}/chemset.cmi +) + +tde_add_ocaml_source( kalzium_solver lexer.ml + ${CMAKE_CURRENT_BINARY_DIR}/chemset.cmi + ${CMAKE_CURRENT_BINARY_DIR}/parser.cmi +) + +tde_add_ocaml_source( kalzium_solver calc.ml + ${CMAKE_CURRENT_BINARY_DIR}/chem.cmi + ${CMAKE_CURRENT_BINARY_DIR}/chemset.cmi + ${CMAKE_CURRENT_BINARY_DIR}/datastruct.cmi + ${CMAKE_CURRENT_BINARY_DIR}/parser.cmi + ${CMAKE_CURRENT_BINARY_DIR}/lexer.cmx +) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/modwrap.o + + COMMAND ${OCAMLOPT_EXECUTABLE} + -I ${FACILE_INCLUDE_DIR} + -c ${CMAKE_CURRENT_SOURCE_DIR}/modwrap.c + + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/modwrap.c + ${CMAKE_CURRENT_BINARY_DIR}/solver.o + + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/solver.o + + COMMAND ${OCAMLOPT_EXECUTABLE} -output-obj + -o ${CMAKE_CURRENT_BINARY_DIR}/solver.o + ${FACILE_INCLUDE_DIR}/facile.cmxa + ${kalzium_solver-ocaml} + + DEPENDS + ${kalzium_solver-ocaml} + + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +add_custom_target( kalzium_solver + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/modwrap.o + ${CMAKE_CURRENT_BINARY_DIR}/solver.o +) diff --git a/kalzium/src/somwidget.ui b/kalzium/src/somwidget.ui index 1494a1fe..d52a7abf 100644 --- a/kalzium/src/somwidget.ui +++ b/kalzium/src/somwidget.ui @@ -179,7 +179,7 @@ the state of matter</string> <connections> </connections> <layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>knuminput.h</includehint> -</includehints> +<includes> + <include location="global" impldecl="in implementation">knuminput.h</include> +</includes> </UI> diff --git a/kalzium/src/spectrumview.ui b/kalzium/src/spectrumview.ui index 785d21af..25071379 100644 --- a/kalzium/src/spectrumview.ui +++ b/kalzium/src/spectrumview.ui @@ -217,8 +217,8 @@ <slot access="protected">slotExportAsImage()</slot> </Q_SLOTS> <layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>spectrumwidget.h</includehint> - <includehint>kpushbutton.h</includehint> -</includehints> +<includes> + <include location="global" impldecl="in implementation">spectrumwidget.h</include> + <include location="global" impldecl="in implementation">kpushbutton.h</include> +</includes> </UI> diff --git a/kalzium/src/timewidget.ui b/kalzium/src/timewidget.ui index a684726f..b4c3b3ca 100644 --- a/kalzium/src/timewidget.ui +++ b/kalzium/src/timewidget.ui @@ -195,7 +195,7 @@ of the elements</string> </connection> </connections> <layoutdefaults spacing="6" margin="11"/> -<includehints> - <includehint>knuminput.h</includehint> -</includehints> +<includes> + <include location="global" impldecl="in implementation">knuminput.h</include> +</includes> </UI> |