meson: Do not install when used as a subproject
This commit is contained in:
		
							parent
							
								
									a7ba6e447d
								
							
						
					
					
						commit
						313ec87dc1
					
				
							
								
								
									
										21
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								meson.build
									
									
									
									
									
								
							@ -4,7 +4,6 @@ project('spdlog', ['cpp'],
 | 
				
			|||||||
  default_options : [
 | 
					  default_options : [
 | 
				
			||||||
    'warning_level=3',
 | 
					    'warning_level=3',
 | 
				
			||||||
    'cpp_std=c++11',
 | 
					    'cpp_std=c++11',
 | 
				
			||||||
    'default_library=static',
 | 
					 | 
				
			||||||
    'buildtype=release',
 | 
					    'buildtype=release',
 | 
				
			||||||
    'b_colorout=always',
 | 
					    'b_colorout=always',
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
@ -34,12 +33,21 @@ endif
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
spdlog_inc = include_directories('./include')
 | 
					spdlog_inc = include_directories('./include')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
spdlog = library('spdlog', ['src/spdlog.cpp'],
 | 
					if get_option('library_type') == 'static'
 | 
				
			||||||
 | 
					  spdlog = static_library('spdlog', ['src/spdlog.cpp'],
 | 
				
			||||||
    cpp_args            : [compile_args] + ['-DSPDLOG_COMPILED_LIB'],
 | 
					    cpp_args            : [compile_args] + ['-DSPDLOG_COMPILED_LIB'],
 | 
				
			||||||
    include_directories : spdlog_inc,
 | 
					    include_directories : spdlog_inc,
 | 
				
			||||||
    dependencies        : dep_list,
 | 
					    dependencies        : dep_list,
 | 
				
			||||||
  install             : true,
 | 
					    install             : not meson.is_subproject(),
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					  spdlog = shared_library('spdlog', ['src/spdlog.cpp'],
 | 
				
			||||||
 | 
					    cpp_args            : [compile_args] + ['-DSPDLOG_COMPILED_LIB'],
 | 
				
			||||||
 | 
					    include_directories : spdlog_inc,
 | 
				
			||||||
 | 
					    dependencies        : dep_list,
 | 
				
			||||||
 | 
					    install             : not meson.is_subproject(),
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
spdlog_dep = declare_dependency(
 | 
					spdlog_dep = declare_dependency(
 | 
				
			||||||
  link_with           : spdlog,
 | 
					  link_with           : spdlog,
 | 
				
			||||||
@ -64,6 +72,8 @@ spdlog_headeronly_dep = declare_dependency(
 | 
				
			|||||||
# ---   Installation   ---
 | 
					# ---   Installation   ---
 | 
				
			||||||
# ------------------------
 | 
					# ------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Do not install when spdlog is used as a subproject
 | 
				
			||||||
 | 
					if not meson.is_subproject()
 | 
				
			||||||
  install_subdir('include/spdlog', install_dir: get_option('includedir'))
 | 
					  install_subdir('include/spdlog', install_dir: get_option('includedir'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  pkg = import('pkgconfig')
 | 
					  pkg = import('pkgconfig')
 | 
				
			||||||
@ -73,6 +83,7 @@ pkg.generate(spdlog,
 | 
				
			|||||||
    url          : 'https://github.com/gabime/spdlog',
 | 
					    url          : 'https://github.com/gabime/spdlog',
 | 
				
			||||||
    extra_cflags : ['-DSPDLOG_COMPILED_LIB']
 | 
					    extra_cflags : ['-DSPDLOG_COMPILED_LIB']
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# -------------------------------------
 | 
					# -------------------------------------
 | 
				
			||||||
# ---   Conditionally add subdirs   ---
 | 
					# ---   Conditionally add subdirs   ---
 | 
				
			||||||
@ -100,11 +111,13 @@ summary_str = '''spdlog build summary:
 | 
				
			|||||||
  - building tests:      @1@
 | 
					  - building tests:      @1@
 | 
				
			||||||
  - building examples:   @2@
 | 
					  - building examples:   @2@
 | 
				
			||||||
  - building benchmarks: @3@
 | 
					  - building benchmarks: @3@
 | 
				
			||||||
 | 
					  - library type:        @4@
 | 
				
			||||||
'''.format(
 | 
					'''.format(
 | 
				
			||||||
  get_option('external_fmt'),
 | 
					  get_option('external_fmt'),
 | 
				
			||||||
  get_option('enable_tests'),
 | 
					  get_option('enable_tests'),
 | 
				
			||||||
  get_option('enable_examples'),
 | 
					  get_option('enable_examples'),
 | 
				
			||||||
  get_option('enable_benchmarks')
 | 
					  get_option('enable_benchmarks'),
 | 
				
			||||||
 | 
					  get_option('library_type')
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
message(summary_str)
 | 
					message(summary_str)
 | 
				
			||||||
 | 
				
			|||||||
@ -2,3 +2,4 @@ option('external_fmt',      type: 'boolean', value: false)
 | 
				
			|||||||
option('enable_examples',   type: 'boolean', value: false)
 | 
					option('enable_examples',   type: 'boolean', value: false)
 | 
				
			||||||
option('enable_benchmarks', type: 'boolean', value: false)
 | 
					option('enable_benchmarks', type: 'boolean', value: false)
 | 
				
			||||||
option('enable_tests',      type: 'boolean', value: false)
 | 
					option('enable_tests',      type: 'boolean', value: false)
 | 
				
			||||||
 | 
					option('library_type',      type: 'combo', choices: ['static', 'shared'], value: 'static')
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user