-
Notifications
You must be signed in to change notification settings - Fork 60
/
Gen-ZAM.cmake
51 lines (46 loc) · 2.21 KB
/
Gen-ZAM.cmake
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
# A macro to define a command that uses the gen-zam templator to produce
# C++ headers from an input template file. The outputs are returned in
# GEN_ZAM_OUTPUT_H.
#
# The macro also creates a target that can be used to define depencencies on the
# generated files. The name of the target includes the input template directory
# to make it unique, and is added automatically to bro_ALL_GENERATED_OUTPUTS.
macro (gen_zam_target gzInputDir)
get_filename_component(gzInputBasename "${gzInputDir}" NAME)
set(target "gen-zam-${gzInputBasename}")
string(REGEX REPLACE "/" "-" target "${target}")
set(GEN_ZAM_OUTPUT_H
${CMAKE_CURRENT_BINARY_DIR}/ZAM-AssignFlavorsDefs.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-Conds.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-DirectDefs.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-EvalDefs.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-EvalMacros.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-GenExprsDefsC1.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-GenExprsDefsC2.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-GenExprsDefsC3.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-GenExprsDefsV.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-GenFieldsDefsC1.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-GenFieldsDefsC2.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-GenFieldsDefsV.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-MethodDecls.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-MethodDefs.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-Op1FlavorsDefs.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-OpSideEffects.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-OpsDefs.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-OpsNamesDefs.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-Vec1EvalDefs.h
${CMAKE_CURRENT_BINARY_DIR}/ZAM-Vec2EvalDefs.h)
if (GEN_ZAM_EXE_PATH)
set(GEN_ZAM_EXE ${GEN_ZAM_EXE_PATH})
else ()
set(GEN_ZAM_EXE "gen-zam")
endif ()
add_custom_command(
OUTPUT ${GEN_ZAM_OUTPUT_H}
COMMAND ${GEN_ZAM_EXE} ARGS ${GEN_ZAM_SRC}
DEPENDS ${GEN_ZAM_SRC} ${GEN_ZAM_EXE}
COMMENT "[gen-zam] Generating ZAM operations"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(${target} DEPENDS ${GEN_ZAM_OUTPUT_H})
add_dependencies(zeek_autogen_files ${target})
endmacro (gen_zam_target)