blob: 35beebf193060686c151c57132205599a1101181 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
From: Bernd Waibel <waebbl-gentoo@posteo.net>
Date: Wed, 25 Aug 2021 09:29:17 +0200
Subject: [PATCH] use system provided act binary
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
---
CMakeLists.txt | 110 ++++++++++++++++++++++++++++++++-----------------
1 file changed, 73 insertions(+), 37 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d70a030..9c91496 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,14 +62,19 @@ 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_SOURCE_DIR_AUTOGENERATED ${CMAKE_CURRENT_SOURCE_DIR}/Autogenerated)
@@ -80,36 +85,67 @@ set(ACT_GENERATED_SOURCE
${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Source/lib3mf_interfacewrapper.cpp
${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Source/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_SOURCE_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_SOURCE_DIR_AUTOGENERATED}/Source"
- COMMAND
- cmake -E remove_directory "${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Bindings"
- COMMAND
- cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Bindings" ${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Bindings
- COMMAND
- cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Implementations/Cpp/Interfaces" "${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Source/"
- 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_SOURCE_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_SOURCE_DIR_AUTOGENERATED}/Source"
+ COMMAND
+ cmake -E remove_directory "${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Bindings"
+ COMMAND
+ cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Bindings" ${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Bindings
+ COMMAND
+ cmake -E copy_directory "${CMAKE_TEMP_HEADER_FOLDER}/Implementations/Cpp/Interfaces" "${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Source/"
+ 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/"
+ 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
${CMAKE_CURRENT_BINARY_DIR_AUTOGENERATED}/LIB3MFACTGENERATIONSTAMP
--
2.32.0
|