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/src/solver | |
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/src/solver')
-rw-r--r-- | kalzium/src/solver/CMakeLists.txt | 118 |
1 files changed, 118 insertions, 0 deletions
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 +) |