Clean up meson.build slightly and add a section to the top to describe what I want to do so I can ask people.
This commit is contained in:
parent
355b5d05d3
commit
1a9b0881bc
31
meson.build
31
meson.build
|
@ -1,30 +1,42 @@
|
|||
# 17 march 2019
|
||||
|
||||
# Here's the overall idea: the build syntax would be something like
|
||||
# $ meson setup build \
|
||||
# [--buildtype=debug|release] \ (core option, default debug)
|
||||
# [--default_library=static|shared] \ (core option, default shared)
|
||||
# [--b_sanitize=whatever]
|
||||
# It turns out that I wouldn't really need any custom options; go figure.
|
||||
# I'm not sure how to allow building 32-bit instead of 64-bit with meson.
|
||||
# I'd also like all the outputs to appear in a folder out/ in the build folder.
|
||||
# I'd also like to be able to omit the library's dependency libraries in the executables if building a shared library, as those are not required in that case; I'd need to require them in a static library.
|
||||
# And for Windows, the shared library (but not shared executables) needs an additional resource file, and the static executables (but not the static library) need a *different* resource file. (Windows static libraries can't contain resources anyway; the linkers will just ignore the resource objects.)
|
||||
|
||||
libui_OS = target_machine.system()
|
||||
libui_MSVC = meson.get_compiler('c').get_id() == 'msvc'
|
||||
|
||||
libui_languages = ['c', 'c++']
|
||||
if libui_OS == 'darwin'
|
||||
libui_languages += ['objc']
|
||||
endif
|
||||
|
||||
libui_default_options = [
|
||||
'buildtype=debug', # build debug by default (TODO: disallow plain?)
|
||||
'default_library=shared', # build shared libraries by default
|
||||
]
|
||||
# TODO switch to tabs; the spaces are just so I can share this file while I'm writing it
|
||||
libui_forced_options = {
|
||||
'warning_level': '3', # always max warnings
|
||||
'b_pch': 'false', # we don't want precompiled headers
|
||||
'b_staticpic': 'true', # use PIC even for static libraries
|
||||
'c_std': 'c99', # strict C99
|
||||
'cpp_std': 'c++11', # strict C++11
|
||||
'cpp_eh': 'sc', # shut the compiler up in some cases
|
||||
}
|
||||
foreach name, value : libui_forced_options
|
||||
libui_default_options += [name + '=' + value]
|
||||
endforeach
|
||||
|
||||
project('libui', libui_languages,
|
||||
project('libui', 'c',
|
||||
default_options: libui_default_options,
|
||||
license: 'MIT')
|
||||
# TODO:
|
||||
# - add add_language('c++') in windows/meson.build and examples/meson.build:cpp-multithread
|
||||
# - add add_language('objc') in darwin/meson.build
|
||||
|
||||
foreach name, value : libui_forced_options
|
||||
actual = '@0@'.format(get_option(name))
|
||||
|
@ -38,7 +50,7 @@ if libui_mode == 'both'
|
|||
error('sorry, but libui does not support building both shared and static libraries at the same time, because Windows resource file rules differ between the two')
|
||||
endif
|
||||
if libui_OS == 'windows' and libui_mode == 'shared' and not libui_MSVC
|
||||
error('sorry, but libui currently does not support building a shared library with MinGW; use -Ddefault_library=static instead')
|
||||
error('sorry, but libui currently does not support building a shared library with MinGW; use --default_library=static instead')
|
||||
endif
|
||||
|
||||
libui_deps = []
|
||||
|
@ -57,6 +69,7 @@ elif libui_OS == 'darwin'
|
|||
else
|
||||
gtk = dependency('gtk+-3.0',
|
||||
version: '>=3.10.0',
|
||||
method: 'pkg-config',
|
||||
required: true)
|
||||
libui_deps += [gtk]
|
||||
libui_soversion = '0'
|
||||
|
@ -66,18 +79,16 @@ endif
|
|||
if libui_MSVC
|
||||
# TODO subsystem version
|
||||
|
||||
# TODO -Wno-switch equivalent
|
||||
# TODO is there a -Wno-switch equivalent?
|
||||
# TODO /sdl turns C4996 into an ERROR
|
||||
# don't use /analyze; that requires us to write annotations everywhere
|
||||
# TODO undecided flags from qo?
|
||||
# the RTC flags are only supplied in debug builds because they are only supposed to be used by debug builds (see "This is because run-time error checks are not valid in a release (optimized) build." in https://docs.microsoft.com/cpp/build/reference/rtc-run-time-error-checks)
|
||||
# /RTCc is not supplied because it's discouraged as of VS2015; see https://www.reddit.com/r/cpp/comments/46mhne/rtcc_rejects_conformant_code_with_visual_c_2015/d06auq5
|
||||
# /EHsc is to shut the compiler up in some cases
|
||||
# TODO add these compiler flags (assuming meson doesn't provide an alternate method for these, which I know it does for EHsc):
|
||||
# /wd4100 (equivalent of -Wno-unused-parameter)
|
||||
# /bigobj /nologo
|
||||
# $<$<CONFIG:Debug>:/RTC1 /RTCs /RTCu>
|
||||
# /EHsc
|
||||
|
||||
# TODO add these linker flags (for each: maybe? depends on whether meson does this itself)
|
||||
# /LARGEADDRESSAWARE
|
||||
|
|
Loading…
Reference in New Issue