project('Pong', ['cpp', 'c'], version: '0.1') add_global_arguments('-g', '-Wall', '-pedantic', '-Wno-unused-function', '-Wno-narrowing', language : ['cpp', 'c']) 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 if not raylib.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 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 if build_machine.system() == 'windows' 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] + extra_deps )