meson.build 2.05 KB
Newer Older
Rahix's avatar
Rahix committed
1
2
3
name = 'pycardium'

modsrc = files(
Rahix's avatar
Rahix committed
4
  'modules/utime.c',
Rahix's avatar
Rahix committed
5
  'modules/leds.c',
Rahix's avatar
Rahix committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
)

#################################
# MicroPython Generated Headers #
#################################

version_h = custom_target(
  'mpversion.h',
  output: 'mpversion.h',
  command: [micropython_gen_version, '@OUTPUT@'],
)

modules_h = custom_target(
  'moduledefs.h',
  output: 'moduledefs.h',
21
  input: [micropython_mod_sources, modsrc],
Rahix's avatar
Rahix committed
22
23
24
25
26
27
28
  command: [micropython_gen_modules, '@OUTPUT@', '@INPUT@'],
)

qstr_h = custom_target(
  'qstrdefs.generated.h',
  output: 'qstrdefs.generated.h',
  input: [
Rahix's avatar
Rahix committed
29
    'modules/qstrdefs.h',
Rahix's avatar
Rahix committed
30
31
32
    'mpconfigport.h',
    micropython_sources,
  ],
33
  depends: [version_h],
Rahix's avatar
Rahix committed
34
35
36
37
38
  command: [micropython_gen_qstr, meson.current_source_dir(), '@OUTPUT@', '@INPUT@'],
)

mp_headers = [version_h, modules_h, qstr_h]

39
40
41
42
43
44
45
46
47
48
49
50
51
52
#################################
#    Python Frozen Modules      #
#################################

subdir('modules/py')

frozen_source = custom_target(
  'frozen.c',
  output: 'frozen.c',
  input: [qstr_h, frozen_modules],
  build_by_default: true,
  command: [micropython_gen_frozen, '@OUTPUT@', '@INPUT@'],
)

Rahix's avatar
Rahix committed
53
54
55
56
57
58
59
60
61
62
63
64
###################
# MicroPython Lib #
###################

upy = static_library(
  'micropython',
  micropython_sources,
  micropython_additional_sources,
  mp_headers,
  include_directories: micropython_includes,
)

65
elf = executable(
Rahix's avatar
Rahix committed
66
67
68
  name + '.elf',
  'main.c',
  'mphalport.c',
69
  frozen_source,
Rahix's avatar
Rahix committed
70
71
72
  modsrc,
  mp_headers,
  include_directories: micropython_includes,
Rahix's avatar
Rahix committed
73
  dependencies: [max32665_startup_core1, board_card10, periphdriver, api_caller],
Rahix's avatar
Rahix committed
74
  link_with: upy,
Rahix's avatar
Rahix committed
75
  link_whole: [max32665_startup_core1_lib, board_card10_lib],
Rahix's avatar
Rahix committed
76
77
78
79
  link_args: [
    '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
  ],
)
80

81
bin = custom_target(
82
83
84
  name + '.bin',
  build_by_default: true,
  output: name + '.bin',
85
  input: elf,
86
87
  command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
88
89
90
91
92
93
94
95

custom_target(
  name + '_epicardium.bin',
  build_by_default: true,
  output: name + '_epicardium.bin',
  input: [epicardium_bin, bin],
  command: [build_multi_image, '@INPUT@', '@OUTPUT0@'],
)