mkxp-z/meson.build

110 lines
3.3 KiB
Meson
Raw Normal View History

project('mkxp-z', 'cpp', 'objc', 'objcpp', version: '1.2.0', default_options: ['cpp_std=c++11', 'buildtype=release'])
2019-07-29 07:56:45 -04:00
minimum_macos_version = get_option('macos_min_version')
2019-08-31 19:12:54 -04:00
# The meson build is mostly directly copied from the old CMakeLists,
# it still needs to be cleaned up
2019-08-04 12:00:20 -04:00
xxd = find_program('xxd', native: true)
objfw = find_program('objfw-config', native: true)
2019-07-29 07:56:45 -04:00
host_system = host_machine.system()
compilers = {'cpp': meson.get_compiler('cpp'), 'objc': meson.get_compiler('objc'), 'objcpp': meson.get_compiler('objcpp')}
2019-07-29 07:56:45 -04:00
2019-09-04 05:48:23 -04:00
# ====================
# Ext libs
# ====================
ext_dependencies = []
# DISCORD
discord = false
discord_libpath = get_option('discord_sdk_path')
if discord_libpath != ''
discordlib = compilers['cpp'].find_library('discord_game_sdk', required: false, dirs: '@0@/lib/@1@'.format(discord_libpath, host_machine.cpu_family()))
2019-09-04 05:48:23 -04:00
if discordlib.found() == true
add_project_arguments(['-I@0@/c'.format(discord_libpath), '-DHAVE_DISCORDSDK'], language: 'cpp')
ext_dependencies += discordlib
discord = true
endif
endif
# ====================
# Main source
# ====================
global_sources = []
global_dependencies = []
global_include_dirs = []
global_args = []
global_link_args = []
# Suppress warnings
global_args += ['-Wno-non-virtual-dtor', '-Wno-reorder']
2019-09-04 05:48:23 -04:00
if get_option('workdir_current')
global_args += '-DWORKDIR_CURRENT'
2019-07-29 08:20:40 -04:00
endif
if get_option('independent_appimage')
global_args += '-DINDEPENDENT_APPIMAGE'
endif
if get_option('use_fakeapi')
global_args += '-DUSE_FAKEAPI'
endif
if not get_option('console')
global_args += '-DNO_CONSOLE'
endif
2019-09-19 03:32:50 -04:00
if get_option('mk')
global_args += '-DMARIN'
endif
global_args += run_command(objfw,'--cppflags').stdout().split()
add_project_arguments(run_command(objfw,'--objcflags').stdout().split(), language:'objc')
add_project_link_arguments(run_command(objfw,'--libs','--ldflags').stdout().split(), language:['objc','objcpp'])
if compilers['objc'].get_id() == 'clang'
add_project_arguments(run_command(objfw,'--arc').stdout().split(), language: ['objc','objcpp'])
2019-09-19 03:32:50 -04:00
endif
2019-07-29 07:56:45 -04:00
subdir('src')
2019-07-31 08:47:44 -04:00
subdir('binding')
2019-07-29 07:56:45 -04:00
subdir('shader')
subdir('assets')
#all_sources = [main, bindings, processed_shaders, processed_assets]
global_include_dirs += include_directories('src', 'binding')
2019-08-19 08:59:35 -04:00
# Disable some warnings
#add_project_arguments(['-Wno-reorder', '-Wno-non-virtual-dtor', '-Wno-uninitialized'], language: 'cpp')
2019-07-29 07:56:45 -04:00
if host_system == 'windows'
subdir('windows')
global_sources += windows_resources
global_include_dirs += include_directories('windows')
2019-07-29 07:56:45 -04:00
elif host_system == 'darwin'
2019-08-26 01:57:12 -04:00
subdir('macos')
if compilers['cpp'].get_id() == 'clang'
add_project_arguments('-stdlib=libc++', language: ['cpp','objcpp'])
add_project_arguments('-std=c++11', language: 'objcpp')
global_args += ['-Wno-undefined-var-template', '-mmacosx-version-min='+minimum_macos_version]
global_link_args += '-mmacosx-version-min='+minimum_macos_version
2019-07-29 07:56:45 -04:00
endif
2019-10-22 02:30:07 -04:00
else
subdir('linux')
2019-07-29 07:56:45 -04:00
endif
2019-07-31 09:45:12 -04:00
executable(meson.project_name(),
sources: global_sources,
dependencies: [global_dependencies, ext_dependencies],
include_directories: global_include_dirs,
link_args: global_link_args,
cpp_args: global_args,
objc_args: global_args,
objcpp_args: global_args,
2019-08-26 01:57:12 -04:00
gui_app: (get_option('console') == false),
2019-10-22 02:30:07 -04:00
install: (host_system != 'windows')
2019-07-29 07:56:45 -04:00
)