diff --git a/3rdparty/bgfx/.editorconfig b/3rdparty/bgfx/.editorconfig index e9070240b79..f39662686c0 100644 --- a/3rdparty/bgfx/.editorconfig +++ b/3rdparty/bgfx/.editorconfig @@ -8,6 +8,9 @@ max_line_length = 100 insert_final_newline = true trim_trailing_whitespace = true +[*.c99.h] +indent_style = space + [*.md] trim_trailing_whitespace = false max_line_length = 80 diff --git a/3rdparty/bgfx/3rdparty/stb/stb_image.c b/3rdparty/bgfx/3rdparty/stb/stb_image.c index 1eadb99b12a..faa463732e8 100644 --- a/3rdparty/bgfx/3rdparty/stb/stb_image.c +++ b/3rdparty/bgfx/3rdparty/stb/stb_image.c @@ -187,10 +187,15 @@ #ifndef STBI_NO_STDIO -#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS // suppress warnings about fopen() -#pragma warning(push) -#pragma warning(disable:4996) // suppress even more warnings about fopen() +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# if !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS // suppress warnings about fopen() +# endif +# pragma warning(push) +# pragma warning(disable:4996) // suppress even more warnings about fopen() +# pragma warning(disable:4312) // warning C4312: 'type cast': conversion from 'int' to 'unsigned char *' of greater size +# pragma warning(disable:4456) // warning C4456: declaration of 'k' hides previous local declaration +# pragma warning(disable:4457) // warning C4457: declaration of 'y' hides function parameter #endif #include #endif // STBI_NO_STDIO diff --git a/3rdparty/bgfx/examples/08-update/update.cpp b/3rdparty/bgfx/examples/08-update/update.cpp index 4c021e23a35..38486b9b3e3 100644 --- a/3rdparty/bgfx/examples/08-update/update.cpp +++ b/3rdparty/bgfx/examples/08-update/update.cpp @@ -292,8 +292,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) for (uint32_t ii = 0, num = bx::uint32_min(10, (uint32_t)quads.size() ); ii < num; ++ii) { - const PackCube& face = quads.front(); - cube.clear(face); + cube.clear(quads.front() ); quads.pop_front(); } } diff --git a/3rdparty/bgfx/examples/12-lod/lod.cpp b/3rdparty/bgfx/examples/12-lod/lod.cpp index a8bdf4dd8c8..7317c8488c7 100644 --- a/3rdparty/bgfx/examples/12-lod/lod.cpp +++ b/3rdparty/bgfx/examples/12-lod/lod.cpp @@ -20,7 +20,7 @@ KnightPos knightTour[8*4] = {0,0}, {1,2}, {3,3}, {4,1}, {5,3}, {7,2}, {6,0}, {5,2}, {7,3}, {6,1}, {4,0}, {3,2}, {2,0}, {0,1}, {1,3}, {2,1}, {0,2}, {1,0}, {2,2}, {0,3}, {1,1}, {3,0}, {4,2}, {5,0}, - {7,1}, {6,3}, {5,1}, {7,0}, {6,2}, {4,3}, {3,1}, {2,3} + {7,1}, {6,3}, {5,1}, {7,0}, {6,2}, {4,3}, {3,1}, {2,3}, }; int _main_(int /*_argc*/, char** /*_argv*/) @@ -55,15 +55,19 @@ int _main_(int /*_argc*/, char** /*_argv*/) bgfx::TextureHandle textureStipple; - const bgfx::Memory* stipple = bgfx::alloc(8*4); - memset(stipple->data, 0, stipple->size); + const bgfx::Memory* stippleTex = bgfx::alloc(8*4); + memset(stippleTex->data, 0, stippleTex->size); for (uint32_t ii = 0; ii < 32; ++ii) { - stipple->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4; + stippleTex->data[knightTour[ii].m_y * 8 + knightTour[ii].m_x] = ii*4; } - textureStipple = bgfx::createTexture2D(8, 4, 1, bgfx::TextureFormat::R8, BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT, stipple); + textureStipple = bgfx::createTexture2D(8, 4, 1 + , bgfx::TextureFormat::R8 + , BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT + , stippleTex + ); Mesh* meshTop[3] = { diff --git a/3rdparty/bgfx/examples/13-stencil/stencil.cpp b/3rdparty/bgfx/examples/13-stencil/stencil.cpp index f79b0e569e5..3b869b5c5f3 100644 --- a/3rdparty/bgfx/examples/13-stencil/stencil.cpp +++ b/3rdparty/bgfx/examples/13-stencil/stencil.cpp @@ -1319,10 +1319,10 @@ int _main_(int /*_argc*/, char** /*_argv*/) ); // Cubes. - for (uint8_t ii = 0; ii < numCubes; ++ii) + for (uint8_t jj = 0; jj < numCubes; ++jj) { cubeMesh.submit(viewId - , cubeMtx[ii] + , cubeMtx[jj] , programTextureLightning , s_renderStates[RenderState::ProjectionShadows_DrawDiffuse] , figureTex diff --git a/3rdparty/bgfx/examples/20-nanovg/blendish.h b/3rdparty/bgfx/examples/20-nanovg/blendish.h index 43258e040e1..1afb1f5d0ed 100644 --- a/3rdparty/bgfx/examples/20-nanovg/blendish.h +++ b/3rdparty/bgfx/examples/20-nanovg/blendish.h @@ -1109,6 +1109,7 @@ BND_EXPORT NVGcolor bndNodeWireColor(const BNDnodeTheme *theme, BNDwidgetState s #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings #pragma warning (disable: 4244) #pragma warning (disable: 4305) + #pragma warning (disable: 4838) // warning C4838: conversion from 'double' to 'float' requires a narrowing conversion #ifdef __cplusplus #define BND_INLINE inline #else diff --git a/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp b/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp index 14cd6fbd9d6..2b30ef39e7b 100644 --- a/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp +++ b/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp @@ -1042,10 +1042,10 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h for (j = 0; j < nglyphs; j++) { float x0 = glyphs[j].x; float x1 = (j+1 < nglyphs) ? glyphs[j+1].x : x+row->width; - float gx = x0 * 0.3f + x1 * 0.7f; - if (mx >= px && mx < gx) + float tgx = x0 * 0.3f + x1 * 0.7f; + if (mx >= px && mx < tgx) caretx = glyphs[j].x; - px = gx; + px = tgx; } nvgBeginPath(vg); nvgFillColor(vg, nvgRGBA(255,192,0,255)); diff --git a/3rdparty/bgfx/examples/24-nbody/nbody.cpp b/3rdparty/bgfx/examples/24-nbody/nbody.cpp index 36a98e97862..b006f0b1315 100644 --- a/3rdparty/bgfx/examples/24-nbody/nbody.cpp +++ b/3rdparty/bgfx/examples/24-nbody/nbody.cpp @@ -117,211 +117,238 @@ int _main_(int /*_argc*/, char** /*_argv*/) , 0 ); - // Imgui. - imguiCreate(); + const bgfx::Caps* caps = bgfx::getCaps(); + const bool computeSupported = !!(caps->supported & BGFX_CAPS_COMPUTE); - bgfx::VertexDecl quadVertexDecl; - quadVertexDecl.begin() - .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) - .end(); - - // Create static vertex buffer. - bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer( - // Static data can be passed with bgfx::makeRef - bgfx::makeRef(s_quadVertices, sizeof(s_quadVertices) ) - , quadVertexDecl - ); - - // Create static index buffer. - bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer( - // Static data can be passed with bgfx::makeRef - bgfx::makeRef(s_quadIndices, sizeof(s_quadIndices) ) - ); - - // Create particle program from shaders. - bgfx::ProgramHandle particleProgram = loadProgram("vs_particle", "fs_particle"); - - // Setup compute buffers - bgfx::VertexDecl computeVertexDecl; - computeVertexDecl.begin() - .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float) - .end(); - - const uint32_t threadGroupUpdateSize = 512; - const uint32_t maxParticleCount = 32 * 1024; - - bgfx::DynamicVertexBufferHandle currPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); - bgfx::DynamicVertexBufferHandle currPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); - bgfx::DynamicVertexBufferHandle prevPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); - bgfx::DynamicVertexBufferHandle prevPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); - - bgfx::UniformHandle u_params = bgfx::createUniform("u_params", bgfx::UniformType::Uniform4fv, 3); - - bgfx::ShaderHandle initInstancesShader = loadShader("cs_init_instances"); - bgfx::ProgramHandle initInstancesProgram = bgfx::createProgram(initInstancesShader, true); - bgfx::ShaderHandle updateInstancesShader = loadShader("cs_update_instances"); - bgfx::ProgramHandle updateInstancesProgram = bgfx::createProgram(updateInstancesShader, true); - - u_paramsDataStruct u_paramsData; - InitializeParams(0, &u_paramsData); - - bgfx::setUniform(u_params, &u_paramsData, 3); - bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write); - bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write); - bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1); - - float view[16]; - float initialPos[3] = { 0.0f, 0.0f, -45.0f }; - cameraCreate(); - cameraSetPosition(initialPos); - cameraSetVerticalAngle(0.0f); - cameraGetViewMtx(view); - - int32_t scrollArea = 0; - - entry::MouseState mouseState; - while (!entry::processEvents(width, height, debug, reset, &mouseState) ) + if (computeSupported) { - int64_t now = bx::getHPCounter(); - static int64_t last = now; - const int64_t frameTime = now - last; - last = now; - const double freq = double(bx::getHPFrequency() ); - const float deltaTime = float(frameTime/freq); + // Imgui. + imguiCreate(); - // Set view 0 default viewport. - bgfx::setViewRect(0, 0, 0, width, height); + bgfx::VertexDecl quadVertexDecl; + quadVertexDecl.begin() + .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) + .end(); - // Use debug font to print information about this example. - bgfx::dbgTextClear(); - bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody"); - bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers."); + // Create static vertex buffer. + bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer( + // Static data can be passed with bgfx::makeRef + bgfx::makeRef(s_quadVertices, sizeof(s_quadVertices) ) + , quadVertexDecl + ); - imguiBeginFrame(mouseState.m_mx - , mouseState.m_my - , (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) - | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) - , 0 - , width - , height - ); - imguiBeginScrollArea("Settings", width - width / 4 - 10, 10, width / 4, 500, &scrollArea); - imguiSlider("Random seed", u_paramsData.baseSeed, 0, 100); - int32_t shape = imguiChoose(u_paramsData.initialShape, "Point", "Sphere", "Box", "Donut"); - imguiSlider("Initial speed", u_paramsData.initialSpeed, 0.0f, 300.0f, 0.1f); - bool reset = imguiButton("Reset"); - imguiSeparatorLine(); - imguiSlider("Particle count (x512)", u_paramsData.dispatchSize, 1, 64); - imguiSlider("Gravity", u_paramsData.gravity, 0.0f, 0.3f, 0.001f); - imguiSlider("Damping", u_paramsData.damping, 0.0f, 1.0f, 0.01f); - imguiSlider("Max acceleration", u_paramsData.maxAccel, 0.0f, 100.0f, 0.01f); - imguiSlider("Time step", u_paramsData.timeStep, 0.0f, 0.02f, 0.0001f); - imguiSeparatorLine(); - imguiSlider("Particle intensity", u_paramsData.particleIntensity, 0.0f, 1.0f, 0.001f); - imguiSlider("Particle size", u_paramsData.particleSize, 0.0f, 1.0f, 0.001f); - imguiSlider("Particle power", u_paramsData.particlePower, 0.001f, 16.0f, 0.01f); - imguiEndScrollArea(); - imguiEndFrame(); + // Create static index buffer. + bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer( + // Static data can be passed with bgfx::makeRef + bgfx::makeRef(s_quadIndices, sizeof(s_quadIndices) ) + ); - // Modify parameters and reset if shape is changed - if (shape != u_paramsData.initialShape) - { - reset = true; - InitializeParams(shape, &u_paramsData); - } + // Create particle program from shaders. + bgfx::ProgramHandle particleProgram = loadProgram("vs_particle", "fs_particle"); - if (reset) - { - bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write); - bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write); - bgfx::setUniform(u_params, &u_paramsData, 3); - bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1); - } + // Setup compute buffers + bgfx::VertexDecl computeVertexDecl; + computeVertexDecl.begin() + .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float) + .end(); + + const uint32_t threadGroupUpdateSize = 512; + const uint32_t maxParticleCount = 32 * 1024; + + bgfx::DynamicVertexBufferHandle currPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); + bgfx::DynamicVertexBufferHandle currPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); + bgfx::DynamicVertexBufferHandle prevPositionBuffer0 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); + bgfx::DynamicVertexBufferHandle prevPositionBuffer1 = bgfx::createDynamicVertexBuffer(1 << 15, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ_WRITE); + + bgfx::UniformHandle u_params = bgfx::createUniform("u_params", bgfx::UniformType::Uniform4fv, 3); + + bgfx::ShaderHandle initInstancesShader = loadShader("cs_init_instances"); + bgfx::ProgramHandle initInstancesProgram = bgfx::createProgram(initInstancesShader, true); + bgfx::ShaderHandle updateInstancesShader = loadShader("cs_update_instances"); + bgfx::ProgramHandle updateInstancesProgram = bgfx::createProgram(updateInstancesShader, true); + + u_paramsDataStruct u_paramsData; + InitializeParams(0, &u_paramsData); - bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Read); - bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Read); - bgfx::setBuffer(2, prevPositionBuffer1, bgfx::Access::Write); - bgfx::setBuffer(3, currPositionBuffer1, bgfx::Access::Write); bgfx::setUniform(u_params, &u_paramsData, 3); - bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1); - - bx::xchg(currPositionBuffer0, currPositionBuffer1); - bx::xchg(prevPositionBuffer0, prevPositionBuffer1); + bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write); + bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write); + bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1); float view[16]; - - // Update camera. - cameraUpdate(deltaTime, mouseState); + float initialPos[3] = { 0.0f, 0.0f, -45.0f }; + cameraCreate(); + cameraSetPosition(initialPos); + cameraSetVerticalAngle(0.0f); cameraGetViewMtx(view); - // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd) + int32_t scrollArea = 0; + + entry::MouseState mouseState; + while (!entry::processEvents(width, height, debug, reset, &mouseState) ) { - float viewHead[16]; - float eye[3] = {}; - bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye); - - float tmp[16]; - bx::mtxMul(tmp, view, viewHead); - - float proj[16]; - bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 10000.0f); - - bgfx::setViewTransform(0, tmp, proj); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else - { - float proj[16]; - bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f); - bgfx::setViewTransform(0, view, proj); + int64_t now = bx::getHPCounter(); + static int64_t last = now; + const int64_t frameTime = now - last; + last = now; + const double freq = double(bx::getHPFrequency() ); + const float deltaTime = float(frameTime/freq); // Set view 0 default viewport. bgfx::setViewRect(0, 0, 0, width, height); + + // Use debug font to print information about this example. + bgfx::dbgTextClear(); + bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody"); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers."); + + imguiBeginFrame(mouseState.m_mx + , mouseState.m_my + , (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) + | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) + , 0 + , width + , height + ); + imguiBeginScrollArea("Settings", width - width / 4 - 10, 10, width / 4, 500, &scrollArea); + imguiSlider("Random seed", u_paramsData.baseSeed, 0, 100); + int32_t shape = imguiChoose(u_paramsData.initialShape, "Point", "Sphere", "Box", "Donut"); + imguiSlider("Initial speed", u_paramsData.initialSpeed, 0.0f, 300.0f, 0.1f); + bool defaults = imguiButton("Reset"); + imguiSeparatorLine(); + imguiSlider("Particle count (x512)", u_paramsData.dispatchSize, 1, 64); + imguiSlider("Gravity", u_paramsData.gravity, 0.0f, 0.3f, 0.001f); + imguiSlider("Damping", u_paramsData.damping, 0.0f, 1.0f, 0.01f); + imguiSlider("Max acceleration", u_paramsData.maxAccel, 0.0f, 100.0f, 0.01f); + imguiSlider("Time step", u_paramsData.timeStep, 0.0f, 0.02f, 0.0001f); + imguiSeparatorLine(); + imguiSlider("Particle intensity", u_paramsData.particleIntensity, 0.0f, 1.0f, 0.001f); + imguiSlider("Particle size", u_paramsData.particleSize, 0.0f, 1.0f, 0.001f); + imguiSlider("Particle power", u_paramsData.particlePower, 0.001f, 16.0f, 0.01f); + imguiEndScrollArea(); + imguiEndFrame(); + + // Modify parameters and reset if shape is changed + if (shape != u_paramsData.initialShape) + { + defaults = true; + InitializeParams(shape, &u_paramsData); + } + + if (defaults) + { + bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Write); + bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Write); + bgfx::setUniform(u_params, &u_paramsData, 3); + bgfx::dispatch(0, initInstancesProgram, maxParticleCount / threadGroupUpdateSize, 1, 1); + } + + bgfx::setBuffer(0, prevPositionBuffer0, bgfx::Access::Read); + bgfx::setBuffer(1, currPositionBuffer0, bgfx::Access::Read); + bgfx::setBuffer(2, prevPositionBuffer1, bgfx::Access::Write); + bgfx::setBuffer(3, currPositionBuffer1, bgfx::Access::Write); + bgfx::setUniform(u_params, &u_paramsData, 3); + bgfx::dispatch(0, updateInstancesProgram, u_paramsData.dispatchSize, 1, 1); + + bx::xchg(currPositionBuffer0, currPositionBuffer1); + bx::xchg(prevPositionBuffer0, prevPositionBuffer1); + + // Update camera. + cameraUpdate(deltaTime, mouseState); + cameraGetViewMtx(view); + + // Set view and projection matrix for view 0. + const bgfx::HMD* hmd = bgfx::getHMD(); + if (NULL != hmd) + { + float viewHead[16]; + float eye[3] = {}; + bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye); + + float tmp[16]; + bx::mtxMul(tmp, view, viewHead); + + float proj[16]; + bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 10000.0f); + + bgfx::setViewTransform(0, tmp, proj); + + // Set view 0 default viewport. + // + // Use HMD's width/height since HMD's internal frame buffer size + // might be much larger than window size. + bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); + } + else + { + float proj[16]; + bx::mtxProj(proj, 90.0f, float(width)/float(height), 0.1f, 10000.0f); + bgfx::setViewTransform(0, view, proj); + + // Set view 0 default viewport. + bgfx::setViewRect(0, 0, 0, width, height); + } + + // Set vertex and fragment shaders. + bgfx::setProgram(particleProgram); + + // Set vertex and index buffer. + bgfx::setVertexBuffer(vbh); + bgfx::setIndexBuffer(ibh); + bgfx::setInstanceDataBuffer(currPositionBuffer0, 0, u_paramsData.dispatchSize * threadGroupUpdateSize); + + // Set render states. + bgfx::setState(0 + | BGFX_STATE_RGB_WRITE + | BGFX_STATE_BLEND_ADD + | BGFX_STATE_DEPTH_TEST_ALWAYS + ); + + // Submit primitive for rendering to view 0. + bgfx::submit(0); + + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); } - // Set vertex and fragment shaders. - bgfx::setProgram(particleProgram); - - // Set vertex and index buffer. - bgfx::setVertexBuffer(vbh); - bgfx::setIndexBuffer(ibh); - bgfx::setInstanceDataBuffer(currPositionBuffer0, 0, u_paramsData.dispatchSize * threadGroupUpdateSize); - - // Set render states. - bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_BLEND_ADD - | BGFX_STATE_DEPTH_TEST_ALWAYS - ); - - // Submit primitive for rendering to view 0. - bgfx::submit(0); - - // Advance to next frame. Rendering thread will be kicked to - // process submitted rendering primitives. - bgfx::frame(); + // Cleanup. + cameraDestroy(); + imguiDestroy(); + bgfx::destroyUniform(u_params); + bgfx::destroyDynamicVertexBuffer(currPositionBuffer0); + bgfx::destroyDynamicVertexBuffer(currPositionBuffer1); + bgfx::destroyDynamicVertexBuffer(prevPositionBuffer0); + bgfx::destroyDynamicVertexBuffer(prevPositionBuffer1); + bgfx::destroyProgram(updateInstancesProgram); + bgfx::destroyProgram(initInstancesProgram); + bgfx::destroyIndexBuffer(ibh); + bgfx::destroyVertexBuffer(vbh); + bgfx::destroyProgram(particleProgram); } + else + { + int64_t timeOffset = bx::getHPCounter(); - // Cleanup. - cameraDestroy(); - imguiDestroy(); - bgfx::destroyUniform(u_params); - bgfx::destroyDynamicVertexBuffer(currPositionBuffer0); - bgfx::destroyDynamicVertexBuffer(currPositionBuffer1); - bgfx::destroyDynamicVertexBuffer(prevPositionBuffer0); - bgfx::destroyDynamicVertexBuffer(prevPositionBuffer1); - bgfx::destroyProgram(updateInstancesProgram); - bgfx::destroyProgram(initInstancesProgram); - bgfx::destroyIndexBuffer(ibh); - bgfx::destroyVertexBuffer(vbh); - bgfx::destroyProgram(particleProgram); + entry::MouseState mouseState; + while (!entry::processEvents(width, height, debug, reset, &mouseState) ) + { + int64_t now = bx::getHPCounter(); + float time = (float)( (now - timeOffset)/double(bx::getHPFrequency() ) ); + + bgfx::setViewRect(0, 0, 0, width, height); + + bgfx::dbgTextClear(); + bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/24-nbody"); + bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: N-body simulation with compute shaders using buffers."); + + bool blink = uint32_t(time*3.0f)&1; + bgfx::dbgTextPrintf(0, 5, blink ? 0x1f : 0x01, " Compute is not supported by GPU. "); + + bgfx::submit(0); + bgfx::frame(); + } + } // Shutdown bgfx. bgfx::shutdown(); diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index 1e388516065..453b8d9b9e0 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -1352,7 +1352,8 @@ namespace bgfx { namespace gl if (BX_ENABLED(BX_PLATFORM_NACL) ) { - m_vaoSupport &= NULL != glGenVertexArrays + m_vaoSupport &= true + && NULL != glGenVertexArrays && NULL != glDeleteVertexArrays && NULL != glBindVertexArray ; @@ -1399,6 +1400,8 @@ namespace bgfx { namespace gl || s_extension[Extension::EXT_timer_query ].m_supported ; + m_timerQuerySupport &= NULL != glGetQueryObjectui64v; + g_caps.supported |= m_depthTextureSupport ? BGFX_CAPS_TEXTURE_COMPARE_LEQUAL : 0 diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index 4f6f58da00c..8221d94a641 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -40,8 +40,9 @@ function toolchain(_buildDir, _libDir) allowed = { { "vs2012-clang", "Clang 3.6" }, { "vs2013-clang", "Clang 3.6" }, - { "vs2012-xp", "Visual Studio 2012 targeting XP" }, - { "vs2013-xp", "Visual Studio 2013 targeting XP" }, + { "vs2012-xp", "Visual Studio 2012 targeting XP" }, + { "vs2013-xp", "Visual Studio 2013 targeting XP" }, + { "vs2015-xp", "Visual Studio 2015 targeting XP" }, { "winphone8", "Windows Phone 8.0" }, { "winphone81", "Windows Phone 8.1" }, }, @@ -110,9 +111,8 @@ function toolchain(_buildDir, _libDir) premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++" premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar" location (path.join(_buildDir, "projects", _ACTION .. "-android-arm")) - end - if "android-mips" == _OPTIONS["gcc"] then + elseif "android-mips" == _OPTIONS["gcc"] then if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_ROOT") then print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.") @@ -122,9 +122,8 @@ function toolchain(_buildDir, _libDir) premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++" premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar" location (path.join(_buildDir, "projects", _ACTION .. "-android-mips")) - end - if "android-x86" == _OPTIONS["gcc"] then + elseif "android-x86" == _OPTIONS["gcc"] then if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_ROOT") then print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.") @@ -134,9 +133,8 @@ function toolchain(_buildDir, _libDir) premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++" premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar" location (path.join(_buildDir, "projects", _ACTION .. "-android-x86")) - end - if "asmjs" == _OPTIONS["gcc"] then + elseif "asmjs" == _OPTIONS["gcc"] then if not os.getenv("EMSCRIPTEN") then print("Set EMSCRIPTEN enviroment variables.") @@ -147,54 +145,46 @@ function toolchain(_buildDir, _libDir) premake.gcc.ar = "$(EMSCRIPTEN)/emar" premake.gcc.llvm = true location (path.join(_buildDir, "projects", _ACTION .. "-asmjs")) - end - if "freebsd" == _OPTIONS["gcc"] then + elseif "freebsd" == _OPTIONS["gcc"] then location (path.join(_buildDir, "projects", _ACTION .. "-freebsd")) - end - if "ios-arm" == _OPTIONS["gcc"] then + elseif "ios-arm" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm")) - end - if "ios-simulator" == _OPTIONS["gcc"] then + elseif "ios-simulator" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" premake.gcc.ar = "ar" location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator")) - end - if "linux-gcc" == _OPTIONS["gcc"] then + elseif "linux-gcc" == _OPTIONS["gcc"] then location (path.join(_buildDir, "projects", _ACTION .. "-linux")) - end - if "linux-clang" == _OPTIONS["gcc"] then + elseif "linux-clang" == _OPTIONS["gcc"] then premake.gcc.cc = "clang" premake.gcc.cxx = "clang++" premake.gcc.ar = "ar" location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang")) - end - if "mingw-gcc" == _OPTIONS["gcc"] then + elseif "mingw-gcc" == _OPTIONS["gcc"] then premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc" premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++" premake.gcc.ar = "$(MINGW)/bin/ar" location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc")) - end - if "mingw-clang" == _OPTIONS["gcc"] then + elseif "mingw-clang" == _OPTIONS["gcc"] then premake.gcc.cc = "$(CLANG)/bin/clang" premake.gcc.cxx = "$(CLANG)/bin/clang++" premake.gcc.ar = "$(MINGW)/bin/ar" -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar" -- premake.gcc.llvm = true location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang")) - end - if "nacl" == _OPTIONS["gcc"] then + elseif "nacl" == _OPTIONS["gcc"] then if not os.getenv("NACL_SDK_ROOT") then print("Set NACL_SDK_ROOT enviroment variables.") @@ -211,9 +201,8 @@ function toolchain(_buildDir, _libDir) premake.gcc.cxx = naclToolchain .. "g++" premake.gcc.ar = naclToolchain .. "ar" location (path.join(_buildDir, "projects", _ACTION .. "-nacl")) - end - if "nacl-arm" == _OPTIONS["gcc"] then + elseif "nacl-arm" == _OPTIONS["gcc"] then if not os.getenv("NACL_SDK_ROOT") then print("Set NACL_SDK_ROOT enviroment variables.") @@ -230,9 +219,9 @@ function toolchain(_buildDir, _libDir) premake.gcc.cxx = naclToolchain .. "g++" premake.gcc.ar = naclToolchain .. "ar" location (path.join(_buildDir, "projects", _ACTION .. "-nacl-arm")) - end - if "osx" == _OPTIONS["gcc"] then + elseif "osx" == _OPTIONS["gcc"] then + if os.is("linux") then local osxToolchain = "x86_64-apple-darwin13-" premake.gcc.cc = osxToolchain .. "clang" @@ -240,9 +229,8 @@ function toolchain(_buildDir, _libDir) premake.gcc.ar = osxToolchain .. "ar" end location (path.join(_buildDir, "projects", _ACTION .. "-osx")) - end - if "pnacl" == _OPTIONS["gcc"] then + elseif "pnacl" == _OPTIONS["gcc"] then if not os.getenv("NACL_SDK_ROOT") then print("Set NACL_SDK_ROOT enviroment variables.") @@ -259,9 +247,8 @@ function toolchain(_buildDir, _libDir) premake.gcc.cxx = naclToolchain .. "clang++" premake.gcc.ar = naclToolchain .. "ar" location (path.join(_buildDir, "projects", _ACTION .. "-pnacl")) - end - if "qnx-arm" == _OPTIONS["gcc"] then + elseif "qnx-arm" == _OPTIONS["gcc"] then if not os.getenv("QNX_HOST") then print("Set QNX_HOST enviroment variables.") @@ -271,9 +258,8 @@ function toolchain(_buildDir, _libDir) premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++" premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar" location (path.join(_buildDir, "projects", _ACTION .. "-qnx-arm")) - end - if "rpi" == _OPTIONS["gcc"] then + elseif "rpi" == _OPTIONS["gcc"] then location (path.join(_buildDir, "projects", _ACTION .. "-rpi")) end elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then @@ -281,27 +267,27 @@ function toolchain(_buildDir, _libDir) if (_ACTION .. "-clang") == _OPTIONS["vs"] then premake.vstudio.toolset = ("LLVM-" .. _ACTION) location (path.join(_buildDir, "projects", _ACTION .. "-clang")) - end - if "winphone8" == _OPTIONS["vs"] then + elseif "winphone8" == _OPTIONS["vs"] then premake.vstudio.toolset = "v110_wp80" location (path.join(_buildDir, "projects", _ACTION .. "-winphone8")) - end - if "winphone81" == _OPTIONS["vs"] then + elseif "winphone81" == _OPTIONS["vs"] then premake.vstudio.toolset = "v120_wp81" platforms { "ARM" } location (path.join(_buildDir, "projects", _ACTION .. "-winphone81")) - end - if ("vs2012-xp") == _OPTIONS["vs"] then + elseif ("vs2012-xp") == _OPTIONS["vs"] then premake.vstudio.toolset = ("v110_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) - end - if ("vs2013-xp") == _OPTIONS["vs"] then + elseif ("vs2013-xp") == _OPTIONS["vs"] then premake.vstudio.toolset = ("v120_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) + + elseif ("vs2015-xp") == _OPTIONS["vs"] then + premake.vstudio.toolset = ("v140_xp") + location (path.join(_buildDir, "projects", _ACTION .. "-xp")) end elseif _ACTION == "xcode4" then @@ -309,8 +295,8 @@ function toolchain(_buildDir, _libDir) if "osx" == _OPTIONS["xcode"] then premake.xcode.toolset = "macosx" location (path.join(_buildDir, "projects", _ACTION .. "-osx")) - end - if "ios" == _OPTIONS["xcode"] then + + elseif "ios" == _OPTIONS["xcode"] then premake.xcode.toolset = "iphoneos" location (path.join(_buildDir, "projects", _ACTION .. "-ios")) end @@ -760,7 +746,7 @@ function toolchain(_buildDir, _libDir) configuration { "osx", "x32" } targetdir (path.join(_buildDir, "osx32_clang/bin")) objdir (path.join(_buildDir, "osx32_clang/obj")) - libdirs { path.join(_libDir, "lib/osx32_clang") } + --libdirs { path.join(_libDir, "lib/osx32_clang") } buildoptions { "-m32", } @@ -768,7 +754,7 @@ function toolchain(_buildDir, _libDir) configuration { "osx", "x64" } targetdir (path.join(_buildDir, "osx64_clang/bin")) objdir (path.join(_buildDir, "osx64_clang/obj")) - libdirs { path.join(_libDir, "lib/osx64_clang") } + --libdirs { path.join(_libDir, "lib/osx64_clang") } buildoptions { "-m64", } diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie index def737c88d0..6a87e019ef2 100644 Binary files a/3rdparty/bx/tools/bin/darwin/genie and b/3rdparty/bx/tools/bin/darwin/genie differ diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie index 7fee2135730..057e0249710 100644 Binary files a/3rdparty/bx/tools/bin/linux/genie and b/3rdparty/bx/tools/bin/linux/genie differ diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe index 41209789d9f..d4b655cc846 100644 Binary files a/3rdparty/bx/tools/bin/windows/genie.exe and b/3rdparty/bx/tools/bin/windows/genie.exe differ diff --git a/3rdparty/genie/README.md b/3rdparty/genie/README.md index b3707e44b84..7282d91a701 100644 --- a/3rdparty/genie/README.md +++ b/3rdparty/genie/README.md @@ -14,7 +14,7 @@ Supported project generators: Download (stable) ----------------- - version 252 (commit 845287a25534f752aeb1d845a1208e54b8820be7) + version 257 (commit 77931cf939ad4ec1bacb1fe92045012fd1e25eba) Linux: https://github.com/bkaradzic/bx/raw/master/tools/bin/linux/genie diff --git a/3rdparty/genie/src/base/api.lua b/3rdparty/genie/src/base/api.lua index 70b63b85808..5b53c818284 100644 --- a/3rdparty/genie/src/base/api.lua +++ b/3rdparty/genie/src/base/api.lua @@ -134,7 +134,6 @@ FatalWarnings = 1, FloatFast = 1, FloatStrict = 1, - IgnoreLDFlags = 1, Managed = 1, MFC = 1, NativeWChar = 1, diff --git a/3rdparty/genie/src/host/scripts.c b/3rdparty/genie/src/host/scripts.c index 283d1db5bda..85cadb1f9f1 100644 --- a/3rdparty/genie/src/host/scripts.c +++ b/3rdparty/genie/src/host/scripts.c @@ -81,21 +81,21 @@ const char* builtin_scripts[] = { /* base/api.lua */ "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},\nbuildoptions_objc =\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},\nremovefiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind = \"list\",\nscope = \"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,\nIgnoreLDFlags = 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 = 'opt" - "imizespeed',\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,\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 = \"str" - "ing\",\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 = \"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},\nmsgcompile_objc =\n{\nkind = \"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{\nkind = \"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) ~= \"-\") 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}\npremake.check_paths = false\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.CurrentContain" - "er\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\"\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 ma" - "keabsolute(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\nlocal arr = matchfunc(value);\nif (premake.check_paths) and (#arr == 0) then\nerror(\"Can't find matching files for pattern :\" .. value)\nend\nmakeabsolute(arr, depth + 1)\nelse\ntable.insert(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 = 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 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\"\nor info.kind == \"dirlist\"\nor info.kind == \"filelist\"\nor " - "info.kind == \"absolutefilelist\"\nthen\nif name ~= \"removefiles\"\nand name ~= \"files\" then\n_G[\"remove\"..name] = function(value)\npremake.remove(name, value)\nend\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 = { }\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(gro" - "up.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 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.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\nif((not sln.projects[name]) or\n((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then\npremake.CurrentContainer = createproject(name, sln, true)\nelse\npremake.CurrentContainer = iff(sln.projects[name].usage,\nsln.projects[name], sln.projects[name].usageProj)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction project(name)\nif (not name) then\nif(type(premake.CurrentContainer) ~= \"project\") t" - "hen return nil end\nif(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) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\nif((not sln.projects[name]) or sln.projects[name].usage) then\npremake.CurrentContainer = createproject(name, sln)\nelse\npremake.CurrentContainer = sln.projects[name];\nend\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 pre" - "make.CurrentGroup\nend\npremake.CurrentGroup = name\nreturn premake.CurrentGroup\nend\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npremake.option.add(opt)\nend\n", + "\",\nscope = \"config\",\n},\nremovefiles =\n{\nkind = \"filelist\",\nscope = \"config\",\n},\nflags =\n{\nkind = \"list\",\nscope = \"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}\nloc" + "al 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,\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 = \"co" + "nfig\",\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 = \"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},\nmsgcompile_objc =\n{\nkind = \"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},\npostbuildcomman" + "ds =\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\",\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: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}\npremake.check_paths = false\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\"\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, dep" + "th)\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\nlocal arr = matchfunc(value);\nif (premake.check_paths) and (#arr == 0) then\nerror(\"Can't find matching files for pattern :\" .. value)\nend\nmakeabsolute(arr, depth + 1)\nelse\ntable.insert(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[fiel" + "dname] = {}\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) 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.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\"\nor info.kind == \"dirlist\"\nor info.kind == \"filelist\"\nor info.kind == \"absolu" + "tefilelist\"\nthen\nif name ~= \"removefiles\"\nand name ~= \"files\" then\n_G[\"remove\"..name] = function(value)\npremake.remove(name, value)\nend\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 = { }\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.paren" + "t = 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 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.CurrentContainer.solution\nelse\nsln = premake.CurrentContainer\nend\nif (type(sln) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\nif((not sln.projects[name]) or\n((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then\npremake.CurrentContainer = createproject(name, sln, true)\nelse\npremake.CurrentContainer = iff(sln.projects[name].usage,\nsln.projects[name], sln.projects[name].usageProj)\nend\nconfiguration { }\nreturn premake.CurrentContainer\nend\nfunction project(name)\nif (not name) then\nif(type(premake.CurrentContainer) ~= \"project\") then return nil end\ni" + "f(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) ~= \"solution\") then\nerror(\"no active solution\", 2)\nend\nif((not sln.projects[name]) or sln.projects[name].usage) then\npremake.CurrentContainer = createproject(name, sln)\nelse\npremake.CurrentContainer = sln.projects[name];\nend\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\nen" + "d\npremake.CurrentGroup = name\nreturn premake.CurrentGroup\nend\nfunction newaction(a)\npremake.action.add(a)\nend\nfunction newoption(opt)\npremake.option.add(opt)\nend\n", /* base/cmdline.lua */ "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{" @@ -115,10 +115,10 @@ const char* builtin_scripts[] = { "gs(cfg)\nlocal result = table.translate(cfg.flags, flags)\nreturn result\nend\nfunction premake.dotnet.getkind(cfg)\nif (cfg.kind == \"ConsoleApp\") then\nreturn \"Exe\"\nelseif (cfg.kind == \"WindowedApp\") then\nreturn \"WinExe\"\nelseif (cfg.kind == \"SharedLib\") then\nreturn \"Library\"\nend\nend", /* tools/gcc.lua */ - "premake.gcc = { }\npremake.gcc.cc = \"gcc\"\npremake.gcc.cxx = \"g++\"\npremake.gcc.ar = \"ar\"\npremake.gcc.llvm = false\nlocal cflags =\n{\nEnableSSE = \"-msse\",\nEnableSSE2 = \"-msse2\",\nExtraWarnings = \"-Wall -Wextra\",\nFatalWarnings = \"-Werror\",\nFloatFast = \"-ffast-math\",\nFloatStrict = \"-ffloat-store\",\nNoFramePointer = \"-fomit-frame-pointer\",\nOptimize = \"-O2\",\nOptimizeSize = \"-Os\",\nOptimizeSpeed = \"-O3\",\nSymbols = \"-g\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"-fno-exceptions\",\nNoRTTI = \"-fno-rtti\",\nUnsignedChar = \"-funsigned-char\",\n}\npremake.gcc.platforms =\n{\nNative = {\ncppflags = \"-MMD\",\n},\nx32 = {\ncppflags = \"-MMD\",\nflags = \"-m32\",\nldflags = \"-L/usr/lib32\",\n},\nx64 = {\ncppflags = \"-MMD\",\nflags = \"-m64\",\nldflags = \"-L/usr/lib64\",\n},\nUniversal = {\ncppflags = \"\",\nflags = \"-arch i386 -arch x86_64 -arch ppc -arch ppc64\",\n},\nUniversal32 = {\ncppflags = \"\",\nflags " - " = \"-arch i386 -arch ppc\",\n},\nUniversal64 = {\ncppflags = \"\",\nflags = \"-arch x86_64 -arch ppc64\",\n},\nPS3 = {\ncc = \"ppu-lv2-g++\",\ncxx = \"ppu-lv2-g++\",\nar = \"ppu-lv2-ar\",\ncppflags = \"-MMD\",\n},\nWiiDev = {\ncppflags = \"-MMD -MP -I$(LIBOGC_INC) $(MACHDEP)\",\nldflags= \"-L$(LIBOGC_LIB) $(MACHDEP)\",\ncfgsettings = [[\n ifeq ($(strip $(DEVKITPPC)),)\n $(error \"DEVKITPPC environment variable is not set\")'\n endif\n include $(DEVKITPPC)/wii_rules']],\n},\n}\nlocal platforms = premake.gcc.platforms\nfunction premake.gcc.getcppflags(cfg)\nlocal flags = { }\ntable.insert(flags, platforms[cfg.platform].cppflags)\nif flags[1]:startswith(\"-MMD\") then\ntable.insert(flags, \"-MP\")\nend\nreturn flags\nend\nfunction premake.gcc.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\ntable.insert(result, platforms[cfg.platform].flags)\nif cfg.system ~= \"windows\" and cfg.kind == \"SharedLib\" then\ntable.insert(result, \"-fPIC\")\nend\nreturn result" - "\nend\nfunction premake.gcc.getcxxflags(cfg)\nlocal result = table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.gcc.getldflags(cfg)\nlocal result = { }\nif not cfg.flags.Symbols then\nif cfg.system == \"macosx\" then\ntable.insert(result, \"-Wl,-x\")\nelse\ntable.insert(result, \"-s\")\nend\nend\nif cfg.kind == \"SharedLib\" then\nif cfg.system == \"macosx\" then\ntable.insert(result, \"-dynamiclib\")\nelse\ntable.insert(result, \"-shared\")\nend\nif cfg.system == \"windows\" and not cfg.flags.NoImportLib then\ntable.insert(result, '-Wl,--out-implib=\"' .. cfg.linktarget.fullpath .. '\"')\nend\nend\nif cfg.kind == \"WindowedApp\" and cfg.system == \"windows\" then\ntable.insert(result, \"-mwindows\")\nend\nlocal platform = platforms[cfg.platform]\ntable.insert(result, platform.flags)\nif not cfg.flags.IgnoreLDFlags then\ntable.insert(result, platform.ldflags)\nend\nreturn result\nend\nfunction premake.gcc.getlibdirflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(c" - "fg, \"all\", \"directory\")) do\ntable.insert(result, '-L' .. _MAKE.esc(value))\nend\nreturn result\nend\nfunction premake.gcc.getlinkflags(cfg)\nlocal result = {}\nfor _, value in ipairs(premake.getlinks(cfg, \"system\", \"name\")) do\nif path.getextension(value) == \".framework\" then\ntable.insert(result, '-framework ' .. _MAKE.esc(path.getbasename(value)))\nelse\ntable.insert(result, '-l' .. _MAKE.esc(value))\nend\nend\nreturn result\nend\nfunction premake.gcc.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.gcc.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-I\" .. _MAKE.esc(dir))\nend\nreturn result\nend\nfunction premake.gcc.getcfgsettings(cfg)\nreturn platforms[cfg.platform].cfgsettings\nend\n", + "premake.gcc = { }\npremake.gcc.cc = \"gcc\"\npremake.gcc.cxx = \"g++\"\npremake.gcc.ar = \"ar\"\npremake.gcc.llvm = false\nlocal cflags =\n{\nEnableSSE = \"-msse\",\nEnableSSE2 = \"-msse2\",\nExtraWarnings = \"-Wall -Wextra\",\nFatalWarnings = \"-Werror\",\nFloatFast = \"-ffast-math\",\nFloatStrict = \"-ffloat-store\",\nNoFramePointer = \"-fomit-frame-pointer\",\nOptimize = \"-O2\",\nOptimizeSize = \"-Os\",\nOptimizeSpeed = \"-O3\",\nSymbols = \"-g\",\n}\nlocal cxxflags =\n{\nNoExceptions = \"-fno-exceptions\",\nNoRTTI = \"-fno-rtti\",\nUnsignedChar = \"-funsigned-char\",\n}\npremake.gcc.platforms =\n{\nNative = {\ncppflags = \"-MMD\",\n},\nx32 = {\ncppflags = \"-MMD\",\nflags = \"-m32\",\n},\nx64 = {\ncppflags = \"-MMD\",\nflags = \"-m64\",\n},\nUniversal = {\ncppflags = \"\",\nflags = \"-arch i386 -arch x86_64 -arch ppc -arch ppc64\",\n},\nUniversal32 = {\ncppflags = \"\",\nflags = \"-arch i386 -arch ppc\",\n},\nUniversal64 = {\ncppflags" + " = \"\",\nflags = \"-arch x86_64 -arch ppc64\",\n},\nPS3 = {\ncc = \"ppu-lv2-g++\",\ncxx = \"ppu-lv2-g++\",\nar = \"ppu-lv2-ar\",\ncppflags = \"-MMD\",\n},\nWiiDev = {\ncppflags = \"-MMD -MP -I$(LIBOGC_INC) $(MACHDEP)\",\nldflags= \"-L$(LIBOGC_LIB) $(MACHDEP)\",\ncfgsettings = [[\n ifeq ($(strip $(DEVKITPPC)),)\n $(error \"DEVKITPPC environment variable is not set\")'\n endif\n include $(DEVKITPPC)/wii_rules']],\n},\n}\nlocal platforms = premake.gcc.platforms\nfunction premake.gcc.getcppflags(cfg)\nlocal flags = { }\ntable.insert(flags, platforms[cfg.platform].cppflags)\nif flags[1]:startswith(\"-MMD\") then\ntable.insert(flags, \"-MP\")\nend\nreturn flags\nend\nfunction premake.gcc.getcflags(cfg)\nlocal result = table.translate(cfg.flags, cflags)\ntable.insert(result, platforms[cfg.platform].flags)\nif cfg.system ~= \"windows\" and cfg.kind == \"SharedLib\" then\ntable.insert(result, \"-fPIC\")\nend\nreturn result\nend\nfunction premake.gcc.getcxxflags(cfg)\nlocal result =" + " table.translate(cfg.flags, cxxflags)\nreturn result\nend\nfunction premake.gcc.getldflags(cfg)\nlocal result = { }\nif not cfg.flags.Symbols then\nif cfg.system == \"macosx\" then\ntable.insert(result, \"-Wl,-x\")\nelse\ntable.insert(result, \"-s\")\nend\nend\nif cfg.kind == \"SharedLib\" then\nif cfg.system == \"macosx\" then\ntable.insert(result, \"-dynamiclib\")\nelse\ntable.insert(result, \"-shared\")\nend\nif cfg.system == \"windows\" and not cfg.flags.NoImportLib then\ntable.insert(result, '-Wl,--out-implib=\"' .. cfg.linktarget.fullpath .. '\"')\nend\nend\nif cfg.kind == \"WindowedApp\" and cfg.system == \"windows\" then\ntable.insert(result, \"-mwindows\")\nend\nlocal platform = platforms[cfg.platform]\ntable.insert(result, platform.flags)\ntable.insert(result, platform.ldflags)\nreturn result\nend\nfunction premake.gcc.getlibdirflags(cfg)\nlocal result = { }\nfor _, value in ipairs(premake.getlinks(cfg, \"all\", \"directory\")) do\ntable.insert(result, '-L' .. _MAKE.esc(value))\nend\nreturn result\ne" + "nd\nfunction premake.gcc.getlinkflags(cfg)\nlocal result = {}\nfor _, value in ipairs(premake.getlinks(cfg, \"system\", \"name\")) do\nif path.getextension(value) == \".framework\" then\ntable.insert(result, '-framework ' .. _MAKE.esc(path.getbasename(value)))\nelse\ntable.insert(result, '-l' .. _MAKE.esc(value))\nend\nend\nreturn result\nend\nfunction premake.gcc.getdefines(defines)\nlocal result = { }\nfor _,def in ipairs(defines) do\ntable.insert(result, '-D' .. def)\nend\nreturn result\nend\nfunction premake.gcc.getincludedirs(includedirs)\nlocal result = { }\nfor _,dir in ipairs(includedirs) do\ntable.insert(result, \"-I\" .. _MAKE.esc(dir))\nend\nreturn result\nend\nfunction premake.gcc.getcfgsettings(cfg)\nreturn platforms[cfg.platform].cfgsettings\nend\n", /* tools/msc.lua */ "premake.msc = { }\npremake.msc.namestyle = \"windows\"\n", diff --git a/3rdparty/genie/src/tools/gcc.lua b/3rdparty/genie/src/tools/gcc.lua index 2e729b109ca..cf82c6ad9d5 100644 --- a/3rdparty/genie/src/tools/gcc.lua +++ b/3rdparty/genie/src/tools/gcc.lua @@ -57,12 +57,10 @@ x32 = { cppflags = "-MMD", flags = "-m32", - ldflags = "-L/usr/lib32", }, x64 = { cppflags = "-MMD", flags = "-m64", - ldflags = "-L/usr/lib64", }, Universal = { cppflags = "", @@ -164,9 +162,7 @@ local platform = platforms[cfg.platform] table.insert(result, platform.flags) - if not cfg.flags.IgnoreLDFlags then - table.insert(result, platform.ldflags) - end + table.insert(result, platform.ldflags) return result end diff --git a/scripts/genie.lua b/scripts/genie.lua index c33ab9bd6a0..bcdc8911d1b 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -237,7 +237,6 @@ end "StaticRuntime", "Unicode", "NoPCH", - "IgnoreLDFlags", } configuration { "vs*" }