blob: 8729af51b066a861b4dab78c2aab71876807abe0 (
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
|
# CMakeList for the params directory
#
# Several xtp files are created from text definitions, the created xtp files are installed.
#
add_custom_target(xtpfiles ALL "")
set_target_properties(
xtpfiles
PROPERTIES FOLDER "Param Files"
)
#
# create param files from car definitions
add_executable( mkcarpart mkcarpart.c )
set_target_properties(
mkcarpart
PROPERTIES FOLDER "Param Files"
)
set(infiles
"AccucraftFn3.cars"
"AccucraftOn3.cars"
"accurail.cars"
"atlascho.cars"
"atlaseho.cars"
)
foreach(infile ${infiles})
# Generate output file name
cmake_path(REPLACE_EXTENSION infile
"xtp"
OUTPUT_VARIABLE outfile
)
# Custom command to do the processing
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${outfile}"
DEPENDS "${infile}" mkcarpart
COMMAND mkcarpart "${infile}" "${CMAKE_CURRENT_BINARY_DIR}/${outfile}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
target_sources(xtpfiles
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/${outfile}"
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/${outfile}"
DESTINATION ${XTRKCAD_SHARE_INSTALL_DIR}/params
)
endforeach()
# create param files from structure definitions
add_executable( mkstruct mkstruct.c )
set_target_properties(
mkstruct
PROPERTIES FOLDER "Param Files"
)
set(infiles
"fallerho.struct"
"revell.struct"
"pikestuf.struct"
)
# define build commands for all struct files
foreach(infile ${infiles})
# Generate output file name
cmake_path(REPLACE_EXTENSION infile
"xtp"
OUTPUT_VARIABLE outfile
)
cmake_path(ABSOLUTE_PATH
outfile
BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
add_custom_command(
OUTPUT "${outfile}"
COMMAND mkstruct "${infile}" "${outfile}"
DEPENDS "${infile}" mkstruct
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
target_sources(xtpfiles
PRIVATE
"${outfile}"
)
install(
FILES "${outfile}"
DESTINATION "${XTRKCAD_SHARE_INSTALL_DIR}/params"
)
endforeach()
install(
FILES t-trak-notes.txt
DESTINATION "${XTRKCAD_SHARE_INSTALL_DIR}/params"
)
|