From 78f5bb671879878dc8ca067eeb5d7cbdc5bd327f Mon Sep 17 00:00:00 2001 From: Andrei Malashkin Date: Mon, 23 Sep 2024 13:29:07 +0200 Subject: [PATCH] get rid of cm_deploy in transpiler --- .../bin/proof-producer/CMakeLists.txt | 2 +- transpiler/CMakeLists.txt | 28 +++++++++++++++---- transpiler/cmake/Config.cmake.in | 19 +++++++++++++ 3 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 transpiler/cmake/Config.cmake.in diff --git a/proof-producer/bin/proof-producer/CMakeLists.txt b/proof-producer/bin/proof-producer/CMakeLists.txt index ec905b2d8c..7a139cc1b6 100644 --- a/proof-producer/bin/proof-producer/CMakeLists.txt +++ b/proof-producer/bin/proof-producer/CMakeLists.txt @@ -68,7 +68,7 @@ function(setup_proof_generator_target) target_link_libraries(${ARG_TARGET_NAME} crypto3::all - crypto3::transpiler + crypto3_transpiler Boost::filesystem Boost::log diff --git a/transpiler/CMakeLists.txt b/transpiler/CMakeLists.txt index f3cf7f3d21..50418abe3b 100644 --- a/transpiler/CMakeLists.txt +++ b/transpiler/CMakeLists.txt @@ -39,10 +39,28 @@ target_link_libraries(crypto3_transpiler INTERFACE crypto3::all ${Boost_LIBRARIES}) -include(CMDeploy) -cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} - INCLUDE include - NAMESPACE ${CMAKE_WORKSPACE_NAME}::) - include(CMTest) cm_add_test_subdirectory(test) + +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) +set(CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/crypto3_transpiler) + +configure_package_config_file( + cmake/Config.cmake.in + crypto3_transpilerConfig.cmake + INSTALL_DESTINATION ${CONFIG_DIR} +) + +# Install generated cmake config +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/crypto3_transpilerConfig.cmake + DESTINATION ${CONFIG_DIR} +) + +# Install transpiler headers +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +# Install library + diff --git a/transpiler/cmake/Config.cmake.in b/transpiler/cmake/Config.cmake.in new file mode 100644 index 0000000000..3dd95928dc --- /dev/null +++ b/transpiler/cmake/Config.cmake.in @@ -0,0 +1,19 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) +find_dependency(Boost COMPONENTS REQUIRED + container json filesystem log log_setup program_options thread system unit_test_framework) + +# Protect against multiple inclusion +message("inclusion attempt") +if (TARGET crypto3_transpiler) + return() +endif() +message("included") + + +add_library(crypto3_transpiler INTERFACE IMPORTED) + +set_target_properties(crypto3_transpiler PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_FULL_INCLUDEDIR@" + INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES})