142 lines
5.3 KiB
Diff
142 lines
5.3 KiB
Diff
|
From c4e004aa8580f799dbbb7ec6951e0826dc387811 Mon Sep 17 00:00:00 2001
|
||
|
From: Bernd Waibel <waebbl-gentoo@posteo.net>
|
||
|
Date: Tue, 6 Apr 2021 08:45:45 +0200
|
||
|
Subject: [PATCH] patch to use system-provided act binary
|
||
|
|
||
|
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
|
||
|
---
|
||
|
CMakeLists.txt | 109 +++++++++++++++++++++++++++++++++----------------
|
||
|
1 file changed, 73 insertions(+), 36 deletions(-)
|
||
|
|
||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 64a11d9..55abdde 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -54,14 +54,19 @@ if (${MSVC})
|
||
|
endif()
|
||
|
|
||
|
### The API generation target
|
||
|
-if(CMAKE_HOST_UNIX)
|
||
|
- if(APPLE)
|
||
|
- set(ACT_COMMANDENDING darwin)
|
||
|
- else()
|
||
|
- set(ACT_COMMANDENDING linux)
|
||
|
+option(USE_SYSTEM_ACT "Use system-provided act binary" OFF)
|
||
|
+if(NOT USE_SYSTEM_ACT)
|
||
|
+ if(CMAKE_HOST_UNIX)
|
||
|
+ if(APPLE)
|
||
|
+ set(ACT_COMMANDENDING darwin)
|
||
|
+ else()
|
||
|
+ set(ACT_COMMANDENDING linux)
|
||
|
+ endif()
|
||
|
+ elseif(CMAKE_HOST_WIN32)
|
||
|
+ set(ACT_COMMANDENDING exe)
|
||
|
endif()
|
||
|
-elseif(CMAKE_HOST_WIN32)
|
||
|
- set(ACT_COMMANDENDING exe)
|
||
|
+else()
|
||
|
+ find_program(ACT act)
|
||
|
endif()
|
||
|
|
||
|
set(CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED ${CMAKE_CURRENT_BINARY_DIR}/Autogenerated)
|
||
|
@@ -71,35 +76,67 @@ set(ACT_GENERATED_SOURCE
|
||
|
${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Source/Implementation/lib3mf_interfacewrapper.cpp
|
||
|
${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Source/Implementation/lib3mf_interfacejournal.cpp
|
||
|
)
|
||
|
-add_custom_command(
|
||
|
- BYPRODUCTS
|
||
|
- ${ACT_GENERATED_SOURCE}
|
||
|
- OUTPUT
|
||
|
- ${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/LIB3MFACTGENERATIONSTAMP
|
||
|
- WORKING_DIRECTORY
|
||
|
- ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit
|
||
|
- COMMAND
|
||
|
- cmake -E make_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}"
|
||
|
- COMMAND
|
||
|
- cmake -E touch "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/LIB3MFACTGENERATIONSTAMP"
|
||
|
- COMMAND
|
||
|
- ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit/bin/act.${ACT_COMMANDENDING} ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit/lib3mf.xml
|
||
|
- COMMAND
|
||
|
- cmake -E remove_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Source"
|
||
|
- COMMAND
|
||
|
- cmake -E remove_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Bindings"
|
||
|
- COMMAND
|
||
|
- cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Bindings" ${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Bindings
|
||
|
- COMMAND
|
||
|
- cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Implementations/Cpp/Interfaces" "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Source/Implementation"
|
||
|
- COMMAND
|
||
|
- cmake -E remove_directory "${CMAKE_TEMP_HEADER_FOLDER}"
|
||
|
- COMMENT
|
||
|
- "Generating hourglass API bindings and implementation stub"
|
||
|
- DEPENDS
|
||
|
- ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit/lib3mf.xml
|
||
|
- VERBATIM
|
||
|
-)
|
||
|
+if(NOT USE_SYSTEM_ACT)
|
||
|
+ add_custom_command(
|
||
|
+ BYPRODUCTS
|
||
|
+ ${ACT_GENERATED_SOURCE}
|
||
|
+ OUTPUT
|
||
|
+ ${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/LIB3MFACTGENERATIONSTAMP
|
||
|
+ WORKING_DIRECTORY
|
||
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit
|
||
|
+ COMMAND
|
||
|
+ cmake -E make_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}"
|
||
|
+ COMMAND
|
||
|
+ cmake -E touch "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/LIB3MFACTGENERATIONSTAMP"
|
||
|
+ COMMAND
|
||
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit/bin/act.${ACT_COMMANDENDING} ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit/lib3mf.xml
|
||
|
+ COMMAND
|
||
|
+ cmake -E remove_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Source"
|
||
|
+ COMMAND
|
||
|
+ cmake -E remove_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Bindings"
|
||
|
+ COMMAND
|
||
|
+ cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Bindings" ${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Bindings
|
||
|
+ COMMAND
|
||
|
+ cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Implementations/Cpp/Interfaces" "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Source/Implementation"
|
||
|
+ COMMAND
|
||
|
+ cmake -E remove_directory "${CMAKE_TEMP_HEADER_FOLDER}"
|
||
|
+ COMMENT
|
||
|
+ "Generating hourglass API bindings and implementation stub"
|
||
|
+ DEPENDS
|
||
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit/lib3mf.xml
|
||
|
+ VERBATIM
|
||
|
+ )
|
||
|
+else()
|
||
|
+ add_custom_command(
|
||
|
+ BYPRODUCTS
|
||
|
+ ${ACT_GENERATED_SOURCE}
|
||
|
+ OUTPUT
|
||
|
+ ${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/LIB3MFACTGENERATIONSTAMP
|
||
|
+ WORKING_DIRECTORY
|
||
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit
|
||
|
+ COMMAND
|
||
|
+ cmake -E make_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}"
|
||
|
+ COMMAND
|
||
|
+ cmake -E touch "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/LIB3MFACTGENERATIONSTAMP"
|
||
|
+ COMMAND
|
||
|
+ ${ACT} ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit/lib3mf.xml
|
||
|
+ COMMAND
|
||
|
+ cmake -E remove_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Source"
|
||
|
+ COMMAND
|
||
|
+ cmake -E remove_directory "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Bindings"
|
||
|
+ COMMAND
|
||
|
+ cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Bindings" ${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Bindings
|
||
|
+ COMMAND
|
||
|
+ cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Implementations/Cpp/Interfaces" "${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/Source/Implementation"
|
||
|
+ COMMAND
|
||
|
+ cmake -E remove_directory "${CMAKE_TEMP_HEADER_FOLDER}"
|
||
|
+ COMMENT
|
||
|
+ "Generating hourglass API bindings and implementation stub"
|
||
|
+ DEPENDS
|
||
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/AutomaticComponentToolkit/lib3mf.xml
|
||
|
+ VERBATIM
|
||
|
+ )
|
||
|
+endif()
|
||
|
|
||
|
add_custom_target(lib3mfACT
|
||
|
DEPENDS
|
||
|
--
|
||
|
2.31.1
|
||
|
|