From aca01d5a8b7d3de53fa34696e18c91db720a5ab6 Mon Sep 17 00:00:00 2001 From: gregory guy Date: Thu, 27 Jun 2019 16:35:25 +0200 Subject: Conversion to the cmake building system. Add includes to UI files to resolve FTBFS. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gregory guy Signed-off-by: Slávek Banko (cherry picked from commit d4a1613e9f119ae68c695ab60f8d9856d1a54a52) --- kalzium/src/solver/CMakeLists.txt | 118 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 kalzium/src/solver/CMakeLists.txt (limited to 'kalzium/src/solver') 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 +) -- cgit v1.2.1