project('Pong', 'c', license : 'GPL-3.0-only', version : '0.2', default_options : ['warning_level=3', 'werror=false', 'optimization=g', 'c_std=c11', 'prefix=/opt']) fs = import('fs') # Checks if on UNIX/POSIX System if host_machine.system() != 'windows' if host_machine.system() != 'darwin' set_variable('posix', true) endif else set_variable('posix', false) endif if get_variable('posix') == true message('Cleaning raylib...') # First clean up run_command('make', '-C', 'raylib/src', 'clean', capture : true, check : true) message('Building raylib...') # Then Build run_command('make', '-C', 'raylib/src', 'PLATFORM=PLATFORM_DESKTOP', 'RAYLIB_BUILD_MODE=RELEASE', capture : true, check : true) else message('Cleaning raylib...') # Have to put OS_PLATFORM=linux or makefile will complain about del command not being found. run_command('mingw32-make', '-C', 'raylib/src', 'PLATFORM_OS=linux', 'clean', capture : true, check : true) message('Building raylib...') run_command('mingw32-make', '-C', 'raylib/src', 'PLATFORM=PLATFORM_DESKTOP', 'RAYLIB_BUILD_MODE=RELEASE', capture : true, check : true) endif # Find the static library if fs.exists('raylib/libraylib.a') == true add_project_link_arguments('../raylib/libraylib.a', language : 'c') elif fs.exists('raylib/src/libraylib.a') == true add_project_link_arguments('../raylib/src/libraylib.a', language : 'c') else error('raylib failed to compile. Check meson-logs to see what went wrong.') endif message('raylib successfully compiled.') Include_Directories = include_directories('raylib/src') # Install launcher if flatpak if get_option('build_flatpak') == true install_data('src/launch.sh', install_dir : 'bin') endif # Checks if on UNIX/POSIX System if host_machine.system() != 'windows' if host_machine.system() != 'darwin' set_variable('posix', true) endif else set_variable('posix', false) endif if get_variable('posix') == true X11_Dep = dependency('x11') endif GL_Dep = dependency('gl') Threads_Dep = dependency('threads') Sources = ['src/main.c', 'src/enemy.c', 'src/ball.c', 'src/title.c', 'src/versus.c', 'src/marathon.c'] if get_variable('posix') == true Dependencies = [GL_Dep, Threads_Dep, X11_Dep] add_project_link_arguments('-lGL', '-lm', '-lpthread', '-ldl', '-lrt', '-lX11', language : 'c') else Dependencies = [GL_Dep, Threads_Dep] add_project_link_arguments('-lopengl32', '-lgdi32', '-lwinmm', '-lpthread', '-lm', language : 'c') endif # If on windows, we need the c11 threads emulation layer. if get_variable('posix') == false Include_Directories = include_directories(['raylib/src', 'src/windows']) endif executable('pong', Sources, dependencies : Dependencies, install : true, install_dir : 'Pong', include_directories : Include_Directories) install_subdir('resources', install_dir : 'Pong')