summaryrefslogtreecommitdiffstats
path: root/build/qmake/mkspecs/features/gypi_gen.prf
blob: ee32c3661d0b04df31bc2f56e8dc4230ec362c1b (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
# This file is loaded after the dummy .pro and all the default_post ran.
# This is the right point to extract the variables we're interested in and generate
# the .gyp file that we'll use later on when running gyp

load(functions)

GYPI_FILE = $$replace(_PRO_FILE_, .pro$, .gyp)

TARGET_TYPE = $$toGypTargetType()

GYPI_CONTENTS =  "{" \
                 "  'targets': [" \
                 "  {" \
                 "    'target_name': '$$TARGET'," \
                 "    'type': '$$TARGET_TYPE'," \
                 "    'includes': [" \
                 "      '../blinq.gypi'," \
                 "    ]," \
                 "    'ldflags': ["
for (lib, LIBS): GYPI_CONTENTS += "      '$$lib',"
!isEmpty(QMAKE_RPATHDIR): GYPI_CONTENTS += "      '$$QMAKE_RPATH$$QMAKE_RPATHDIR',"

GYPI_CONTENTS += "    ],"

!isEmpty(DEFINES) {
  GYPI_CONTENTS += "    'defines': ["
  for (define, DEFINES): GYPI_CONTENTS += "      '$$define',"
  GYPI_CONTENTS += "    ],"
}
GYPI_CONTENTS += "    'sources': ["
for (sourcefile, SOURCES): GYPI_CONTENTS += "      '$$sourcefile',"
for (headerfile, HEADERS): GYPI_CONTENTS += "      '$$headerfile',"
GYPI_CONTENTS += "    ],"
!isEmpty(INCLUDEPATH) {
  GYPI_CONTENTS += "    'include_dirs': ["
  for (path, INCLUDEPATH): GYPI_CONTENTS += "      '$$path',"
  GYPI_CONTENTS += "    ],"
}
GYPI_CONTENTS += "  }," \
                 "  ]," \
                 "}"

write_file($$GYPI_FILE, GYPI_CONTENTS)

# The generated Makefile shouldn't build anything by itself, just re-run qmake if necessary
TEMPLATE = aux
SOURCES =
HEADERS =