mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-07 00:46:33 +02:00
Remove the single C TU from the codebase
This leaves one non-C++ TU in the entire codebase: Cocoa.mm is Objective C++ and is only compiled on MacOS, where it's used for clipboard integration. This too will go away when we move to SDL3, which has a proper clipboard API.
This commit is contained in:
1
.github/build.sh
vendored
1
.github/build.sh
vendored
@@ -370,7 +370,6 @@ java_runtime_jar = '$JAVA_HOME_8_X64/jre/lib/rt.jar'
|
||||
|
||||
[binaries]
|
||||
# android_ndk_toolchain_prefix comes from the correct cross-file in ./android/cross
|
||||
c = andriod_ndk_toolchain_bin / (android_ndk_toolchain_prefix + 'clang')
|
||||
cpp = andriod_ndk_toolchain_bin / (android_ndk_toolchain_prefix + 'clang++')
|
||||
strip = andriod_ndk_toolchain_bin / 'llvm-strip'
|
||||
javac = '$JAVA_HOME_8_X64/bin/javac'
|
||||
|
1
.github/emscripten-ghactions.ini
vendored
1
.github/emscripten-ghactions.ini
vendored
@@ -1,5 +1,4 @@
|
||||
[binaries]
|
||||
c = 'emcc'
|
||||
cpp = 'em++'
|
||||
strip = 'emstrip'
|
||||
ar = 'emar'
|
||||
|
1
.github/macaa64-ghactions.ini
vendored
1
.github/macaa64-ghactions.ini
vendored
@@ -1,5 +1,4 @@
|
||||
[binaries]
|
||||
c = [ 'clang', '-arch', 'arm64' ]
|
||||
cpp = [ 'clang++', '-arch', 'arm64' ]
|
||||
objcpp = [ 'clang++', '-arch', 'arm64' ]
|
||||
strip = 'strip'
|
||||
|
1
.github/mingw-ghactions.ini
vendored
1
.github/mingw-ghactions.ini
vendored
@@ -2,7 +2,6 @@
|
||||
prefix = 'x86_64-w64-mingw32'
|
||||
|
||||
[binaries]
|
||||
c = prefix + '-gcc'
|
||||
cpp = prefix + '-g++'
|
||||
strip = prefix + '-strip'
|
||||
windres = prefix + '-windres'
|
||||
|
@@ -10,8 +10,6 @@ android_platform_jar = '/opt/android-sdk/platforms/' + android_platform + '/andr
|
||||
java_runtime_jar = '/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar'
|
||||
|
||||
[binaries]
|
||||
c = andriod_ndk_toolchain_bin / (android_ndk_toolchain_prefix + 'clang')
|
||||
# c = [ 'ccache', andriod_ndk_toolchain_bin / (android_ndk_toolchain_prefix + 'clang') ]
|
||||
cpp = andriod_ndk_toolchain_bin / (android_ndk_toolchain_prefix + 'clang++')
|
||||
# cpp = [ 'ccache', andriod_ndk_toolchain_bin / (android_ndk_toolchain_prefix + 'clang++') ]
|
||||
strip = andriod_ndk_toolchain_bin / 'llvm-strip'
|
||||
|
@@ -1,5 +1,4 @@
|
||||
[binaries]
|
||||
c = [ 'clang', '-arch', 'arm64' ]
|
||||
cpp = [ 'clang++', '-arch', 'arm64' ]
|
||||
objcpp = [ 'clang++', '-arch', 'arm64' ]
|
||||
strip = 'strip'
|
||||
|
@@ -2,7 +2,6 @@
|
||||
prefix = 'x86_64-w64-mingw32'
|
||||
|
||||
[binaries]
|
||||
c = prefix + '-gcc'
|
||||
cpp = prefix + '-g++'
|
||||
strip = prefix + '-strip'
|
||||
windres = prefix + '-windres'
|
||||
|
51
meson.build
51
meson.build
@@ -1,9 +1,8 @@
|
||||
project(
|
||||
'the-powder-toy',
|
||||
[ 'c', 'cpp' ],
|
||||
'cpp',
|
||||
version: 'the.cake.is.a.lie',
|
||||
default_options: [
|
||||
'c_std=c99',
|
||||
'cpp_std=c++17',
|
||||
'cpp_rtti=false',
|
||||
],
|
||||
@@ -29,7 +28,7 @@ to_array = generator(
|
||||
render_icons_with_inkscape = get_option('render_icons_with_inkscape')
|
||||
inkscape = find_program('inkscape', required: render_icons_with_inkscape)
|
||||
|
||||
c_compiler = meson.get_compiler('c')
|
||||
cpp_compiler = meson.get_compiler('cpp')
|
||||
|
||||
is_x86 = host_machine.cpu_family() in [ 'x86', 'x86_64' ]
|
||||
is_64bit = host_machine.cpu_family() in [ 'aarch64', 'x86_64' ]
|
||||
@@ -37,12 +36,12 @@ is_64bit = host_machine.cpu_family() in [ 'aarch64', 'x86_64' ]
|
||||
host_arch = host_machine.cpu_family()
|
||||
host_platform = host_machine.system()
|
||||
# educated guesses follow, PRs welcome
|
||||
if c_compiler.get_id() in [ 'msvc', 'clang-cl' ]
|
||||
if cpp_compiler.get_id() in [ 'msvc', 'clang-cl' ]
|
||||
if host_platform != 'windows'
|
||||
error('this seems fishy')
|
||||
endif
|
||||
host_libc = 'msvc'
|
||||
elif c_compiler.get_id() in [ 'gcc' ] and host_platform == 'windows'
|
||||
elif cpp_compiler.get_id() in [ 'gcc' ] and host_platform == 'windows'
|
||||
host_libc = 'mingw'
|
||||
elif host_platform in [ 'darwin' ]
|
||||
host_libc = 'macos'
|
||||
@@ -115,7 +114,7 @@ else
|
||||
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(
|
||||
dependencies: cpp_compiler.find_library(
|
||||
bzip2_lib_name,
|
||||
has_headers: bzip2_include_name,
|
||||
dirs: bzip2_lib_dir,
|
||||
@@ -199,7 +198,6 @@ if enable_http and host_platform != 'emscripten'
|
||||
endif
|
||||
|
||||
project_link_args = []
|
||||
project_c_args = []
|
||||
project_cpp_args = []
|
||||
|
||||
fftw_dep = dependency('fftw3f', static: is_static)
|
||||
@@ -234,7 +232,6 @@ if host_platform == 'emscripten'
|
||||
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)
|
||||
@@ -246,7 +243,7 @@ json_dep = dependency('jsoncpp', static: is_static)
|
||||
|
||||
if not is_debug
|
||||
args_ccomp_opt = []
|
||||
if c_compiler.get_argument_syntax() == 'msvc'
|
||||
if cpp_compiler.get_argument_syntax() == 'msvc'
|
||||
args_ccomp_opt += [
|
||||
'/Oy-',
|
||||
'/fp:fast',
|
||||
@@ -263,34 +260,31 @@ if not is_debug
|
||||
'-fomit-frame-pointer',
|
||||
]
|
||||
endif
|
||||
project_c_args += args_ccomp_opt
|
||||
project_cpp_args += args_ccomp_opt
|
||||
endif
|
||||
|
||||
if not is_debug
|
||||
args_ccomp_lto = []
|
||||
if c_compiler.get_id() in [ 'clang', 'clang-cl' ]
|
||||
if cpp_compiler.get_id() in [ 'clang', 'clang-cl' ]
|
||||
# use ThinLTO for Clang/LLVM
|
||||
args_ccomp_lto += [ '-flto=thin' ]
|
||||
elif c_compiler.get_argument_syntax() == 'msvc'
|
||||
elif cpp_compiler.get_argument_syntax() == 'msvc'
|
||||
args_ccomp_lto += [ '/GL' ]
|
||||
project_link_args += [ '/LTCG' ]
|
||||
endif
|
||||
project_c_args += args_ccomp_lto
|
||||
project_cpp_args += args_ccomp_lto
|
||||
endif
|
||||
|
||||
if c_compiler.get_argument_syntax() == 'msvc'
|
||||
if cpp_compiler.get_argument_syntax() == 'msvc'
|
||||
args_msvc = [
|
||||
'/GS',
|
||||
'/D_SCL_SECURE_NO_WARNINGS',
|
||||
]
|
||||
project_c_args += args_msvc
|
||||
project_cpp_args += args_msvc
|
||||
endif
|
||||
|
||||
# clang-cl supports both syntaxes. use the GCC one.
|
||||
if c_compiler.get_argument_syntax() == 'msvc' and c_compiler.get_id() not in [ 'clang-cl' ]
|
||||
if cpp_compiler.get_argument_syntax() == 'msvc' and cpp_compiler.get_id() not in [ 'clang-cl' ]
|
||||
args_ccomp_sse = []
|
||||
if x86_sse_level == 30
|
||||
warning('SSE3 configured to be enabled but unavailable in msvc')
|
||||
@@ -306,7 +300,6 @@ if c_compiler.get_argument_syntax() == 'msvc' and c_compiler.get_id() not in [ '
|
||||
elif x86_sse_level >= 10 and host_machine.cpu_family() == 'x86'
|
||||
args_ccomp_sse += [ '/arch:SSE' ]
|
||||
endif
|
||||
project_c_args += args_ccomp_sse
|
||||
project_cpp_args += args_ccomp_sse
|
||||
else
|
||||
args_ccomp_sse = []
|
||||
@@ -331,7 +324,6 @@ else
|
||||
elif x86_sse_level >= 10
|
||||
args_ccomp_sse += [ '-msse' ]
|
||||
endif
|
||||
project_c_args += args_ccomp_sse
|
||||
project_cpp_args += args_ccomp_sse
|
||||
endif
|
||||
|
||||
@@ -369,13 +361,12 @@ if host_platform == 'windows'
|
||||
endforeach
|
||||
endif
|
||||
foreach def : defs_ccomp_win
|
||||
if c_compiler.get_argument_syntax() == 'msvc'
|
||||
if cpp_compiler.get_argument_syntax() == 'msvc'
|
||||
args_ccomp_win += [ '/D' + def ]
|
||||
else
|
||||
args_ccomp_win += [ '-D' + def ]
|
||||
endif
|
||||
endforeach
|
||||
project_c_args += args_ccomp_win
|
||||
project_cpp_args += args_ccomp_win
|
||||
elif host_platform == 'android'
|
||||
args_ccomp_android = []
|
||||
@@ -386,27 +377,15 @@ elif host_platform == 'android'
|
||||
# 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
|
||||
project_link_args += [ '-static-libstdc++' ]
|
||||
project_c_args += args_ccomp_android
|
||||
project_cpp_args += args_ccomp_android
|
||||
endif
|
||||
|
||||
if c_compiler.get_argument_syntax() == 'msvc' and c_compiler.get_id() not in [ 'clang-cl' ]
|
||||
project_c_args += [
|
||||
'/wd5262',
|
||||
'/wd4834',
|
||||
'/wd4100',
|
||||
]
|
||||
if cpp_compiler.get_argument_syntax() == 'msvc' and cpp_compiler.get_id() not in [ 'clang-cl' ]
|
||||
project_cpp_args += [
|
||||
'/wd4834',
|
||||
'/wd4100',
|
||||
]
|
||||
else
|
||||
project_c_args += [
|
||||
'-Wno-implicit-fallthrough',
|
||||
'-Wno-missing-field-initializers',
|
||||
'-Wno-unused-result',
|
||||
'-Wno-unused-parameter',
|
||||
]
|
||||
project_cpp_args += [
|
||||
'-Wno-invalid-offsetof',
|
||||
'-Wno-unused-result',
|
||||
@@ -449,7 +428,7 @@ if get_option('export_lua_symbols')
|
||||
if is_static and lua_variant != 'none' and not project_export_dynamic
|
||||
if host_platform == 'windows'
|
||||
error('Lua symbols are currently impossible to export correctly on Windows')
|
||||
elif c_compiler.has_link_argument('-Wl,--export-dynamic-symbol')
|
||||
elif cpp_compiler.has_link_argument('-Wl,--export-dynamic-symbol')
|
||||
project_link_args += [
|
||||
'-Wl,--export-dynamic-symbol=lua_*',
|
||||
'-Wl,--export-dynamic-symbol=luaL_*',
|
||||
@@ -479,7 +458,6 @@ if get_option('build_powder')
|
||||
app_exe,
|
||||
sources: powder_files,
|
||||
include_directories: project_inc,
|
||||
c_args: project_c_args,
|
||||
cpp_args: project_cpp_args,
|
||||
link_args: project_link_args,
|
||||
dependencies: powder_deps,
|
||||
@@ -491,7 +469,6 @@ if get_option('build_powder')
|
||||
app_exe,
|
||||
sources: powder_files,
|
||||
include_directories: project_inc,
|
||||
c_args: project_c_args,
|
||||
cpp_args: project_cpp_args,
|
||||
win_subsystem: is_debug ? 'console' : 'windows',
|
||||
link_args: project_link_args,
|
||||
@@ -522,7 +499,6 @@ if get_option('build_render')
|
||||
'render',
|
||||
sources: render_files,
|
||||
include_directories: project_inc,
|
||||
c_args: project_c_args,
|
||||
cpp_args: project_cpp_args,
|
||||
link_args: render_link_args,
|
||||
dependencies: render_deps,
|
||||
@@ -547,7 +523,6 @@ if get_option('build_font')
|
||||
'font',
|
||||
sources: font_files,
|
||||
include_directories: project_inc,
|
||||
c_args: project_c_args,
|
||||
cpp_args: project_cpp_args,
|
||||
link_args: project_link_args,
|
||||
dependencies: font_deps,
|
||||
|
@@ -12,7 +12,7 @@ else
|
||||
if host_platform == 'windows'
|
||||
use_system_cert_provider = true
|
||||
client_files += files('WindowsCertProvider.cpp')
|
||||
powder_deps += c_compiler.find_library('crypt32')
|
||||
powder_deps += cpp_compiler.find_library('crypt32')
|
||||
endif
|
||||
if host_platform == 'android'
|
||||
use_system_cert_provider = true
|
||||
|
@@ -1,8 +1,8 @@
|
||||
if host_platform == 'windows'
|
||||
if use_bluescreen
|
||||
project_deps += [
|
||||
c_compiler.find_library('dbghelp'),
|
||||
c_compiler.find_library('psapi'),
|
||||
cpp_compiler.find_library('dbghelp'),
|
||||
cpp_compiler.find_library('psapi'),
|
||||
]
|
||||
endif
|
||||
stacktrace_files = files('Windows.cpp')
|
||||
@@ -18,7 +18,7 @@ elif host_platform == 'linux'
|
||||
bluescreen_export_symbols = true
|
||||
if host_machine.system() in [ 'freebsd' ]
|
||||
project_deps += [
|
||||
c_compiler.find_library('execinfo'),
|
||||
cpp_compiler.find_library('execinfo'),
|
||||
]
|
||||
endif
|
||||
else
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#include "LuaCompat.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#if LUA_VERSION_NUM >= 502
|
||||
// Implement missing luaL_typerror function
|
||||
int luaL_typerror(lua_State *L, int narg, const char *tname)
|
||||
@@ -27,3 +29,4 @@ void lua_pushglobaltable(lua_State *L)
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
}
|
@@ -1,9 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
@@ -23,6 +21,4 @@ LUALIB_API void (lua_pushglobaltable) (lua_State *L);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -2,7 +2,7 @@ luaconsole_files = files(
|
||||
'LuaButton.cpp',
|
||||
'LuaBz2.cpp',
|
||||
'LuaCheckbox.cpp',
|
||||
'LuaCompat.c',
|
||||
'LuaCompat.cpp',
|
||||
'LuaComponent.cpp',
|
||||
'LuaElements.cpp',
|
||||
'LuaEvent.cpp',
|
||||
|
Reference in New Issue
Block a user