mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-21 21:52:04 +02:00
Begin using Objective-C (ObjFW), remove cwalk
This commit is contained in:
parent
b1fd0c8616
commit
c863267965
11 changed files with 134 additions and 179 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,6 +14,7 @@ xxd+
|
||||||
|
|
||||||
# VS Code
|
# VS Code
|
||||||
/.vscode
|
/.vscode
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
# Codeblocks
|
# Codeblocks
|
||||||
mkxp.layout
|
mkxp.layout
|
||||||
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -1,4 +0,0 @@
|
||||||
[submodule "cwalk"]
|
|
||||||
path = cwalk
|
|
||||||
url = https://github.com/likle/cwalk
|
|
||||||
branch = stable
|
|
46
README.md
46
README.md
|
@ -21,6 +21,7 @@ This binding should support RGSS1, RGSS2 and RGSS3, though I've only tested it w
|
||||||
|
|
||||||
## Dependencies / Building
|
## Dependencies / Building
|
||||||
|
|
||||||
|
* ObjFW
|
||||||
* Boost.Unordered (headers only)
|
* Boost.Unordered (headers only)
|
||||||
* Boost.Program_options
|
* Boost.Program_options
|
||||||
* libsigc++ 2.0
|
* libsigc++ 2.0
|
||||||
|
@ -254,24 +255,31 @@ mingw-w64-i686-SDL2_{image,ttf}
|
||||||
```sh
|
```sh
|
||||||
mkdir src; cd src
|
mkdir src; cd src
|
||||||
git clone https://github.com/Ancurio/SDL_Sound
|
git clone https://github.com/Ancurio/SDL_Sound
|
||||||
|
git clone https://github.com/ObjFW/ObjFW
|
||||||
git clone https://github.com/inori-z/ruby --single-branch --branch ruby_1_8_7
|
git clone https://github.com/inori-z/ruby --single-branch --branch ruby_1_8_7
|
||||||
|
|
||||||
cd SDL_Sound && ./bootstrap
|
cd SDL_Sound && ./bootstrap
|
||||||
./configure --enable-{modplug,speex,flac}=no
|
./configure --enable-{modplug,speex,flac}=no
|
||||||
make install -j`nproc`
|
make install -j`nproc`
|
||||||
cd ..
|
|
||||||
|
cd ../ObjFW
|
||||||
|
./autogen.sh
|
||||||
|
./configure
|
||||||
|
make install -j`nproc`
|
||||||
|
|
||||||
|
cd ../ruby
|
||||||
|
|
||||||
# when you install ruby, some extensions might not want to build.
|
# when you install ruby, some extensions might not want to build.
|
||||||
# You probably don’t particularly need any, so you can just delete
|
# You probably don’t particularly need any, so you can just delete
|
||||||
# any problematic ones if you like:
|
# any problematic ones if you like:
|
||||||
|
|
||||||
rm -rf ruby/ext/{tk,win32ole,openssl}
|
rm -rf ext/{tk,win32ole,openssl}
|
||||||
|
|
||||||
# and try building again afterwards. Or you can try to fix whatever
|
# and try building again afterwards. Or you can try to fix whatever
|
||||||
# the problem is (missing libraries, usually). Hey, do whatever you need to
|
# the problem is (missing libraries, usually). Hey, do whatever you need to
|
||||||
# do, Capp’n.
|
# do, Capp’n.
|
||||||
|
|
||||||
cd ruby && autoconf
|
autoconf
|
||||||
./configure --enable-shared --disable-install-doc
|
./configure --enable-shared --disable-install-doc
|
||||||
make -j`nproc` && make install
|
make -j`nproc` && make install
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -285,7 +293,7 @@ cd ..
|
||||||
5. Build mkxp-z:
|
5. Build mkxp-z:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone --recursive https://github.com/inori-z/mkxp-z
|
git clone https://github.com/inori-z/mkxp-z
|
||||||
cd mkxp-z
|
cd mkxp-z
|
||||||
|
|
||||||
# Ruby 1.8 doesn’t support pkg-config (Might add it in, since this
|
# Ruby 1.8 doesn’t support pkg-config (Might add it in, since this
|
||||||
|
@ -308,7 +316,7 @@ You'll find your stuff under your MSYS home directory. You can also type `explor
|
||||||
2. Get most of your dependencies from Homebrew:
|
2. Get most of your dependencies from Homebrew:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew install meson cmake automake autoconf sdl2 sdl2_{image,ttf} \
|
brew install meson cmake automake autoconf sdl2 sdl2_{image,ttf} objfw \
|
||||||
boost pixman physfs libsigc++ libvorbis fluidsynth pkgconfig libtool
|
boost pixman physfs libsigc++ libvorbis fluidsynth pkgconfig libtool
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -322,19 +330,20 @@ git clone https://github.com/inori-z/ruby --single-branch --branch ruby_1_8_7
|
||||||
cd SDL_Sound && ./bootstrap
|
cd SDL_Sound && ./bootstrap
|
||||||
./configure
|
./configure
|
||||||
make install -j`nproc`
|
make install -j`nproc`
|
||||||
cd ..
|
|
||||||
|
cd ../ruby
|
||||||
|
|
||||||
# when you install ruby, some extensions might not want to build.
|
# when you install ruby, some extensions might not want to build.
|
||||||
# You probably don’t particularly need any, so you can just delete
|
# You probably don’t particularly need any, so you can just delete
|
||||||
# any problematic ones if you like:
|
# any problematic ones if you like:
|
||||||
|
|
||||||
rm -rf ruby/ext/tk
|
rm -rf ext/tk
|
||||||
|
|
||||||
# and try building again afterwards. Or you can try to fix whatever
|
# and try building again afterwards. Or you can try to fix whatever
|
||||||
# the problem is (missing libraries, usually). Hey, do whatever you
|
# the problem is (missing libraries, usually). Hey, do whatever you
|
||||||
# need to do, Capp’n.
|
# need to do, Capp’n.
|
||||||
|
|
||||||
cd ruby && autoconf
|
autoconf
|
||||||
|
|
||||||
# We're putting our build of ruby in its own prefix. macOS already
|
# We're putting our build of ruby in its own prefix. macOS already
|
||||||
# includes Ruby (at least until 10.16 or so), and you really do
|
# includes Ruby (at least until 10.16 or so), and you really do
|
||||||
|
@ -348,21 +357,21 @@ cd ..
|
||||||
4. Build mkxp-z:
|
4. Build mkxp-z:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone --recursive https://github.com/inori-z/mkxp-z
|
git clone https://github.com/inori-z/mkxp-z
|
||||||
cd mkxp-z
|
cd mkxp-z
|
||||||
|
|
||||||
# Ruby 1.8 doesn’t support pkg-config (Might add it in, since this
|
# Ruby 1.8 doesn’t support pkg-config (Might add it in, since this
|
||||||
# is a bit annoying) so you have to set include and link paths yourself.
|
# is a bit annoying) so you have to set include and link paths yourself.
|
||||||
# the header folder that Ruby 1.8 creates for macOS includes a version
|
# the header folder that Ruby 1.8 creates for macOS includes a version
|
||||||
# number (i.e. `x86_64-darwin18.7.0`), and is going to be located under
|
# number (i.e. `x86_64-darwin19.0.0`), and is going to be located under
|
||||||
# `/usr/local/opt/mkxp-ruby/lib/ruby/1.8`.
|
# `/usr/local/opt/mkxp-ruby/lib/ruby/1.8`.
|
||||||
|
|
||||||
# You will also need to link to `/usr/local/opt/mkxp-ruby/lib`, and tell
|
# You will also need to link to `/usr/local/opt/mkxp-ruby/lib`, and tell
|
||||||
# meson where your pkgconfig path is (`/usr/local/lib/pkgconfig`).
|
# meson where your pkgconfig path is (`/usr/local/lib/pkgconfig`).
|
||||||
|
|
||||||
meson build -Dpkg_config_path=/usr/local/lib/pkgconfig \
|
meson build -Dpkg_config_path=/usr/local/lib/pkgconfig \
|
||||||
-Dcpp_args=-I/usr/local/opt/mkxp-ruby/lib/ruby/1.8/x86_64-darwin18.7.0 \
|
-Dcpp_args=-I/usr/local/opt/mkxp-ruby/lib/ruby/1.8/x86_64-darwin19.0.0 \
|
||||||
-Dcpp_link_args=-L/usr/local/opt/mkxp-ruby/lib
|
-Dobjcpp_link_args=-L/usr/local/opt/mkxp-ruby/lib
|
||||||
|
|
||||||
cd build
|
cd build
|
||||||
ninja
|
ninja
|
||||||
|
@ -371,7 +380,7 @@ ninja
|
||||||
Your results will be in `~/src/mkxp-z/build` . You can type `open ~/src/mkxp-z/build` to get there quickly.
|
Your results will be in `~/src/mkxp-z/build` . You can type `open ~/src/mkxp-z/build` to get there quickly.
|
||||||
|
|
||||||
|
|
||||||
## Building on Linux (Ubuntu Disco)
|
## Building on Linux (Ubuntu Eoan)
|
||||||
|
|
||||||
> I'm assuming that if you're using anything other than Ubuntu, you're probably familiar enough with this sort of thing to not need instructions. In fact, you've probably built this thing already, haven't you?
|
> I'm assuming that if you're using anything other than Ubuntu, you're probably familiar enough with this sort of thing to not need instructions. In fact, you've probably built this thing already, haven't you?
|
||||||
|
|
||||||
|
@ -405,15 +414,20 @@ cd ../..
|
||||||
# Now we can do the other stuff:
|
# Now we can do the other stuff:
|
||||||
|
|
||||||
git clone https://github.com/Ancurio/SDL_Sound
|
git clone https://github.com/Ancurio/SDL_Sound
|
||||||
|
git clone https://github.com/ObjFW/ObjFW
|
||||||
git clone https://github.com/inori-z/ruby --single-branch --branch ruby_1_8_7
|
git clone https://github.com/inori-z/ruby --single-branch --branch ruby_1_8_7
|
||||||
|
|
||||||
cd SDL_Sound && ./bootstrap
|
cd SDL_Sound && ./bootstrap
|
||||||
./configure
|
./configure
|
||||||
make -j`nproc`
|
make -j`nproc`
|
||||||
sudo make install
|
sudo make install
|
||||||
cd ..
|
|
||||||
|
|
||||||
cd ruby && autoconf
|
cd ../ObjFW
|
||||||
|
./autogen.sh
|
||||||
|
./configure
|
||||||
|
make install -j`nproc`
|
||||||
|
|
||||||
|
cd ../ruby && autoconf
|
||||||
./configure --enable-shared --disable-install-doc
|
./configure --enable-shared --disable-install-doc
|
||||||
make -j`nproc`
|
make -j`nproc`
|
||||||
sudo make install
|
sudo make install
|
||||||
|
@ -423,7 +437,7 @@ cd ..
|
||||||
4. Build mkxp-z:
|
4. Build mkxp-z:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone --recursive https://github.com/inori-z/mkxp-z
|
git clone https://github.com/inori-z/mkxp-z
|
||||||
cd mkxp-z
|
cd mkxp-z
|
||||||
|
|
||||||
# Ruby 1.8 doesn’t support pkg-config (Might add it in, since this
|
# Ruby 1.8 doesn’t support pkg-config (Might add it in, since this
|
||||||
|
|
|
@ -11,9 +11,8 @@ endif
|
||||||
embedded_assets_f = files(embedded_assets)
|
embedded_assets_f = files(embedded_assets)
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
processed_assets = []
|
|
||||||
foreach file : embedded_assets_f
|
foreach file : embedded_assets_f
|
||||||
processed_assets += custom_target(embedded_assets[count],
|
global_sources += custom_target(embedded_assets[count],
|
||||||
input: file,
|
input: file,
|
||||||
output: '@0@.xxd'.format(embedded_assets[count]),
|
output: '@0@.xxd'.format(embedded_assets[count]),
|
||||||
command: [
|
command: [
|
||||||
|
|
|
@ -33,11 +33,14 @@
|
||||||
#include "lang-fun.h"
|
#include "lang-fun.h"
|
||||||
#include "boost-hash.h"
|
#include "boost-hash.h"
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
#include <ruby.h>
|
#include <ruby.h>
|
||||||
|
|
||||||
#ifndef OLD_RUBY
|
#ifndef OLD_RUBY
|
||||||
#include <ruby/encoding.h>
|
#include <ruby/encoding.h>
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
@ -1,27 +1,18 @@
|
||||||
|
|
||||||
ver = get_option('mri_version')
|
ver = get_option('mri_version')
|
||||||
binding_dependencies = []
|
|
||||||
if ver.version_compare('>1.8') == true
|
if ver.version_compare('>1.8') == true
|
||||||
binding_dependencies += dependency('ruby-' + ver)
|
global_dependencies += dependency('ruby-' + ver)
|
||||||
else
|
else
|
||||||
lib = get_option('ruby_lib')
|
lib = get_option('ruby_lib')
|
||||||
binding_dependencies += compiler.find_library(lib)
|
global_dependencies += compilers['cpp'].find_library(lib)
|
||||||
add_project_arguments('-DOLD_RUBY', language: 'cpp')
|
add_project_arguments('-DOLD_RUBY', language: ['cpp','objc','objcpp'])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('no_preload_scripts') == true
|
if get_option('no_preload_scripts') == true
|
||||||
add_project_arguments('-DNO_PRELOAD_SCRIPTS', language: 'cpp')
|
add_project_arguments('-DNO_PRELOAD_SCRIPTS', language: ['cpp','objc','objcpp'])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
binding_headers = files(
|
global_include_dirs += include_directories('.')
|
||||||
'binding-util.h',
|
|
||||||
'binding-types.h',
|
|
||||||
'serializable-binding.h',
|
|
||||||
'disposable-binding.h',
|
|
||||||
'sceneelement-binding.h',
|
|
||||||
'viewportelement-binding.h',
|
|
||||||
'flashable-binding.h',
|
|
||||||
)
|
|
||||||
|
|
||||||
binding_source = [files(
|
binding_source = [files(
|
||||||
'binding-mri.cpp',
|
'binding-mri.cpp',
|
||||||
|
@ -49,4 +40,4 @@ if discord == true
|
||||||
binding_source += files('discord-binding.cpp')
|
binding_source += files('discord-binding.cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
bindings = [binding_headers, binding_source]
|
global_sources += binding_source
|
1
cwalk
1
cwalk
|
@ -1 +0,0 @@
|
||||||
Subproject commit fe3b37eb3cbcc0f45fb3f1bed0a40f1cfb234ce4
|
|
71
meson.build
71
meson.build
|
@ -1,4 +1,4 @@
|
||||||
project('mkxp-z', 'cpp', 'c', version: '1.1.0', default_options: ['cpp_std=c++11'])
|
project('mkxp-z', 'cpp', 'objc', 'objcpp', version: '1.2.0', default_options: ['cpp_std=c++11', 'buildtype=release'])
|
||||||
|
|
||||||
minimum_macos_version = get_option('macos_min_version')
|
minimum_macos_version = get_option('macos_min_version')
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@ minimum_macos_version = get_option('macos_min_version')
|
||||||
# it still needs to be cleaned up
|
# it still needs to be cleaned up
|
||||||
|
|
||||||
xxd = find_program('xxd', native: true)
|
xxd = find_program('xxd', native: true)
|
||||||
|
objfw = find_program('objfw-config', native: true)
|
||||||
host_system = host_machine.system()
|
host_system = host_machine.system()
|
||||||
compiler = meson.get_compiler('cpp')
|
compilers = {'cpp': meson.get_compiler('cpp'), 'objc': meson.get_compiler('objc'), 'objcpp': meson.get_compiler('objcpp')}
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# Ext libs
|
# Ext libs
|
||||||
|
@ -19,7 +20,7 @@ ext_dependencies = []
|
||||||
discord = false
|
discord = false
|
||||||
discord_libpath = get_option('discord_sdk_path')
|
discord_libpath = get_option('discord_sdk_path')
|
||||||
if discord_libpath != ''
|
if discord_libpath != ''
|
||||||
discordlib = compiler.find_library('discord_game_sdk', required: false, dirs: '@0@/lib/@1@'.format(discord_libpath, host_machine.cpu_family()))
|
discordlib = compilers['cpp'].find_library('discord_game_sdk', required: false, dirs: '@0@/lib/@1@'.format(discord_libpath, host_machine.cpu_family()))
|
||||||
|
|
||||||
if discordlib.found() == true
|
if discordlib.found() == true
|
||||||
add_project_arguments(['-I@0@/c'.format(discord_libpath), '-DHAVE_DISCORDSDK'], language: 'cpp')
|
add_project_arguments(['-I@0@/c'.format(discord_libpath), '-DHAVE_DISCORDSDK'], language: 'cpp')
|
||||||
|
@ -31,25 +32,41 @@ endif
|
||||||
# ====================
|
# ====================
|
||||||
# Main source
|
# Main source
|
||||||
# ====================
|
# ====================
|
||||||
|
global_sources = []
|
||||||
|
global_dependencies = []
|
||||||
|
global_include_dirs = []
|
||||||
|
global_args = []
|
||||||
|
global_link_args = []
|
||||||
|
|
||||||
|
# Suppress warnings
|
||||||
|
global_args += ['-Wno-non-virtual-dtor', '-Wno-reorder']
|
||||||
|
|
||||||
if get_option('workdir_current')
|
if get_option('workdir_current')
|
||||||
add_project_arguments('-DWORKDIR_CURRENT', language: 'cpp')
|
global_args += '-DWORKDIR_CURRENT'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('independent_appimage')
|
if get_option('independent_appimage')
|
||||||
add_project_arguments('-DINDEPENDENT_APPIMAGE', language: 'cpp')
|
global_args += '-DINDEPENDENT_APPIMAGE'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('use_fakeapi')
|
if get_option('use_fakeapi')
|
||||||
add_project_arguments('-DUSE_FAKEAPI', language: 'cpp')
|
global_args += '-DUSE_FAKEAPI'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if not get_option('console')
|
if not get_option('console')
|
||||||
add_project_arguments('-DNO_CONSOLE', language: 'cpp')
|
global_args += '-DNO_CONSOLE'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('mk')
|
if get_option('mk')
|
||||||
add_project_arguments('-DMARIN', language: 'cpp')
|
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'])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
|
@ -57,40 +74,36 @@ subdir('binding')
|
||||||
subdir('shader')
|
subdir('shader')
|
||||||
subdir('assets')
|
subdir('assets')
|
||||||
|
|
||||||
all_sources = [main, bindings, processed_shaders, processed_assets]
|
#all_sources = [main, bindings, processed_shaders, processed_assets]
|
||||||
include_dirs = [include_directories('src', 'binding')]
|
global_include_dirs += include_directories('src', 'binding')
|
||||||
|
|
||||||
# Use cwalk
|
|
||||||
all_sources += files('cwalk/src/cwalk.c')
|
|
||||||
include_dirs += include_directories('cwalk/include')
|
|
||||||
|
|
||||||
# Disable some warnings
|
# Disable some warnings
|
||||||
add_project_arguments(['-Wno-reorder', '-Wno-non-virtual-dtor', '-Wno-uninitialized'], language: 'cpp')
|
#add_project_arguments(['-Wno-reorder', '-Wno-non-virtual-dtor', '-Wno-uninitialized'], language: 'cpp')
|
||||||
|
|
||||||
|
|
||||||
linker_args = []
|
|
||||||
|
|
||||||
if host_system == 'windows'
|
if host_system == 'windows'
|
||||||
subdir('windows')
|
subdir('windows')
|
||||||
all_sources += windows_resources
|
global_sources += windows_resources
|
||||||
include_dirs += include_directories('windows')
|
global_include_dirs += include_directories('windows')
|
||||||
elif host_system == 'darwin'
|
elif host_system == 'darwin'
|
||||||
subdir('macos')
|
subdir('macos')
|
||||||
if compiler.get_id() == 'clang'
|
if compilers['cpp'].get_id() == 'clang'
|
||||||
add_project_arguments('-stdlib=libc++', language: 'cpp')
|
add_project_arguments('-stdlib=libc++', language: ['cpp','objcpp'])
|
||||||
add_project_arguments('-Wno-undefined-var-template', language: 'cpp')
|
add_project_arguments('-std=c++11', language: 'objcpp')
|
||||||
add_project_arguments('-mmacosx-version-min='+minimum_macos_version, language: 'cpp')
|
global_args += ['-Wno-undefined-var-template', '-mmacosx-version-min='+minimum_macos_version]
|
||||||
add_project_arguments('-mmacosx-version-min='+minimum_macos_version, language: 'c')
|
global_link_args += '-mmacosx-version-min='+minimum_macos_version
|
||||||
add_project_link_arguments('-mmacosx-version-min='+minimum_macos_version, language: 'cpp')
|
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
subdir('linux')
|
subdir('linux')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
executable(meson.project_name(),
|
executable(meson.project_name(),
|
||||||
sources: all_sources,
|
sources: global_sources,
|
||||||
dependencies: [main_dependencies, binding_dependencies, ext_dependencies],
|
dependencies: [global_dependencies, ext_dependencies],
|
||||||
include_directories: include_dirs,
|
include_directories: global_include_dirs,
|
||||||
|
link_args: global_link_args,
|
||||||
|
cpp_args: global_args,
|
||||||
|
objc_args: global_args,
|
||||||
|
objcpp_args: global_args,
|
||||||
gui_app: (get_option('console') == false),
|
gui_app: (get_option('console') == false),
|
||||||
install: (host_system != 'windows')
|
install: (host_system != 'windows')
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,9 +29,8 @@ embedded_shaders = [
|
||||||
embedded_shaders_f = files(embedded_shaders)
|
embedded_shaders_f = files(embedded_shaders)
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
processed_shaders = []
|
|
||||||
foreach file : embedded_shaders_f
|
foreach file : embedded_shaders_f
|
||||||
processed_shaders += custom_target(embedded_shaders[count],
|
global_sources += custom_target(embedded_shaders[count],
|
||||||
input: file,
|
input: file,
|
||||||
output: '@0@.xxd'.format(embedded_shaders[count]),
|
output: '@0@.xxd'.format(embedded_shaders[count]),
|
||||||
command: [
|
command: [
|
||||||
|
|
|
@ -19,35 +19,31 @@
|
||||||
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "filesystem.h"
|
#import <ObjFW/ObjFW.h>
|
||||||
|
|
||||||
#include "rgssad.h"
|
#import "filesystem.h"
|
||||||
#include "font.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "exception.h"
|
|
||||||
#include "sharedstate.h"
|
|
||||||
#include "boost-hash.h"
|
|
||||||
#include "debugwriter.h"
|
|
||||||
|
|
||||||
// boost::filesystem::path and std::filesystem::path
|
#import "rgssad.h"
|
||||||
// are too troublesome
|
#import "font.h"
|
||||||
extern "C"{
|
#import "util.h"
|
||||||
#include "cwalk.h"
|
#import "exception.h"
|
||||||
}
|
#import "sharedstate.h"
|
||||||
|
#import "boost-hash.h"
|
||||||
|
#import "debugwriter.h"
|
||||||
|
|
||||||
#include <physfs.h>
|
#import <physfs.h>
|
||||||
|
|
||||||
#include <SDL_sound.h>
|
#import <SDL_sound.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#import <unistd.h>
|
||||||
#include <stdio.h>
|
#import <stdio.h>
|
||||||
#include <string.h>
|
#import <string.h>
|
||||||
#include <algorithm>
|
#import <algorithm>
|
||||||
#include <vector>
|
#import <vector>
|
||||||
#include <stack>
|
#import <stack>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <iconv.h>
|
#import <iconv.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct SDLRWIoContext
|
struct SDLRWIoContext
|
||||||
|
@ -643,6 +639,7 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename)
|
||||||
// FIXME: Paths with Windows drive letters don't
|
// FIXME: Paths with Windows drive letters don't
|
||||||
// hecking work, apparently never did
|
// hecking work, apparently never did
|
||||||
char *filename_nm = normalize(filename, false, false);
|
char *filename_nm = normalize(filename, false, false);
|
||||||
|
Debug() << filename_nm;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
size_t len = strcpySafe(buffer, filename_nm, sizeof(buffer), -1);
|
size_t len = strcpySafe(buffer, filename_nm, sizeof(buffer), -1);
|
||||||
delete filename_nm;
|
delete filename_nm;
|
||||||
|
@ -718,23 +715,28 @@ void FileSystem::openReadRaw(SDL_RWops &ops,
|
||||||
// SDL_SaveBMP wants absolute paths
|
// SDL_SaveBMP wants absolute paths
|
||||||
char* FileSystem::normalize(const char *pathname, bool preferred, bool absolute)
|
char* FileSystem::normalize(const char *pathname, bool preferred, bool absolute)
|
||||||
{
|
{
|
||||||
char *path_nml = new char[512];
|
@autoreleasepool
|
||||||
char *path_abs = 0;
|
|
||||||
#ifdef __WIN32__
|
|
||||||
cwk_path_set_style((preferred) ? CWK_STYLE_WINDOWS : CWK_STYLE_UNIX);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (cwk_path_is_relative(pathname) && absolute)
|
|
||||||
{
|
{
|
||||||
path_abs = new char[512];
|
char* ret = new char[512];
|
||||||
char bp[512] = {0};
|
id str = [OFMutableString stringWithUTF8String:pathname];
|
||||||
getcwd(bp, 512);
|
|
||||||
cwk_path_join(bp, pathname, path_abs, 512);
|
if (absolute)
|
||||||
|
{
|
||||||
|
OFURL* base = [OFURL fileURLWithPath:[[OFFileManager defaultManager] currentDirectoryPath]];
|
||||||
|
OFURL* purl = [OFURL fileURLWithPath:str];
|
||||||
|
OFString* path = [[OFURL URLWithString:[purl string] relativeToURL:base] path];
|
||||||
|
str = [OFMutableString stringWithString:path];
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __WIN32__
|
||||||
|
if (preferred)
|
||||||
|
{
|
||||||
|
[str replaceOccurrencesOfString:@"/" withString:@"\\"];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
strncpy(ret, [[str stringByStandardizingPath] UTF8String], 512);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
cwk_path_normalize((path_abs) ? path_abs : (char*)pathname, path_nml, 512);
|
|
||||||
if (path_abs) delete path_abs;
|
|
||||||
return path_nml;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileSystem::exists(const char *filename)
|
bool FileSystem::exists(const char *filename)
|
|
@ -12,22 +12,23 @@ boost = dependency('boost', version: '>=1.49', modules: 'program_options')
|
||||||
openal = dependency('openal')
|
openal = dependency('openal')
|
||||||
zlib = dependency('zlib')
|
zlib = dependency('zlib')
|
||||||
|
|
||||||
main_dependencies = [sigcxx, openal, opengl, boost, zlib, pixman, physfs, vorbisfile, sdl2, sdl2_ttf, sdl2_image, sdl_sound]
|
global_include_dirs += include_directories('.')
|
||||||
|
global_dependencies += [sigcxx, openal, opengl, boost, zlib, pixman, physfs, vorbisfile, sdl2, sdl2_ttf, sdl2_image, sdl_sound]
|
||||||
if host_system == 'darwin'
|
if host_system == 'darwin'
|
||||||
main_dependencies += compiler.find_library('iconv')
|
global_dependencies += compilers['cpp'].find_library('iconv')
|
||||||
main_dependencies += dependency('CoreFoundation')
|
global_dependencies += dependency('CoreFoundation')
|
||||||
|
|
||||||
if openal.type_name() != 'pkgconfig'
|
if openal.type_name() != 'pkgconfig'
|
||||||
add_project_arguments('-DUSE_MAC_OPENAL', language: 'cpp')
|
add_project_arguments('-DUSE_MAC_OPENAL', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
elif host_system == 'windows'
|
elif host_system == 'windows'
|
||||||
main_dependencies += compiler.find_library('wsock32')
|
global_dependencies += compiler.find_library('wsock32')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('shared_fluid') == true
|
if get_option('shared_fluid') == true
|
||||||
fluidsynth = dependency('fluidsynth')
|
fluidsynth = dependency('fluidsynth')
|
||||||
add_project_arguments('-DSHARED_FLUID', language: 'cpp')
|
add_project_arguments('-DSHARED_FLUID', language: 'cpp')
|
||||||
main_dependencies += fluidsynth
|
global_dependencies += fluidsynth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('default_framerate') == true
|
if get_option('default_framerate') == true
|
||||||
|
@ -38,75 +39,12 @@ if get_option('cjk_fallback_font') == true
|
||||||
add_project_arguments('-DCJK_FALLBACK', language: 'cpp')
|
add_project_arguments('-DCJK_FALLBACK', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
main_headers = files(
|
|
||||||
'quadarray.h',
|
|
||||||
'audio.h',
|
|
||||||
'binding.h',
|
|
||||||
'bitmap.h',
|
|
||||||
'disposable.h',
|
|
||||||
'etc.h',
|
|
||||||
'etc-internal.h',
|
|
||||||
'eventthread.h',
|
|
||||||
'flashable.h',
|
|
||||||
'font.h',
|
|
||||||
'input.h',
|
|
||||||
'iniconfig.h',
|
|
||||||
'plane.h',
|
|
||||||
'scene.h',
|
|
||||||
'sprite.h',
|
|
||||||
'table.h',
|
|
||||||
'texpool.h',
|
|
||||||
'tilequad.h',
|
|
||||||
'transform.h',
|
|
||||||
'viewport.h',
|
|
||||||
'window.h',
|
|
||||||
'serializable.h',
|
|
||||||
'shader.h',
|
|
||||||
'glstate.h',
|
|
||||||
'quad.h',
|
|
||||||
'tilemap.h',
|
|
||||||
'tilemap-common.h',
|
|
||||||
'graphics.h',
|
|
||||||
'gl-debug.h',
|
|
||||||
'global-ibo.h',
|
|
||||||
'exception.h',
|
|
||||||
'filesystem.h',
|
|
||||||
'serial-util.h',
|
|
||||||
'intrulist.h',
|
|
||||||
'binding.h',
|
|
||||||
'gl-util.h',
|
|
||||||
'util.h',
|
|
||||||
'config.h',
|
|
||||||
'settingsmenu.h',
|
|
||||||
'keybindings.h',
|
|
||||||
'tileatlas.h',
|
|
||||||
'sharedstate.h',
|
|
||||||
'al-util.h',
|
|
||||||
'boost-hash.h',
|
|
||||||
'debugwriter.h',
|
|
||||||
'gl-fun.h',
|
|
||||||
'gl-meta.h',
|
|
||||||
'vertex.h',
|
|
||||||
'soundemitter.h',
|
|
||||||
'aldatasource.h',
|
|
||||||
'alstream.h',
|
|
||||||
'audiostream.h',
|
|
||||||
'rgssad.h',
|
|
||||||
'windowvx.h',
|
|
||||||
'tilemapvx.h',
|
|
||||||
'tileatlasvx.h',
|
|
||||||
'sharedmidistate.h',
|
|
||||||
'fluid-fun.h',
|
|
||||||
'sdl-util.h',
|
|
||||||
'lang-fun.h'
|
|
||||||
)
|
|
||||||
|
|
||||||
main_source = files(
|
main_source = files(
|
||||||
'main.cpp',
|
'main.cpp',
|
||||||
'audio.cpp',
|
'audio.cpp',
|
||||||
'bitmap.cpp',
|
'bitmap.cpp',
|
||||||
'eventthread.cpp',
|
'eventthread.cpp',
|
||||||
'filesystem.cpp',
|
'filesystem.mm',
|
||||||
'font.cpp',
|
'font.cpp',
|
||||||
'input.cpp',
|
'input.cpp',
|
||||||
'iniconfig.cpp',
|
'iniconfig.cpp',
|
||||||
|
@ -148,12 +86,12 @@ main_source = files(
|
||||||
'lang-fun.cpp'
|
'lang-fun.cpp'
|
||||||
)
|
)
|
||||||
|
|
||||||
main = [main_source, main_headers]
|
|
||||||
|
|
||||||
if get_option('use_fakeapi') == true
|
if get_option('use_fakeapi') == true
|
||||||
main += files('fake-api.cpp', 'fake-api.h')
|
main_source += files('fake-api.cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if discord == true
|
if discord == true
|
||||||
main += files('discordstate.cpp', 'discordstate.h')
|
main_source += files('discordstate.cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
global_sources += main_source
|
Loading…
Add table
Reference in a new issue