2022-08-23 04:14:06 -05:00
|
|
|
project(
|
|
|
|
'the-powder-toy',
|
|
|
|
[ 'c', 'cpp' ],
|
|
|
|
version: 'the.cake.is.a.lie',
|
|
|
|
default_options: [
|
|
|
|
'c_std=c99',
|
|
|
|
'cpp_std=c++17',
|
|
|
|
'cpp_rtti=false',
|
|
|
|
'build.c_std=c99', # used by to_array
|
|
|
|
'build.cpp_std=c++17', # used by to_array
|
|
|
|
'build.cpp_rtti=false', # used by to_array
|
|
|
|
],
|
2023-08-31 09:46:33 -05:00
|
|
|
meson_version: '>=0.64.0',
|
2022-08-23 04:14:06 -05:00
|
|
|
)
|
2019-12-17 08:03:41 -06:00
|
|
|
|
2022-12-17 06:53:37 -06:00
|
|
|
if get_option('prepare')
|
|
|
|
# we're being run by prepare.py in a ghactions workflow only to determine the values of options; exit early
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2023-10-02 10:26:57 -05:00
|
|
|
fs = import('fs')
|
2021-01-04 09:35:02 -06:00
|
|
|
to_array = generator(
|
2022-12-25 04:03:29 -06:00
|
|
|
executable('toarray', sources: 'resources/ToArray.cpp', native: true),
|
2021-01-04 09:35:02 -06:00
|
|
|
output: [ '@PLAINNAME@.cpp', '@PLAINNAME@.h' ],
|
2021-12-07 10:15:21 -06:00
|
|
|
arguments: [ '@OUTPUT0@', '@OUTPUT1@', '@INPUT@', '@EXTRA_ARGS@' ]
|
2021-01-04 09:35:02 -06:00
|
|
|
)
|
|
|
|
|
2022-10-23 04:41:26 -05:00
|
|
|
render_icons_with_inkscape = get_option('render_icons_with_inkscape')
|
|
|
|
inkscape = find_program('inkscape', required: render_icons_with_inkscape)
|
|
|
|
|
2022-04-11 14:11:03 -05:00
|
|
|
c_compiler = meson.get_compiler('c')
|
2022-08-23 04:14:06 -05:00
|
|
|
|
|
|
|
is_x86 = host_machine.cpu_family() in [ 'x86', 'x86_64' ]
|
|
|
|
is_64bit = host_machine.cpu_family() in [ 'aarch64', 'x86_64' ]
|
|
|
|
is_msvc = c_compiler.get_id() in [ 'msvc' ]
|
|
|
|
|
|
|
|
host_arch = host_machine.cpu_family()
|
|
|
|
host_platform = host_machine.system()
|
|
|
|
# educated guesses follow, PRs welcome
|
2022-04-11 14:11:03 -05:00
|
|
|
if c_compiler.get_id() in [ 'msvc' ]
|
2023-01-19 11:31:47 -06:00
|
|
|
if host_platform != 'windows'
|
|
|
|
error('this seems fishy')
|
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
host_libc = 'msvc'
|
|
|
|
elif c_compiler.get_id() in [ 'gcc' ] and host_platform == 'windows'
|
|
|
|
host_libc = 'mingw'
|
|
|
|
if get_option('b_lto')
|
|
|
|
warning('mingw does not like static + lto')
|
|
|
|
endif
|
|
|
|
elif host_platform in [ 'darwin' ]
|
|
|
|
host_libc = 'macos'
|
2023-01-24 11:37:06 -06:00
|
|
|
elif host_platform in [ 'emscripten' ]
|
|
|
|
host_platform = 'emscripten'
|
|
|
|
host_libc = 'emscripten'
|
2022-08-23 04:14:06 -05:00
|
|
|
elif host_platform in [ 'android' ]
|
|
|
|
host_platform = 'android'
|
|
|
|
host_libc = 'bionic'
|
2021-03-12 14:02:02 -06:00
|
|
|
else
|
2023-01-19 11:31:47 -06:00
|
|
|
if host_platform != 'linux'
|
|
|
|
# TODO: maybe use 'default' in place of 'linux', or use something other than host_platform where details such as desktop integration are concerned
|
|
|
|
warning('host platform is not linux but we will pretend that it is')
|
|
|
|
host_platform = 'linux'
|
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
host_libc = 'gnu'
|
2021-03-12 14:02:02 -06:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
|
|
|
|
static_variant = get_option('static')
|
|
|
|
if static_variant != 'prebuilt' and host_platform == 'android'
|
|
|
|
warning('only prebuilt libs are supported for android')
|
|
|
|
static_variant = 'prebuilt'
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if static_variant == 'system' and host_platform == 'windows'
|
|
|
|
warning('no way to find system libs on windows')
|
|
|
|
static_variant = 'prebuilt'
|
2021-01-21 11:26:30 -06:00
|
|
|
endif
|
2022-04-09 08:01:23 -05:00
|
|
|
|
2022-08-23 04:14:06 -05:00
|
|
|
is_static = static_variant != 'none'
|
|
|
|
is_debug = get_option('optimization') in [ '0', 'g' ]
|
2023-01-25 02:30:43 -06:00
|
|
|
app_exe = get_option('app_exe')
|
2022-04-09 08:01:23 -05:00
|
|
|
|
2022-08-23 04:14:06 -05:00
|
|
|
tpt_libs_static = 'none'
|
|
|
|
if static_variant == 'prebuilt'
|
|
|
|
tpt_libs_static = 'static'
|
2022-04-09 08:01:23 -05:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if static_variant == 'none' and host_platform == 'windows'
|
|
|
|
tpt_libs_static = 'dynamic'
|
|
|
|
endif
|
|
|
|
tpt_libs_debug = is_debug ? 'debug' : 'release'
|
|
|
|
tpt_libs_variant = '@0@-@1@-@2@-@3@'.format(host_arch, host_platform, host_libc, tpt_libs_static)
|
2022-04-09 08:01:23 -05:00
|
|
|
tpt_libs_vtag = get_option('tpt_libs_vtag')
|
|
|
|
if tpt_libs_vtag == ''
|
2023-10-03 08:59:42 -05:00
|
|
|
tpt_libs_vtag = 'v20231003175140'
|
2022-04-09 08:01:23 -05:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if tpt_libs_static != 'none'
|
|
|
|
if tpt_libs_variant not in [
|
|
|
|
'x86_64-linux-gnu-static',
|
|
|
|
'x86_64-windows-mingw-static',
|
|
|
|
'x86_64-windows-mingw-dynamic',
|
|
|
|
'x86_64-windows-msvc-static',
|
|
|
|
'x86_64-windows-msvc-dynamic',
|
|
|
|
'x86-windows-msvc-static',
|
|
|
|
'x86-windows-msvc-dynamic',
|
|
|
|
'x86_64-darwin-macos-static',
|
|
|
|
'aarch64-darwin-macos-static',
|
|
|
|
'x86-android-bionic-static',
|
|
|
|
'x86_64-android-bionic-static',
|
|
|
|
'arm-android-bionic-static',
|
|
|
|
'aarch64-android-bionic-static',
|
2023-01-24 11:37:06 -06:00
|
|
|
'wasm32-emscripten-emscripten-static',
|
2022-08-23 04:14:06 -05:00
|
|
|
]
|
|
|
|
error('no prebuilt @0@ libraries are currently provided'.format(tpt_libs_variant))
|
2021-03-12 14:02:02 -06:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
tpt_libs = subproject('tpt-libs-prebuilt-@0@-@1@-@2@'.format(tpt_libs_variant, tpt_libs_debug, tpt_libs_vtag))
|
2022-10-11 06:08:42 -05:00
|
|
|
else
|
|
|
|
if get_option('workaround_elusive_bzip2')
|
|
|
|
bzip2_lib_name = get_option('workaround_elusive_bzip2_lib_name')
|
|
|
|
bzip2_include_name = get_option('workaround_elusive_bzip2_include_name')
|
|
|
|
bzip2_lib_dir = get_option('workaround_elusive_bzip2_lib_dir')
|
|
|
|
bzip2_include_dir = include_directories(get_option('workaround_elusive_bzip2_include_dir'))
|
|
|
|
bzip2_static = get_option('workaround_elusive_bzip2_static')
|
|
|
|
meson.override_dependency('bzip2', declare_dependency(
|
|
|
|
dependencies: c_compiler.find_library(
|
|
|
|
bzip2_lib_name,
|
|
|
|
has_headers: bzip2_include_name,
|
|
|
|
dirs: bzip2_lib_dir,
|
|
|
|
header_include_directories: bzip2_include_dir,
|
|
|
|
static: bzip2_static,
|
|
|
|
),
|
|
|
|
include_directories: bzip2_include_dir,
|
|
|
|
))
|
|
|
|
endif
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
|
|
|
|
2022-08-23 04:14:06 -05:00
|
|
|
x86_sse_level_str = get_option('x86_sse')
|
|
|
|
if x86_sse_level_str == 'auto'
|
|
|
|
x86_sse_level = 20
|
2022-09-07 23:52:23 -05:00
|
|
|
if not is_x86 or not is_64bit or host_platform == 'darwin' or (is_64bit and is_msvc)
|
2022-08-23 04:14:06 -05:00
|
|
|
x86_sse_level = 0
|
|
|
|
endif
|
|
|
|
elif x86_sse_level_str == 'sse3'
|
|
|
|
x86_sse_level = 30
|
|
|
|
elif x86_sse_level_str == 'sse2'
|
|
|
|
x86_sse_level = 20
|
|
|
|
elif x86_sse_level_str == 'sse'
|
|
|
|
x86_sse_level = 10
|
|
|
|
elif x86_sse_level_str == 'none'
|
|
|
|
x86_sse_level = 0
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
|
|
|
|
2022-08-23 04:14:06 -05:00
|
|
|
lua_variant = get_option('lua')
|
|
|
|
if lua_variant == 'auto'
|
2023-01-24 11:37:06 -06:00
|
|
|
if host_platform == 'emscripten'
|
|
|
|
lua_variant = 'lua5.2'
|
|
|
|
else
|
|
|
|
lua_variant = 'luajit'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if lua_variant == 'luajit' and host_platform == 'emscripten'
|
|
|
|
error('luajit does not work with emscripten')
|
2022-04-11 14:11:03 -05:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if lua_variant == 'none'
|
|
|
|
lua_dep = []
|
|
|
|
elif lua_variant == 'lua5.1' or lua_variant == 'lua5.2'
|
|
|
|
lua_dep = dependency(lua_variant + '-c++', static: is_static, required: false)
|
|
|
|
if not lua_dep.found()
|
2022-10-11 06:08:42 -05:00
|
|
|
if not get_option('workaround_noncpp_lua')
|
|
|
|
error('your system @0@ is not compatible with C++, configure with -Dworkaround_noncpp_lua=true to disable this error'.format(lua_variant))
|
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
lua_dep = dependency(lua_variant, static: is_static)
|
|
|
|
endif
|
|
|
|
elif lua_variant == 'luajit'
|
|
|
|
lua_dep = dependency('luajit', static: is_static)
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
|
|
|
|
2022-08-23 04:14:06 -05:00
|
|
|
enable_http = get_option('http')
|
|
|
|
if host_platform == 'android'
|
|
|
|
android_ndk_toolchain_prefix = meson.get_external_property('android_ndk_toolchain_prefix')
|
|
|
|
android_platform = meson.get_external_property('android_platform')
|
|
|
|
tpt_libs_android_toolchain_prefix = tpt_libs.get_variable('android_toolchain_prefix')
|
|
|
|
tpt_libs_android_system_version = tpt_libs.get_variable('android_system_version')
|
|
|
|
tpt_libs_android_platform = tpt_libs.get_variable('android_platform')
|
|
|
|
if '@0@@1@-'.format(tpt_libs_android_toolchain_prefix, tpt_libs_android_system_version) != android_ndk_toolchain_prefix
|
|
|
|
error('tpt-libs android toolchain mismatch')
|
|
|
|
endif
|
|
|
|
if tpt_libs_android_platform != android_platform
|
|
|
|
error('tpt-libs android platform mismatch')
|
|
|
|
endif
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
2023-01-24 11:37:06 -06:00
|
|
|
curl_dep = []
|
|
|
|
if enable_http and host_platform != 'emscripten'
|
|
|
|
curl_dep = dependency('libcurl', static: is_static)
|
|
|
|
endif
|
|
|
|
|
|
|
|
project_link_args = []
|
|
|
|
project_c_args = []
|
|
|
|
project_cpp_args = []
|
2022-08-23 04:14:06 -05:00
|
|
|
|
2023-01-27 10:46:59 -06:00
|
|
|
fftw_dep = dependency('fftw3f', static: is_static)
|
2019-12-17 08:03:41 -06:00
|
|
|
threads_dep = dependency('threads')
|
2023-01-24 11:37:06 -06:00
|
|
|
if host_platform == 'emscripten'
|
|
|
|
zlib_dep = []
|
|
|
|
png_dep = []
|
|
|
|
sdl2_dep = []
|
|
|
|
bzip2_dep = []
|
|
|
|
project_link_args += [
|
|
|
|
'--no-heap-copy',
|
|
|
|
'-s', 'WASM=1',
|
|
|
|
'-s', 'ALLOW_MEMORY_GROWTH=1',
|
|
|
|
'-s', 'FORCE_FILESYSTEM=1',
|
2023-06-18 10:52:03 -05:00
|
|
|
'-s', 'EXIT_RUNTIME=0',
|
|
|
|
'-s', 'EXPORTED_RUNTIME_METHODS=ccall,cwrap',
|
|
|
|
'-s', 'FS_DEBUG',
|
2023-08-21 13:32:16 -05:00
|
|
|
'-s', 'MODULARIZE',
|
|
|
|
'-s', 'EXPORT_NAME=create_' + app_exe,
|
2023-12-09 09:51:42 -06:00
|
|
|
'-Wl,-u,_emscripten_run_callback_on_thread',
|
2023-06-18 10:52:03 -05:00
|
|
|
'-lidbfs.js',
|
2023-01-24 11:37:06 -06:00
|
|
|
]
|
|
|
|
emcc_args = [
|
|
|
|
'-s', 'USE_SDL=2',
|
|
|
|
'-s', 'USE_BZIP2=1',
|
|
|
|
'-s', 'USE_LIBPNG',
|
|
|
|
'-s', 'USE_ZLIB=1',
|
|
|
|
'-s', 'DISABLE_EXCEPTION_CATCHING=0',
|
|
|
|
]
|
|
|
|
if is_debug
|
|
|
|
project_link_args += [ '--source-map-base=./' ]
|
|
|
|
emcc_args += [ '-gsource-map' ]
|
|
|
|
endif
|
|
|
|
project_link_args += emcc_args
|
|
|
|
project_c_args += emcc_args
|
|
|
|
project_cpp_args += emcc_args
|
|
|
|
else
|
|
|
|
zlib_dep = dependency('zlib', static: is_static)
|
|
|
|
png_dep = dependency('libpng16', static: is_static)
|
|
|
|
sdl2_dep = dependency('sdl2', static: is_static)
|
|
|
|
bzip2_dep = dependency('bzip2', static: is_static)
|
|
|
|
endif
|
2022-10-11 06:08:42 -05:00
|
|
|
json_dep = dependency('jsoncpp', static: is_static)
|
2019-12-17 08:03:41 -06:00
|
|
|
|
2022-08-23 04:14:06 -05:00
|
|
|
if is_msvc
|
|
|
|
if x86_sse_level >= 30
|
|
|
|
warning('SSE3 configured to be enabled but unavailable in msvc')
|
|
|
|
x86_sse_level = 20
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if is_64bit and x86_sse_level > 0
|
|
|
|
warning('SSE explicitly configured but unavailable in msvc targeting 64-bit machines')
|
|
|
|
x86_sse_level = 0
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
2021-02-15 11:07:32 -06:00
|
|
|
args_msvc = [
|
|
|
|
'/GS',
|
2022-08-23 04:14:06 -05:00
|
|
|
'/D_SCL_SECURE_NO_WARNINGS',
|
|
|
|
'/DUNICODE',
|
|
|
|
'/D_UNICODE',
|
2021-02-15 11:07:32 -06:00
|
|
|
]
|
2022-08-23 04:14:06 -05:00
|
|
|
if x86_sse_level >= 20
|
|
|
|
args_msvc += [ '/arch:SSE2' ]
|
|
|
|
elif x86_sse_level >= 10
|
|
|
|
args_msvc += [ '/arch:SSE' ]
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if not is_debug
|
2021-02-15 11:07:32 -06:00
|
|
|
args_msvc += [
|
|
|
|
'/Oy-',
|
|
|
|
'/fp:fast',
|
2022-09-11 04:55:01 -05:00
|
|
|
'/GL',
|
2021-02-15 11:07:32 -06:00
|
|
|
]
|
|
|
|
project_link_args += [
|
|
|
|
'/OPT:REF',
|
|
|
|
'/OPT:ICF',
|
2022-09-11 04:55:01 -05:00
|
|
|
'/LTCG',
|
2021-02-15 11:07:32 -06:00
|
|
|
]
|
|
|
|
endif
|
2019-12-17 08:03:41 -06:00
|
|
|
project_c_args += args_msvc
|
|
|
|
project_cpp_args += args_msvc
|
|
|
|
else
|
2022-08-23 04:14:06 -05:00
|
|
|
args_ccomp = []
|
|
|
|
if host_platform == 'darwin' and x86_sse_level > 0
|
|
|
|
message('SSE level explicitly configured but unavailable on macosx')
|
|
|
|
x86_sse_level = 0
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if x86_sse_level >= 30
|
|
|
|
args_ccomp += [ '-msse3' ]
|
|
|
|
elif x86_sse_level >= 20
|
|
|
|
args_ccomp += [ '-msse2' ]
|
|
|
|
elif x86_sse_level >= 10
|
|
|
|
args_ccomp += [ '-msse' ]
|
|
|
|
endif
|
|
|
|
if host_platform == 'windows'
|
2021-10-22 09:38:42 -05:00
|
|
|
args_ccomp += [
|
|
|
|
'-DUNICODE',
|
|
|
|
'-D_UNICODE',
|
|
|
|
]
|
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if not is_debug
|
2021-02-15 11:07:32 -06:00
|
|
|
args_ccomp += [
|
|
|
|
'-ftree-vectorize',
|
|
|
|
'-funsafe-math-optimizations',
|
|
|
|
'-ffast-math',
|
|
|
|
'-fomit-frame-pointer',
|
|
|
|
]
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
if host_platform == 'android'
|
|
|
|
if not is_64bit
|
2022-04-11 14:11:03 -05:00
|
|
|
args_ccomp += [ '-U_FILE_OFFSET_BITS' ]
|
|
|
|
endif
|
2022-10-06 00:41:08 -05:00
|
|
|
# android doesn't ship libc++_shared.so, so we might as well link it statically;
|
|
|
|
# the alternative would be to grab libc++_shared.so from the NDK and ship it with
|
|
|
|
# the app alongside libpowder.so, and possibly add it to SDL's list of libraries to load
|
2022-04-11 14:11:03 -05:00
|
|
|
project_link_args += [ '-static-libstdc++' ]
|
2021-04-10 11:24:37 -05:00
|
|
|
endif
|
2022-08-23 04:14:06 -05:00
|
|
|
project_c_args += args_ccomp + [
|
|
|
|
'-Wno-implicit-fallthrough',
|
|
|
|
'-Wno-missing-field-initializers',
|
|
|
|
'-Wno-unused-result',
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
]
|
|
|
|
project_cpp_args += args_ccomp + [
|
|
|
|
'-Wno-invalid-offsetof',
|
|
|
|
'-Wno-unused-result',
|
|
|
|
'-Wno-missing-field-initializers',
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
]
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
|
|
|
|
2022-08-23 04:14:06 -05:00
|
|
|
if host_platform == 'windows'
|
2023-10-15 04:58:30 -05:00
|
|
|
args_ccomp_win = [ '-D_WIN32_WINNT=0x0501', '-DNOMINMAX' ]
|
2019-12-17 08:03:41 -06:00
|
|
|
windows_mod = import('windows')
|
2022-08-23 04:14:06 -05:00
|
|
|
if is_static
|
2023-01-04 13:24:56 -06:00
|
|
|
args_ccomp_win += [ '-DCURL_STATICLIB' ]
|
2022-08-23 04:14:06 -05:00
|
|
|
if host_arch == 'x86_64'
|
2023-01-04 13:24:56 -06:00
|
|
|
args_ccomp_win += [ '-DZLIB_WINAPI' ]
|
2021-03-12 14:02:02 -06:00
|
|
|
endif
|
2019-12-17 08:03:41 -06:00
|
|
|
else
|
2022-08-23 04:14:06 -05:00
|
|
|
foreach input_output_condition : tpt_libs.get_variable('config_dlls')
|
|
|
|
dll_input = input_output_condition[0]
|
|
|
|
dll_output = input_output_condition[1]
|
|
|
|
dll_condition = input_output_condition[2]
|
|
|
|
do_copy = false
|
|
|
|
if dll_condition == 'all'
|
|
|
|
do_copy = true
|
|
|
|
elif dll_condition == 'lua=' + lua_variant
|
|
|
|
do_copy = true
|
|
|
|
endif
|
|
|
|
if do_copy
|
2023-10-02 10:26:57 -05:00
|
|
|
fs.copyfile(dll_input, dll_output)
|
2022-08-23 04:14:06 -05:00
|
|
|
endif
|
2019-12-17 08:03:41 -06:00
|
|
|
endforeach
|
|
|
|
endif
|
2023-01-04 13:24:56 -06:00
|
|
|
project_c_args += args_ccomp_win
|
|
|
|
project_cpp_args += args_ccomp_win
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
|
|
|
|
2022-12-25 04:03:29 -06:00
|
|
|
project_inc = include_directories([ 'src', 'resources' ])
|
2019-12-17 08:03:41 -06:00
|
|
|
|
2022-08-23 04:14:06 -05:00
|
|
|
if host_platform == 'windows'
|
|
|
|
ident_platform = is_64bit ? 'WIN64' : 'WIN32'
|
|
|
|
elif host_platform == 'linux'
|
|
|
|
ident_platform = is_64bit ? 'LIN64' : 'LIN32'
|
|
|
|
elif host_platform == 'darwin'
|
|
|
|
ident_platform = host_arch == 'aarch64' ? 'MACOSARM' : 'MACOSX'
|
2022-02-21 23:56:02 -06:00
|
|
|
else
|
2022-08-23 04:14:06 -05:00
|
|
|
ident_platform = 'UNKNOWN'
|
2022-02-21 23:56:02 -06:00
|
|
|
endif
|
|
|
|
|
2024-01-01 02:34:44 -06:00
|
|
|
project_deps = []
|
2022-09-07 23:52:23 -05:00
|
|
|
data_files = []
|
2023-05-11 10:47:25 -05:00
|
|
|
powder_deps = []
|
2019-12-17 08:03:41 -06:00
|
|
|
|
2024-01-02 11:35:33 -06:00
|
|
|
project_export_dynamic = false
|
|
|
|
|
2019-12-17 08:03:41 -06:00
|
|
|
subdir('src')
|
|
|
|
subdir('resources')
|
|
|
|
|
2022-09-07 23:52:23 -05:00
|
|
|
powder_files += data_files
|
|
|
|
render_files += data_files
|
|
|
|
font_files += data_files
|
|
|
|
|
2023-01-24 11:37:06 -06:00
|
|
|
if host_platform == 'emscripten'
|
|
|
|
project_link_args += [
|
2023-08-21 13:32:16 -05:00
|
|
|
'-o', app_exe + '.js', # so we get a .wasm, and a .js
|
2023-01-24 11:37:06 -06:00
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
2019-12-17 08:03:41 -06:00
|
|
|
if get_option('build_powder')
|
2024-01-01 02:34:44 -06:00
|
|
|
powder_deps += project_deps + [
|
2019-12-17 08:03:41 -06:00
|
|
|
threads_dep,
|
|
|
|
zlib_dep,
|
2022-08-07 08:27:04 -05:00
|
|
|
png_dep,
|
2019-12-17 08:03:41 -06:00
|
|
|
sdl2_dep,
|
2022-08-23 04:14:06 -05:00
|
|
|
lua_dep,
|
|
|
|
curl_dep,
|
|
|
|
fftw_dep,
|
2022-10-11 06:08:42 -05:00
|
|
|
bzip2_dep,
|
|
|
|
json_dep,
|
2019-12-17 08:03:41 -06:00
|
|
|
]
|
2022-08-23 04:14:06 -05:00
|
|
|
if host_platform == 'android'
|
2022-04-11 14:11:03 -05:00
|
|
|
powder_sha = shared_library(
|
2022-12-17 06:53:37 -06:00
|
|
|
app_exe,
|
2022-04-11 14:11:03 -05:00
|
|
|
sources: powder_files,
|
2023-01-14 16:04:15 -06:00
|
|
|
include_directories: project_inc,
|
2022-04-11 14:11:03 -05:00
|
|
|
c_args: project_c_args,
|
|
|
|
cpp_args: project_cpp_args,
|
|
|
|
link_args: project_link_args,
|
|
|
|
dependencies: powder_deps,
|
|
|
|
)
|
2022-08-23 04:14:06 -05:00
|
|
|
subdir('android')
|
2022-04-11 14:11:03 -05:00
|
|
|
else
|
|
|
|
executable(
|
2022-12-17 06:53:37 -06:00
|
|
|
app_exe,
|
2022-04-11 14:11:03 -05:00
|
|
|
sources: powder_files,
|
2023-01-14 16:04:15 -06:00
|
|
|
include_directories: project_inc,
|
2022-04-11 14:11:03 -05:00
|
|
|
c_args: project_c_args,
|
|
|
|
cpp_args: project_cpp_args,
|
2022-08-23 04:14:06 -05:00
|
|
|
win_subsystem: is_debug ? 'console' : 'windows',
|
2022-04-11 14:11:03 -05:00
|
|
|
link_args: project_link_args,
|
|
|
|
dependencies: powder_deps,
|
2024-01-02 11:35:33 -06:00
|
|
|
export_dynamic: project_export_dynamic,
|
2023-06-11 11:20:26 -05:00
|
|
|
install: true,
|
2022-04-11 14:11:03 -05:00
|
|
|
)
|
|
|
|
endif
|
2019-12-17 08:03:41 -06:00
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('build_render')
|
2023-01-24 11:37:06 -06:00
|
|
|
if host_platform == 'emscripten'
|
|
|
|
error('render does not target emscripten')
|
|
|
|
endif
|
2024-01-01 02:34:44 -06:00
|
|
|
render_deps = project_deps + [
|
2019-12-17 08:03:41 -06:00
|
|
|
threads_dep,
|
|
|
|
zlib_dep,
|
2022-10-11 06:08:42 -05:00
|
|
|
bzip2_dep,
|
|
|
|
json_dep,
|
2022-08-07 08:27:04 -05:00
|
|
|
png_dep,
|
2019-12-17 08:03:41 -06:00
|
|
|
]
|
2022-08-07 08:27:04 -05:00
|
|
|
render_link_args = project_link_args
|
|
|
|
if host_platform == 'linux' and is_static
|
|
|
|
render_link_args += [ '-static' ]
|
|
|
|
endif
|
2019-12-17 08:03:41 -06:00
|
|
|
executable(
|
|
|
|
'render',
|
|
|
|
sources: render_files,
|
2023-01-14 16:04:15 -06:00
|
|
|
include_directories: project_inc,
|
2021-01-18 05:20:36 -06:00
|
|
|
c_args: project_c_args,
|
|
|
|
cpp_args: project_cpp_args,
|
2022-08-07 08:27:04 -05:00
|
|
|
link_args: render_link_args,
|
2019-12-17 08:03:41 -06:00
|
|
|
dependencies: render_deps,
|
2024-01-02 11:35:33 -06:00
|
|
|
export_dynamic: project_export_dynamic,
|
2019-12-17 08:03:41 -06:00
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('build_font')
|
2023-01-24 11:37:06 -06:00
|
|
|
if host_platform == 'emscripten'
|
|
|
|
error('font does not target emscripten')
|
|
|
|
endif
|
2024-01-01 02:34:44 -06:00
|
|
|
font_deps = project_deps + [
|
2019-12-17 08:03:41 -06:00
|
|
|
threads_dep,
|
|
|
|
zlib_dep,
|
2022-08-07 08:27:04 -05:00
|
|
|
png_dep,
|
2019-12-17 08:03:41 -06:00
|
|
|
sdl2_dep,
|
2022-10-11 06:08:42 -05:00
|
|
|
bzip2_dep,
|
2022-10-20 23:22:07 -05:00
|
|
|
json_dep,
|
2019-12-17 08:03:41 -06:00
|
|
|
]
|
|
|
|
executable(
|
|
|
|
'font',
|
|
|
|
sources: font_files,
|
2023-01-14 16:04:15 -06:00
|
|
|
include_directories: project_inc,
|
2021-01-18 05:20:36 -06:00
|
|
|
c_args: project_c_args,
|
|
|
|
cpp_args: project_cpp_args,
|
2019-12-17 08:03:41 -06:00
|
|
|
link_args: project_link_args,
|
|
|
|
dependencies: font_deps,
|
2024-01-02 11:35:33 -06:00
|
|
|
export_dynamic: project_export_dynamic,
|
2019-12-17 08:03:41 -06:00
|
|
|
)
|
|
|
|
endif
|