From 0e9088beb6090baeb5264020592a8fbeffca12ab Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Fri, 8 Mar 2024 14:44:17 -0500 Subject: [PATCH] Added comments, and added a way to use the bundled raylib, even if we are building a dynamically linked version --- meson.build | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 564daf3..2dd3ad4 100644 --- a/meson.build +++ b/meson.build @@ -3,19 +3,23 @@ add_global_arguments('-g', '-Wall', '-pedantic', '-Wno-unused-function', '-Wno-n compiler = meson.get_compiler('cpp') cmake = import('cmake') +# 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 if not raylib.found() - raylib = compiler.find_library('raylib', has_headers: ['raylib.h', 'raymath.h'], required: true) # Try to manually search for the dependency + message('===========+RAYLIB NOT FOUND===============') + raylib = compiler.find_library('raylib', has_headers: ['raylib.h', 'raymath.h'], required: false) # Try to manually search for the dependency + endif + if not raylib.found() + opt_var = cmake.subproject_options() + opt_var.add_cmake_defines({'BUILD_SHARED_LIBS' : true}) + opt_var.add_cmake_defines({'CMAKE_SKIP_RPATH' : true}) + raylib_proj = cmake.subproject('raylib', options: opt_var) + raylib = raylib_proj.dependency('raylib') endif -# if not raylib.found() -# opt_var = cmake.subproject_options() -# opt_var.add_cmake_defines({'BUILD_SHARED_LIBS' : true}) -# opt_var.add_cmake_defines({'CMAKE_SKIP_RPATH' : true}) -# raylib_proj = cmake.subproject('raylib', options: opt_var) -# raylib = raylib_proj.dependency('raylib') -# endif endif + +# I we are building a static library if get_option('default_library') == 'static' raylib_proj = cmake.subproject('raylib') raylib = raylib_proj.dependency('raylib') @@ -30,7 +34,7 @@ if build_machine.system() == 'windows' endif executable('pong', - 'main.cpp', 'easysock.cpp', 'sock.cpp','paddle.cpp', 'ball.cpp', 'numeric_base.cpp', 'connect_code.cpp', 'server.cpp', 'client.cpp', + 'main.cpp', 'easysock.cpp', 'sock.cpp','paddle.cpp', 'ball.cpp', 'numeric_base.cpp', 'connect_code.cpp', 'server.cpp', 'client.cpp', 'check_input.cpp', 'serialization.c', dependencies: [raylib, ws2_dep, winmm] )