o
    nc                     @  sH   d dl mZ d dlmZ d dlZdZdZdZdZdZ	G d	d
 d
eZ
dS )    )annotations)
SampleImplNzOvoid main (string[] args) {{
    stdout.printf ("Hello {project_name}!\n");
}}
a  project('{project_name}', ['c', 'vala'],
  version : '{version}')

dependencies = [
    dependency('glib-2.0'),
    dependency('gobject-2.0'),
]

exe = executable('{exe_name}', '{source_name}', dependencies : dependencies,
  install : true)

test('basic', exe)
znamespace {namespace} {{
    public int sum(int a, int b) {{
        return(a + b);
    }}

    public int square(int a) {{
        return(a * a);
    }}
}}
zusing {namespace};

public void main() {{
    stdout.printf("
Testing shlib");
    stdout.printf("
	2 + 3 is %d", sum(2, 3));
    stdout.printf("
	8 squared is %d\n", square(8));
}}
a  project('{project_name}', ['c', 'vala'],
  version : '{version}')

dependencies = [
    dependency('glib-2.0'),
    dependency('gobject-2.0'),
]

# These arguments are only used to build the shared library
# not the executables that use the library.
shlib = shared_library('foo', '{source_file}',
               dependencies: dependencies,
               install: true,
               install_dir: [true, true, true])

test_exe = executable('{test_exe_name}', '{test_source_file}', dependencies : dependencies,
  link_with : shlib)
test('{test_name}', test_exe)

# Make this library usable as a Meson subproject.
{ltoken}_dep = declare_dependency(
  include_directories: include_directories('.'),
  link_with : shlib)
c                      s0   e Zd Z fddZd	ddZd	ddZ  ZS )
ValaProjectc                   s   t    |j| _|j| _d S )N)super__init__nameversion)selfoptions	__class__ home/ych/rk3568/buildroot/output/rockchip_rk3568_recovery/host/lib/python3.10/site-packages/mesonbuild/templates/valatemplates.pyr   W   s   
zValaProject.__init__returnNonec                 C  sd   t dd| j }|d }t|dddtj| jd tddddtj| j||| j	d	 d S )
N	[^a-z0-9]_.valawutf-8encoding)project_namemeson.build)r   Zexe_namesource_namer   )
resubr   loweropenwritehello_vala_templateformathello_vala_meson_templater   )r	   lowercase_tokenr   r   r   r   create_executable\   s   zValaProject.create_executablec           	      C  s   t dd| j }| }|d |dd   }|d }|}|d }|d }||||||||| j||| jd}t|d	d
dtj	di | t|d	d
dt
j	di | tdd	d
dtj	di | d S )Nr   r   r      _testr   z
_test.vala)ZutokenZltokenZ
header_dir
class_name	namespaceZsource_fileZtest_source_filetest_exe_namer   lib_nameZ	test_namer   r   r   r   r   r   )r   r   r   r   upperr   r   r   lib_vala_templater!   lib_vala_test_templatelib_vala_meson_template)	r	   r#   Zuppercase_tokenr'   r)   r(   Zlib_vala_nameZtest_vala_namekwargsr   r   r   create_libraryf   s.     $zValaProject.create_library)r   r   )__name__
__module____qualname__r   r$   r0   __classcell__r   r   r   r   r   V   s    

r   )
__future__r   Zmesonbuild.templates.sampleimplr   r   r    r"   r,   r-   r.   r   r   r   r   r   <module>   s   	