Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ShellScripts/common/post_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ run_script() {
# Copy Linux-specific wrapper script
cp -fu ShellScripts/Linux/run_oolite.sh "$PROGDIR"
local GNUSTEP_CONF="$GNUSTEP_FOLDER/etc/GNUstep/GNUstep.conf"
if [ ! -f "$GNUSTEP_CONF" ] && [ "$GNUSTEP_FOLDER" = "/usr" ] && [ -f "/etc/GNUstep/GNUstep.conf" ]; then
GNUSTEP_CONF="/etc/GNUstep/GNUstep.conf"
fi
install -D "$GNUSTEP_CONF" "$PROGDIR/Resources/GNUstep.conf.orig" || { echo "$err_msg GNUstep config" >&2; return 1; }

# If we're using GNUstep libraries that aren't in a system folder copy them
Expand Down
45 changes: 2 additions & 43 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,14 @@ project(
],
)

# ------------------------------------------------------------------------------
# Compiler Setup & Baseline Arguments
# ------------------------------------------------------------------------------
cc = meson.get_compiler('c')
host_os = host_machine.system()
is_windows = (host_os == 'windows' or host_os == 'cygwin')

c_family = ['c', 'cpp', 'objc']

version_string = meson.project_version()
add_project_arguments(
'-DOO_VERSION_FULL="@0@"'.format(version_string),
'-DGNUSTEP_BASE_LIBRARY=1',
language: c_family,
)
add_project_arguments(
'-fexceptions',
'-fobjc-exceptions',
language: 'objc',
)

if cc.get_id() == 'clang'
add_project_arguments(
'-DGNUSTEP_RUNTIME=1',
'-D_NONFRAGILE_ABI=1',
'-fobjc-runtime=gnustep-2.2',
'-fblocks',
language: 'objc',
)
else
add_project_arguments('-std=gnu99', language: ['c', 'objc'])
add_project_arguments(
'-DGNU_RUNTIME=1',
'-fobjc-runtime=gcc',
language: 'objc',
)
endif

is_debug = (get_option('optimization') == '0' or get_option('debug'))
if is_debug
Expand Down Expand Up @@ -114,20 +85,8 @@ if get_option('oo_javascript_trace')
add_project_arguments('-DMOZ_TRACE_JSCALLS=1', language: c_family)
endif

extra_link_args = []
if get_option('b_lto')
if cc.get_id() == 'clang'
add_project_arguments('-flto=thin', language: c_family)
extra_link_args += [
'-flto=thin',
'-Wl,--thinlto-cache-dir=thinlto_cache',
]
else
add_project_arguments('-flto=auto', language: c_family)
extra_link_args += ['-flto=auto']
endif
endif

gnustep_folder = '' # Not needed for Windows
# dependencies, compiler/linker flags and build
subdir('src')

