summaryrefslogtreecommitdiff
path: root/app/lib/params/CMakeLists.txt
blob: 22229ac7390f077cd243e1036b8a2127ab491841 (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

# $Header: /home/dmarkle/xtrkcad-fork-cvs/xtrkcad/app/lib/params/CMakeLists.txt,v 1.9 2008-06-04 18:53:04 m_fischer Exp $
#
# CMakeList for the params directory
#
# Several xtp files are created from text definitions, all xtp files and the
# created xtp files are installed.
#

FILE(GLOB XTP_FILES *.xtp)

SET( outFiles )

#  create param files from car definitions

ADD_EXECUTABLE( mkcarpart mkcarpart.c )

FILE(GLOB inFiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cars")

FOREACH(infileName ${inFiles})
    # Generate output file name
    STRING(REGEX REPLACE ".cars\$" ".xtp" outfileName "${infileName}")
    SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfileName}")
    # Generate input file name
    SET(infile "${CMAKE_CURRENT_SOURCE_DIR}/${infileName}")
    # Custom command to do the processing
    ADD_CUSTOM_COMMAND(OUTPUT "${outfile}"
        COMMAND mkcarpart "${infile}" "${outfile}"
        DEPENDS "${infile}" mkcarpart
		WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
    # Finally remember the output file for dependencies
    SET(outFiles ${outFiles} "${outfile}")
ENDFOREACH(infileName)

# create param files from  structure definitions

ADD_EXECUTABLE( mkstruct mkstruct.c )

FILE(GLOB inFiles RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.struct")

# define build commands for all struct files
FOREACH(infileName ${inFiles})
    # Generate output file name
    STRING(REGEX REPLACE ".struct\$" ".xtp" outfileName "${infileName}")
    SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfileName}")
    # Generate input file name
    SET(infile "${CMAKE_CURRENT_SOURCE_DIR}/${infileName}")
    # Custom command to do the processing
    ADD_CUSTOM_COMMAND(OUTPUT "${outfile}"
        COMMAND mkstruct "${infile}" "${outfile}"
        DEPENDS "${infile}" mkstruct
		WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" )
    # Finally remember the output file for dependencies
    SET(outFiles ${outFiles} "${outfile}")
ENDFOREACH(infileName)


ADD_CUSTOM_TARGET(xtpfiles ALL DEPENDS ${outFiles})

INSTALL(
	FILES ${XTP_FILES} t-trak-notes.txt ${outFiles}
	DESTINATION ${XTRKCAD_SHARE_INSTALL_DIR}/params
	)