1project('nk_pugl', 'c', default_options : [ 2 'buildtype=release', 3 'warning_level=3', 4 'werror=false', 5 'b_lto=false', 6 'c_std=gnu11']) 7 8build_examples = get_option('build-examples') 9 10static_link = false #meson.is_cross_build() 11 12cc = meson.get_compiler('c') 13 14m_dep = cc.find_library('m') 15lv2_dep = dependency('lv2', 16 version : '>=1.14.0') 17glew_dep = dependency('glew', 18 version : '>=2.0.0', 19 static : static_link) 20glu_dep = dependency('glu', 21 version : '>=9.0.0', 22 static : static_link) 23 24deps = [m_dep, lv2_dep, glu_dep, glew_dep] 25links = [] 26 27pugl_inc = include_directories(join_paths('pugl', 'include')) 28inc_dir = [pugl_inc] 29 30add_project_arguments('-D_GNU_SOURCE', language : 'c') 31 32bin_srcs = [ 33 join_paths('example', 'example.c') 34] 35 36lib_srcs = [ 37 join_paths('pugl', 'src', 'implementation.c') 38] 39 40c_args = ['-fvisibility=hidden', 41 '-ffast-math'] 42 43if host_machine.system() == 'windows' 44 deps += cc.find_library('opengl32') 45 deps += cc.find_library('gdi32') 46 deps += cc.find_library('ws2_32') 47 lib_srcs += join_paths('pugl', 'src', 'win.c') 48 lib_srcs += join_paths('pugl', 'src', 'win_gl.c') 49elif host_machine.system() == 'darwin' 50 add_languages('objc') 51 links += ['-framework', 'OpenGL'] 52 links += ['-framework', 'Cocoa'] 53 lib_srcs += join_paths('pugl', 'src', 'mac.m') 54 lib_srcs += join_paths('pugl', 'src', 'mac_gl.m') 55else 56 deps += dependency('gl') 57 deps += dependency('x11', version : '>=1.6.0') 58 deps += dependency('xext', version : '>=1.3.0') 59 lib_srcs += join_paths('pugl', 'src', 'x11.c') 60 lib_srcs += join_paths('pugl', 'src', 'x11_gl.c') 61endif 62 63nk_pugl_gl = declare_dependency( 64 compile_args : ['-DPUGL_STATIC'], 65 include_directories : inc_dir, 66 dependencies : deps, 67 link_args : links, 68 sources : lib_srcs) 69 70cousine_regular_ttf = configure_file( 71 input : join_paths('nuklear', 'extra_font', 'Cousine-Regular.ttf'), 72 output : 'Cousine-Regular.ttf', 73 copy : true, 74 install : false) 75 76if build_examples 77 78 executable('nk_pugl.gl', [bin_srcs], 79 c_args : c_args, 80 include_directories : inc_dir, 81 dependencies: nk_pugl_gl, 82 install : false) 83endif 84