trunk/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h
| r244644 | r244645 | |
| 1 | | static const uint8_t fs_imgui_latlong_glsl[646] = |
| 1 | static const uint8_t fs_imgui_latlong_glsl[649] = |
| 2 | 2 | { |
| 3 | 3 | 0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima |
| 4 | 4 | 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x07, 0x01, 0x00, 0x00, // geLodEnabled.... |
| 5 | 5 | 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, // ...s_texColor... |
| 6 | | 0x00, 0x01, 0x00, 0x4e, 0x02, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...N...varying h |
| 6 | 0x00, 0x01, 0x00, 0x51, 0x02, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // ...Q...varying h |
| 7 | 7 | 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec2 v_texc |
| 8 | 8 | 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h |
| 9 | 9 | 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ighp vec4 u_imag |
| r244644 | r244645 | |
| 21 | 21 | 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x76, 0x5f, // tmpvar_3 = (v_ |
| 22 | 22 | 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x33, 0x2e, // texcoord0.y * 3. |
| 23 | 23 | 0x31, 0x34, 0x31, 0x35, 0x39, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // 14159);. result |
| 24 | | 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // _1.x = (sin(tmpv |
| 25 | | 0x61, 0x72, 0x5f, 0x33, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, // ar_3) * cos(tmpv |
| 26 | | 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // ar_2));. result |
| 27 | | 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // _1.y = cos(tmpva |
| 28 | | 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, // r_3);. result_1 |
| 29 | | 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, 0x76, // .z = (-(sin(tmpv |
| 30 | | 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, 0x70, // ar_3)) * sin(tmp |
| 31 | | 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, // var_2));. lowp |
| 32 | | 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // vec4 tmpvar_4;. |
| 33 | | 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // tmpvar_4.xyz = |
| 34 | | 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, 0x20, // textureCubeLod |
| 35 | | 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x72, // (s_texColor, r |
| 36 | | 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, // esult_1, u_image |
| 37 | | 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, 0x2e, 0x78, 0x79, // LodEnabled.x).xy |
| 38 | | 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, // z;. tmpvar_4.w |
| 39 | | 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, 0x20, 0x2a, 0x20, // = (0.2 + (0.8 * |
| 40 | | 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, // u_imageLodEnable |
| 41 | | 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // d.y));. gl_Frag |
| 42 | | 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // Color = tmpvar_4 |
| 43 | | 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... |
| 24 | 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, 0x6d, // _1.x = (-(sin(tm |
| 25 | 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x73, 0x69, 0x6e, 0x28, 0x74, // pvar_3)) * sin(t |
| 26 | 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, // mpvar_2));. res |
| 27 | 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x73, 0x28, 0x74, 0x6d, // ult_1.y = cos(tm |
| 28 | 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, // pvar_3);. resul |
| 29 | 0x74, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x2d, 0x28, 0x73, 0x69, 0x6e, 0x28, 0x74, // t_1.z = (-(sin(t |
| 30 | 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x63, 0x6f, 0x73, 0x28, // mpvar_3)) * cos( |
| 31 | 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, // tmpvar_2));. lo |
| 32 | 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // wp vec4 tmpvar_4 |
| 33 | 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, // ;. tmpvar_4.xyz |
| 34 | 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, // = textureCubeLo |
| 35 | 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // d (s_texColor |
| 36 | 0x2c, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x69, 0x6d, // , result_1, u_im |
| 37 | 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x78, 0x29, // ageLodEnabled.x) |
| 38 | 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // .xyz;. tmpvar_4 |
| 39 | 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x32, 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x38, // .w = (0.2 + (0.8 |
| 40 | 0x20, 0x2a, 0x20, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, // * u_imageLodEna |
| 41 | 0x62, 0x6c, 0x65, 0x64, 0x2e, 0x79, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // bled.y));. gl_F |
| 42 | 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva |
| 43 | 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_4;.}... |
| 44 | 44 | }; |
| 45 | | static const uint8_t fs_imgui_latlong_dx9[553] = |
| 45 | static const uint8_t fs_imgui_latlong_dx9[537] = |
| 46 | 46 | { |
| 47 | 47 | 0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima |
| 48 | 48 | 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x15, 0x01, 0x00, 0x00, // geLodEnabled.... |
| 49 | | 0x01, 0x00, 0x04, 0x02, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, // ..........0.CTAB |
| 49 | 0x01, 0x00, 0xf4, 0x01, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x30, 0x00, 0x43, 0x54, 0x41, 0x42, // ..........0.CTAB |
| 50 | 50 | 0x1c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, // ................ |
| 51 | 51 | 0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // ............D... |
| 52 | 52 | 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........P....... |
| r244644 | r244645 | |
| 71 | 71 | 0x01, 0x00, 0x00, 0xa0, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, // ................ |
| 72 | 72 | 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x55, 0xa0, // ..............U. |
| 73 | 73 | 0x01, 0x00, 0xaa, 0xa0, 0x25, 0x00, 0x00, 0x02, 0x02, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x80, // ....%........... |
| 74 | | 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x55, 0x80, // ..............U. |
| 75 | | 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x01, 0x00, 0x55, 0x80, 0x02, 0x00, 0x55, 0x81, // ..........U...U. |
| 74 | 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x05, 0x80, 0x01, 0x00, 0xc5, 0x80, 0x02, 0x00, 0x55, 0x81, // ..............U. |
| 76 | 75 | 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02, // ................ |
| 77 | 76 | 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ........_....... |
| 78 | 77 | 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x07, 0x80, // ................ |
| r244644 | r244645 | |
| 84 | 83 | { |
| 85 | 84 | 0x46, 0x53, 0x48, 0x03, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima |
| 86 | 85 | 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x15, 0x00, 0x30, 0x0a, // geLodEnabled..0. |
| 87 | | 0x01, 0x00, 0x30, 0x02, 0x44, 0x58, 0x42, 0x43, 0x89, 0x11, 0x25, 0xa6, 0xf5, 0x66, 0x12, 0x3f, // ..0.DXBC..%..f.? |
| 88 | | 0xc0, 0x1f, 0x67, 0x9b, 0x6e, 0x4e, 0xac, 0x03, 0x01, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, // ..g.nN......0... |
| 86 | 0x01, 0x00, 0x30, 0x02, 0x44, 0x58, 0x42, 0x43, 0xbb, 0x3e, 0xd7, 0x3a, 0x63, 0xc9, 0x70, 0x0b, // ..0.DXBC.>.:c.p. |
| 87 | 0xa5, 0x2c, 0x7d, 0xb2, 0x3c, 0x0c, 0x75, 0x44, 0x01, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, // .,}.<.uD....0... |
| 89 | 88 | 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, // ....,........... |
| 90 | 89 | 0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGNP........... |
| 91 | 90 | 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // 8............... |
| r244644 | r244645 | |
| 101 | 100 | 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x30, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X0...p.. |
| 102 | 101 | 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, // ....UU..b...2... |
| 103 | 102 | 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ...... |
| 104 | | 0x68, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, // h.......8...2... |
| 105 | | 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // ....F........@.. |
| 106 | | 0xdb, 0x0f, 0xc9, 0x40, 0xdb, 0x0f, 0x49, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...@..I@........ |
| 107 | | 0x4d, 0x00, 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, // M...B........... |
| 108 | | 0x1a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x06, // ....A.......M... |
| 109 | | 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x16, 0x05, 0x10, 0x00, // 2............... |
| 103 | 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, // h.......8...2... |
| 104 | 0x00, 0x00, 0x00, 0x00, 0x16, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, // .............@.. |
| 105 | 0xdb, 0x0f, 0x49, 0x40, 0xdb, 0x0f, 0xc9, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ..I@...@........ |
| 106 | 0x4d, 0x00, 0x00, 0x06, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, // M...B........... |
| 107 | 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, // ........M....... |
| 108 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, // ............A... |
| 110 | 109 | 0x00, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x06, 0x00, 0xd0, 0x00, 0x00, 0x62, 0x00, 0x10, 0x00, // ....M.......b... |
| 111 | | 0x02, 0x00, 0x00, 0x00, 0x06, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // ............8... |
| 112 | | 0x82, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........*....... |
| 113 | | 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, // ........8....... |
| 114 | | 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, // ................ |
| 115 | | 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H........... |
| 116 | | 0x86, 0x03, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F~...... |
| 110 | 0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, // ............8... |
| 111 | 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........*....... |
| 112 | 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, // :.......8....... |
| 113 | 0x01, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, // ....:.......*... |
| 114 | 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H........... |
| 115 | 0x46, 0x03, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F~...... |
| 117 | 116 | 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .`........ ..... |
| 118 | 117 | 0xa3, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....6...r ...... |
| 119 | 118 | 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x82, 0x20, 0x10, 0x00, // F.......2.... .. |
trunk/3rdparty/bgfx/src/bgfx.cpp
| r244644 | r244645 | |
| 19 | 19 | # define BGFX_CHECK_RENDER_THREAD() |
| 20 | 20 | #endif // BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS |
| 21 | 21 | |
| 22 | #define BGFX_CHECK_HANDLE(_handle, _max) \ |
| 23 | BX_CHECK(isValid(_handle) \ |
| 24 | && _handle.idx < _max \ |
| 25 | , "Invalid handle. %d (< %d " #_max ")" \ |
| 26 | , _handle.idx \ |
| 27 | , _max \ |
| 28 | ); |
| 29 | |
| 22 | 30 | #if BX_PLATFORM_ANDROID |
| 23 | 31 | ::ANativeWindow* g_bgfxAndroidWindow = NULL; |
| 24 | 32 | |
| r244644 | r244645 | |
| 797 | 805 | |
| 798 | 806 | void Frame::sort() |
| 799 | 807 | { |
| 808 | for (uint32_t ii = 0, num = m_num; ii < num; ++ii) |
| 809 | { |
| 810 | m_sortKeys[ii] = SortKey::remapView(m_sortKeys[ii], m_viewRemap); |
| 811 | } |
| 800 | 812 | bx::radixSort64(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_num); |
| 801 | 813 | } |
| 802 | 814 | |
| r244644 | r244645 | |
| 951 | 963 | BX_TRACE("Multithreaded renderer is disabled."); |
| 952 | 964 | #endif // BGFX_CONFIG_MULTITHREADED |
| 953 | 965 | |
| 966 | for (uint32_t ii = 0; ii < BX_COUNTOF(m_viewRemap); ++ii) |
| 967 | { |
| 968 | m_viewRemap[ii] = ii; |
| 969 | } |
| 970 | |
| 954 | 971 | memset(m_fb, 0xff, sizeof(m_fb) ); |
| 955 | 972 | memset(m_clear, 0, sizeof(m_clear) ); |
| 956 | 973 | memset(m_rect, 0, sizeof(m_rect) ); |
| r244644 | r244645 | |
| 1156 | 1173 | freeDynamicBuffers(); |
| 1157 | 1174 | m_submit->m_resolution = m_resolution; |
| 1158 | 1175 | m_submit->m_debug = m_debug; |
| 1176 | |
| 1177 | memcpy(m_submit->m_viewRemap, m_viewRemap, sizeof(m_viewRemap) ); |
| 1159 | 1178 | memcpy(m_submit->m_fb, m_fb, sizeof(m_fb) ); |
| 1160 | 1179 | memcpy(m_submit->m_clear, m_clear, sizeof(m_clear) ); |
| 1161 | 1180 | memcpy(m_submit->m_rect, m_rect, sizeof(m_rect) ); |
| r244644 | r244645 | |
| 1961 | 1980 | g_caps.supported = 0 |
| 1962 | 1981 | | (BGFX_CONFIG_MULTITHREADED ? BGFX_CAPS_RENDERER_MULTITHREADED : 0) |
| 1963 | 1982 | ; |
| 1983 | g_caps.maxViews = BGFX_CONFIG_MAX_VIEWS; |
| 1964 | 1984 | g_caps.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS; |
| 1965 | 1985 | g_caps.maxFBAttachments = 1; |
| 1966 | 1986 | |
| r244644 | r244645 | |
| 2617 | 2637 | s_ctx->setClearColor(_index, _rgba); |
| 2618 | 2638 | } |
| 2619 | 2639 | |
| 2640 | bool checkView(uint8_t _id) |
| 2641 | { |
| 2642 | // workaround GCC 4.9 type-limit check. |
| 2643 | const uint32_t id = _id; |
| 2644 | return id < BGFX_CONFIG_MAX_VIEWS; |
| 2645 | } |
| 2646 | |
| 2620 | 2647 | void setViewName(uint8_t _id, const char* _name) |
| 2621 | 2648 | { |
| 2622 | 2649 | BGFX_CHECK_MAIN_THREAD(); |
| 2623 | | BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id); |
| 2650 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2624 | 2651 | s_ctx->setViewName(_id, _name); |
| 2625 | 2652 | } |
| 2626 | 2653 | |
| 2627 | 2654 | void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) |
| 2628 | 2655 | { |
| 2629 | 2656 | BGFX_CHECK_MAIN_THREAD(); |
| 2630 | | BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id); |
| 2657 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2631 | 2658 | s_ctx->setViewRect(_id, _x, _y, _width, _height); |
| 2632 | 2659 | } |
| 2633 | 2660 | |
| 2634 | 2661 | void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) |
| 2635 | 2662 | { |
| 2636 | 2663 | BGFX_CHECK_MAIN_THREAD(); |
| 2637 | | BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id); |
| 2664 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2638 | 2665 | s_ctx->setViewScissor(_id, _x, _y, _width, _height); |
| 2639 | 2666 | } |
| 2640 | 2667 | |
| 2641 | 2668 | void setViewClear(uint8_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) |
| 2642 | 2669 | { |
| 2643 | 2670 | BGFX_CHECK_MAIN_THREAD(); |
| 2644 | | BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id); |
| 2671 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2645 | 2672 | s_ctx->setViewClear(_id, _flags, _rgba, _depth, _stencil); |
| 2646 | 2673 | } |
| 2647 | 2674 | |
| 2648 | 2675 | void setViewClear(uint8_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) |
| 2649 | 2676 | { |
| 2650 | 2677 | BGFX_CHECK_MAIN_THREAD(); |
| 2651 | | BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id); |
| 2678 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2652 | 2679 | s_ctx->setViewClear(_id, _flags, _depth, _stencil, _0, _1, _2, _3, _4, _5, _6, _7); |
| 2653 | 2680 | } |
| 2654 | 2681 | |
| 2655 | 2682 | void setViewSeq(uint8_t _id, bool _enabled) |
| 2656 | 2683 | { |
| 2657 | 2684 | BGFX_CHECK_MAIN_THREAD(); |
| 2658 | | BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id); |
| 2685 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2659 | 2686 | s_ctx->setViewSeq(_id, _enabled); |
| 2660 | 2687 | } |
| 2661 | 2688 | |
| 2662 | 2689 | void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) |
| 2663 | 2690 | { |
| 2664 | 2691 | BGFX_CHECK_MAIN_THREAD(); |
| 2665 | | BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id); |
| 2692 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2666 | 2693 | s_ctx->setViewFrameBuffer(_id, _handle); |
| 2667 | 2694 | } |
| 2668 | 2695 | |
| 2669 | 2696 | void setViewTransform(uint8_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR) |
| 2670 | 2697 | { |
| 2671 | 2698 | BGFX_CHECK_MAIN_THREAD(); |
| 2672 | | BX_CHECK(_id < BGFX_CONFIG_MAX_VIEWS, "Invalid view id: %d", _id); |
| 2699 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2673 | 2700 | s_ctx->setViewTransform(_id, _view, _projL, _flags, _projR); |
| 2674 | 2701 | } |
| 2675 | 2702 | |
| 2703 | void setViewRemap(uint8_t _id, uint8_t _num, const void* _remap) |
| 2704 | { |
| 2705 | BGFX_CHECK_MAIN_THREAD(); |
| 2706 | BX_CHECK(checkView(_id), "Invalid view id: %d", _id); |
| 2707 | s_ctx->setViewRemap(_id, _num, _remap); |
| 2708 | } |
| 2709 | |
| 2676 | 2710 | void setMarker(const char* _marker) |
| 2677 | 2711 | { |
| 2678 | 2712 | BGFX_CHECK_MAIN_THREAD(); |
| r244644 | r244645 | |
| 2724 | 2758 | void setUniform(UniformHandle _handle, const void* _value, uint16_t _num) |
| 2725 | 2759 | { |
| 2726 | 2760 | BGFX_CHECK_MAIN_THREAD(); |
| 2761 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_UNIFORMS); |
| 2727 | 2762 | s_ctx->setUniform(_handle, _value, _num); |
| 2728 | 2763 | } |
| 2729 | 2764 | |
| 2730 | 2765 | void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) |
| 2731 | 2766 | { |
| 2732 | 2767 | BGFX_CHECK_MAIN_THREAD(); |
| 2768 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS); |
| 2733 | 2769 | s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices); |
| 2734 | 2770 | } |
| 2735 | 2771 | |
| 2736 | 2772 | void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) |
| 2737 | 2773 | { |
| 2738 | 2774 | BGFX_CHECK_MAIN_THREAD(); |
| 2775 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS); |
| 2739 | 2776 | s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices); |
| 2740 | 2777 | } |
| 2741 | 2778 | |
| r244644 | r244645 | |
| 2760 | 2797 | void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) |
| 2761 | 2798 | { |
| 2762 | 2799 | BGFX_CHECK_MAIN_THREAD(); |
| 2800 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS); |
| 2763 | 2801 | s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices); |
| 2764 | 2802 | } |
| 2765 | 2803 | |
| 2766 | 2804 | void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices) |
| 2767 | 2805 | { |
| 2768 | 2806 | BGFX_CHECK_MAIN_THREAD(); |
| 2807 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS); |
| 2769 | 2808 | s_ctx->setVertexBuffer(_handle, _numVertices); |
| 2770 | 2809 | } |
| 2771 | 2810 | |
| r244644 | r244645 | |
| 2784 | 2823 | void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) |
| 2785 | 2824 | { |
| 2786 | 2825 | BGFX_CHECK_MAIN_THREAD(); |
| 2826 | BX_CHECK(NULL != _idb, "_idb can't be NULL"); |
| 2787 | 2827 | s_ctx->setInstanceDataBuffer(_idb, _num); |
| 2788 | 2828 | } |
| 2789 | 2829 | |
| 2790 | 2830 | void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) |
| 2791 | 2831 | { |
| 2792 | 2832 | BGFX_CHECK_MAIN_THREAD(); |
| 2833 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS); |
| 2793 | 2834 | s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num); |
| 2794 | 2835 | } |
| 2795 | 2836 | |
| 2796 | 2837 | void setInstanceDataBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) |
| 2797 | 2838 | { |
| 2798 | 2839 | BGFX_CHECK_MAIN_THREAD(); |
| 2840 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS); |
| 2799 | 2841 | s_ctx->setInstanceDataBuffer(_handle, _startVertex, _num); |
| 2800 | 2842 | } |
| 2801 | 2843 | |
| 2802 | 2844 | void setProgram(ProgramHandle _handle) |
| 2803 | 2845 | { |
| 2804 | 2846 | BGFX_CHECK_MAIN_THREAD(); |
| 2847 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_PROGRAMS); |
| 2805 | 2848 | s_ctx->setProgram(_handle); |
| 2806 | 2849 | } |
| 2807 | 2850 | |
| r244644 | r244645 | |
| 2826 | 2869 | void setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) |
| 2827 | 2870 | { |
| 2828 | 2871 | BGFX_CHECK_MAIN_THREAD(); |
| 2872 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_INDEX_BUFFERS); |
| 2829 | 2873 | s_ctx->setBuffer(_stage, _handle, _access); |
| 2830 | 2874 | } |
| 2831 | 2875 | |
| 2832 | 2876 | void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) |
| 2833 | 2877 | { |
| 2834 | 2878 | BGFX_CHECK_MAIN_THREAD(); |
| 2879 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_VERTEX_BUFFERS); |
| 2835 | 2880 | s_ctx->setBuffer(_stage, _handle, _access); |
| 2836 | 2881 | } |
| 2837 | 2882 | |
| 2838 | 2883 | void setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access) |
| 2839 | 2884 | { |
| 2840 | 2885 | BGFX_CHECK_MAIN_THREAD(); |
| 2886 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS); |
| 2841 | 2887 | s_ctx->setBuffer(_stage, _handle, _access); |
| 2842 | 2888 | } |
| 2843 | 2889 | |
| 2844 | 2890 | void setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access) |
| 2845 | 2891 | { |
| 2846 | 2892 | BGFX_CHECK_MAIN_THREAD(); |
| 2893 | BGFX_CHECK_HANDLE(_handle, BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS); |
| 2847 | 2894 | s_ctx->setBuffer(_stage, _handle, _access); |
| 2848 | 2895 | } |
| 2849 | 2896 | |
| 2850 | | void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access) |
| 2897 | void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) |
| 2851 | 2898 | { |
| 2852 | 2899 | BGFX_CHECK_MAIN_THREAD(); |
| 2853 | | s_ctx->setImage(_stage, _sampler, _handle, _mip, _format, _access); |
| 2900 | s_ctx->setImage(_stage, _sampler, _handle, _mip, _access, _format); |
| 2854 | 2901 | } |
| 2855 | 2902 | |
| 2856 | | void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access) |
| 2903 | void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, Access::Enum _access, TextureFormat::Enum _format) |
| 2857 | 2904 | { |
| 2858 | 2905 | BGFX_CHECK_MAIN_THREAD(); |
| 2859 | | s_ctx->setImage(_stage, _sampler, _handle, _attachment, _format, _access); |
| 2906 | s_ctx->setImage(_stage, _sampler, _handle, _attachment, _access, _format); |
| 2860 | 2907 | } |
| 2861 | 2908 | |
| 2862 | 2909 | void dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) |
| r244644 | r244645 | |
| 3466 | 3513 | return bgfx::submit(_id, _depth); |
| 3467 | 3514 | } |
| 3468 | 3515 | |
| 3469 | | BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_texture_format_t _format, bgfx_access_t _access) |
| 3516 | BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format) |
| 3470 | 3517 | { |
| 3471 | 3518 | union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler }; |
| 3472 | 3519 | union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; |
| 3473 | | bgfx::setImage(_stage, sampler.cpp, handle.cpp, _mip, bgfx::TextureFormat::Enum(_format), bgfx::Access::Enum(_access) ); |
| 3520 | bgfx::setImage(_stage, sampler.cpp, handle.cpp, _mip, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) ); |
| 3474 | 3521 | } |
| 3475 | 3522 | |
| 3476 | | BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_texture_format_t _format, bgfx_access_t _access) |
| 3523 | BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_access_t _access, bgfx_texture_format_t _format) |
| 3477 | 3524 | { |
| 3478 | 3525 | union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler }; |
| 3479 | 3526 | union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle }; |
| 3480 | | bgfx::setImage(_stage, sampler.cpp, handle.cpp, _attachment, bgfx::TextureFormat::Enum(_format), bgfx::Access::Enum(_access) ); |
| 3527 | bgfx::setImage(_stage, sampler.cpp, handle.cpp, _attachment, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) ); |
| 3481 | 3528 | } |
| 3482 | 3529 | |
| 3483 | 3530 | BGFX_C_API void bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) |
trunk/3rdparty/bgfx/src/bgfx_p.h
| r244644 | r244645 | |
| 679 | 679 | }; |
| 680 | 680 | |
| 681 | 681 | #define SORT_KEY_RENDER_DRAW (UINT64_C(1)<<0x2b) |
| 682 | #define SORT_KEY_VIEW_SHIFT UINT8_C(0x37) |
| 683 | #define SORT_KEY_VIEW_MASK ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<<SORT_KEY_VIEW_SHIFT) |
| 682 | 684 | |
| 683 | | BX_STATIC_ASSERT(BGFX_CONFIG_MAX_VIEWS <= 32); |
| 685 | BX_STATIC_ASSERT(BGFX_CONFIG_MAX_VIEWS <= 256); |
| 684 | 686 | BX_STATIC_ASSERT( (BGFX_CONFIG_MAX_PROGRAMS & (BGFX_CONFIG_MAX_PROGRAMS-1) ) == 0); // must be power of 2 |
| 685 | 687 | |
| 686 | 688 | struct SortKey |
| r244644 | r244645 | |
| 689 | 691 | { |
| 690 | 692 | // | 3 2 1 0| |
| 691 | 693 | // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210| |
| 692 | | // | vvvvvsssssssssssdttpppppppppdddddddddddddddddddddddddddddddd| |
| 694 | // | vvvvvvvvsssssssssssdttpppppppppdddddddddddddddddddddddddddddddd| |
| 693 | 695 | // | ^ ^^ ^ ^ ^| |
| 694 | 696 | // | | || | | || |
| 695 | 697 | // | view-+ seq-+| +-trans +-program depth-+| |
| r244644 | r244645 | |
| 699 | 701 | const uint64_t program = uint64_t(m_program)<<0x20; |
| 700 | 702 | const uint64_t trans = uint64_t(m_trans )<<0x29; |
| 701 | 703 | const uint64_t seq = uint64_t(m_seq )<<0x2c; |
| 702 | | const uint64_t view = uint64_t(m_view )<<0x37; |
| 704 | const uint64_t view = uint64_t(m_view )<<SORT_KEY_VIEW_SHIFT; |
| 703 | 705 | const uint64_t key = depth|program|trans|SORT_KEY_RENDER_DRAW|seq|view; |
| 704 | 706 | return key; |
| 705 | 707 | } |
| r244644 | r244645 | |
| 708 | 710 | { |
| 709 | 711 | // | 3 2 1 0| |
| 710 | 712 | // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210| |
| 711 | | // | vvvvvsssssssssssdppppppppp | |
| 713 | // | vvvvvvvvsssssssssssdppppppppp | |
| 712 | 714 | // | ^ ^^ ^ | |
| 713 | 715 | // | | || | | |
| 714 | 716 | // | view-+ seq-+| +-program | |
| r244644 | r244645 | |
| 716 | 718 | |
| 717 | 719 | const uint64_t program = uint64_t(m_program)<<0x22; |
| 718 | 720 | const uint64_t seq = uint64_t(m_seq )<<0x2c; |
| 719 | | const uint64_t view = uint64_t(m_view )<<0x37; |
| 721 | const uint64_t view = uint64_t(m_view )<<SORT_KEY_VIEW_SHIFT; |
| 720 | 722 | const uint64_t key = program|seq|view; |
| 721 | 723 | return key; |
| 722 | 724 | } |
| r244644 | r244645 | |
| 725 | 727 | bool decode(uint64_t _key) |
| 726 | 728 | { |
| 727 | 729 | m_seq = (_key>>0x2c)& 0x7ff; |
| 728 | | m_view = (_key>>0x37)&(BGFX_CONFIG_MAX_VIEWS-1); |
| 730 | m_view = uint8_t( (_key&SORT_KEY_VIEW_MASK)>>SORT_KEY_VIEW_SHIFT); |
| 729 | 731 | if (_key & SORT_KEY_RENDER_DRAW) |
| 730 | 732 | { |
| 731 | 733 | m_depth = _key & 0xffffffff; |
| r244644 | r244645 | |
| 738 | 740 | return true; // compute |
| 739 | 741 | } |
| 740 | 742 | |
| 743 | bool decode(uint64_t _key, uint8_t _viewRemap[BGFX_CONFIG_MAX_VIEWS]) |
| 744 | { |
| 745 | bool compute = decode(_key); |
| 746 | m_view = _viewRemap[m_view]; |
| 747 | return compute; |
| 748 | } |
| 749 | |
| 750 | static uint64_t remapView(uint64_t _key, uint8_t _viewRemap[BGFX_CONFIG_MAX_VIEWS]) |
| 751 | { |
| 752 | const uint8_t oldView = uint8_t( (_key & SORT_KEY_VIEW_MASK) >> SORT_KEY_VIEW_SHIFT); |
| 753 | const uint64_t view = uint64_t(_viewRemap[oldView]) << SORT_KEY_VIEW_SHIFT; |
| 754 | const uint64_t key = (_key & ~SORT_KEY_VIEW_MASK) | view; |
| 755 | return key; |
| 756 | } |
| 757 | |
| 741 | 758 | void reset() |
| 742 | 759 | { |
| 743 | 760 | m_depth = 0; |
| r244644 | r244645 | |
| 1353 | 1370 | |
| 1354 | 1371 | void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) |
| 1355 | 1372 | { |
| 1356 | | BX_CHECK(_handle.idx < BGFX_CONFIG_MAX_VERTEX_BUFFERS, "Invalid vertex buffer handle. %d (< %d)", _handle.idx, BGFX_CONFIG_MAX_VERTEX_BUFFERS); |
| 1357 | 1373 | m_draw.m_startVertex = _startVertex; |
| 1358 | 1374 | m_draw.m_numVertices = _numVertices; |
| 1359 | 1375 | m_draw.m_vertexBuffer = _handle; |
| r244644 | r244645 | |
| 1394 | 1410 | |
| 1395 | 1411 | void setProgram(ProgramHandle _handle) |
| 1396 | 1412 | { |
| 1397 | | BX_CHECK(isValid(_handle), "Can't set program with invalid handle."); |
| 1398 | 1413 | m_key.m_program = _handle.idx; |
| 1399 | 1414 | } |
| 1400 | 1415 | |
| r244644 | r244645 | |
| 1432 | 1447 | bind.m_un.m_compute.m_mip = 0; |
| 1433 | 1448 | } |
| 1434 | 1449 | |
| 1435 | | void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access) |
| 1450 | void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) |
| 1436 | 1451 | { |
| 1437 | 1452 | Binding& bind = m_compute.m_bind[_stage]; |
| 1438 | 1453 | bind.m_idx = _handle.idx; |
| r244644 | r244645 | |
| 1564 | 1579 | |
| 1565 | 1580 | SortKey m_key; |
| 1566 | 1581 | |
| 1582 | uint8_t m_viewRemap[BGFX_CONFIG_MAX_VIEWS]; |
| 1567 | 1583 | FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS]; |
| 1568 | 1584 | Clear m_clear[BGFX_CONFIG_MAX_VIEWS]; |
| 1569 | 1585 | float m_clearColor[BGFX_CONFIG_MAX_CLEAR_COLOR_PALETTE][4]; |
| r244644 | r244645 | |
| 1720 | 1736 | m_free.push_back(Free(_ptr, _size) ); |
| 1721 | 1737 | } |
| 1722 | 1738 | |
| 1739 | uint64_t remove() |
| 1740 | { |
| 1741 | BX_CHECK(0 == m_used.size(), ""); |
| 1742 | |
| 1743 | if (0 < m_free.size() ) |
| 1744 | { |
| 1745 | Free free = m_free.front(); |
| 1746 | m_free.pop_front(); |
| 1747 | return free.m_ptr; |
| 1748 | } |
| 1749 | |
| 1750 | return 0; |
| 1751 | } |
| 1752 | |
| 1723 | 1753 | uint64_t alloc(uint32_t _size) |
| 1724 | 1754 | { |
| 1725 | 1755 | for (FreeList::iterator it = m_free.begin(), itEnd = m_free.end(); it != itEnd; ++it) |
| r244644 | r244645 | |
| 1758 | 1788 | } |
| 1759 | 1789 | } |
| 1760 | 1790 | |
| 1761 | | void compact() |
| 1791 | bool compact() |
| 1762 | 1792 | { |
| 1763 | 1793 | m_free.sort(); |
| 1764 | 1794 | |
| r244644 | r244645 | |
| 1775 | 1805 | ++next; |
| 1776 | 1806 | } |
| 1777 | 1807 | } |
| 1808 | |
| 1809 | return 0 == m_used.size(); |
| 1778 | 1810 | } |
| 1779 | 1811 | |
| 1780 | 1812 | private: |
| r244644 | r244645 | |
| 2147 | 2179 | else |
| 2148 | 2180 | { |
| 2149 | 2181 | m_dynIndexBufferAllocator.free(uint64_t(dib.m_handle.idx)<<32 | dib.m_offset); |
| 2150 | | m_dynIndexBufferAllocator.compact(); |
| 2182 | if (m_dynIndexBufferAllocator.compact() ) |
| 2183 | { |
| 2184 | for (uint64_t ptr = m_dynIndexBufferAllocator.remove(); 0 != ptr; ptr = m_dynIndexBufferAllocator.remove() ) |
| 2185 | { |
| 2186 | IndexBufferHandle handle = { uint16_t(ptr>>32) }; |
| 2187 | destroyIndexBuffer(handle); |
| 2188 | } |
| 2189 | } |
| 2151 | 2190 | } |
| 2152 | 2191 | |
| 2153 | 2192 | m_dynamicIndexBufferHandle.free(_handle.idx); |
| r244644 | r244645 | |
| 2292 | 2331 | else |
| 2293 | 2332 | { |
| 2294 | 2333 | m_dynVertexBufferAllocator.free(uint64_t(dvb.m_handle.idx)<<32 | dvb.m_offset); |
| 2295 | | m_dynVertexBufferAllocator.compact(); |
| 2334 | if (m_dynVertexBufferAllocator.compact() ) |
| 2335 | { |
| 2336 | for (uint64_t ptr = m_dynVertexBufferAllocator.remove(); 0 != ptr; ptr = m_dynVertexBufferAllocator.remove() ) |
| 2337 | { |
| 2338 | VertexBufferHandle handle = { uint16_t(ptr>>32) }; |
| 2339 | destroyVertexBuffer(handle); |
| 2340 | } |
| 2341 | } |
| 2296 | 2342 | } |
| 2297 | 2343 | |
| 2298 | 2344 | m_dynamicVertexBufferHandle.free(_handle.idx); |
| r244644 | r244645 | |
| 2672 | 2718 | |
| 2673 | 2719 | BGFX_API_FUNC(TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info) ) |
| 2674 | 2720 | { |
| 2675 | | if (NULL != _info) |
| 2721 | TextureInfo ti; |
| 2722 | if (NULL == _info) |
| 2676 | 2723 | { |
| 2677 | | ImageContainer imageContainer; |
| 2678 | | if (imageParse(imageContainer, _mem->data, _mem->size) ) |
| 2679 | | { |
| 2680 | | calcTextureSize(*_info |
| 2681 | | , (uint16_t)imageContainer.m_width |
| 2682 | | , (uint16_t)imageContainer.m_height |
| 2683 | | , (uint16_t)imageContainer.m_depth |
| 2684 | | , imageContainer.m_cubeMap |
| 2685 | | , imageContainer.m_numMips |
| 2686 | | , TextureFormat::Enum(imageContainer.m_format) |
| 2687 | | ); |
| 2688 | | } |
| 2689 | | else |
| 2690 | | { |
| 2691 | | _info->format = TextureFormat::Unknown; |
| 2692 | | _info->storageSize = 0; |
| 2693 | | _info->width = 0; |
| 2694 | | _info->height = 0; |
| 2695 | | _info->depth = 0; |
| 2696 | | _info->numMips = 0; |
| 2697 | | _info->bitsPerPixel = 0; |
| 2698 | | _info->cubeMap = false; |
| 2699 | | } |
| 2724 | _info = &ti; |
| 2700 | 2725 | } |
| 2701 | 2726 | |
| 2727 | ImageContainer imageContainer; |
| 2728 | if (imageParse(imageContainer, _mem->data, _mem->size) ) |
| 2729 | { |
| 2730 | calcTextureSize(*_info |
| 2731 | , (uint16_t)imageContainer.m_width |
| 2732 | , (uint16_t)imageContainer.m_height |
| 2733 | , (uint16_t)imageContainer.m_depth |
| 2734 | , imageContainer.m_cubeMap |
| 2735 | , imageContainer.m_numMips |
| 2736 | , TextureFormat::Enum(imageContainer.m_format) |
| 2737 | ); |
| 2738 | } |
| 2739 | else |
| 2740 | { |
| 2741 | _info->format = TextureFormat::Unknown; |
| 2742 | _info->storageSize = 0; |
| 2743 | _info->width = 0; |
| 2744 | _info->height = 0; |
| 2745 | _info->depth = 0; |
| 2746 | _info->numMips = 0; |
| 2747 | _info->bitsPerPixel = 0; |
| 2748 | _info->cubeMap = false; |
| 2749 | } |
| 2750 | |
| 2702 | 2751 | TextureHandle handle = { m_textureHandle.alloc() }; |
| 2703 | 2752 | BX_WARN(isValid(handle), "Failed to allocate texture handle."); |
| 2704 | 2753 | if (isValid(handle) ) |
| 2705 | 2754 | { |
| 2706 | 2755 | TextureRef& ref = m_textureRef[handle.idx]; |
| 2707 | 2756 | ref.m_refCount = 1; |
| 2757 | ref.m_format = uint8_t(_info->format); |
| 2708 | 2758 | |
| 2709 | 2759 | CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateTexture); |
| 2710 | 2760 | cmdbuf.write(handle); |
| r244644 | r244645 | |
| 3038 | 3088 | } |
| 3039 | 3089 | } |
| 3040 | 3090 | |
| 3091 | BGFX_API_FUNC(void setViewRemap(uint8_t _id, uint8_t _num, const void* _remap) ) |
| 3092 | { |
| 3093 | const uint32_t num = bx::uint32_min( (BGFX_CONFIG_MAX_VIEWS - _id) + _num, BGFX_CONFIG_MAX_VIEWS) - _id; |
| 3094 | if (NULL == _remap) |
| 3095 | { |
| 3096 | for (uint32_t ii = 0; ii < num; ++ii) |
| 3097 | { |
| 3098 | uint8_t id = uint8_t(ii+_id); |
| 3099 | m_viewRemap[id] = id; |
| 3100 | } |
| 3101 | } |
| 3102 | else |
| 3103 | { |
| 3104 | memcpy(&m_viewRemap[_id], _remap, num); |
| 3105 | } |
| 3106 | } |
| 3107 | |
| 3041 | 3108 | BGFX_API_FUNC(void setMarker(const char* _marker) ) |
| 3042 | 3109 | { |
| 3043 | 3110 | m_submit->setMarker(_marker); |
| r244644 | r244645 | |
| 3190 | 3257 | m_submit->setBuffer(_stage, dvb.m_handle, _access); |
| 3191 | 3258 | } |
| 3192 | 3259 | |
| 3193 | | BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access) ) |
| 3260 | BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) ) |
| 3194 | 3261 | { |
| 3195 | | m_submit->setImage(_stage, _sampler, _handle, _mip, _format, _access); |
| 3262 | _format = TextureFormat::Count == _format ? TextureFormat::Enum(m_textureRef[_handle.idx].m_format) : _format; |
| 3263 | m_submit->setImage(_stage, _sampler, _handle, _mip, _access, _format); |
| 3196 | 3264 | } |
| 3197 | 3265 | |
| 3198 | | BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access) ) |
| 3266 | BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, Access::Enum _access, TextureFormat::Enum _format) ) |
| 3199 | 3267 | { |
| 3200 | 3268 | BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment); |
| 3201 | 3269 | TextureHandle textureHandle = BGFX_INVALID_HANDLE; |
| r244644 | r244645 | |
| 3207 | 3275 | BX_CHECK(isValid(textureHandle), "Frame buffer texture %d is invalid.", _attachment); |
| 3208 | 3276 | } |
| 3209 | 3277 | |
| 3210 | | setImage(_stage, _sampler, textureHandle, 0, _format, _access); |
| 3278 | setImage(_stage, _sampler, textureHandle, 0, _access, _format); |
| 3211 | 3279 | } |
| 3212 | 3280 | |
| 3213 | 3281 | BGFX_API_FUNC(uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ, uint8_t _flags) ) |
| r244644 | r244645 | |
| 3337 | 3405 | struct TextureRef |
| 3338 | 3406 | { |
| 3339 | 3407 | int16_t m_refCount; |
| 3408 | uint8_t m_format; |
| 3340 | 3409 | }; |
| 3341 | 3410 | |
| 3342 | 3411 | struct FrameBufferRef |
| r244644 | r244645 | |
| 3358 | 3427 | FrameBufferRef m_frameBufferRef[BGFX_CONFIG_MAX_FRAME_BUFFERS]; |
| 3359 | 3428 | VertexDeclRef m_declRef; |
| 3360 | 3429 | |
| 3430 | uint8_t m_viewRemap[BGFX_CONFIG_MAX_VIEWS]; |
| 3361 | 3431 | FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS]; |
| 3362 | 3432 | Clear m_clear[BGFX_CONFIG_MAX_VIEWS]; |
| 3363 | 3433 | |
trunk/3rdparty/bx/scripts/toolchain.lua
| r244644 | r244645 | |
| 3 | 3 | -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause |
| 4 | 4 | -- |
| 5 | 5 | |
| 6 | | local bxDir = (path.getabsolute("..") .. "/") |
| 6 | local bxDir = path.getabsolute("..") |
| 7 | 7 | local naclToolchain = "" |
| 8 | 8 | |
| 9 | 9 | function toolchain(_buildDir, _libDir) |
| r244644 | r244645 | |
| 71 | 71 | -- Avoid error when invoking genie --help. |
| 72 | 72 | if (_ACTION == nil) then return false end |
| 73 | 73 | |
| 74 | | location (_buildDir .. "projects/" .. _ACTION) |
| 74 | location (path.join(_buildDir, "projects", _ACTION)) |
| 75 | 75 | |
| 76 | 76 | if _ACTION == "clean" then |
| 77 | 77 | os.rmdir(BUILD_DIR) |
| r244644 | r244645 | |
| 107 | 107 | premake.gcc.cc = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc" |
| 108 | 108 | premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++" |
| 109 | 109 | premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar" |
| 110 | | location (_buildDir .. "projects/" .. _ACTION .. "-android-arm") |
| 110 | location (path.join(_buildDir, "projects", _ACTION .. "-android-arm")) |
| 111 | 111 | end |
| 112 | 112 | |
| 113 | 113 | if "android-mips" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 119 | 119 | premake.gcc.cc = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-gcc" |
| 120 | 120 | premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++" |
| 121 | 121 | premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar" |
| 122 | | location (_buildDir .. "projects/" .. _ACTION .. "-android-mips") |
| 122 | location (path.join(_buildDir, "projects", _ACTION .. "-android-mips")) |
| 123 | 123 | end |
| 124 | 124 | |
| 125 | 125 | if "android-x86" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 131 | 131 | premake.gcc.cc = "$(ANDROID_NDK_X86)/bin/i686-linux-android-gcc" |
| 132 | 132 | premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++" |
| 133 | 133 | premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar" |
| 134 | | location (_buildDir .. "projects/" .. _ACTION .. "-android-x86") |
| 134 | location (path.join(_buildDir, "projects", _ACTION .. "-android-x86")) |
| 135 | 135 | end |
| 136 | 136 | |
| 137 | 137 | if "asmjs" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 144 | 144 | premake.gcc.cxx = "$(EMSCRIPTEN)/em++" |
| 145 | 145 | premake.gcc.ar = "$(EMSCRIPTEN)/emar" |
| 146 | 146 | premake.gcc.llvm = true |
| 147 | | location (_buildDir .. "projects/" .. _ACTION .. "-asmjs") |
| 147 | location (path.join(_buildDir, "projects", _ACTION .. "-asmjs")) |
| 148 | 148 | end |
| 149 | 149 | |
| 150 | 150 | if "freebsd" == _OPTIONS["gcc"] then |
| 151 | | location (_buildDir .. "projects/" .. _ACTION .. "-freebsd") |
| 151 | location (path.join(_buildDir, "projects", _ACTION .. "-freebsd")) |
| 152 | 152 | end |
| 153 | 153 | |
| 154 | 154 | if "ios-arm" == _OPTIONS["gcc"] then |
| 155 | 155 | premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" |
| 156 | 156 | premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" |
| 157 | 157 | premake.gcc.ar = "ar" |
| 158 | | location (_buildDir .. "projects/" .. _ACTION .. "-ios-arm") |
| 158 | location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm")) |
| 159 | 159 | end |
| 160 | 160 | |
| 161 | 161 | if "ios-simulator" == _OPTIONS["gcc"] then |
| 162 | 162 | premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" |
| 163 | 163 | premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" |
| 164 | 164 | premake.gcc.ar = "ar" |
| 165 | | location (_buildDir .. "projects/" .. _ACTION .. "-ios-simulator") |
| 165 | location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator")) |
| 166 | 166 | end |
| 167 | 167 | |
| 168 | 168 | if "linux-gcc" == _OPTIONS["gcc"] then |
| 169 | | location (_buildDir .. "projects/" .. _ACTION .. "-linux") |
| 169 | location (path.join(_buildDir, "projects", _ACTION .. "-linux")) |
| 170 | 170 | end |
| 171 | 171 | |
| 172 | 172 | if "linux-clang" == _OPTIONS["gcc"] then |
| 173 | 173 | premake.gcc.cc = "clang" |
| 174 | 174 | premake.gcc.cxx = "clang++" |
| 175 | 175 | premake.gcc.ar = "ar" |
| 176 | | location (_buildDir .. "projects/" .. _ACTION .. "-linux-clang") |
| 176 | location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang")) |
| 177 | 177 | end |
| 178 | 178 | |
| 179 | 179 | if "mingw-gcc" == _OPTIONS["gcc"] then |
| 180 | 180 | premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc" |
| 181 | 181 | premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++" |
| 182 | 182 | premake.gcc.ar = "$(MINGW)/bin/ar" |
| 183 | | location (_buildDir .. "projects/" .. _ACTION .. "-mingw-gcc") |
| 183 | location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc")) |
| 184 | 184 | end |
| 185 | 185 | |
| 186 | 186 | if "mingw-clang" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 189 | 189 | premake.gcc.ar = "$(MINGW)/bin/ar" |
| 190 | 190 | -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar" |
| 191 | 191 | -- premake.gcc.llvm = true |
| 192 | | location (_buildDir .. "projects/" .. _ACTION .. "-mingw-clang") |
| 192 | location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang")) |
| 193 | 193 | end |
| 194 | 194 | |
| 195 | 195 | if "nacl" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 208 | 208 | premake.gcc.cc = naclToolchain .. "gcc" |
| 209 | 209 | premake.gcc.cxx = naclToolchain .. "g++" |
| 210 | 210 | premake.gcc.ar = naclToolchain .. "ar" |
| 211 | | location (_buildDir .. "projects/" .. _ACTION .. "-nacl") |
| 211 | location (path.join(_buildDir, "projects", _ACTION .. "-nacl")) |
| 212 | 212 | end |
| 213 | 213 | |
| 214 | 214 | if "nacl-arm" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 227 | 227 | premake.gcc.cc = naclToolchain .. "gcc" |
| 228 | 228 | premake.gcc.cxx = naclToolchain .. "g++" |
| 229 | 229 | premake.gcc.ar = naclToolchain .. "ar" |
| 230 | | location (_buildDir .. "projects/" .. _ACTION .. "-nacl-arm") |
| 230 | location (path.join(_buildDir, "projects", _ACTION .. "-nacl-arm")) |
| 231 | 231 | end |
| 232 | 232 | |
| 233 | 233 | if "osx" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 237 | 237 | premake.gcc.cxx = osxToolchain .. "clang++" |
| 238 | 238 | premake.gcc.ar = osxToolchain .. "ar" |
| 239 | 239 | end |
| 240 | | location (_buildDir .. "projects/" .. _ACTION .. "-osx") |
| 240 | location (path.join(_buildDir, "projects", _ACTION .. "-osx")) |
| 241 | 241 | end |
| 242 | 242 | |
| 243 | 243 | if "pnacl" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 256 | 256 | premake.gcc.cc = naclToolchain .. "clang" |
| 257 | 257 | premake.gcc.cxx = naclToolchain .. "clang++" |
| 258 | 258 | premake.gcc.ar = naclToolchain .. "ar" |
| 259 | | location (_buildDir .. "projects/" .. _ACTION .. "-pnacl") |
| 259 | location (path.join(_buildDir, "projects", _ACTION .. "-pnacl")) |
| 260 | 260 | end |
| 261 | 261 | |
| 262 | 262 | if "qnx-arm" == _OPTIONS["gcc"] then |
| r244644 | r244645 | |
| 268 | 268 | premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc" |
| 269 | 269 | premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++" |
| 270 | 270 | premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar" |
| 271 | | location (_buildDir .. "projects/" .. _ACTION .. "-qnx-arm") |
| 271 | location (path.join(_buildDir, "projects", _ACTION .. "-qnx-arm")) |
| 272 | 272 | end |
| 273 | 273 | |
| 274 | 274 | if "rpi" == _OPTIONS["gcc"] then |
| 275 | | location (_buildDir .. "projects/" .. _ACTION .. "-rpi") |
| 275 | location (path.join(_buildDir, "projects", _ACTION .. "-rpi")) |
| 276 | 276 | end |
| 277 | 277 | elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then |
| 278 | 278 | |
| 279 | 279 | if (_ACTION .. "-clang") == _OPTIONS["vs"] then |
| 280 | 280 | premake.vstudio.toolset = ("LLVM-" .. _ACTION) |
| 281 | | location (_buildDir .. "projects/" .. _ACTION .. "-clang") |
| 281 | location (path.join(_buildDir, "projects", _ACTION .. "-clang")) |
| 282 | 282 | end |
| 283 | 283 | |
| 284 | 284 | if "winphone8" == _OPTIONS["vs"] then |
| 285 | 285 | premake.vstudio.toolset = "v110_wp80" |
| 286 | | location (_buildDir .. "projects/" .. _ACTION .. "-winphone8") |
| 286 | location (path.join(_buildDir, "projects", _ACTION .. "-winphone8")) |
| 287 | 287 | end |
| 288 | 288 | |
| 289 | 289 | if "winphone81" == _OPTIONS["vs"] then |
| 290 | 290 | premake.vstudio.toolset = "v120_wp81" |
| 291 | 291 | platforms { "ARM" } |
| 292 | | location (_buildDir .. "projects/" .. _ACTION .. "-winphone81") |
| 292 | location (path.join(_buildDir, "projects", _ACTION .. "-winphone81")) |
| 293 | 293 | end |
| 294 | 294 | elseif _ACTION == "xcode4" then |
| 295 | 295 | |
| 296 | 296 | if "osx" == _OPTIONS["xcode"] then |
| 297 | 297 | premake.xcode.toolset = "macosx" |
| 298 | | location (_buildDir .. "projects/" .. _ACTION .. "-osx") |
| 298 | location (path.join(_buildDir, "projects", _ACTION .. "-osx")) |
| 299 | 299 | end |
| 300 | 300 | if "ios" == _OPTIONS["xcode"] then |
| 301 | 301 | premake.xcode.toolset = "iphoneos" |
| 302 | | location (_buildDir .. "projects/" .. _ACTION .. "-ios") |
| 302 | location (path.join(_buildDir, "projects", _ACTION .. "-ios")) |
| 303 | 303 | end |
| 304 | 304 | end |
| 305 | 305 | |
| r244644 | r244645 | |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | configuration { "vs*" } |
| 337 | | includedirs { bxDir .. "include/compat/msvc" } |
| 337 | includedirs { path.join(bxDir, "include/compat/msvc") } |
| 338 | 338 | defines { |
| 339 | 339 | "WIN32", |
| 340 | 340 | "_WIN32", |
| r244644 | r244645 | |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | configuration { "vs2008" } |
| 358 | | includedirs { bxDir .. "include/compat/msvc/pre1600" } |
| 358 | includedirs { path.join(bxDir .. "include/compat/msvc/pre1600") } |
| 359 | 359 | |
| 360 | 360 | configuration { "x32", "vs*" } |
| 361 | | targetdir (_buildDir .. "win32_" .. _ACTION .. "/bin") |
| 362 | | objdir (_buildDir .. "win32_" .. _ACTION .. "/obj") |
| 361 | targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin")) |
| 362 | objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj")) |
| 363 | 363 | libdirs { |
| 364 | | _libDir .. "lib/win32_" .. _ACTION, |
| 364 | path.join(_libDir, "lib/win32_" .. _ACTION), |
| 365 | 365 | "$(DXSDK_DIR)/lib/x86", |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | configuration { "x64", "vs*" } |
| 369 | 369 | defines { "_WIN64" } |
| 370 | | targetdir (_buildDir .. "win64_" .. _ACTION .. "/bin") |
| 371 | | objdir (_buildDir .. "win64_" .. _ACTION .. "/obj") |
| 370 | targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin")) |
| 371 | objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj")) |
| 372 | 372 | libdirs { |
| 373 | | _libDir .. "lib/win64_" .. _ACTION, |
| 373 | path.join(_libDir, "lib/win64_" .. _ACTION), |
| 374 | 374 | "$(DXSDK_DIR)/lib/x64", |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | configuration { "ARM", "vs*" } |
| 378 | | targetdir (_buildDir .. "arm_" .. _ACTION .. "/bin") |
| 379 | | objdir (_buildDir .. "arm_" .. _ACTION .. "/obj") |
| 378 | targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin")) |
| 379 | objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj")) |
| 380 | 380 | |
| 381 | 381 | configuration { "vs*-clang" } |
| 382 | 382 | buildoptions { |
| r244644 | r244645 | |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | configuration { "x32", "vs*-clang" } |
| 387 | | targetdir (_buildDir .. "win32_" .. _ACTION .. "-clang/bin") |
| 388 | | objdir (_buildDir .. "win32_" .. _ACTION .. "-clang/obj") |
| 387 | targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin")) |
| 388 | objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj")) |
| 389 | 389 | |
| 390 | 390 | configuration { "x64", "vs*-clang" } |
| 391 | | targetdir (_buildDir .. "win64_" .. _ACTION .. "-clang/bin") |
| 392 | | objdir (_buildDir .. "win64_" .. _ACTION .. "-clang/obj") |
| 391 | targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin")) |
| 392 | objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj")) |
| 393 | 393 | |
| 394 | 394 | configuration { "winphone8*" } |
| 395 | 395 | removeflags { |
| r244644 | r244645 | |
| 399 | 399 | |
| 400 | 400 | configuration { "mingw-*" } |
| 401 | 401 | defines { "WIN32" } |
| 402 | | includedirs { bxDir .. "include/compat/mingw" } |
| 402 | includedirs { path.join(bxDir, "include/compat/mingw") } |
| 403 | 403 | buildoptions { |
| 404 | 404 | "-std=c++11", |
| 405 | 405 | "-Wunused-value", |
| r244644 | r244645 | |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | configuration { "x32", "mingw-gcc" } |
| 419 | | targetdir (_buildDir .. "win32_mingw-gcc" .. "/bin") |
| 420 | | objdir (_buildDir .. "win32_mingw-gcc" .. "/obj") |
| 419 | targetdir (path.join(_buildDir, "win32_mingw-gcc/bin")) |
| 420 | objdir (path.join(_buildDir, "win32_mingw-gcc/obj")) |
| 421 | 421 | libdirs { |
| 422 | | _libDir .. "lib/win32_mingw-gcc", |
| 422 | path.join(_libDir, "lib/win32_mingw-gcc"), |
| 423 | 423 | "$(DXSDK_DIR)/lib/x86", |
| 424 | 424 | } |
| 425 | 425 | buildoptions { "-m32" } |
| 426 | 426 | |
| 427 | 427 | configuration { "x64", "mingw-gcc" } |
| 428 | | targetdir (_buildDir .. "win64_mingw-gcc" .. "/bin") |
| 429 | | objdir (_buildDir .. "win64_mingw-gcc" .. "/obj") |
| 428 | targetdir (path.join(_buildDir, "win64_mingw-gcc/bin")) |
| 429 | objdir (path.join(_buildDir, "win64_mingw-gcc/obj")) |
| 430 | 430 | libdirs { |
| 431 | | _libDir .. "lib/win64_mingw-gcc", |
| 431 | path.join(_libDir, "lib/win64_mingw-gcc"), |
| 432 | 432 | "$(DXSDK_DIR)/lib/x64", |
| 433 | 433 | "$(GLES_X64_DIR)", |
| 434 | 434 | } |
| r244644 | r244645 | |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | configuration { "x32", "mingw-clang" } |
| 449 | | targetdir (_buildDir .. "win32_mingw-clang" .. "/bin") |
| 450 | | objdir (_buildDir .. "win32_mingw-clang" .. "/obj") |
| 449 | targetdir (path.join(_buildDir, "win32_mingw-clang/bin")) |
| 450 | objdir (path.join(_buildDir, "win32_mingw-clang/obj")) |
| 451 | 451 | libdirs { |
| 452 | | _libDir .. "lib/win32_mingw-clang", |
| 452 | path.join(_libDir, "lib/win32_mingw-clang"), |
| 453 | 453 | "$(DXSDK_DIR)/lib/x86", |
| 454 | 454 | } |
| 455 | 455 | buildoptions { "-m32" } |
| 456 | 456 | |
| 457 | 457 | configuration { "x64", "mingw-clang" } |
| 458 | | targetdir (_buildDir .. "win64_mingw-clang" .. "/bin") |
| 459 | | objdir (_buildDir .. "win64_mingw-clang" .. "/obj") |
| 458 | targetdir (path.join(_buildDir, "win64_mingw-clang/bin")) |
| 459 | objdir (path.join(_buildDir, "win64_mingw-clang/obj")) |
| 460 | 460 | libdirs { |
| 461 | | _libDir .. "lib/win64_mingw-clang", |
| 461 | path.join(_libDir, "lib/win64_mingw-clang"), |
| 462 | 462 | "$(DXSDK_DIR)/lib/x64", |
| 463 | 463 | "$(GLES_X64_DIR)", |
| 464 | 464 | } |
| r244644 | r244645 | |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | configuration { "linux-gcc", "x32" } |
| 490 | | targetdir (_buildDir .. "linux32_gcc" .. "/bin") |
| 491 | | objdir (_buildDir .. "linux32_gcc" .. "/obj") |
| 492 | | libdirs { _libDir .. "lib/linux32_gcc" } |
| 490 | targetdir (path.join(_buildDir, "linux32_gcc/bin")) |
| 491 | objdir (path.join(_buildDir, "linux32_gcc/obj")) |
| 492 | libdirs { path.join(_libDir, "lib/linux32_gcc") } |
| 493 | 493 | buildoptions { |
| 494 | 494 | "-m32", |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | configuration { "linux-gcc", "x64" } |
| 498 | | targetdir (_buildDir .. "linux64_gcc" .. "/bin") |
| 499 | | objdir (_buildDir .. "linux64_gcc" .. "/obj") |
| 500 | | libdirs { _libDir .. "lib/linux64_gcc" } |
| 498 | targetdir (path.join(_buildDir, "linux64_gcc/bin")) |
| 499 | objdir (path.join(_buildDir, "linux64_gcc/obj")) |
| 500 | libdirs { path.join(_libDir, "lib/linux64_gcc") } |
| 501 | 501 | buildoptions { |
| 502 | 502 | "-m64", |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | configuration { "linux-clang", "x32" } |
| 506 | | targetdir (_buildDir .. "linux32_clang" .. "/bin") |
| 507 | | objdir (_buildDir .. "linux32_clang" .. "/obj") |
| 508 | | libdirs { _libDir .. "lib/linux32_clang" } |
| 506 | targetdir (path.join(_buildDir, "linux32_clang/bin")) |
| 507 | objdir (path.join(_buildDir, "linux32_clang/obj")) |
| 508 | libdirs { path.join(_libDir, "lib/linux32_clang") } |
| 509 | 509 | buildoptions { |
| 510 | 510 | "-m32", |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | configuration { "linux-clang", "x64" } |
| 514 | | targetdir (_buildDir .. "linux64_clang" .. "/bin") |
| 515 | | objdir (_buildDir .. "linux64_clang" .. "/obj") |
| 516 | | libdirs { _libDir .. "lib/linux64_clang" } |
| 514 | targetdir (path.join(_buildDir, "linux64_clang/bin")) |
| 515 | objdir (path.join(_buildDir, "linux64_clang/obj")) |
| 516 | libdirs { path.join(_libDir, "lib/linux64_clang") } |
| 517 | 517 | buildoptions { |
| 518 | 518 | "-m64", |
| 519 | 519 | } |
| r244644 | r244645 | |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | configuration { "android-arm" } |
| 562 | | targetdir (_buildDir .. "android-arm" .. "/bin") |
| 563 | | objdir (_buildDir .. "android-arm" .. "/obj") |
| 562 | targetdir (path.join(_buildDir, "android-arm/bin")) |
| 563 | objdir (path.join(_buildDir, "android-arm/obj")) |
| 564 | 564 | libdirs { |
| 565 | | _libDir .. "lib/android-arm", |
| 565 | path.join(_libDir, "lib/android-arm"), |
| 566 | 566 | "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a", |
| 567 | 567 | } |
| 568 | 568 | includedirs { |
| 569 | 569 | "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include", |
| 570 | 570 | } |
| 571 | 571 | buildoptions { |
| 572 | | "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm", |
| 572 | "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"), |
| 573 | 573 | "-mthumb", |
| 574 | 574 | "-march=armv7-a", |
| 575 | 575 | "-mfloat-abi=softfp", |
| r244644 | r244645 | |
| 578 | 578 | "-Wundef", |
| 579 | 579 | } |
| 580 | 580 | linkoptions { |
| 581 | | "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm", |
| 582 | | "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib/crtbegin_so.o", |
| 583 | | "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib/crtend_so.o", |
| 581 | "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"), |
| 582 | path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"), |
| 583 | path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"), |
| 584 | 584 | "-march=armv7-a", |
| 585 | 585 | "-Wl,--fix-cortex-a8", |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | configuration { "android-mips" } |
| 589 | | targetdir (_buildDir .. "android-mips" .. "/bin") |
| 590 | | objdir (_buildDir .. "android-mips" .. "/obj") |
| 589 | targetdir (path.join(_buildDir, "android-mips/bin")) |
| 590 | objdir (path.join(_buildDir, "android-mips/obj")) |
| 591 | 591 | libdirs { |
| 592 | | _libDir .. "lib/android-mips", |
| 592 | path.join(_libDir, "lib/android-mips"), |
| 593 | 593 | "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips", |
| 594 | 594 | } |
| 595 | 595 | includedirs { |
| 596 | 596 | "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include", |
| 597 | 597 | } |
| 598 | 598 | buildoptions { |
| 599 | | "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips", |
| 599 | "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"), |
| 600 | 600 | "-Wunused-value", |
| 601 | 601 | "-Wundef", |
| 602 | 602 | } |
| 603 | 603 | linkoptions { |
| 604 | | "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips", |
| 605 | | "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtbegin_so.o", |
| 606 | | "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtend_so.o", |
| 604 | "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"), |
| 605 | path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"), |
| 606 | path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"), |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | configuration { "android-x86" } |
| 610 | | targetdir (_buildDir .. "android-x86" .. "/bin") |
| 611 | | objdir (_buildDir .. "android-x86" .. "/obj") |
| 610 | targetdir (path.join(_buildDir, "android-x86/bin")) |
| 611 | objdir (path.join(_buildDir, "android-x86/obj")) |
| 612 | 612 | libdirs { |
| 613 | | _libDir .. "lib/android-x86", |
| 613 | path.join(_libDir, "lib/android-x86"), |
| 614 | 614 | "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86", |
| 615 | 615 | } |
| 616 | 616 | includedirs { |
| 617 | 617 | "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include", |
| 618 | 618 | } |
| 619 | 619 | buildoptions { |
| 620 | | "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86", |
| 620 | "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"), |
| 621 | 621 | "-march=i686", |
| 622 | 622 | "-mtune=atom", |
| 623 | 623 | "-mstackrealign", |
| r244644 | r244645 | |
| 627 | 627 | "-Wundef", |
| 628 | 628 | } |
| 629 | 629 | linkoptions { |
| 630 | | "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86", |
| 631 | | "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtbegin_so.o", |
| 632 | | "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtend_so.o", |
| 630 | "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"), |
| 631 | path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"), |
| 632 | path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "/arch-x86/usr/lib/crtend_so.o"), |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | configuration { "asmjs" } |
| 636 | | targetdir (_buildDir .. "asmjs" .. "/bin") |
| 637 | | objdir (_buildDir .. "asmjs" .. "/obj") |
| 638 | | libdirs { _libDir .. "lib/asmjs" } |
| 636 | targetdir (path.join(_buildDir, "asmjs/bin")) |
| 637 | objdir (path.join(_buildDir, "asmjs/obj")) |
| 638 | libdirs { path.join(_libDir, "lib/asmjs") } |
| 639 | 639 | buildoptions { |
| 640 | 640 | "-isystem$(EMSCRIPTEN)/system/include", |
| 641 | 641 | "-isystem$(EMSCRIPTEN)/system/include/libc", |
| r244644 | r244645 | |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | configuration { "freebsd" } |
| 647 | | targetdir (_buildDir .. "freebsd" .. "/bin") |
| 648 | | objdir (_buildDir .. "freebsd" .. "/obj") |
| 649 | | libdirs { _libDir .. "lib/freebsd" } |
| 647 | targetdir (path.join(_buildDir, "freebsd/bin")) |
| 648 | objdir (path.join(_buildDir, "freebsd/obj")) |
| 649 | libdirs { path.join(_libDir, "lib/freebsd") } |
| 650 | 650 | includedirs { |
| 651 | | bxDir .. "include/compat/freebsd", |
| 651 | path.join(bxDir, "include/compat/freebsd"), |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | configuration { "nacl or nacl-arm or pnacl" } |
| r244644 | r244645 | |
| 664 | 664 | } |
| 665 | 665 | includedirs { |
| 666 | 666 | "$(NACL_SDK_ROOT)/include", |
| 667 | | bxDir .. "include/compat/nacl", |
| 667 | path.join(bxDir, "include/compat/nacl"), |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | configuration { "nacl" } |
| r244644 | r244645 | |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | configuration { "x32", "nacl" } |
| 681 | | targetdir (_buildDir .. "nacl-x86" .. "/bin") |
| 682 | | objdir (_buildDir .. "nacl-x86" .. "/obj") |
| 683 | | libdirs { _libDir .. "lib/nacl-x86" } |
| 681 | targetdir (path.join(_buildDir, "nacl-x86/bin")) |
| 682 | objdir (path.join(_buildDir, "nacl-x86/obj")) |
| 683 | libdirs { path.join(_libDir, "lib/nacl-x86") } |
| 684 | 684 | linkoptions { "-melf32_nacl" } |
| 685 | 685 | |
| 686 | 686 | configuration { "x32", "nacl", "Debug" } |
| r244644 | r244645 | |
| 690 | 690 | libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" } |
| 691 | 691 | |
| 692 | 692 | configuration { "x64", "nacl" } |
| 693 | | targetdir (_buildDir .. "nacl-x64" .. "/bin") |
| 694 | | objdir (_buildDir .. "nacl-x64" .. "/obj") |
| 695 | | libdirs { _libDir .. "lib/nacl-x64" } |
| 693 | targetdir (path.join(_buildDir, "nacl-x64/bin")) |
| 694 | objdir (path.join(_buildDir, "nacl-x64/obj")) |
| 695 | libdirs { path.join(_libDir, "lib/nacl-x64") } |
| 696 | 696 | linkoptions { "-melf64_nacl" } |
| 697 | 697 | |
| 698 | 698 | configuration { "x64", "nacl", "Debug" } |
| r244644 | r244645 | |
| 705 | 705 | buildoptions { |
| 706 | 706 | "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0 |
| 707 | 707 | } |
| 708 | | targetdir (_buildDir .. "nacl-arm" .. "/bin") |
| 709 | | objdir (_buildDir .. "nacl-arm" .. "/obj") |
| 710 | | libdirs { _libDir .. "lib/nacl-arm" } |
| 708 | targetdir (path.join(_buildDir, "nacl-arm/bin")) |
| 709 | objdir (path.join(_buildDir, "nacl-arm/obj")) |
| 710 | libdirs { path.join(_libDir, "lib/nacl-arm") } |
| 711 | 711 | |
| 712 | 712 | configuration { "nacl-arm", "Debug" } |
| 713 | 713 | libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" } |
| r244644 | r244645 | |
| 716 | 716 | libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" } |
| 717 | 717 | |
| 718 | 718 | configuration { "pnacl" } |
| 719 | | targetdir (_buildDir .. "pnacl" .. "/bin") |
| 720 | | objdir (_buildDir .. "pnacl" .. "/obj") |
| 721 | | libdirs { _libDir .. "lib/pnacl" } |
| 719 | targetdir (path.join(_buildDir, "pnacl/bin")) |
| 720 | objdir (path.join(_buildDir, "pnacl/obj")) |
| 721 | libdirs { path.join(_libDir, "lib/pnacl") } |
| 722 | 722 | |
| 723 | 723 | configuration { "pnacl", "Debug" } |
| 724 | 724 | libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" } |
| r244644 | r244645 | |
| 727 | 727 | libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" } |
| 728 | 728 | |
| 729 | 729 | configuration { "Xbox360" } |
| 730 | | targetdir (_buildDir .. "xbox360" .. "/bin") |
| 731 | | objdir (_buildDir .. "xbox360" .. "/obj") |
| 732 | | includedirs { bxDir .. "include/compat/msvc" } |
| 733 | | libdirs { _libDir .. "lib/xbox360" } |
| 730 | targetdir (path.join(_buildDir, "xbox360/bin")) |
| 731 | objdir (path.join(_buildDir, "xbox360/obj")) |
| 732 | includedirs { path.join(bxDir, "include/compat/msvc") } |
| 733 | libdirs { path.join(_libDir, "lib/xbox360") } |
| 734 | 734 | defines { |
| 735 | 735 | "NOMINMAX", |
| 736 | 736 | "_XBOX", |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | configuration { "osx", "x32" } |
| 740 | | targetdir (_buildDir .. "osx32_clang" .. "/bin") |
| 741 | | objdir (_buildDir .. "osx32_clang" .. "/obj") |
| 742 | | libdirs { _libDir .. "lib/osx32_clang" } |
| 740 | targetdir (path.join(_buildDir, "osx32_clang/bin")) |
| 741 | objdir (path.join(_buildDir, "osx32_clang/obj")) |
| 742 | libdirs { path.join(_libDir, "lib/osx32_clang") } |
| 743 | 743 | buildoptions { |
| 744 | 744 | "-m32", |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | configuration { "osx", "x64" } |
| 748 | | targetdir (_buildDir .. "osx64_clang" .. "/bin") |
| 749 | | objdir (_buildDir .. "osx64_clang" .. "/obj") |
| 750 | | libdirs { _libDir .. "lib/osx64_clang" } |
| 748 | targetdir (path.join(_buildDir, "osx64_clang/bin")) |
| 749 | objdir (path.join(_buildDir, "osx64_clang/obj")) |
| 750 | libdirs { path.join(_libDir, "lib/osx64_clang") } |
| 751 | 751 | buildoptions { |
| 752 | 752 | "-m64", |
| 753 | 753 | } |
| r244644 | r244645 | |
| 759 | 759 | "-Wunused-value", |
| 760 | 760 | "-Wundef", |
| 761 | 761 | } |
| 762 | | includedirs { bxDir .. "include/compat/osx" } |
| 762 | includedirs { path.join(bxDir, "include/compat/osx") } |
| 763 | 763 | |
| 764 | 764 | configuration { "ios*" } |
| 765 | 765 | linkoptions { |
| r244644 | r244645 | |
| 770 | 770 | "-Wunused-value", |
| 771 | 771 | "-Wundef", |
| 772 | 772 | } |
| 773 | | includedirs { bxDir .. "include/compat/ios" } |
| 773 | includedirs { path.join(bxDir, "include/compat/ios") } |
| 774 | 774 | |
| 775 | 775 | configuration { "ios-arm" } |
| 776 | | targetdir (_buildDir .. "ios-arm" .. "/bin") |
| 777 | | objdir (_buildDir .. "ios-arm" .. "/obj") |
| 778 | | libdirs { _libDir .. "lib/ios-arm" } |
| 776 | targetdir (path.join(_buildDir, "ios-arm/bin")) |
| 777 | objdir (path.join(_buildDir, "ios-arm/obj")) |
| 778 | libdirs { path.join(_libDir, "lib/ios-arm") } |
| 779 | 779 | linkoptions { |
| 780 | 780 | "-miphoneos-version-min=7.0", |
| 781 | 781 | "-arch armv7", |
| r244644 | r244645 | |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | configuration { "ios-simulator" } |
| 794 | | targetdir (_buildDir .. "ios-simulator" .. "/bin") |
| 795 | | objdir (_buildDir .. "ios-simulator" .. "/obj") |
| 796 | | libdirs { _libDir .. "lib/ios-simulator" } |
| 794 | targetdir (path.join(_buildDir, "ios-simulator/bin")) |
| 795 | objdir (path.join(_buildDir, "ios-simulator/obj")) |
| 796 | libdirs { path.join(_libDir, "lib/ios-simulator") } |
| 797 | 797 | linkoptions { |
| 798 | 798 | "-mios-simulator-version-min=7.0", |
| 799 | 799 | "-arch i386", |
| r244644 | r244645 | |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | configuration { "qnx-arm" } |
| 812 | | targetdir (_buildDir .. "qnx-arm" .. "/bin") |
| 813 | | objdir (_buildDir .. "qnx-arm" .. "/obj") |
| 814 | | libdirs { _libDir .. "lib/qnx-arm" } |
| 815 | | -- includedirs { bxDir .. "include/compat/qnx" } |
| 812 | targetdir (path.join(_buildDir, "qnx-arm/bin")) |
| 813 | objdir (path.join(_buildDir, "qnx-arm/obj")) |
| 814 | libdirs { path.join(_libDir, "lib/qnx-arm") } |
| 815 | -- includedirs { path.join(bxDir, "include/compat/qnx") } |
| 816 | 816 | buildoptions { |
| 817 | 817 | "-std=c++0x", |
| 818 | 818 | "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0 |
| r244644 | r244645 | |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | configuration { "rpi" } |
| 824 | | targetdir (_buildDir .. "rpi" .. "/bin") |
| 825 | | objdir (_buildDir .. "rpi" .. "/obj") |
| 824 | targetdir (path.join(_buildDir, "rpi/bin")) |
| 825 | objdir (path.join(_buildDir, "rpi/obj")) |
| 826 | 826 | libdirs { |
| 827 | | _libDir .. "lib/rpi", |
| 827 | path.join(_libDir, "lib/rpi"), |
| 828 | 828 | "/opt/vc/lib", |
| 829 | 829 | } |
| 830 | 830 | defines { |
trunk/3rdparty/genie/src/host/scripts.c
| r244644 | r244645 | |
| 69 | 69 | "m)\ntbl[item] = item\nend\nend\nend\nreturn tbl\nend\nlocal function removevalues(tbl, removes)\nfor i=#tbl,1,-1 do\n for _, pattern in ipairs(removes) do\n if pattern == tbl[i] then\n table.remove(tbl, i)\n break\n end\n end\n end\nend\nlocal function mergeobject(dest, src)\nif not src then \nreturn \nend\nfor fieldname, value in pairs(src) do\nif not nocopy[fieldname] then\nlocal field = premake.fields[fieldname]\nif field then\nif type(value) == \"table\" then\ndest[fieldname] = mergefield(field.kind, dest[fieldname], value)\nif src.removes then\nremoves = src.removes[fieldname]\nif removes then\nremovevalues(dest[fieldname], removes)\nend\nend\nelse\ndest[fieldname] = value\nend\nelse\ndest[fieldname] = value\nend\nend\nend\nend\nlocal function merge(dest, obj, basis, terms, cfgname, pltname)\nlocal key = cfgname or \"\"\npltname = pltname or \"Native\"\nif pltname ~= \"Native\" then\nkey = key .. pltname\nend" |
| 70 | 70 | "\nterms.config = (cfgname or \"\"):lower()\nterms.platform = pltname:lower()\nlocal cfg = {}\nmergeobject(cfg, basis[key])\nadjustpaths(obj.location, cfg)\nmergeobject(cfg, obj)\nif (cfg.kind) then \nterms['kind']=cfg.kind:lower()\nend\nfor _, blk in ipairs(obj.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, terms))then\nmergeobject(cfg, blk)\nif (cfg.kind and not cfg.terms.kind) then \ncfg.terms['kind'] = cfg.kind:lower()\nterms['kind'] = cfg.kind:lower()\nend\nend\nend\ncfg.name = cfgname\ncfg.platform = pltname\nfor k,v in pairs(terms) do\ncfg.terms[k] =v\nend\ndest[key] = cfg\nend\nlocal function collapse(obj, basis)\nlocal result = {}\nbasis = basis or {}\nlocal sln = obj.solution or obj\nlocal terms = premake.getactiveterms()\nmerge(result, obj, basis, terms)--this adjusts terms\nfor _, cfgname in ipairs(sln.configurations) do\nlocal terms_local = {}\nfor k,v in pairs(terms)do terms_local[k]=v end\nmerge(result, obj, basis, terms_local, cfgname, \"Native\")--terms cam also be adjusted here\nf" |
| 71 | 71 | "or _, pltname in ipairs(sln.platforms or {}) do\nif pltname ~= \"Native\" then\nmerge(result, obj, basis,terms_local, cfgname, pltname)--terms also here\nend\nend\nend\nreturn result\nend\nlocal function builduniquedirs()\nlocal num_variations = 4\nlocal cfg_dirs = {}\nlocal hit_counts = {}\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dirs = { }\ndirs[1] = path.getabsolute(path.join(cfg.location, cfg.objdir or cfg.project.objdir or \"obj\"))\ndirs[2] = path.join(dirs[1], iif(cfg.platform == \"Native\", \"\", cfg.platform))\ndirs[3] = path.join(dirs[2], cfg.name)\ndirs[4] = path.join(dirs[3], cfg.project.name)\ncfg_dirs[cfg] = dirs\nlocal start = iif(cfg.name, 2, 1)\nfor v = start, num_variations do\nlocal d = dirs[v]\nhit_counts[d] = (hit_counts[d] or 0) + 1\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal dir\nlocal start = iif(cfg.name, " |
| 72 | | "2, 1)\nfor v = start, num_variations do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nlocal function buildtargets()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget = premake.gettarget(cfg, \"link\", pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objectsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\n local function getCfgKind(cfg)\n if(cfg.kind) then\n return cfg.kind;\n end\n \n if(cfg.project.__configs[\"\"] and cfg.project.__configs[\"\"].kind) then\n return cfg.project.__configs[\"\"].kind;\n end\n \n return nil\n end\n \n local function getprojrec(dstArray, foundList, cfg, cfgname, searc" |
| 73 | | "hField, bLinkage)\n if(not cfg) then return end\n \n local foundUsePrjs = {};\n for _, useName in ipairs(cfg[searchField]) do\n local testName = useName:lower();\n if((not foundList[testName])) then\n local theProj = nil;\n local theUseProj = nil;\n for _, prj in ipairs(cfg.project.solution.projects) do\n if (prj.name:lower() == testName) then\n if(prj.usage) then\n theUseProj = prj;\n else\n theProj = prj;\n end\n end\n end\n \n --Must connect to a usage project.\n if(theUseProj) then\n foundList[testName] = true;\n local prjEntry = {\n name = testName,\n proj = theProj,\n usageProj = theUseProj,\n bLinkageOnly = bLinkage,\n };\n dstArray[testName] = prjEntry;\n table.insert(foundUsePrjs, theUseProj);\n end\n end\n end\n \n for _, usePrj in ipairs(foundUsePrjs) do\n --Links can only recurse through static libraries.\n if((searchField ~= \"links\") or\n (getCfgKind(usePrj.__configs[cfgname]) == \"StaticLib\")) then\n getprojrec(dstArray, foundList, usePrj.__configs[cfgname" |
| 74 | | "],\n cfgname, searchField, bLinkage);\n end\n end\n end\n \n --\n -- This function will recursively get all projects that the given configuration has in its \"uses\"\n -- field. The return values are a list of tables. Each table in that list contains the following:\n --name = The lowercase name of the project.\n --proj = The project. Can be nil if it is usage-only.\n --usageProj = The usage project. Can't be nil, as using a project that has no\n -- usage project is not put into the list.\n --bLinkageOnly = If this is true, then only the linkage information should be copied.\n -- The recursion will only look at the \"uses\" field on *usage* projects.\n -- This function will also add projects to the list that are mentioned in the \"links\"\n -- field of usage projects. These will only copy linker information, but they will recurse.\n -- through other \"links\" fields.\n --\n local function getprojectsconnections(cfg, cfgname)\n local dstArray = {};\n local foundList = {};\n foundList[cfg.pr" |
| 75 | | "oject.name:lower()] = true;\n \n --First, follow the uses recursively.\n getprojrec(dstArray, foundList, cfg, cfgname, \"uses\", false);\n \n --Next, go through all of the usage projects and recursively get their links.\n --But only if they're not already there. Get the links as linkage-only.\n local linkArray = {};\n for prjName, prjEntry in pairs(dstArray) do\n getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, \n \"links\", true);\n end\n \n --Copy from linkArray into dstArray.\n for prjName, prjEntry in pairs(linkArray) do\n dstArray[prjName] = prjEntry;\n end\n \n return dstArray;\n end\n \n \n local function isnameofproj(cfg, strName)\n local sln = cfg.project.solution;\n local strTest = strName:lower();\n for prjIx, prj in ipairs(sln.projects) do\n if (prj.name:lower() == strTest) then\n return true;\n end\n end\n \n return false;\n end\n --\n -- Copies the field from dstCfg to srcCfg.\n --\n local function copydependentfield(srcCfg, dstC" |
| 76 | | "fg, strSrcField)\n local srcField = premake.fields[strSrcField];\n local strDstField = strSrcField;\n \n if type(srcCfg[strSrcField]) == \"table\" then\n --handle paths.\n if (srcField.kind == \"dirlist\" or srcField.kind == \"filelist\") and\n (not keeprelative[strSrcField]) then\n for i,p in ipairs(srcCfg[strSrcField]) do\n table.insert(dstCfg[strDstField],\n path.rebase(p, srcCfg.project.location, dstCfg.project.location))\n end\n else\n if(strSrcField == \"links\") then\n for i,p in ipairs(srcCfg[strSrcField]) do\n if(not isnameofproj(dstCfg, p)) then\n table.insert(dstCfg[strDstField], p)\n else\n printf(\"Failed to copy '%s' from proj '%s'.\",\n p, srcCfg.project.name);\n end\n end\n else\n for i,p in ipairs(srcCfg[strSrcField]) do\n table.insert(dstCfg[strDstField], p)\n end\n end\n end\n else\n if(srcField.kind == \"path\" and (not keeprelative[strSrcField])) then\n dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],\n prj.location, dstCfg.project.location);\n else\n " |
| 77 | | " dstCfg[strDstField] = srcCfg[strSrcField];\n end\n end\n end\n \n --\n -- This function will take the list of project entries and apply their usage project data\n -- to the given configuration. It will copy compiling information for the projects that are\n -- not listed as linkage-only. It will copy the linking information for projects only if\n -- the source project is not a static library. It won't copy linking information\n -- if the project is in this solution; instead it will add that project to the configuration's\n -- links field, expecting that Premake will handle the rest.\n --\n local function copyusagedata(cfg, cfgname, linkToProjs)\n local myPrj = cfg.project;\n local bIsStaticLib = (getCfgKind(cfg) == \"StaticLib\");\n \n for prjName, prjEntry in pairs(linkToProjs) do\n local srcPrj = prjEntry.usageProj;\n local srcCfg = srcPrj.__configs[cfgname];\n \n for name, field in pairs(premake.fields) do\n if(srcCfg[name]) then\n if(field.usagecopy) then\n if(not prjEntry.bLinkageO" |
| 78 | | "nly) then\n copydependentfield(srcCfg, cfg, name)\n end\n elseif(field.linkagecopy) then\n --Copy the linkage data if we're building a non-static thing\n --and this is a pure usage project. If it's not pure-usage, then\n --we will simply put the project's name in the links field later.\n if((not bIsStaticLib) and (not prjEntry.proj)) then\n copydependentfield(srcCfg, cfg, name)\n end\n end\n end\n end\n \n if((not bIsStaticLib) and prjEntry.proj) then\n table.insert(cfg.links, prjEntry.proj.name);\n end\n end\n end\nfunction premake.bake.buildconfigs()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.location or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _, blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\nfor sln in premake.solution.each() do\nlocal basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor " |
| 79 | | "_, cfg in pairs(prj.__configs) do\nbake.postprocess(prj, cfg)\nend\nend\nend\nfor sln in premake.solution.each() do\nfor prjIx, prj in ipairs(sln.projects) do\nif(not prj.usage) then\nfor cfgname, cfg in pairs(prj.__configs) do\nlocal usesPrjs = getprojectsconnections(cfg, cfgname);\ncopyusagedata(cfg, cfgname, usesPrjs)\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nlocal removeList = {};\nfor index, prj in ipairs(sln.projects) do\nif(prj.usage) then\ntable.insert(removeList, 1, index); --Add in reverse order.\nend\nend\nfor _, index in ipairs(removeList) do\ntable.remove(sln.projects, index);\nend\nend\nbuilduniquedirs()\nbuildtargets(cfg)\nend\nfunction premake.bake.postprocess(prj, cfg)\ncfg.project = prj\ncfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)\ncfg.longname = premake.getconfigname(cfg.name, cfg.platform)\ncfg.location = cfg.location or cfg.basedir\nlocal platform = premake.platforms[cfg.platform]\nif platform.iscrosscompiler then\ncfg.system = cfg.platform\nels" |
| 80 | | "e\ncfg.system = os.get()\nend\nif cfg.kind == \"SharedLib\" and platform.nosharedlibs then\ncfg.kind = \"StaticLib\"\nend\nlocal files = { }\nfor _, fname in ipairs(cfg.files) do\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (fname == exclude)\nif (excluded) then break end\nend\nif (not excluded) then\ntable.insert(files, fname)\nend\nend\ncfg.files = files\nfor name, field in pairs(premake.fields) do\nif field.isflags then\nlocal values = cfg[name]\nfor _, flag in ipairs(values) do values[flag] = true end\nend\nend\ncfg.__fileconfigs = { }\nfor _, fname in ipairs(cfg.files) do\ncfg.terms.required = fname:lower()\nlocal fcfg = {}\nfor _, blk in ipairs(cfg.project.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then\nmergeobject(fcfg, blk)\nend\nend\nfcfg.name = fname\ncfg.__fileconfigs[fname] = fcfg\ntable.insert(cfg.__fileconfigs, fcfg)\nend\nend\n", |
| 72 | "2, 1)\nfor v = start, num_variations do\ndir = cfg_dirs[cfg][v]\nif hit_counts[dir] == 1 then break end\nend\nif (cfg.flags.SingleOutputDir) then\ncfg.objectsdir = cfg.objdir or cfg.project.objdir or \"obj\"\nelse\ncfg.objectsdir = path.getrelative(cfg.location, dir)\nend\nend\nend\nend\nend\nlocal function buildtargets()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nfor _, cfg in pairs(prj.__configs) do\nlocal pathstyle = premake.getpathstyle(cfg)\nlocal namestyle = premake.getnamestyle(cfg)\ncfg.buildtarget = premake.gettarget(cfg, \"build\", pathstyle, namestyle, cfg.system)\ncfg.linktarget = premake.gettarget(cfg, \"link\", pathstyle, namestyle, cfg.system)\nif pathstyle == \"windows\" then\ncfg.objectsdir = path.translate(cfg.objectsdir, \"\\\\\")\nend\nend\nend\nend\nend\n local function getCfgKind(cfg)\n if(cfg.kind) then\n return cfg.kind;\n end\n \n if(cfg.project.__configs[\"\"] and cfg.project.__configs[\"\"].kind) then\n return cfg.project.__configs[\"\"].k" |
| 73 | "ind;\n end\n \n return nil\n end\n \n local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage)\n if(not cfg) then return end\n \n local foundUsePrjs = {};\n for _, useName in ipairs(cfg[searchField]) do\n local testName = useName:lower();\n if((not foundList[testName])) then\n local theProj = nil;\n local theUseProj = nil;\n for _, prj in ipairs(cfg.project.solution.projects) do\n if (prj.name:lower() == testName) then\n if(prj.usage) then\n theUseProj = prj;\n else\n theProj = prj;\n end\n end\n end\n \n --Must connect to a usage project.\n if(theUseProj) then\n foundList[testName] = true;\n local prjEntry = {\n name = testName,\n proj = theProj,\n usageProj = theUseProj,\n bLinkageOnly = bLinkage,\n };\n dstArray[testName] = prjEntry;\n table.insert(foundUsePrjs, theUseProj);\n end\n end\n end\n \n for _, usePrj in ipairs(foundUsePrjs) do\n --Links can only recurse through static libraries.\n if((searchField ~= \"links\") or\n (getCfgKind(" |
| 74 | "usePrj.__configs[cfgname]) == \"StaticLib\")) then\n getprojrec(dstArray, foundList, usePrj.__configs[cfgname],\n cfgname, searchField, bLinkage);\n end\n end\n end\n \n --\n -- This function will recursively get all projects that the given configuration has in its \"uses\"\n -- field. The return values are a list of tables. Each table in that list contains the following:\n --name = The lowercase name of the project.\n --proj = The project. Can be nil if it is usage-only.\n --usageProj = The usage project. Can't be nil, as using a project that has no\n -- usage project is not put into the list.\n --bLinkageOnly = If this is true, then only the linkage information should be copied.\n -- The recursion will only look at the \"uses\" field on *usage* projects.\n -- This function will also add projects to the list that are mentioned in the \"links\"\n -- field of usage projects. These will only copy linker information, but they will recurse.\n -- through other \"links\" fields.\n --\n local func" |
| 75 | "tion getprojectsconnections(cfg, cfgname)\n local dstArray = {};\n local foundList = {};\n foundList[cfg.project.name:lower()] = true;\n \n --First, follow the uses recursively.\n getprojrec(dstArray, foundList, cfg, cfgname, \"uses\", false);\n \n --Next, go through all of the usage projects and recursively get their links.\n --But only if they're not already there. Get the links as linkage-only.\n local linkArray = {};\n for prjName, prjEntry in pairs(dstArray) do\n getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, \n \"links\", true);\n end\n \n --Copy from linkArray into dstArray.\n for prjName, prjEntry in pairs(linkArray) do\n dstArray[prjName] = prjEntry;\n end\n \n return dstArray;\n end\n \n \n local function isnameofproj(cfg, strName)\n local sln = cfg.project.solution;\n local strTest = strName:lower();\n for prjIx, prj in ipairs(sln.projects) do\n if (prj.name:lower() == strTest) then\n return true;\n end\n end\n \n return false;\n e" |
| 76 | "nd\n --\n -- Copies the field from dstCfg to srcCfg.\n --\n local function copydependentfield(srcCfg, dstCfg, strSrcField)\n local srcField = premake.fields[strSrcField];\n local strDstField = strSrcField;\n \n if type(srcCfg[strSrcField]) == \"table\" then\n --handle paths.\n if (srcField.kind == \"dirlist\" or srcField.kind == \"filelist\") and\n (not keeprelative[strSrcField]) then\n for i,p in ipairs(srcCfg[strSrcField]) do\n table.insert(dstCfg[strDstField],\n path.rebase(p, srcCfg.project.location, dstCfg.project.location))\n end\n else\n if(strSrcField == \"links\") then\n for i,p in ipairs(srcCfg[strSrcField]) do\n if(not isnameofproj(dstCfg, p)) then\n table.insert(dstCfg[strDstField], p)\n else\n printf(\"Failed to copy '%s' from proj '%s'.\",\n p, srcCfg.project.name);\n end\n end\n else\n for i,p in ipairs(srcCfg[strSrcField]) do\n table.insert(dstCfg[strDstField], p)\n end\n end\n end\n else\n if(srcField.kind == \"path\" and (not keeprelative[strSrcField])) then\n" |
| 77 | " dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],\n prj.location, dstCfg.project.location);\n else\n dstCfg[strDstField] = srcCfg[strSrcField];\n end\n end\n end\n \n --\n -- This function will take the list of project entries and apply their usage project data\n -- to the given configuration. It will copy compiling information for the projects that are\n -- not listed as linkage-only. It will copy the linking information for projects only if\n -- the source project is not a static library. It won't copy linking information\n -- if the project is in this solution; instead it will add that project to the configuration's\n -- links field, expecting that Premake will handle the rest.\n --\n local function copyusagedata(cfg, cfgname, linkToProjs)\n local myPrj = cfg.project;\n local bIsStaticLib = (getCfgKind(cfg) == \"StaticLib\");\n \n for prjName, prjEntry in pairs(linkToProjs) do\n local srcPrj = prjEntry.usageProj;\n local srcCfg = srcPrj.__configs[cfgname];\n \n for name, field" |
| 78 | " in pairs(premake.fields) do\n if(srcCfg[name]) then\n if(field.usagecopy) then\n if(not prjEntry.bLinkageOnly) then\n copydependentfield(srcCfg, cfg, name)\n end\n elseif(field.linkagecopy) then\n --Copy the linkage data if we're building a non-static thing\n --and this is a pure usage project. If it's not pure-usage, then\n --we will simply put the project's name in the links field later.\n if((not bIsStaticLib) and (not prjEntry.proj)) then\n copydependentfield(srcCfg, cfg, name)\n end\n end\n end\n end\n \n if((not bIsStaticLib) and prjEntry.proj) then\n table.insert(cfg.links, prjEntry.proj.name);\n end\n end\n end\nfunction premake.bake.buildconfigs()\nfor sln in premake.solution.each() do\nfor _, prj in ipairs(sln.projects) do\nprj.location = prj.location or sln.location or prj.basedir\nadjustpaths(prj.location, prj)\nfor _, blk in ipairs(prj.blocks) do\nadjustpaths(prj.location, blk)\nend\nend\nsln.location = sln.location or sln.basedir\nend\nfor sln in premake.solution.each() do\n" |
| 79 | "local basis = collapse(sln)\nfor _, prj in ipairs(sln.projects) do\nprj.__configs = collapse(prj, basis)\nfor _, cfg in pairs(prj.__configs) do\nbake.postprocess(prj, cfg)\nend\nend\nend\nfor sln in premake.solution.each() do\nfor prjIx, prj in ipairs(sln.projects) do\nif(not prj.usage) then\nfor cfgname, cfg in pairs(prj.__configs) do\nlocal usesPrjs = getprojectsconnections(cfg, cfgname);\ncopyusagedata(cfg, cfgname, usesPrjs)\nend\nend\nend\nend\nfor sln in premake.solution.each() do\nlocal removeList = {};\nfor index, prj in ipairs(sln.projects) do\nif(prj.usage) then\ntable.insert(removeList, 1, index); --Add in reverse order.\nend\nend\nfor _, index in ipairs(removeList) do\ntable.remove(sln.projects, index);\nend\nend\nbuilduniquedirs()\nbuildtargets(cfg)\nend\nfunction premake.bake.postprocess(prj, cfg)\ncfg.project = prj\ncfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true)\ncfg.longname = premake.getconfigname(cfg.name, cfg.platform)\ncfg.location = cfg.location or cfg.basedir\nloca" |
| 80 | "l platform = premake.platforms[cfg.platform]\nif platform.iscrosscompiler then\ncfg.system = cfg.platform\nelse\ncfg.system = os.get()\nend\nif cfg.kind == \"SharedLib\" and platform.nosharedlibs then\ncfg.kind = \"StaticLib\"\nend\nlocal files = { }\nfor _, fname in ipairs(cfg.files) do\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (fname == exclude)\nif (excluded) then break end\nend\nif (not excluded) then\ntable.insert(files, fname)\nend\nend\ncfg.files = files\nfor name, field in pairs(premake.fields) do\nif field.isflags then\nlocal values = cfg[name]\nfor _, flag in ipairs(values) do values[flag] = true end\nend\nend\ncfg.__fileconfigs = { }\nfor _, fname in ipairs(cfg.files) do\ncfg.terms.required = fname:lower()\nlocal fcfg = {}\nfor _, blk in ipairs(cfg.project.blocks) do\nif (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then\nmergeobject(fcfg, blk)\nend\nend\nfcfg.name = fname\ncfg.__fileconfigs[fname] = fcfg\ntable.insert(cfg.__fileconfigs, fcfg)\nend\nend\n", |
| 81 | 81 | |
| 82 | 82 | /* base/api.lua */ |
| 83 | | "premake.fields =\n{\narchivesplit_size =\n{\nkind = \"string\",\nscope = \"config\",\n},\nbasedir =\n{\nkind = \"path\",\nscope = \"container\",\n},\nbuildaction =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\nbuildoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nbuildoptions_cpp =\n{\nkind = \"list\",\nscope = \"config\",\n},\nconfigurations =\n{\nkind = \"list\",\nscope = \"solution\",\n},\ndebugargs =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndebugdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ndebugenvs =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndeploymentoptions =\n{\nkind = \"list\",\nscope = \"config\",\nusagecopy = true,\n},\nexcludes =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nfiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind = \"list\",\nscope = \"config\",\nisflags = true,\nusagecopy = true,\nallowed = functi" |
| 84 | | "on(value)\nlocal allowed_flags = {\nATL = 1,\nDebugEnvsDontMerge = 1,\nDebugEnvsInherit = 1,\nEnableMinimalRebuild = 1,\nEnableSSE = 1,\nEnableSSE2 = 1,\nExtraWarnings = 1,\nFatalWarnings = 1,\nFloatFast = 1,\nFloatStrict = 1,\nManaged = 1,\nMFC = 1,\nNativeWChar = 1,\nNo64BitChecks = 1,\nNoEditAndContinue = 1,\nNoExceptions = 1,\nNoFramePointer = 1,\nNoImportLib = 1,\nNoIncrementalLink = 1,\nNoManifest = 1,\nNoMultiProcessorCompilation = 1,\nNoNativeWChar = 1,\nNoPCH = 1,\nNoRTTI = 1,\nOptimize = 1,\nOptimizeSize = 1,\nOptimizeSpeed = 1,\nSEH = 1,\nStaticATL = 1,\nStaticRuntime = 1,\nSymbols = 1,\nUnicode = 1,\nUnsafe = 1,\nUnsignedChar = 1,\nWinMain = 1,\n}\nlocal englishToAmericanSpelling =\n{\noptimise = 'optimize',\noptimisesize = 'optimizesize',\noptimisespeed = 'optimizespeed',\n}\nlocal lowervalue = value:lower()\nlowervalue = englishToAmericanSpelling[lowervalue] or lowervalue\nfor v, _ in pairs(allowed_flags) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid flag\"\nend," |
| 85 | | "\n},\nframework =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"1.0\",\n\"1.1\",\n\"2.0\",\n\"3.0\",\n\"3.5\",\n\"4.0\",\n\"4.5\",\n}\n},\nforcedincludes = \n{\nkind = \"absolutefilelist\",\nscope = \"config\",\n},\nimagepath =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimageoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nimplibdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimplibextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibname =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibsuffix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n},\nkind =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\nlanguage =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\nlibdirs =\n{\nkind " |
| 86 | | " = \"dirlist\",\nscope = \"config\",\nlinkagecopy = true,\n},\nlinkoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nlinks =\n{\nkind = \"list\",\nscope = \"config\",\nallowed = function(value)\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend,\nlinkagecopy = true,\n},\nlocation =\n{\nkind = \"path\",\nscope = \"container\",\n},\nmakesettings =\n{\nkind = \"list\",\nscope = \"config\",\n},\nmessageskip =\n{\nkind = \"list\",\nscope = \"solution\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_messages = {\nSkipCreatingMessage = 1,\nSkipBuildingMessage = 1,\nSkipCleaningMessage = 1,\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_messages) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid message to skip\"\nend,\n},\nmsgarchiving =\n{\nkind = \"string\",\nscope = \"config\",\n},\nmsgcompile =\n{\nkind = \"string\",\nscope = \"config\",\n},\nmsgresource =\n{\nkind = \"string\",\ns" |
| 87 | | "cope = \"config\",\n},\nmsglinking =\n{\nkind = \"string\",\nscope = \"config\",\n},\nobjdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\noptions =\n{\nkind = \"list\",\nscope = \"container\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_options = {\nForceCPP = 1,\nArchiveSplit = 1\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_options) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid option\"\nend,\n},\npchheader =\n{\nkind = \"string\",\nscope = \"config\",\n},\npchsource =\n{\nkind = \"path\",\nscope = \"config\",\n},\nplatforms =\n{\nkind = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n},\npostbuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprebuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprelinkcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresdefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresincludedirs =\n{\nkind = \"dirlist\"," |
| 88 | | "\nscope = \"config\",\n},\nresoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nstartproject =\n{\nkind = \"string\",\nscope = \"solution\",\n},\ntargetdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ntargetsubdir =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetname =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetsuffix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntrimpaths =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nuuid =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\") then ok = false end\nif (value:sub(14,14) ~= \"-\") then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:s" |
| 89 | | "ub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper()\nend\n},\nuses =\n{\nkind = \"list\",\nscope = \"config\",\n},\nvpaths =\n{\nkind = \"keypath\",\nscope = \"container\",\n},\n}\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == \"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not container) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nel" |
| 90 | | "seif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction premake.setarray(obj, fieldname, value, allowed)\nobj[fieldname] = obj[fieldname] or {}\nlocal function add(value, depth)\nif type(value) == \"table\" then\nfor _,v in ipairs(value) do\nadd(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif not value then\nerror(err, depth)\nend\ntable.insert(obj[fieldname], value)\nend\nend\nif value then\nadd(value, 5)\nend\nreturn obj[fieldname]\nend\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value, depth)\nif (type(value) == \"table\") then\nfor _, item in ipairs(value) do\nmakeabsolute(item, depth + 1)\nend\nelseif type(value) == \"string\" then\nif value:find(\"*\") then\nmakeabsolute(matchfunc(value), depth + 1)\nelse\ntable.insert(result, path.getabsolute(value))\nend\nelse\nerror(\"Invalid value in list: exp" |
| 91 | | "ected string, got \" .. type(value), depth)\nend\nend\nmakeabsolute(value, 3)\nreturn premake.setarray(ctype, fieldname, result)\nend\nfunction premake.setdirarray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\nfunction premake.setkeyvalue(ctype, fieldname, values)\nlocal container, err = premake.getobject(ctype)\nif not container then\nerror(err, 4)\nend\nif not container[fieldname] then\ncontainer[fieldname] = {}\nend\nif type(values) ~= \"table\" then\nerror(\"invalid value; table expected\", 4)\nend\nlocal field = container[fieldname]\nfor key,value in pairs(values) do\nif not field[key] then\nfield[key] = {}\nend\ntable.insertflat(field[key], value)\nend\nreturn field\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\nlocal container, err = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (value) " |
| 92 | | "then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nfunction premake.remove(fieldname, value)\nlocal cfg = premake.CurrentConfiguration\ncfg.removes = cfg.removes or {}\ncfg.removes[fieldname] = premake.setarray(cfg.removes, fieldname, value)\nend\nlocal function accessor(name, value)\nlocal kind = premake.fields[name].kind\nlocal scope = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif (kind == \"string\" or kind == \"path\") and value then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nlocal container, err = premake.getobject(scope)\nif (not container) then\nerror(err, 3)\nend\nif kind == \"string\" then\nreturn premake.setstring(scope, name, value, allowed)\nelseif kind == \"path\" then\nif value then value = path.getabsolute(value) end\nreturn premake.setstring(scope, name, value)\nelseif kind == \"list\" then\nreturn premake.s" |
| 93 | | "etarray(container, name, value, allowed)\nelseif kind == \"dirlist\" then\nreturn premake.setdirarray(container, name, value)\nelseif kind == \"filelist\" or kind == \"absolutefilelist\" then\nreturn premake.setfilearray(container, name, value)\nelseif kind == \"keyvalue\" or kind == \"keypath\" then\nreturn premake.setkeyvalue(scope, name, value)\nend\nend\nfor name, info in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nif info.kind == \"list\" or \n info.kind == \"dirlist\" or \n info.kind == \"filelist\" or\n info.kind == \"absolutefilelist\" \nthen\n_G[\"remove\"..name] = function(value)\npremake.remove(name, value)\nend\nend\nend\nfunction configuration(terms)\nif not terms then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ncfg.terms = table.flatten({terms})\ntable.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\ncfg.keywords" |
| 94 | | " = { }\nfor _, word in ipairs(cfg.terms) do\ntable.insert(cfg.keywords, path.wildcards(word):lower())\nend\nfor name, field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nlocal function creategroup(name, sln, parent, inpath)\nlocal group = {}\nsetmetatable(group, {\n__type = \"group\"\n})\ntable.insert(sln.groups, group)\nsln.groups[inpath] = group\ngroup.solution = sln\ngroup.name = name\ngroup.uuid = os.uuid(group.name)\ngroup.parent = parent\nreturn group\nend\nlocal function creategroupsfrompath(inpath, sln)\nif inpath == nil then return nil end\ninpath = path.translate(inpath, \"/\")\nlocal groups = string.explode(inpath, \"/\")\nlocal curpath = \"\"\nlocal lastgroup = nil\nfor i, v in ipairs(groups) do\ncurpath = curpath .. \"/\" .. v:lower()\nlocal group = sln.groups[curpath]\nif group == nil then\ngroup = creategroup(v, sln, lastgroup, curpath)\nend\nlastgroup = group\nend\nreturn lastgroup\nend\nlocal function cre" |
| 95 | | "ateproject(name, sln, isUsage)\nlocal prj = {}\nsetmetatable(prj, {\n__type = \"project\",\n})\ntable.insert(sln.projects, prj)\nif(isUsage) then\nif(sln.projects[name]) then\nsln.projects[name].usageProj = prj;\nelse\nsln.projects[name] = prj\nend\nelse\nif(sln.projects[name]) then\nprj.usageProj = sln.projects[name];\nend\nsln.projects[name] = prj\nend\nlocal group = creategroupsfrompath(premake.CurrentGroup, sln)\nprj.solution = sln\nprj.name = name\nprj.basedir = os.getcwd()\nprj.uuid = os.uuid(prj.name)\nprj.blocks = { }\nprj.usage = isUsage\nprj.group = group\nreturn prj;\nend\nfunction usage(name)\nif (not name) then\nif(type(premake.CurrentContainer) ~= \"project\") then return nil end\nif(not premake.CurrentContainer.usage) then return nil end\nreturn premake.CurrentContainer\nend\nlocal sln\nif (type(premake.CurrentContainer) == \"project\") then\nsln = premake.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"" |
| 96 | | "solution\") then\nerror(\"no active solution\", 2)\nend\n -- if this is a new project, or the project in that slot doesn't have a usage, create it\n if((not sln.projects[name]) or\n ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then\n premake.CurrentContainer = createproject(name, sln, true)\n else\n premake.CurrentContainer = iff(sln.projects[name].usage,\n sln.projects[name], sln.projects[name].usageProj)\n end\n -- add an empty, global configuration to the project\n configuration { }\n return premake.CurrentContainer\n end\n function project(name)\n if (not name) then\n --Only return non-usage projects\n if(type(premake.CurrentContainer) ~= \"project\") then return nil end\n if(premake.CurrentContainer.usage) then return nil end\n return premake.CurrentContainer\nend\n -- identify the parent solution\n local sln\n if (type(premake.CurrentContainer) == \"project\") then\n sln = premake.CurrentContainer.solution\n else\n sln = premake.CurrentContainer\n end" |
| 97 | | "\n if (type(sln) ~= \"solution\") then\n error(\"no active solution\", 2)\n end\n -- if this is a new project, or the old project is a usage project, create it\n if((not sln.projects[name]) or sln.projects[name].usage) then\n premake.CurrentContainer = createproject(name, sln)\n else\n premake.CurrentContainer = sln.projects[name];\n end\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = premake.solution.get(name)\nif (not premake.CurrentContainer) then\npremake.CurrentContainer = premake.solution.new(name)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction group(name)\nif not name then \nreturn premake.CurrentGroup\nend\npremake.CurrentGroup = name\nreturn premake.CurrentGroup\nend\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npre" |
| 98 | | "make.option.add(opt)\nend\n", |
| 83 | "premake.fields =\n{\narchivesplit_size =\n{\nkind = \"string\",\nscope = \"config\",\n},\nbasedir =\n{\nkind = \"path\",\nscope = \"container\",\n},\nbuildaction =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"Compile\",\n\"Copy\",\n\"Embed\",\n\"None\"\n}\n},\nbuildoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nbuildoptions_c =\n{\nkind = \"list\",\nscope = \"config\",\n},\nbuildoptions_cpp =\n{\nkind = \"list\",\nscope = \"config\",\n},\nconfigurations =\n{\nkind = \"list\",\nscope = \"solution\",\n},\ndebugargs =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndebugdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ndebugenvs =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndefines =\n{\nkind = \"list\",\nscope = \"config\",\n},\ndeploymentoptions =\n{\nkind = \"list\",\nscope = \"config\",\nusagecopy = true,\n},\nexcludes =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nfiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind = \"list\",\nscope = " |
| 84 | "\"config\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_flags = {\nATL = 1,\nDebugEnvsDontMerge = 1,\nDebugEnvsInherit = 1,\nEnableMinimalRebuild = 1,\nEnableSSE = 1,\nEnableSSE2 = 1,\nExtraWarnings = 1,\nFatalWarnings = 1,\nFloatFast = 1,\nFloatStrict = 1,\nManaged = 1,\nMFC = 1,\nNativeWChar = 1,\nNo64BitChecks = 1,\nNoEditAndContinue = 1,\nNoExceptions = 1,\nNoFramePointer = 1,\nNoImportLib = 1,\nNoIncrementalLink = 1,\nNoManifest = 1,\nNoMultiProcessorCompilation = 1,\nNoNativeWChar = 1,\nNoPCH = 1,\nNoRTTI = 1,\nSingleOutputDir = 1,\nOptimize = 1,\nOptimizeSize = 1,\nOptimizeSpeed = 1,\nSEH = 1,\nStaticATL = 1,\nStaticRuntime = 1,\nSymbols = 1,\nUnicode = 1,\nUnsafe = 1,\nUnsignedChar = 1,\nWinMain = 1,\n}\nlocal englishToAmericanSpelling =\n{\noptimise = 'optimize',\noptimisesize = 'optimizesize',\noptimisespeed = 'optimizespeed',\n}\nlocal lowervalue = value:lower()\nlowervalue = englishToAmericanSpelling[lowervalue] or lowervalue\nfor v, _ in pairs(allowed_flags) do\ni" |
| 85 | "f v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid flag\"\nend,\n},\nframework =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = {\n\"1.0\",\n\"1.1\",\n\"2.0\",\n\"3.0\",\n\"3.5\",\n\"4.0\",\n\"4.5\",\n}\n},\nforcedincludes = \n{\nkind = \"absolutefilelist\",\nscope = \"config\",\n},\nimagepath =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimageoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nimplibdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\nimplibextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibname =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nimplibsuffix =\n{\nkind = \"string\",\nscope = \"config\",\n},\nincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\nusagecopy = true,\n},\nkind =\n{\nkind = \"string\",\nscope = \"config\",\nallowed = {\n\"ConsoleApp\",\n\"WindowedApp\",\n\"StaticLib\",\n\"SharedLib\"\n}\n},\nlanguage =\n{\nkind = \"string\",\nsco" |
| 86 | "pe = \"container\",\nallowed = {\n\"C\",\n\"C++\",\n\"C#\"\n}\n},\nlibdirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\nlinkagecopy = true,\n},\nlinkoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nlinks =\n{\nkind = \"list\",\nscope = \"config\",\nallowed = function(value)\nif value:find('/', nil, true) then\nvalue = path.getabsolute(value)\nend\nreturn value\nend,\nlinkagecopy = true,\n},\nlocation =\n{\nkind = \"path\",\nscope = \"container\",\n},\nmakesettings =\n{\nkind = \"list\",\nscope = \"config\",\n},\nmessageskip =\n{\nkind = \"list\",\nscope = \"solution\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_messages = {\nSkipCreatingMessage = 1,\nSkipBuildingMessage = 1,\nSkipCleaningMessage = 1,\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_messages) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid message to skip\"\nend,\n},\nmsgarchiving =\n{\nkind = \"string\",\nscope = \"config\",\n},\nmsgcompile =\n{\n" |
| 87 | "kind = \"string\",\nscope = \"config\",\n},\nmsgresource =\n{\nkind = \"string\",\nscope = \"config\",\n},\nmsglinking =\n{\nkind = \"string\",\nscope = \"config\",\n},\nobjdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\noptions =\n{\nkind = \"list\",\nscope = \"container\",\nisflags = true,\nusagecopy = true,\nallowed = function(value)\nlocal allowed_options = {\nForceCPP = 1,\nArchiveSplit = 1\n}\nlocal lowervalue = value:lower()\nfor v, _ in pairs(allowed_options) do\nif v:lower() == lowervalue then\nreturn v\nend\nend\nreturn nil, \"invalid option\"\nend,\n},\npchheader =\n{\nkind = \"string\",\nscope = \"config\",\n},\npchsource =\n{\nkind = \"path\",\nscope = \"config\",\n},\nplatforms =\n{\nkind = \"list\",\nscope = \"solution\",\nallowed = table.keys(premake.platforms),\n},\npostbuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprebuildcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nprelinkcommands =\n{\nkind = \"list\",\nscope = \"config\",\n},\nresdefines =\n{\n" |
| 88 | "kind = \"list\",\nscope = \"config\",\n},\nresincludedirs =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nresoptions =\n{\nkind = \"list\",\nscope = \"config\",\n},\nstartproject =\n{\nkind = \"string\",\nscope = \"solution\",\n},\ntargetdir =\n{\nkind = \"path\",\nscope = \"config\",\n},\ntargetsubdir =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetextension =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetname =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetprefix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntargetsuffix =\n{\nkind = \"string\",\nscope = \"config\",\n},\ntrimpaths =\n{\nkind = \"dirlist\",\nscope = \"config\",\n},\nuuid =\n{\nkind = \"string\",\nscope = \"container\",\nallowed = function(value)\nlocal ok = true\nif (#value ~= 36) then ok = false end\nfor i=1,36 do\nlocal ch = value:sub(i,i)\nif (not ch:find(\"[ABCDEFabcdef0123456789-]\")) then ok = false end\nend\nif (value:sub(9,9) ~= \"-\") then ok = false end\nif (value:sub(14,14) ~= \"-\")" |
| 89 | " then ok = false end\nif (value:sub(19,19) ~= \"-\") then ok = false end\nif (value:sub(24,24) ~= \"-\") then ok = false end\nif (not ok) then\nreturn nil, \"invalid UUID\"\nend\nreturn value:upper()\nend\n},\nuses =\n{\nkind = \"list\",\nscope = \"config\",\n},\nvpaths =\n{\nkind = \"keypath\",\nscope = \"container\",\n},\n}\nfunction premake.checkvalue(value, allowed)\nif (allowed) then\nif (type(allowed) == \"function\") then\nreturn allowed(value)\nelse\nfor _,v in ipairs(allowed) do\nif (value:lower() == v:lower()) then\nreturn v\nend\nend\nreturn nil, \"invalid value '\" .. value .. \"'\"\nend\nelse\nreturn value\nend\nend\nfunction premake.getobject(t)\nlocal container\nif (t == \"container\" or t == \"solution\") then\ncontainer = premake.CurrentContainer\nelse\ncontainer = premake.CurrentConfiguration\nend\nif t == \"solution\" then\nif type(container) == \"project\" then\ncontainer = container.solution\nend\nif type(container) ~= \"solution\" then\ncontainer = nil\nend\nend\nlocal msg\nif (not conta" |
| 90 | "iner) then\nif (t == \"container\") then\nmsg = \"no active solution or project\"\nelseif (t == \"solution\") then\nmsg = \"no active solution\"\nelse\nmsg = \"no active solution, project, or configuration\"\nend\nend\nreturn container, msg\nend\nfunction premake.setarray(obj, fieldname, value, allowed)\nobj[fieldname] = obj[fieldname] or {}\nlocal function add(value, depth)\nif type(value) == \"table\" then\nfor _,v in ipairs(value) do\nadd(v, depth + 1)\nend\nelse\nvalue, err = premake.checkvalue(value, allowed)\nif not value then\nerror(err, depth)\nend\ntable.insert(obj[fieldname], value)\nend\nend\nif value then\nadd(value, 5)\nend\nreturn obj[fieldname]\nend\nlocal function domatchedarray(ctype, fieldname, value, matchfunc)\nlocal result = { }\nfunction makeabsolute(value, depth)\nif (type(value) == \"table\") then\nfor _, item in ipairs(value) do\nmakeabsolute(item, depth + 1)\nend\nelseif type(value) == \"string\" then\nif value:find(\"*\") then\nmakeabsolute(matchfunc(value), depth + 1)\nelse\ntable.i" |
| 91 | "nsert(result, path.getabsolute(value))\nend\nelse\nerror(\"Invalid value in list: expected string, got \" .. type(value), depth)\nend\nend\nmakeabsolute(value, 3)\nreturn premake.setarray(ctype, fieldname, result)\nend\nfunction premake.setdirarray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchdirs)\nend\nfunction premake.setfilearray(ctype, fieldname, value)\nreturn domatchedarray(ctype, fieldname, value, os.matchfiles)\nend\nfunction premake.setkeyvalue(ctype, fieldname, values)\nlocal container, err = premake.getobject(ctype)\nif not container then\nerror(err, 4)\nend\nif not container[fieldname] then\ncontainer[fieldname] = {}\nend\nif type(values) ~= \"table\" then\nerror(\"invalid value; table expected\", 4)\nend\nlocal field = container[fieldname]\nfor key,value in pairs(values) do\nif not field[key] then\nfield[key] = {}\nend\ntable.insertflat(field[key], value)\nend\nreturn field\nend\nfunction premake.setstring(ctype, fieldname, value, allowed)\nlocal container, err" |
| 92 | " = premake.getobject(ctype)\nif (not container) then\nerror(err, 4)\nend\nif (value) then\nvalue, err = premake.checkvalue(value, allowed)\nif (not value) then\nerror(err, 4)\nend\ncontainer[fieldname] = value\nend\nreturn container[fieldname]\nend\nfunction premake.remove(fieldname, value)\nlocal cfg = premake.CurrentConfiguration\ncfg.removes = cfg.removes or {}\ncfg.removes[fieldname] = premake.setarray(cfg.removes, fieldname, value)\nend\nlocal function accessor(name, value)\nlocal kind = premake.fields[name].kind\nlocal scope = premake.fields[name].scope\nlocal allowed = premake.fields[name].allowed\nif (kind == \"string\" or kind == \"path\") and value then\nif type(value) ~= \"string\" then\nerror(\"string value expected\", 3)\nend\nend\nlocal container, err = premake.getobject(scope)\nif (not container) then\nerror(err, 3)\nend\nif kind == \"string\" then\nreturn premake.setstring(scope, name, value, allowed)\nelseif kind == \"path\" then\nif value then value = path.getabsolute(value) end\nreturn " |
| 93 | "premake.setstring(scope, name, value)\nelseif kind == \"list\" then\nreturn premake.setarray(container, name, value, allowed)\nelseif kind == \"dirlist\" then\nreturn premake.setdirarray(container, name, value)\nelseif kind == \"filelist\" or kind == \"absolutefilelist\" then\nreturn premake.setfilearray(container, name, value)\nelseif kind == \"keyvalue\" or kind == \"keypath\" then\nreturn premake.setkeyvalue(scope, name, value)\nend\nend\nfor name, info in pairs(premake.fields) do\n_G[name] = function(value)\nreturn accessor(name, value)\nend\nif info.kind == \"list\" or \n info.kind == \"dirlist\" or \n info.kind == \"filelist\" or\n info.kind == \"absolutefilelist\" \nthen\n_G[\"remove\"..name] = function(value)\npremake.remove(name, value)\nend\nend\nend\nfunction configuration(terms)\nif not terms then\nreturn premake.CurrentConfiguration\nend\nlocal container, err = premake.getobject(\"container\")\nif (not container) then\nerror(err, 2)\nend\nlocal cfg = { }\ncfg.terms = table.flatten({terms})\n" |
| 94 | "table.insert(container.blocks, cfg)\npremake.CurrentConfiguration = cfg\ncfg.keywords = { }\nfor _, word in ipairs(cfg.terms) do\ntable.insert(cfg.keywords, path.wildcards(word):lower())\nend\nfor name, field in pairs(premake.fields) do\nif (field.kind ~= \"string\" and field.kind ~= \"path\") then\ncfg[name] = { }\nend\nend\nreturn cfg\nend\nlocal function creategroup(name, sln, parent, inpath)\nlocal group = {}\nsetmetatable(group, {\n__type = \"group\"\n})\ntable.insert(sln.groups, group)\nsln.groups[inpath] = group\ngroup.solution = sln\ngroup.name = name\ngroup.uuid = os.uuid(group.name)\ngroup.parent = parent\nreturn group\nend\nlocal function creategroupsfrompath(inpath, sln)\nif inpath == nil then return nil end\ninpath = path.translate(inpath, \"/\")\nlocal groups = string.explode(inpath, \"/\")\nlocal curpath = \"\"\nlocal lastgroup = nil\nfor i, v in ipairs(groups) do\ncurpath = curpath .. \"/\" .. v:lower()\nlocal group = sln.groups[curpath]\nif group == nil then\ngroup = creategroup(v, sln, lastgr" |
| 95 | "oup, curpath)\nend\nlastgroup = group\nend\nreturn lastgroup\nend\nlocal function createproject(name, sln, isUsage)\nlocal prj = {}\nsetmetatable(prj, {\n__type = \"project\",\n})\ntable.insert(sln.projects, prj)\nif(isUsage) then\nif(sln.projects[name]) then\nsln.projects[name].usageProj = prj;\nelse\nsln.projects[name] = prj\nend\nelse\nif(sln.projects[name]) then\nprj.usageProj = sln.projects[name];\nend\nsln.projects[name] = prj\nend\nlocal group = creategroupsfrompath(premake.CurrentGroup, sln)\nprj.solution = sln\nprj.name = name\nprj.basedir = os.getcwd()\nprj.uuid = os.uuid(prj.name)\nprj.blocks = { }\nprj.usage = isUsage\nprj.group = group\nreturn prj;\nend\nfunction usage(name)\nif (not name) then\nif(type(premake.CurrentContainer) ~= \"project\") then return nil end\nif(not premake.CurrentContainer.usage) then return nil end\nreturn premake.CurrentContainer\nend\nlocal sln\nif (type(premake.CurrentContainer) == \"project\") then\nsln = premake.Curr" |
| 96 | "entContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\n -- if this is a new project, or the project in that slot doesn't have a usage, create it\n if((not sln.projects[name]) or\n ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then\n premake.CurrentContainer = createproject(name, sln, true)\n else\n premake.CurrentContainer = iff(sln.projects[name].usage,\n sln.projects[name], sln.projects[name].usageProj)\n end\n -- add an empty, global configuration to the project\n configuration { }\n return premake.CurrentContainer\n end\n function project(name)\n if (not name) then\n --Only return non-usage projects\n if(type(premake.CurrentContainer) ~= \"project\") then return nil end\n if(premake.CurrentContainer.usage) then return nil end\n return premake.CurrentContainer\nend\n -- identify the parent solution\n local sln\n if (type(premake.CurrentContainer) == \"project\") then\n sln " |
| 97 | "= premake.CurrentContainer.solution\n else\n sln = premake.CurrentContainer\n end\n if (type(sln) ~= \"solution\") then\n error(\"no active solution\", 2)\n end\n -- if this is a new project, or the old project is a usage project, create it\n if((not sln.projects[name]) or sln.projects[name].usage) then\n premake.CurrentContainer = createproject(name, sln)\n else\n premake.CurrentContainer = sln.projects[name];\n end\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction solution(name)\nif not name then\nif type(premake.CurrentContainer) == \"project\" then\nreturn premake.CurrentContainer.solution\nelse\nreturn premake.CurrentContainer\nend\nend\npremake.CurrentContainer = premake.solution.get(name)\nif (not premake.CurrentContainer) then\npremake.CurrentContainer = premake.solution.new(name)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction group(name)\nif not name then \nreturn premake.CurrentGroup\nend\npremake.CurrentGroup = name\nreturn premake.CurrentGroup\n" |
| 98 | "end\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npremake.option.add(opt)\nend\n", |
| 99 | 99 | |
| 100 | 100 | /* base/cmdline.lua */ |
| 101 | 101 | "newoption \n{\ntrigger = \"cc\",\nvalue = \"VALUE\",\ndescription = \"Choose a C/C++ compiler set\",\nallowed = {\n{ \"gcc\", \"GNU GCC (gcc/g++)\" },\n{ \"ow\", \"OpenWatcom\" },\n}\n}\nnewoption\n{\ntrigger = \"dotnet\",\nvalue = \"VALUE\",\ndescription = \"Choose a .NET compiler set\",\nallowed = {\n{ \"msnet\", \"Microsoft .NET (csc)\" },\n{ \"mono\", \"Novell Mono (mcs)\" },\n{ \"pnet\", \"Portable.NET (cscc)\" },\n}\n}\nnewoption\n{\ntrigger = \"file\",\nvalue = \"FILE\",\ndescription = \"Read FILE as a Premake script; default is 'premake4.lua'\"\n}\nnewoption\n{\ntrigger = \"help\",\ndescription = \"Display this information\"\n}\nnewoption\n{\ntrigger = \"os\",\nvalue = \"VALUE\",\ndescription = \"Generate files for a different operating system\",\nallowed = {\n{ \"bsd\", \"OpenBSD, NetBSD, or FreeBSD\" },\n{ \"linux\", \"Linux\" },\n{ \"macosx\", \"Apple Mac OS X\" },\n{ \"windows\", \"Microsoft Windows\" },\n}\n}\nnewoption\n{" |
| r244644 | r244645 | |
| 185 | 185 | "$(SILENT) if exist $(subst /,\\\\\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\\\\\,$(OBJDIR))')\n_p('endif')\n_p('')\n_p('prebuild:')\n_p('\\t$(PREBUILDCMDS)')\n_p('')\n_p('prelink:')\n_p('\\t$(PRELINKCMDS)')\n_p('')\ncpp.pchrules(prj)\ncpp.fileRules(prj)\n_p('-include $(OBJECTS:%%.o=%%.d)')\n_p('ifneq (,$(PCH))')\n_p(' -include $(OBJDIR)/$(notdir $(PCH)).d')\n_p('endif')\nend\nfunction premake.gmake_cpp_header(prj, cc, platforms)\n_p('# %s project makefile autogenerated by GENie', premake.action.current().shortname)\n_p('ifndef config')\n_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))\n_p('endif')\n_p('')\n_p('ifndef verbose')\n_p(' SILENT = @')\n_p('endif')\n_p('')\n_p('SHELLTYPE := msdos')\n_p('ifeq (,$(ComSpec)$(COMSPEC))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')\n_p(' SHELLTYPE := posix')\n_p('endif')\n_p('')\n_p('ifeq (posix,$(SHELLTYPE))')\n_p(' MKDIR = $(SILENT) mkdir -p \"$(1)\"')\n_p(' COPY = $(" |
| 186 | 186 | "SILENT) cp -fR \"$(1)\" \"$(2)\"')\n_p('else')\n_p(' MKDIR = $(SILENT) mkdir \"$(subst /,\\\\\\\\,$(1))\" 2> nul || exit 0')\n_p(' COPY = $(SILENT) copy /Y \"$(subst /,\\\\\\\\,$(1))\" \"$(subst /,\\\\\\\\,$(2))\"')\n_p('endif')\n_p('')\n_p('CC = %s', cc.cc)\n_p('CXX = %s', cc.cxx)\n_p('AR = %s', cc.ar)\n_p('')\n_p('ifndef RESCOMP')\n_p(' ifdef WINDRES')\n_p(' RESCOMP = $(WINDRES)')\n_p(' else')\n_p(' RESCOMP = windres')\n_p(' endif')\n_p('endif')\n_p('')\nend\nfunction premake.gmake_cpp_config(prj, cfg, cc)\n_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))\ncpp.platformtools(cfg, cc)\n_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))\n_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))\n_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))\n_p(' DEFINES +=%s', make.list(cc.getdefines(cfg.defines)))\n_p(' INCLUDES +=%s', make.list(cc.getincludedirs(cfg.includedirs)))\ncpp.pchconfig(cfg)\ncpp.flags(cfg, cc)\ncpp.linker(cfg, cc)\n_p(' OBJECTS := \\\\')\nfor _, fi" |
| 187 | 187 | "le in ipairs(prj.files) do\nif path.iscppfile(file) then\nlocal excluded = false\nfor _, exclude in ipairs(cfg.excludes) do\nexcluded = (exclude == file)\nif (excluded) then break end\nend\nif excluded == false then\n_p('\\t$(OBJDIR)/%s.o \\\\'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n)\nend\nend\nend\n_p('')\n_p(' define PREBUILDCMDS')\nif #cfg.prebuildcommands > 0 then\n_p('\\t@echo Running pre-build commands')\n_p('\\t%s', table.implode(cfg.prebuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define PRELINKCMDS')\nif #cfg.prelinkcommands > 0 then\n_p('\\t@echo Running pre-link commands')\n_p('\\t%s', table.implode(cfg.prelinkcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\n_p(' define POSTBUILDCMDS')\nif #cfg.postbuildcommands > 0 then\n_p('\\t@echo Running post-build commands')\n_p('\\t%s', table.implode(cfg.postbuildcommands, \"\", \"\", \"\\n\\t\"))\nend\n_p(' endef')\nmake.settings(cfg, cc)\n_p('endif')\n_p('')\nend\nfunction cpp.platformtools(cfg, cc)\nlocal platfor" |
| 188 | | "m = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,premake.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions_cpp)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resdefines),\n cc.getincludedir" |
| 189 | | "s(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(cfg, cc)\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nif cfg.kind == \"StaticLib\" then\nif cfg.platform:startswith(\"Universal\") then\n_p(' LINKCMD = libtool -o $(TARGET)')\nelse\nif cc.llvm then\n_p(' LINKCMD = $(AR) rcs $(TARGET)')\nelse\n_p(' LINKCMD = $(AR) -rcs $(TARGET)')\nend\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = path.getabsolute(path.join(cfg.project.location, incdir))\n" |
| 190 | | "local testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -MMD -MP $(DEFINES) $(INCLUDES) -o \"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj)\nfor _, file in ipairs(prj.files or {}) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\n_p('')\nelseif (path.getextension(file) == \".rc\") then\n_p('$(OB" |
| 191 | | "JDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.%s=%%.d) -c \"$<\"', flags, objext)\nend\n", |
| 188 | "m = cc.platforms[cfg.platform]\nif platform.cc then\n_p(' CC = %s', platform.cc)\nend\nif platform.cxx then\n_p(' CXX = %s', platform.cxx)\nend\nif platform.ar then\n_p(' AR = %s', platform.ar)\nend\nend\nfunction cpp.flags(cfg, cc)\nif cfg.pchheader and not cfg.flags.NoPCH then\n_p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))')\nend\nif #cfg.forcedincludes > 0 then\n_p(' FORCE_INCLUDE += -include %s'\n,premake.esc(table.concat(cfg.forcedincludes, \";\")))\nend\n_p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \"))\n_p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)))\n_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)))\n_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',\n make.list(table.join(cc.getdefines(cfg.resd" |
| 189 | "efines),\n cc.getincludedirs(cfg.resincludedirs), cfg.resoptions)))\nend\nfunction cpp.linker(cfg, cc)\n_p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions)))\n_p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \"siblings\", \"fullpath\"))))\n_p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg)))\nif cfg.kind == \"StaticLib\" then\nif cfg.platform:startswith(\"Universal\") then\n_p(' LINKCMD = libtool -o $(TARGET)')\nelse\nif cc.llvm then\n_p(' LINKCMD = $(AR) rcs $(TARGET)')\nelse\n_p(' LINKCMD = $(AR) -rcs $(TARGET)')\nend\nend\nelse\nlocal tool = iif(cfg.language == \"C\", \"CC\", \"CXX\")\n_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool)\nend\nend\nfunction cpp.pchconfig(cfg)\nif not cfg.pchheader or cfg.flags.NoPCH then\nreturn\nend\nlocal pch = cfg.pchheader\nfor _, incdir in ipairs(cfg.includedirs) do\nlocal abspath = p" |
| 190 | "ath.getabsolute(path.join(cfg.project.location, incdir))\nlocal testname = path.join(abspath, pch)\nif os.isfile(testname) then\npch = path.getrelative(cfg.location, testname)\nbreak\nend\nend\n_p(' PCH = %s', _MAKE.esc(pch))\n_p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch')\nend\nfunction cpp.pchrules(prj)\n_p('ifneq (,$(PCH))')\n_p('$(GCH): $(PCH)')\n_p('\\t@echo $(notdir $<)')\nlocal cmd = iif(prj.language == \"C\", \"$(CC) -x c-header $(ALL_CFLAGS)\", \"$(CXX) -x c++-header $(ALL_CXXFLAGS)\")\n_p('\\t$(SILENT) %s -MMD -MP $(DEFINES) $(INCLUDES) -o \"$@\" -MF \"$(@:%%.gch=%%.d)\" -c \"$<\"', cmd)\n_p('endif')\n_p('')\nend\nfunction cpp.fileRules(prj)\nfor _, file in ipairs(prj.files or {}) do\nif path.iscppfile(file) then\n_p('$(OBJDIR)/%s.o: %s'\n, _MAKE.esc(path.trimdots(path.removeext(file)))\n, _MAKE.esc(file)\n)\nif prj.msgcompile then\n_p('\\t@echo ' .. prj.msgcompile)\nelse\n_p('\\t@echo $(notdir $<)')\nend\ncpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \"o\")\n_p('')\n" |
| 191 | "elseif (path.getextension(file) == \".rc\") then\n_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))\nif prj.msgresource then\n_p('\\t@echo ' .. prj.msgresource)\nelse\n_p('\\t@echo $(notdir $<)')\nend\n_p('\\t$(SILENT) $(RESCOMP) $< -O coff -o \"$@\" $(ALL_RESFLAGS)')\n_p('')\nend\nend\nend\nfunction cpp.buildcommand(iscfile, objext)\nlocal flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')\n_p('\\t$(SILENT) %s $(FORCE_INCLUDE) -o \"$@\" -MF $(@:%%.%s=%%.d) -c \"$<\"', flags, objext)\nend\n", |
| 192 | 192 | |
| 193 | 193 | /* actions/make/make_csharp.lua */ |
| 194 | 194 | "local function getresourcefilename(cfg, fname)\nif path.getextension(fname) == \".resx\" then\n local name = cfg.buildtarget.basename .. \".\"\n local dir = path.getdirectory(fname)\n if dir ~= \".\" then \nname = name .. path.translate(dir, \".\") .. \".\"\nend\nreturn \"$(OBJDIR)/\" .. _MAKE.esc(name .. path.getbasename(fname)) .. \".resources\"\nelse\nreturn fname\nend\nend\nfunction premake.make_csharp(prj)\nlocal csc = premake.dotnet\nlocal cfglibs = { }\nlocal cfgpairs = { }\nlocal anycfg\nfor cfg in premake.eachconfig(prj) do\nanycfg = cfg\ncfglibs[cfg] = premake.getlinks(cfg, \"siblings\", \"fullpath\")\ncfgpairs[cfg] = { }\nfor _, fname in ipairs(cfglibs[cfg]) do\nif path.getdirectory(fname) ~= cfg.buildtarget.directory then\ncfgpairs[cfg][\"$(TARGETDIR)/\" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)\nend\nend\nend\nlocal sources = {}\nlocal embedded = { }\nlocal copypairs = { }\nfor fcfg in premake.project.eachfile(prj) do\nlocal action = csc.getbuildaction(fcfg)\nif action == \"Co" |