Added dynamic libraries for macos
This commit is contained in:
63
meson.build
63
meson.build
@@ -4,6 +4,45 @@ add_global_arguments('-std=c++11', language: ['cpp'])
|
||||
compiler = meson.get_compiler('cpp')
|
||||
cmake = import('cmake')
|
||||
|
||||
# For macOS only - define extra dependencies early
|
||||
if build_machine.system() == 'darwin'
|
||||
objc_dep = dependency('objc', required: false)
|
||||
if not objc_dep.found()
|
||||
objc_dep = compiler.find_library('objc', required: true)
|
||||
endif
|
||||
# Add other macOS frameworks that might be needed
|
||||
foundation_dep = dependency('Foundation', required: false)
|
||||
if not foundation_dep.found()
|
||||
foundation_dep = compiler.find_library('Foundation', required: false)
|
||||
endif
|
||||
cocoa_dep = dependency('Cocoa', required: false)
|
||||
if not cocoa_dep.found()
|
||||
cocoa_dep = compiler.find_library('Cocoa', required: false)
|
||||
endif
|
||||
iokit_dep = dependency('IOKit', required: false)
|
||||
if not iokit_dep.found()
|
||||
iokit_dep = compiler.find_library('IOKit', required: false)
|
||||
endif
|
||||
|
||||
extra_deps = [objc_dep]
|
||||
if foundation_dep.found()
|
||||
extra_deps += [foundation_dep]
|
||||
endif
|
||||
if cocoa_dep.found()
|
||||
extra_deps += [cocoa_dep]
|
||||
endif
|
||||
if iokit_dep.found()
|
||||
extra_deps += [iokit_dep]
|
||||
endif
|
||||
else
|
||||
extra_deps = []
|
||||
endif
|
||||
|
||||
# For Windows only
|
||||
ws2_dep = compiler.find_library('ws2_32', required: false)
|
||||
winmm = compiler.find_library('winmm', required: false)
|
||||
|
||||
# Handle raylib dependency based on library type
|
||||
# if we are building a shared library
|
||||
if get_option('default_library') == 'shared'
|
||||
raylib = dependency('raylib', required: false) # Try to find dependency with pkg-config
|
||||
@@ -17,24 +56,20 @@ if get_option('default_library') == 'shared'
|
||||
raylib_proj = cmake.subproject('raylib', options: opt_var)
|
||||
raylib = raylib_proj.dependency('raylib')
|
||||
endif
|
||||
else
|
||||
# For static library (default case)
|
||||
opt_var = cmake.subproject_options()
|
||||
opt_var.add_cmake_defines({'BUILD_SHARED_LIBS' : false})
|
||||
raylib_proj = cmake.subproject('raylib', options: opt_var)
|
||||
raylib = raylib_proj.dependency('raylib')
|
||||
endif
|
||||
|
||||
# I we are building a static library
|
||||
if get_option('default_library') == 'static'
|
||||
raylib_proj = cmake.subproject('raylib')
|
||||
raylib = raylib_proj.dependency('raylib')
|
||||
endif
|
||||
|
||||
#For Windows only
|
||||
ws2_dep = compiler.find_library('ws2_32', required: false)
|
||||
winmm = compiler.find_library('winmm', required: false)
|
||||
if build_machine.system() == 'windows'
|
||||
add_project_arguments('-Wl,--subsystem,windows', '-mwindows', language: ['cpp', 'c']) # Prevent opening console when game is run
|
||||
|
||||
add_project_arguments('-Wl,--subsystem,windows', '-mwindows', language: ['cpp', 'c']) # Prevent opening console when game is run
|
||||
endif
|
||||
|
||||
executable('pong',
|
||||
'main.cpp', 'sock.cpp','paddle.cpp', 'ball.cpp', 'numeric_base.cpp', 'connect_code.cpp', 'server.cpp', 'client.cpp', 'check_input.cpp', 'raygui_helpers.cpp', 'display_text.cpp',
|
||||
'netpong-serialization/serialization.c', 'timer.c', 'easysock.c',
|
||||
dependencies: [raylib, ws2_dep, winmm]
|
||||
'main.cpp', 'sock.cpp','paddle.cpp', 'ball.cpp', 'numeric_base.cpp', 'connect_code.cpp', 'server.cpp', 'client.cpp', 'check_input.cpp', 'raygui_helpers.cpp', 'display_text.cpp',
|
||||
'netpong-serialization/serialization.c', 'timer.c', 'easysock.c',
|
||||
dependencies: [raylib, ws2_dep, winmm] + extra_deps
|
||||
)
|
||||
|
Reference in New Issue
Block a user