§
    ƒnócj  ã                  óZ   — d dl mZ d dlmZ d dlZdZdZdZdZdZ	d	Z
 G d
„ de¦  «        ZdS )é    )Úannotations)Ú
SampleImplNa�  #pragma once
#if defined _WIN32 || defined __CYGWIN__
  #ifdef BUILDING_{utoken}
    #define {utoken}_PUBLIC __declspec(dllexport)
  #else
    #define {utoken}_PUBLIC __declspec(dllimport)
  #endif
#else
  #ifdef BUILDING_{utoken}
      #define {utoken}_PUBLIC __attribute__ ((visibility ("default")))
  #else
      #define {utoken}_PUBLIC
  #endif
#endif

int {utoken}_PUBLIC {function_name}();

zç#include <{header_file}>

/* This function will not be exported and is not
 * directly callable by users of this library.
 */
int internal_function() {{
    return 0;
}}

int {function_name}() {{
    return internal_function();
}}
zÔ#include <{header_file}>
#include <stdio.h>

int main(int argc, char **argv) {{
    if(argc != 1) {{
        printf("%s takes no arguments.\n", argv[0]);
        return 1;
    }}
    return {function_name}();
}}
aÕ  project('{project_name}', 'c',
  version : '{version}',
  default_options : ['warning_level=3'])

# These arguments are only used to build the shared library
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']

shlib = shared_library('{lib_name}', '{source_file}',
  install : true,
  c_args : lib_args,
  gnu_symbol_visibility : 'hidden',
)

test_exe = executable('{test_exe_name}', '{test_source_file}',
  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)

# Make this library usable from the system's
# package manager.
install_headers('{header_file}', subdir : '{header_dir}')

pkg_mod = import('pkgconfig')
pkg_mod.generate(
  name : '{project_name}',
  filebase : '{ltoken}',
  description : 'Meson sample project.',
  subdirs : '{header_dir}',
  libraries : shlib,
  version : '{version}',
)
a  #include <stdio.h>

#define PROJECT_NAME "{project_name}"

int main(int argc, char **argv) {{
    if(argc != 1) {{
        printf("%s takes no arguments.\n", argv[0]);
        return 1;
    }}
    printf("This is project %s.\n", PROJECT_NAME);
    return 0;
}}
z¸project('{project_name}', 'c',
  version : '{version}',
  default_options : ['warning_level=3'])

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

test('basic', exe)
c                  ó.   ‡ — e Zd Zˆ fd„Zdd„Zdd„Zˆ xZS )ÚCProjectc                óx   •— t          ¦   «                              ¦   «          |j        | _        |j        | _        d S )N)ÚsuperÚ__init__ÚnameÚversion)ÚselfÚoptionsÚ	__class__s     €úA/usr/lib/python3/dist-packages/mesonbuild/templates/ctemplates.pyr	   zCProject.__init__�   s/   ø€ Ý‰Œ×ÒÑÔÐØ”LˆŒ	Ø”ˆŒˆˆó    ÚreturnÚNonec                ó†  — t          j        dd| j                             ¦   «         ¦  «        }|dz   }t	          |dd¬¦  «                             t                               | j        ¬¦  «        ¦  «         t	          ddd¬¦  «                             t                               | j        ||| j	        ¬	¦  «        ¦  «         d S )
Nú	[^a-z0-9]Ú_ú.cÚwúutf-8©Úencoding)Úproject_nameúmeson.build)r   Úexe_nameÚsource_namer   )
ÚreÚsubr
   ÚlowerÚopenÚwriteÚhello_c_templateÚformatÚhello_c_meson_templater   )r   Úlowercase_tokenr   s      r   Úcreate_executablezCProject.create_executable†   sÃ   € Ýœ& ¨s°D´I·O²OÑ4EÔ4EÑFÔFˆØ%¨Ñ,ˆÝˆ[˜#¨Ð0Ñ0Ô0×6Ò6Õ7G×7NÒ7NÐ\`Ô\eÐ7NÑ7fÔ7fÑgÔgÐgÝˆ]˜C¨'Ð2Ñ2Ô2×8Ò8Ý"×)Ò)°t´yØ3BØ6AØ26´,ð *ñ @ô @ñ	Aô 	Að 	Að 	Að 	Ar   c                óœ  — t          j        dd| j                             ¦   «         ¦  «        }|                     ¦   «         }|dd…         dz   }|dz   }|dz   }|dz   }|d	z   }||||||||| j        ||| j        d
œ}t          |dd¬¦  «                             t          j	        di |¤Ž¦  «         t          |dd¬¦  «                             t          j	        di |¤Ž¦  «         t          |dd¬¦  «                             t          j	        di |¤Ž¦  «         t          ddd¬¦  «                             t          j	        di |¤Ž¦  «         d S )Nr   r   r   é   Ú_funcÚ_testz.hr   z_test.c)ÚutokenÚltokenÚ
header_dirÚfunction_nameÚheader_fileÚsource_fileÚtest_source_fileÚtest_exe_namer   Úlib_nameÚ	test_namer   r   r   r   r   © )r   r    r
   r!   Úupperr   r"   r#   Úlib_h_templater%   Úlib_c_templateÚlib_c_test_templateÚlib_c_meson_template)	r   r'   Úuppercase_tokenr0   r4   Ú
lib_h_nameÚ
lib_c_nameÚtest_c_nameÚkwargss	            r   Úcreate_libraryzCProject.create_library�   s}  € Ýœ& ¨s°D´I·O²OÑ4EÔ4EÑFÔFˆØ)×/Ò/Ñ1Ô1ˆØ'¨¨!¨Ô,¨wÑ6ˆØ'¨'Ñ1ˆØ$ tÑ+ˆ
Ø$ tÑ+ˆ
Ø%¨	Ñ1ˆØ+Ø+Ø /Ø#0Ø!+Ø!+Ø&1Ø#0Ø"&¤)Ø-Ø.Ø!œ\ðð ˆõ 	ˆZ˜ wÐ/Ñ/Ô/×5Ò5µnÔ6KÐ6UÐ6UÈfÐ6UÐ6UÑVÔVÐVÝˆZ˜ wÐ/Ñ/Ô/×5Ò5µnÔ6KÐ6UÐ6UÈfÐ6UÐ6UÑVÔVÐVÝˆ[˜#¨Ð0Ñ0Ô0×6Ò6Õ7JÔ7QÐ7[Ð7[ÐTZÐ7[Ð7[Ñ\Ô\Ð\Ýˆ]˜C¨'Ð2Ñ2Ô2×8Ò8Õ9MÔ9TÐ9^Ð9^ÐW]Ð9^Ð9^Ñ_Ô_Ð_Ð_Ð_r   )r   r   )Ú__name__Ú
__module__Ú__qualname__r	   r(   rB   Ú__classcell__)r   s   @r   r   r   €   sl   ø€ € € € € ð'ð 'ð 'ð 'ð 'ð
Að Að Að Að`ð `ð `ð `ð `ð `ð `ð `r   r   )Ú
__future__r   Úmesonbuild.templates.sampleimplr   r   r9   r:   r;   r<   r$   r&   r   r7   r   r   ú<module>rI      s¡   ðð #Ð "Ð "Ð "Ð "Ð "à 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 	€	€	€	ð€ð&€ð
Ð ð$Ð ðLÐ ðÐ ð(`ð (`ð (`ð (`ð (`ˆzñ (`ô (`ð (`ð (`ð (`r   