install_env_args = [
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Debug/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated Meson configuration for sub-module: Debug

my_sources += files(
oolite_sources += files(
'OODebugMonitor.m',
'OODebugStandards.m',
'OODebugSupport.m',
Expand All @@ -10,5 +10,5 @@ my_sources += files(
'OOTCPStreamDecoderAbstractionLayer.m',
)

my_includes += include_directories('.')
oolite_includes += include_directories('.')

4 changes: 2 additions & 2 deletions src/Core/Entities/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated Meson configuration for sub-module: Entities

my_sources += files(
oolite_sources += files(
'DockEntity.m',
'DustEntity.m',
'Entity.m',
Expand Down Expand Up @@ -44,5 +44,5 @@ my_sources += files(
'WormholeEntity.m',
)

my_includes += include_directories('.')
oolite_includes += include_directories('.')

4 changes: 2 additions & 2 deletions src/Core/Materials/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated Meson configuration for sub-module: Materials

my_sources += files(
oolite_sources += files(
'OOBasicMaterial.m',
'OOCombinedEmissionMapGenerator.m',
'OOConcreteTexture.m',
Expand All @@ -26,5 +26,5 @@ my_sources += files(
'OOTextureLoader.m',
)

my_includes += include_directories('.')
oolite_includes += include_directories('.')

4 changes: 2 additions & 2 deletions src/Core/MiniZip/meson.build
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Generated Meson configuration for sub-module: MiniZip

my_sources += files(
oolite_sources += files(
'ioapi.c',
'unzip.c',
)

my_includes += include_directories('.')
oolite_includes += include_directories('.')

4 changes: 2 additions & 2 deletions src/Core/OXPVerifier/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated Meson configuration for sub-module: OXPVerifier

my_sources += files(
oolite_sources += files(
'OOAIStateMachineVerifierStage.m',
'OOCheckDemoShipsPListVerifierStage.m',
'OOCheckEquipmentPListVerifierStage.m',
Expand All @@ -16,5 +16,5 @@ my_sources += files(
'OOTextureVerifierStage.m',
)

my_includes += include_directories('.')
oolite_includes += include_directories('.')

4 changes: 2 additions & 2 deletions src/Core/Scripting/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated Meson configuration for sub-module: Scripting

my_sources += files(
oolite_sources += files(
'EntityOOJavaScriptExtensions.m',
'OOConstToJSString.m',
'OOJSCall.m',
Expand Down Expand Up @@ -50,5 +50,5 @@ my_sources += files(
'OOScriptTimer.m',
)

my_includes += include_directories('.')
oolite_includes += include_directories('.')

2 changes: 1 addition & 1 deletion src/Core/Tables/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Generated Meson build file for Tables

my_includes += include_directories('.')
oolite_includes += include_directories('.')
4 changes: 2 additions & 2 deletions src/Core/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated Meson configuration for sub-module: Core

my_sources += files(
oolite_sources += files(
'AI.m',
'AIGraphViz.m',
'CollisionRegion.m',
Expand Down Expand Up @@ -103,7 +103,7 @@ my_sources += files(
'legacy_random.c',
)

my_includes += include_directories('.')
oolite_includes += include_directories('.')

# Enter child subdirectories
subdir('Debug')
Expand Down
6 changes: 3 additions & 3 deletions src/SDL/EXRSnapshotSupport/meson.build
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Generated Meson configuration for sub-module: EXRSnapshotSupport

my_sources += files(
oolite_sources += files(
'OOSaveEXRSnapshot.cpp',
)

if host_machine.system() == 'windows'
my_sources += files(
oolite_sources += files(
'miniz.c',
)
endif

my_includes += include_directories('.')
oolite_includes += include_directories('.')

4 changes: 2 additions & 2 deletions src/SDL/OOResourcesWin/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if host_machine.system() == 'windows'
windows = import('windows')
my_sources += windows.compile_resources('OOResourcesWin.rc')
oolite_sources += windows.compile_resources('OOResourcesWin.rc')
endif

my_includes += include_directories('.')
oolite_includes += include_directories('.')

4 changes: 2 additions & 2 deletions src/SDL/meson.build
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Generated Meson configuration for sub-module: SDL

my_sources += files(
oolite_sources += files(
'Comparison.m',
'GameController+SDLFullScreen.m',
'MyOpenGLView.m',
'OOSDLJoystickManager.m',
'main.m',
)

my_includes += include_directories('.')
oolite_includes += include_directories('.')

# Enter child subdirectories
subdir('EXRSnapshotSupport')
Expand Down
135 changes: 12 additions & 123 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
oolite_deps = [
oolite_sources = []
oolite_includes = []
oolite_override_options = []
oolite_link_args = []
oolite_dependencies = [
dependency('sdl3'),
dependency('libpng'),
dependency('openal'),
Expand All @@ -9,137 +13,22 @@ oolite_deps = [
]

if get_option('espeak')
oolite_deps += [dependency('espeak-ng')]
oolite_dependencies += [dependency('espeak-ng')]
add_project_arguments('-DHAVE_LIBESPEAK=1', language: c_family)
endif

gnustep_folder = '' # Not needed for Windows
my_sources = []
my_includes = []

if is_windows
add_project_arguments(
'-DWIN32',
'-DXP_WIN',
'-DWINVER=0x0A00',
language: c_family,
)
extra_link_args += ['-mwindows']

if cc.get_id() == 'clang' and get_option('pdb')
add_project_arguments('-g', '-gcodeview', language: c_family)
extra_link_args += ['-Wl,-pdb=']
endif

win_js_suffix = (get_option('optimization') == '0' or get_option('debug')) ? 'dbg' : ''
dep_libs = [
'glu32',
'opengl32',
'dwmapi',
'winmm',
'ws2_32',
'objc',
'gnustep-base',
'js' + win_js_suffix,
]
foreach lib : dep_libs
oolite_deps += [cc.find_library(lib, required: true)]
endforeach
if (cc.get_id() == 'gcc')
add_project_arguments('-DSTATIC_JS_API', language: c_family)
endif

else
add_project_arguments('-ggdb3', '-DLINUX', '-DXP_UNIX', language: c_family)
extra_link_args += ['-ggdb3']

oolite_deps += [
dependency('gl'),
dependency('glu'),
dependency('x11'),
]

fs = import('fs')
project_root = meson.project_source_root()
home_local = join_paths(fs.expanduser('~'), '.local')

candidate_roots = [
{'abs': project_root, 'rel': '..'},
{'abs': home_local, 'rel': home_local},
{'abs': '/usr/local', 'rel': '/usr/local'},
{'abs': '/app', 'rel': '/app'},
]
js_name = is_debug ? 'jsdbg_static' : 'js_static'
js_lib = disabler()
gs_lib = disabler()
objc_lib = disabler()
js_inc = ''
gs_inc = ''
foreach root : candidate_roots
if not js_lib.found()
js_sub = (root['abs'] == project_root) ? 'build/mozilla_js' : ''
js_folder = root['abs'] / js_sub
lib_check = cc.find_library(
js_name,
dirs: [js_folder / 'lib', js_folder / 'lib64'],
required: false,
)
if lib_check.found()
js_lib = lib_check
js_inc = root['rel'] / js_sub / 'include'
endif
endif

if not gs_lib.found()
gs_sub = (root['abs'] == project_root) ? 'build/gnustep' : ''
gnustep_folder = root['abs'] / gs_sub
test_dirs = [gnustep_folder / 'lib', gnustep_folder / 'lib64']
lib_check = cc.find_library(
'gnustep-base',
dirs: test_dirs,
required: false,
)
if lib_check.found()
gs_lib = lib_check
objc_lib = cc.find_library(
'objc',
dirs: test_dirs,
required: true,
)
gs_inc = root['rel'] / gs_sub / 'include'
endif
endif

if js_lib.found() and gs_lib.found()
break
endif
endforeach

if not js_lib.found()
error('Required dependency "@0@" was not found.'.format(js_name))
endif
if not gs_lib.found()
error('Required dependency "gnustep-base" was not found.')
endif

inc_dir = include_directories([js_inc, gs_inc], is_system: true)
oolite_deps += declare_dependency(
dependencies: [js_lib, gs_lib, objc_lib],
include_directories: inc_dir,
)
endif

# Enter child subdirectories
subdir('meson')
subdir('Core')
subdir('SDL')

oolite_bin = executable(
'oolite',
my_sources,
include_directories: my_includes,
dependencies: oolite_deps,
oolite_sources,
include_directories: oolite_includes,
dependencies: oolite_dependencies,
override_options: oolite_override_options,
link_args: oolite_link_args,
win_subsystem: 'windows',
link_args: extra_link_args,
build_rpath: '$ORIGIN',
install_rpath: '$ORIGIN',
install: true,
Expand Down
Loading
Loading