Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 462b067

Browse files
authored
Merge pull request #501 from cortex-command-community/bug/500-fix-meson-builds-on-macos
Bug/500 fix meson builds on macos
2 parents 1e2f928 + 0f7c11e commit 462b067

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ If you want to change the buildtype afterwards, you can use `meson configure --b
101101

102102
`cd $DATA_REPOSITORY; ln -s ../Cortex-Command-Community-Project-Source/build/CortexCommand . `
103103

104-
2. Copy all `libfmod` files from `external/lib/linux/x86_64` into the **Data Repository**.
104+
2. (*optional*) Copy (link) all `libfmod` files from `external/lib/[os]/[arch]` into the **Data Repository**.
105+
- Linux: `cd $DATA_REPOSITORY; ln -s ../Cortex-Command-Community-Project-Source/external/lib/linux/x86_64/libfmod.so* .`
106+
- macOS: `cd $DATA_REPOSITORY; ln -s ../Cortex-Command-Community-Project-Source/external/lib/macOS/libfmod.dylib .`
105107

106-
`cd $DATA_REPOSITORY; ln -s ../Cortex-Command-Community-Project-Source/external/lib/linux/x86_64/libfmod.so* .`
107108

108109
4. Run `./CortexCommand` or `./CortexCommand_debug` in the **Data Repository**.
109110

external/lib/linux/x86_64/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ if get_option('install_fmod')
44
install_data(fmod_so, install_dir:get_option('fmod_dir'), install_mode:'rwxr-xr-x')
55
endif
66

7-
fmod = compiler.find_library('libfmod', dirs: meson.current_source_dir())
7+
fmod = compiler.find_library('fmod', dirs: meson.current_source_dir())
88

99
deps += fmod

external/lib/macos/meson.build

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
fmod_so = files('libfmod.dylib')
2-
3-
external_objects += fmod_so
1+
fmod = compiler.find_library('fmod', dirs:meson.current_source_dir())
2+
deps += fmod

meson.build

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ if compiler.get_argument_syntax()== 'gcc' # used for gcc compatible compilers
3333
# Build against system libraries on linux
3434
message('gcc detected')
3535

36-
build_rpath = '$ORIGIN:$ORIGIN/../external/lib/linux/x86_64' # Set RUNPATH so that CCCP can find libfmod.so without needing to set LD_LIBRARY_PATH
36+
if host_machine.system() == 'linux'
37+
build_rpath = '$ORIGIN:$ORIGIN/../external/lib/linux/x86_64' # Set RUNPATH so that CCCP can find libfmod.so without needing to set LD_LIBRARY_PATH
38+
elif host_machine.system()=='darwin'
39+
build_rpath = '@executable_path/../external/lib/macos' # Add a new R_PATH CCCP can find libfmod.dylib on Darwin TODO: Confirm and validate this.
40+
endif
41+
3742
#suffix = 'x86_64'
38-
if host_machine.system()=='linux'
39-
link_args += ['-Wl,--enable-new-dtags'] # Set RUNPATH instead of RPATH
40-
endif
43+
if host_machine.system()=='linux'
44+
link_args += ['-Wl,--enable-new-dtags'] # Set RUNPATH instead of RPATH
45+
endif
4146

4247
# Set preprocessor flags and cpp arguments according to build options
4348
buildtype_debug = get_option('debug')
@@ -175,16 +180,16 @@ endif
175180

176181
#### Installing #####
177182
base_exclude_files = [
178-
'Base.rte/Settings.ini',
179-
'Launch Actor Editor.bat',
180-
'Launch Area Editor.bat',
181-
'Launch Assembly Editor.bat',
182-
'Launch Gib Editor.bat',
183-
'Launch Scene Editor.bat',
184-
'LogConsole.txt',
185-
'LogLoading.txt',
186-
'LogLoadingWarning.txt',
187-
'Start Dedicated Server.bat'
183+
'Base.rte/Settings.ini',
184+
'Launch Actor Editor.bat',
185+
'Launch Area Editor.bat',
186+
'Launch Assembly Editor.bat',
187+
'Launch Gib Editor.bat',
188+
'Launch Scene Editor.bat',
189+
'LogConsole.txt',
190+
'LogLoading.txt',
191+
'LogLoadingWarning.txt',
192+
'Start Dedicated Server.bat'
188193
]
189194

190195
if get_option('install_data')

0 commit comments

Comments
 (0)