2019-09-17 02:29:34 -04:00
|
|
|
project('mkxp-z', 'cpp', 'c', version: '1.1.0', default_options: ['cpp_std=c++11'])
|
2019-07-29 07:56:45 -04:00
|
|
|
|
2019-09-02 11:16:38 -04:00
|
|
|
minimum_macos_version = get_option('macos_min_version')
|
2019-08-31 19:12:54 -04:00
|
|
|
|
2019-08-20 05:21:30 -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)
|
2019-07-29 07:56:45 -04:00
|
|
|
host_system = host_machine.system()
|
2019-07-31 10:53:46 -04:00
|
|
|
compiler = meson.get_compiler('cpp')
|
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 = compiler.find_library('discord_game_sdk', required: false, dirs: '@0@/lib/@1@'.format(discord_libpath, host_machine.cpu_family()))
|
|
|
|
|
|
|
|
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
|
|
|
|
# ====================
|
|
|
|
|
2019-08-10 04:35:37 -04:00
|
|
|
if get_option('workdir_current')
|
2019-07-29 08:20:40 -04:00
|
|
|
add_project_arguments('-DWORKDIR_CURRENT', language: 'cpp')
|
|
|
|
endif
|
|
|
|
|
2019-08-20 05:21:30 -04:00
|
|
|
if get_option('use_fakeapi')
|
|
|
|
add_project_arguments('-DUSE_FAKEAPI', language: 'cpp')
|
2019-08-10 03:46:20 -04:00
|
|
|
endif
|
|
|
|
|
2019-08-10 04:35:37 -04:00
|
|
|
if not get_option('console')
|
|
|
|
add_project_arguments('-DNO_CONSOLE', language: 'cpp')
|
|
|
|
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')
|
|
|
|
|
2019-07-31 07:04:13 -04:00
|
|
|
all_sources = [main, bindings, processed_shaders, processed_assets]
|
2019-07-31 08:47:44 -04:00
|
|
|
include_dirs = [include_directories('src', 'binding')]
|
2019-07-29 07:56:45 -04:00
|
|
|
|
2019-08-19 08:59:35 -04:00
|
|
|
# Use cwalk
|
|
|
|
all_sources += files('cwalk/src/cwalk.c')
|
|
|
|
include_dirs += include_directories('cwalk/include')
|
|
|
|
|
2019-09-04 05:48:23 -04:00
|
|
|
|
2019-07-29 07:56:45 -04:00
|
|
|
linker_args = []
|
|
|
|
|
|
|
|
if host_system == 'windows'
|
|
|
|
subdir('windows')
|
|
|
|
all_sources += windows_resources
|
2019-07-30 09:17:20 -04:00
|
|
|
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')
|
2019-07-31 15:33:02 -04:00
|
|
|
if compiler.get_id() == 'clang'
|
2019-08-08 08:48:48 -04:00
|
|
|
add_project_arguments('-stdlib=libc++', language: 'cpp')
|
2019-08-31 19:12:54 -04:00
|
|
|
add_project_arguments('-mmacosx-version-min='+minimum_macos_version, language: 'cpp')
|
|
|
|
add_project_arguments('-mmacosx-version-min='+minimum_macos_version, language: 'c')
|
|
|
|
add_project_link_arguments('-mmacosx-version-min='+minimum_macos_version, language: 'cpp')
|
2019-07-29 07:56:45 -04:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-07-31 09:45:12 -04:00
|
|
|
executable(meson.project_name(),
|
2019-07-29 07:56:45 -04:00
|
|
|
sources: all_sources,
|
2019-09-04 05:48:23 -04:00
|
|
|
dependencies: [main_dependencies, binding_dependencies, ext_dependencies],
|
2019-08-09 07:36:18 -04:00
|
|
|
include_directories: include_dirs,
|
2019-08-26 01:57:12 -04:00
|
|
|
gui_app: (get_option('console') == false),
|
|
|
|
install: (host_system == 'darwin')
|
2019-07-29 07:56:45 -04:00
|
|
|
)
|