-
Notifications
You must be signed in to change notification settings - Fork 8
/
meson.build
155 lines (142 loc) · 8.9 KB
/
meson.build
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
project('py4godot', 'cpp')
cc = meson.get_compiler('cpp')
message('compiler:' + cc.get_id())
message('system:' + build_machine.system())
message('cpu_family:' + build_machine.cpu_family())
message('host_platform:' + host_machine.system())
platform_format = ''
machine = host_machine.system()
platform_format = '32'
if host_machine.cpu_family() == 'x86_64'
platform_format = '64'
endif
if host_machine.cpu_family() == 'aarch64'
platform_format = '64'
endif
message('platform:' + platform_format)
message('machine:' + machine)
extra_args = []
message(meson.get_compiler('cpp').get_id())
link_args = []
cpp_args = []
if meson.get_compiler('cpp').get_id() == 'gcc'
add_global_arguments('-DMS_WIN' + platform_format, language: 'cpp')
cpp_args = ['-D LIBRARY_EXPORTS=1']
if platform_format == '32'
link_args = ['-m32']
cpp_args += ['-m32', '-std=c++17']
endif
endif
if meson.get_compiler('cpp').get_id() == 'g++'
add_global_arguments('-DMS_WIN' + platform_format, language: 'cpp')
cpp_args = ['-D LIBRARY_EXPORTS=1']
if platform_format == '32'
link_args = ['-m32']
cpp_args += ['-m32', '-std=c++17']
endif
endif
if meson.get_compiler('cpp').get_id() == 'clang'
cpp_args += ['-std=c++17', '-Wno-address-of-temporary']
endif
if meson.get_compiler('cpp').get_id() == 'msvc'
add_global_arguments('/bigobj', language: 'cpp')
cpp_args = ['/DLIBRARY_EXPORTS=1']
endif
message(meson.current_source_dir())
if build_machine.system() == 'windows'
py = import('python').find_installation('python3')
dep_py = py.dependency()
internal_inc = include_directories('py4godot/gdextension-api/', 'py4godot/core', 'py4godot/enums',
'py4godot/classes', 'py4godot/pluginscript_api', 'py4godot/godot_bindings',
'py4godot/script_instance', 'py4godot/core/variant4', 'py4godot/cppcore', 'py4godot/cppenums',
'py4godot/cppclasses', 'py4godot/cpputils', 'py4godot/script_language', 'py4godot/pluginscript_api',
'py4godot/pluginscript_api/utils')
glob = run_command('python', files(meson.current_source_dir()+'/meson_scripts/glob_tools.py'))
glob_cpp = run_command('python', files(meson.current_source_dir()+'/meson_scripts/glob_tools_cpp.py'))
endif
if build_machine.system() == 'darwin'
message('search:')
message(meson.current_source_dir()+'/python_files/cpython-3.12.4-'+machine+platform_format + '/python')
py = import('python').find_installation('python3')
dep_py = py.dependency()
lib_py = cc.find_library('python3.12', dirs:meson.current_source_dir()+'/python_files/cpython-3.12.4-'+machine+platform_format + '/python/lib')
internal_inc = include_directories('py4godot','py4godot/gdextension-api/', 'py4godot/core', 'py4godot/enums',
'py4godot/classes', 'py4godot/pluginscript_api', 'py4godot/godot_bindings',
'py4godot/script_instance', 'py4godot/core/variant4', 'py4godot/cppcore', 'py4godot/cppenums',
'py4godot/cppclasses', 'py4godot/cpputils', 'py4godot/script_language', 'py4godot/pluginscript_api',
'py4godot/pluginscript_api/utils',
'py4godot/instance_data', 'python_files/cpython-3.12.4-'+machine+platform_format+'/python/include/python3.12')
glob = run_command('python3', files(meson.current_source_dir()+'/meson_scripts/glob_tools.py'))
glob_cpp = run_command('python3', files(meson.current_source_dir()+'/meson_scripts/glob_tools_cpp.py'))
dep_py = lib_py
endif
if meson.has_external_property('is_mingw') and build_machine.system() == 'linux'
message('dirs:')
message(meson.current_source_dir()+'/python_files/cpython-3.12.4-'+machine+platform_format + '/python')
link_args += ['-static-libgcc', '-static-libstdc++'] #TODO: Is this good like this?
lib_py = cc.find_library('python312', dirs:meson.current_source_dir()+'/python_files/cpython-3.12.4-'+machine+platform_format + '/python')
internal_inc = include_directories('py4godot','py4godot/gdextension-api/', 'py4godot/core', 'py4godot/enums',
'py4godot/classes', 'py4godot/pluginscript_api', 'py4godot/godot_bindings',
'py4godot/script_instance', 'py4godot/core/variant4', 'py4godot/cppcore', 'py4godot/cppenums',
'py4godot/cppclasses', 'py4godot/cpputils', 'py4godot/script_language', 'py4godot/pluginscript_api',
'py4godot/pluginscript_api/utils',
'py4godot/instance_data', 'python_files/cpython-3.12.4-'+machine+platform_format+'/python/include')
glob = run_command('python3', files(meson.current_source_dir()+'/meson_scripts/glob_tools.py'))
glob_cpp = run_command('python3', files(meson.current_source_dir()+'/meson_scripts/glob_tools_cpp.py'))
dep_py = lib_py
endif
if not meson.has_external_property('is_mingw') and build_machine.system() == 'linux'
lib_py = cc.find_library('python3.12', dirs:meson.current_source_dir()+'/python_files/cpython-3.12.4-'+machine+platform_format+'/python/lib')
internal_inc = include_directories('py4godot','py4godot/gdextension-api/', 'py4godot/core', 'py4godot/enums',
'py4godot/classes', 'py4godot/pluginscript_api', 'py4godot/godot_bindings',
'py4godot/script_instance', 'py4godot/core/variant4', 'py4godot/cppcore', 'py4godot/cppenums',
'py4godot/cppclasses', 'py4godot/cpputils', 'py4godot/script_language', 'py4godot/pluginscript_api',
'py4godot/pluginscript_api/utils','python_files/cpython-3.12.4-'+machine+platform_format+'/python/include/python3.12',
'py4godot/instance_data')
glob = run_command('python3', files(meson.current_source_dir()+'/meson_scripts/glob_tools.py'))
glob_cpp = run_command('python3', files(meson.current_source_dir()+'/meson_scripts/glob_tools_cpp.py'))
dep_py = lib_py
endif
if build_machine.system() == 'linux'
endif
godot_program = find_program('godot')
sources = glob.stdout().strip().split('\n')
cppsources = glob_cpp.stdout().strip().split('\n')
main_lib = shared_library('main',cppsources,
dependencies:[dep_py], include_directories:internal_inc,name_prefix:'',c_args:extra_args,
link_args : link_args,
cpp_args:cpp_args,
install_rpath: '$ORIGIN/../lib',
build_rpath : '$ORIGIN/../lib')
pythonscript_lib = shared_library('pythonscript',
'py4godot/godot_bindings/pythonscript.cpp',
dependencies:[dep_py],
include_directories:internal_inc,name_prefix:'',
c_args:extra_args, link_args:link_args,link_with:main_lib,
cpp_args:cpp_args,
install_rpath: '$ORIGIN/../lib',
build_rpath : '$ORIGIN/../lib')
foreach source : sources
converted_source = source.replace('\\','#')
linux_converted = converted_source.replace('/', '#')
shared_library(linux_converted, [source+'.cpp'],
dependencies:[dep_py], include_directories:internal_inc,name_prefix:'',c_args:extra_args,
link_args : link_args,
link_with : main_lib,
cpp_args:cpp_args, install_rpath: '$ORIGIN/../lib',
build_rpath : '$ORIGIN/../lib')
endforeach
#test('test_vector3', godot_program, args : ['--path', 'tests/core/vector3', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_vector2', godot_program, args : ['--path', 'tests/core/vector2', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_rect2', godot_program, args : ['--path', 'tests/core/rect2', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
test('test_aabb', py, args:['test_file.py', 'tests/core/aabb'], workdir:meson.source_root(), timeout:100, is_parallel:false)
#test('test_basis', godot_program, args : ['--path', 'tests/core/basis', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_array', godot_program, args : ['--path', 'tests/core/array', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_color', godot_program, args : ['--path', 'tests/core/color', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_dictionary', godot_program, args : ['--path', 'tests/core/dictionary', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_node_path', godot_program, args : ['--path', 'tests/core/node_path', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_rid', godot_program, args : ['--path', 'tests/core/rid', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_quat', godot_program, args : ['--path', 'tests/core/quat', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_transform', godot_program, args : ['--path', 'tests/core/transform', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
#test('test_transform2d', godot_program, args : ['--path', 'tests/core/transform2d', '--headless'], workdir:meson.source_root(), timeout:1000, is_parallel:false)
test('test_signals', py, args:['test_file.py', 'tests/binding/signals'], workdir:meson.source_root(), timeout:1000, is_parallel:false)