示例#1
0
int main( void )
{
    mkdir( "watcom", S_IRWXU | S_IRWXG | S_IRWXO );  // make the path...
    mkdir( "win", S_IRWXU | S_IRWXG | S_IRWXO );

    makefile = fopen( "master.mif", "wt" );
    if( makefile )
    {
        fprintf( makefile, "proj_name=w32api\n" );
        fprintf( makefile, "host_CPU=386\n" );
        fprintf( makefile, "host_OS=nt\n" );
        fprintf( makefile, "!include cproj.mif\n" );
        fprintf( makefile, "splice = wsplice -i.. -i../../include -k$(system) $(options) ../common.sp $[@ $^@\n" );
        fprintf( makefile, ".EXTENSIONS\n" );
        fprintf( makefile, ".EXTENSIONS : .h .hpp .mh .mhp\n" );
        fprintf( makefile, "common: &\n" );
        ScanHeaders( WriteTargetList );
        fprintf( makefile, "\n" );
        fprintf( makefile, "WIN_files = &\n" );
        fprintf( makefile, "                  $(common)\n" );
        fprintf( makefile, "\n" );
        fprintf( makefile, "all : $($(system)_files) .symbolic\n" );
        fprintf( makefile, "        @%%null\n" );
        fprintf( makefile, ".mh:$(path)\n" );
        fprintf( makefile, ".mhp:$(path)\n" );
        fprintf( makefile, ".mhp.hpp:\n" );
        fprintf( makefile, "             $(splice)\n" );
        fprintf( makefile, ".mh.h:\n" );
        fprintf( makefile, "             $(splice)\n" );
        fprintf( makefile, "!include ../deps.mif\n" );
        fprintf( makefile, "clean: .SYMBOLIC\n" );
        fprintf( makefile, "          rm -f *.h sys/*.h *.hpp common.cnv\n" );
        fclose( makefile );
    }
    makefile=fopen( "deps.mif", "wt" );
    if( makefile )
    {
        ScanHeaders( WriteDeps );
        fclose( makefile );
    }

    makefile=fopen( "win/makefile", "wt" );
    if( makefile )
    {
        fprintf( makefile, "#pmake: all build os_win os_nt \n" );
        fprintf( makefile, "path=../watcom;../watcom/gl\n" );
        fprintf( makefile, "options=-kUNICODE\n" );
        fprintf( makefile, "system=WIN\n" );
        fprintf( makefile, "!include ../master.mif\n" );
        fclose( makefile );
    }
    ScanHeaders( WriteMHFiles );

    return 0;
}
bool JSBModule::Load(const String& jsonFilename)
{
    JSBind* jsbind = GetSubsystem<JSBind>();

    LOGINFOF("Loading Module: %s", jsonFilename.CString());

    SharedPtr<File> jsonFile(new File(context_, jsonFilename));

    if (!jsonFile->IsOpen())
    {
        LOGERRORF("Unable to open module json: %s", jsonFilename.CString());
        return false;
    }

    moduleJSON_ = new JSONFile(context_);

    if (!moduleJSON_->BeginLoad(*jsonFile))
    {
        LOGERRORF("Unable to parse module json: %s", jsonFilename.CString());
        return false;
    }

    JSONValue root = moduleJSON_->GetRoot();

    name_ = root.GetString("name");

    JSONValue requires = root.GetChild("requires");

    if (requires.IsArray())
    {
        for (unsigned j = 0; j < requires.GetSize(); j++)
        {
            requirements_.Push(requires.GetString(j));
        }

    }

    JSONValue classes = root.GetChild("classes");

    for (unsigned i = 0; i < classes.GetSize(); i++)
    {
        classnames_.Push(classes.GetString(i));
    }

    JSONValue classes_rename = root.GetChild("classes_rename");

    if (classes_rename.IsObject())
    {
        Vector<String> childNames = classes_rename.GetValueNames();
        for (unsigned j = 0; j < childNames.Size(); j++)
        {
            String classname = childNames.At(j);
            String crename = classes_rename.GetString(classname);

            classRenames_[classname] = crename;

        }

    }

    JSONValue includes = root.GetChild("includes");

    if (includes.IsArray())
    {
        for (unsigned j = 0; j < includes.GetSize(); j++)
        {
            includes_.Push(includes.GetString(j));

        }
    }

    JSONValue sources = root.GetChild("sources");

    for (unsigned i = 0; i < sources.GetSize(); i++)
    {
        sourceDirs_.Push(sources.GetString(i));
    }

    if (name_ == "Graphics")
    {
#ifdef _MSC_VER
        if (jsbind->GetPlatform() == "ANDROID" || jsbind->GetPlatform() == "WEB")
        {
            sourceDirs_.Push("Source/Atomic/Graphics/OpenGL");
        }
        else
        {
#ifdef ATOMIC_D3D11
            sourceDirs_.Push("Source/Atomic/Graphics/Direct3D11");
#else
            sourceDirs_.Push("Source/Atomic/Graphics/Direct3D9");
#endif
        }
#else
        sourceDirs_.Push("Source/Atomic/Graphics/OpenGL");
#endif
    }


    ScanHeaders();

    return true;
}