meson.build 1.54 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
21
22
23
24
25
26
27
28
)

#################################
# 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',
  input: [micropython_sources, modsrc],
  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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
    'mpconfigport.h',
    micropython_sources,
  ],
  depends: [modules_h, version_h],
  command: [micropython_gen_qstr, meson.current_source_dir(), '@OUTPUT@', '@INPUT@'],
)

mp_headers = [version_h, modules_h, qstr_h]

###################
# MicroPython Lib #
###################

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

51
elf = executable(
Rahix's avatar
Rahix committed
52
53
54
55
56
57
  name + '.elf',
  'main.c',
  'mphalport.c',
  modsrc,
  mp_headers,
  include_directories: micropython_includes,
Rahix's avatar
Rahix committed
58
  dependencies: [max32665_startup_core1, board_card10, periphdriver, api_caller],
Rahix's avatar
Rahix committed
59
  link_with: upy,
Rahix's avatar
Rahix committed
60
  link_whole: [max32665_startup_core1_lib, board_card10_lib],
Rahix's avatar
Rahix committed
61
62
63
64
  link_args: [
    '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
  ],
)
65
66
67
68
69

custom_target(
  name + '.bin',
  build_by_default: true,
  output: name + '.bin',
70
  input: elf,
71
72
  command: [build_image, '@INPUT@', '@OUTPUT0@'],
)