FeatherMC/meson.build

94 lines
2.3 KiB
Meson

project('FeatherMC', ['c', 'cpp'], version : '0.0', meson_version : '>= 0.55', default_options : [
'warning_level=2',
])
add_project_arguments('-DNOMINMAX', language : 'cpp')
feather_compiler = meson.get_compiler('cpp')
feather_cpp_std = 'c++17'
feather_platform = target_machine.system()
if feather_compiler.get_id() == 'msvc'
add_project_arguments('/std:' + feather_cpp_std, language : 'cpp')
endif
threads_dep = dependency('threads')
cmake = import('cmake')
########################################
# zlib
########################################
zlib_vars = cmake.subproject_options()
zlib_vars.add_cmake_defines({
'BUILD_SHARED_LIBS' : false
})
zlib_vars.set_install(false)
zlib_proj = cmake.subproject('zlib', options : zlib_vars)
zlib_dep = zlib_proj.dependency('zlibstatic')
########################################
# libevent
########################################
libevent_vars = cmake.subproject_options()
libevent_vars.add_cmake_defines({
'EVENT__DISABLE_OPENSSL' : true,
'EVENT__DISABLE_MBEDTLS' : true,
'EVENT__DISABLE_BENCHMARK' : true,
'EVENT__DISABLE_TESTS' : true,
'EVENT__DISABLE_REGRESS' : true,
'EVENT__DISABLE_SAMPLES' : true,
'EVENT__LIBRARY_TYPE' : 'STATIC',
})
libevent_vars.set_install(false)
libevent_proj = cmake.subproject('libevent', options : libevent_vars)
libevent_core_dep = libevent_proj.dependency('event_core_static')
libevent_extra_dep = libevent_proj.dependency('event_extra_static')
########################################
# cNBT
########################################
# TODO: cNBT
cnbt_vars = cmake.subproject_options()
cnbt_vars.add_cmake_defines({
'CNBT_BUILD_EXAMPLES' : false,
'BUILD_SHARED_LIBS' : false,
})
cnbt_vars.set_install(false)
cnbt_proj = cmake.subproject('cNBT', options : cnbt_vars)
cnbt_dep = cnbt_proj.dependency('nbt')
########################################
feather_deps = [
threads_dep,
zlib_dep,
libevent_core_dep,
libevent_extra_dep,
cnbt_dep
]
if feather_platform == 'windows'
ws2_32_dep = feather_compiler.find_library('ws2_32')
iphlpapi_dep = feather_compiler.find_library('iphlpapi')
feather_deps += [ ws2_32_dep, iphlpapi_dep ]
else
libevent_pthreads_dep = libevent_proj.dependency('event_pthreads_static')
feather_deps += [ libevent_pthreads_dep ]
endif
python = find_program('python')
subdir('src')