【问题标题】:How to build a c program project using meson如何使用介子建立一个c程序项目
【发布时间】:2022-12-16 21:00:13
【问题描述】:

我想使用介子构建一个 c 项目。请提供 meson.build 文件中的内容及其放置位置?

这些是项目的文件夹

Project_dir/
        src/
          command.c
       include/
          command.h
       main.c

【问题讨论】:

    标签: meson-build


    【解决方案1】:
        Project_dir/
                src/
                  command.c
               include/
                  command.h
               main.c
               meson.build
    

    然后在 meson.build

            project(
              'dummy', 'c',
              version : '1.1.0',
              default_options : ['buildtype=debugoptimized','warning_level=1'],
            )
            
           #define default build args for all c
           build_args_c = ['-Wall',]
           #source cofe
           project_source_files = ['src/command.c','main.c',]  
           #include folder
           proj_headers = include_directories(inc)
          
           executable(
                  dummy,
                  project_source_files,
                  #dependencies:   [''],
                  c_args : build_args_c,
                  gnu_symbol_visibility : 'default',
                  include_directories :  proj_headers]
              )
    

    设置介子项目

    meson setup dummyProj
    

    然后编译

    meson compile -C dummyProj
    

    【讨论】:

      猜你喜欢
      • 2021-01-12
      • 2018-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-30
      • 2012-05-26
      • 2010-09-17
      相关资源
      最近更新 更多