Coder Social home page Coder Social logo

liveplusplus_o3de_gem's Introduction

LivePlusPlus_O3DE_Gem

An integration of Live++ for Open 3D Engine (GitHub) (Windows only).

Important: Live++ is NOT open source. See its website for details: Pricing and Legal.

Example Project

Refer to the included example project with Live++ enabled and configured:

I left out the actual Live++ package due to copyright, of course!

Compatibility with Live++ versions

Installation

  1. Let's assume O3DE engine is at C:\git\o3de and your project is at C:\git\YourProject.
  2. Pull down this repository, for example to C:\git\Gems\LivePlusPlus_O3DE_Gem\LivePlusPlus.
  3. Register it as a gem for your O3DE project (see Register Gems for details). For example:
    • C:\git\o3de> .\scripts\o3de.bat register --gem-path C:\git\Gems\LivePlusPlus_O3DE_Gem\LivePlusPlus --external-subdirectory-project-path C:\git\YourProject.
  4. Enable the LivePlusPlus gem in your project
    • This can be achieved by adding LivePlusPlus to enabled_gems.json in the C:\git\YourProject directory.
    • Or by using O3DE Project Manager.
  5. Get your copy of Live++.
  6. Unzip it into C:\git\Gems\LivePlusPlus_O3DE_Gem\LivePlusPlus\3rdParty\LivePP.
  7. Compile your project and run.

Modifying Compiler/Linker Settings for Hotpatching C++ code

Enable Hotpatching for your project and your gems

For each project/gem you wish to hotpatch, do the following:

This will enable hotpatching just for gems and projects that you wish to hotpatch. You do need to make this change for each ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} target, though. An additional improvement would be to create a common place for enable_hotpatch_windows.cmake PAL files and re-use them across Gems.

Configuration

  1. Refer to Live++ documentation.

  2. By default, all gems registered for your O3DE project will be hot patched.

  3. Optionally, you can set a regex filter to choose which O3DE gems by using O3DE registry.

    Note: This can significantly improve performance of Live++ and is highly encouraged to improve iteration times.

    https://github.com/AMZN-Olex/LivePlusPlus_O3DE_Gem/blob/f0eea72f356d3e9e84a663e915316607b8d42b93/ExampleProject/Registry/liveplusplus.setreg#L1-L9

    Here are some other examples:

    • ".*" - Matches any path
    • ".ImGui." - Matches ImGui gems
    • ".ImGui.|.ScriptCanvas." - Matches ImGui and ScriptCanvas gem

That is it! You are done!

Optional Advanced Configurations

(Optional) Enable Hotpatching for the the entire engine

  1. Go to o3de\cmake\Platform\Common\MSVC\Configurations_msvc.cmake
  2. Make the following changes: a. Profile Builds
    PS C:\git\o3de> git diff C:\git\o3de\cmake\Platform\Common\MSVC\Configurations_msvc.cmake
    diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake
    index 9353e4eb1c..3ae8796b3c 100644
    --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake
    +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake
    @@ -68,6 +68,8 @@ ly_append_configurations_options(
            /Zc:inline      # Removes unreferenced functions or data that are COMDATs or only have internal linkage
            /Zc:wchar_t     # Use compiler native wchar_t
            /Zi             # Generate debugging information (no Edit/Continue)
    +        /Z7             # for hot patching C++ code
    +        /Gw             # for hot patching C++ code
        COMPILATION_RELEASE
            /Ox             # Full optimization
            /Ob2            # Inline any suitable function
    @@ -78,8 +80,9 @@ ly_append_configurations_options(
            /NOLOGO             # Suppress Copyright and version number message
            /IGNORE:4099        # 3rdParty linking produces noise with LNK4099
        LINK_NON_STATIC_PROFILE
    -        /OPT:REF            # Eliminates functions and data that are never referenced
    -        /OPT:ICF            # Perform identical COMDAT folding. Redundant COMDATs can be removed from the linker output
    +        /OPT:NOREF            # for hot patching C++ code
    +        /OPT:NOICF            # for hot patching C++ code
    +        /FUNCTIONPADMIN       # for hot patching C++ code
            /INCREMENTAL:NO
            /DEBUG              # Generate pdbs
        LINK_NON_STATIC_RELEASE
    b. Debug Builds
    PS E:\o3de> git diff cmake\Platform\Common\MSVC\Configurations_msvc.cmake
    diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake
    index 66a5b7b01f..221d813e08 100644
    --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake
    +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake
    @@ -70,6 +70,8 @@ ly_append_configurations_options(
                            # It also causes the compiler to place the library name MSVCRTD.lib into the .obj file.
            /Ob0            # Disables inline expansions
            /Od             # Disables optimization
    +       /Z7             # for hot patching C++ code
    +       /Gw             # for hot patching C++ code
        COMPILATION_PROFILE
            /GF             # Enable string pooling
            /Gy             # Function level linking
    @@ -88,9 +90,11 @@ ly_append_configurations_options(
        LINK
            /NOLOGO             # Suppress Copyright and version number message
            /IGNORE:4099        # 3rdParty linking produces noise with LNK4099
    +        /OPT:NOREF         # for hot patching C++ code
    +        /OPT:NOICF         # for hot patching C++ code
    +        /FUNCTIONPADMIN    # for hot patching C++ code
    +
        LINK_NON_STATIC_PROFILE
    -        /OPT:REF            # Eliminates functions and data that are never referenced
    -        /OPT:ICF            # Perform identical COMDAT folding. Redundant COMDATs can be removed from the linker output
         /INCREMENTAL:NO

Enabling Live++ for other dynamic libraries

  1. By default only AZ Modules are loaded for use with Live++. There are some dynamic libraries that are themselves not AZ Modules. It is possible to load these explicitly in LivePlusPlusSystemComponent_Windows.cpp with:

    const char* library = <full-path-to-dll>; // e.g. <path/to>/EditorLib.dll
    m_lppAgent.EnableModuleANSI(library, lpp::LPP_MODULES_OPTION_NONE);

    In the following section: https://github.com/AMZN-Olex/LivePlusPlus_O3DE_Gem/blob/f0eea72f356d3e9e84a663e915316607b8d42b93/LivePlusPlus/Code/Platform/Windows/LivePlusPlusSystemComponent_Windows.cpp#L169-L176

Enjoy!

liveplusplus_o3de_gem's People

Contributors

selfisholex avatar pr0g avatar

Stargazers

 avatar Mikael K. avatar  avatar Benjamin Stanley avatar Alex Peterson avatar  avatar Ignacio Martinez avatar  avatar Bryan Chasko avatar Pinfel avatar Gene Walters avatar Benjamin Jillich avatar

Watchers

 avatar Benjamin Jillich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.