News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

New wizard for Directx9

Started by patlecat, May 31, 2007, 09:57:14 PM

Previous topic - Next topic

patlecat

Quote from: Biplab on June 01, 2007, 06:14:19 PM
Quote from: patlecat on June 01, 2007, 06:02:35 PM
I never said that there is a file called libd3dx9.a :wink:
But GCC will not accept MS Compiler compiled Libraries. So the couple of necessary files are missing in Win32-api distributed for MinGW compilers. :)
Are you saying that all the nice programs I built with MingW and this DirectX-SDK were not real? Only a figment of my imagination? :shock: OMG

ok just joking. I used these versions with TDMs GCC4.2:

    * binutils (binutils-2.17.50-20060824-1.tar.gz)
    * mingw-runtime (mingw-runtime-3.11.tar.gz)
    * w32api (w32api-3.7.tar.gz)

stahta01

Quote from: Biplab on June 01, 2007, 12:29:43 PM
But there is no DirectX 8 headers and thus I can't test it.
2. Are Direct X headers and libraries are available separately for MinGW??

Regards,

Biplab

I use http://alleg.sourceforge.net/wip.html for DX7 and DX8 Files. Note, I have no idea if they are valid GPL files, but it's what MAME recommends to use.
Direct link to dx80_mgw
http://alleg.sourceforge.net/files/dx80_mgw.zip
Directions from http://www.mamedev.org/tools/
QuoteExtract this file into your mingw directory, overwriting any duplicates that you encounter along the way.

Tim S

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Biplab

Thanks a lot, Tim, for the link. :)

I'd try it. My idea is to test the wizard across DX8/9 with MinGW/MSVC.
Be a part of the solution, not a part of the problem.

patlecat

Silly question from a beginner: What does NDEBUG in GCC mean?  :oops:
If it means No-Debug (therefore Release Build) then we must modify the above script!

TDragon

Quote from: patlecat on June 02, 2007, 11:36:44 AM
Silly question from a beginner: What does NDEBUG in GCC mean?  :oops:
If it means No-Debug (therefore Release Build) then we must modify the above script!
Yes, it does mean No Debug. Defining NDEBUG turns off the effect of the standard assert macro.
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Biplab

Quote from: patlecat on June 02, 2007, 11:36:44 AM
If it means No-Debug (therefore Release Build) then we must modify the above script!

You are free to modify the script till it becomes a working one. That's why I didn't put it in main repo. :)
Be a part of the solution, not a part of the problem.

patlecat

ok then here is my newest tested version, without the additions of biplab to support dx8, since i neither use nor support dx8 - only dx9.
////////////////////////////////////////////////////////////////////////////////
//
// Direct/X project wizard
// modded by patlecat, june07
//
////////////////////////////////////////////////////////////////////////////////

// globals
DirectXPath <- _T("");

function BeginWizard()
{
    local intro_msg = _T("Welcome to the new Direct/X project wizard!\n\n" +
                         "This wizard will guide you to create a new project\n" +
                         "using the Direct/X extensions.\n\n" +
                         "This wizard expects the global variable \"dx\" to point\n" +
                         "to the appropriate DirectX SDK.\n" +
                         "This is the MS DirectX SDK for a Visual C++ Toolkit 2003 project\n" +
                         "and e.g. the DevPack folder for a GCC project.\n\n" +
                         "For a Visual C++ Toolkit 2003 project in addition the global variable\n" +
                         "\"psdk\" must point to the directory of the MS platform SDK.\n\n" +
                         "You will be asked to setup the variables accordingly. If this is\n" +
                         "not the case, verify \"Settings->Global variables\"\n" +
                         "after this wizard has completed.\n\n" +
                         "When you're ready to proceed, please click \"Next\"...");

    local dxpath_descr = _T("Please select the location of the Direct/X SDK on your computer.\n" +
                            "This is the top-level folder where Direct/X was installed (unpacked).\n" +
                            "To help you, this folder must contain the subfolders\n" +
                            "\"include\" and \"lib\".");

    Wizard.AddInfoPage(_T("DirectXIntro"), intro_msg);
    Wizard.AddProjectPathPage();
    Wizard.AddCompilerPage(_T(""), _T("gcc;msvctk"), true, true);
    Wizard.AddGenericSelectPathPage(_T("DirectXPath"), dxpath_descr, _T("Please select Direct/X's location:"), _T("$(#dx)"));
}

////////////////////////////////////////////////////////////////////////////////
// Direct/X's path page
////////////////////////////////////////////////////////////////////////////////

function OnLeave_DirectXPath(fwd)
{
    if (fwd)
    {
        local dir         = Wizard.GetTextControlValue(_T("txtFolder")); // txtFolder is the text control in GenericSelectPathPage
        local dir_nomacro = ReplaceMacros(dir, true);
        if (!IO.FileExists(dir_nomacro + _T("/include/d3d.h")))
        {
            ShowError(_T("The path you entered seems valid, but this wizard " +
                         "can't locate Direct/X's files in it..."));
            return false;
        }
        if (!IO.FileExists(dir_nomacro + _T("/include/d3d9.h")))
        {
            ShowError(_T("The path you entered is valid, but this wizard " +
                         "requires at least the Direct/X 9.0c SDK..."));
            return false;
        }

        if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("msvc*")))
        {
            local psdk = ReplaceMacros(_T("$(#psdk)"), true);
            if (!IO.DirectoryExists(psdk))
            {
                ShowError(_T("The path to the platform SDK seems not to be valid.\n" +
                             "This setup requires the MS platform SDK..."));
                return false;
            }
        }

        DirectXPath = dir;
    }
    return true;
}

// return the files this project contains
function GetFilesDir()
{
    return _T("directx/files");
}

// setup the already created project
function SetupProject(project)
{
    // set project options
    local gvar = ReplaceMacros(_T("$(#dx)"), true);

    // set compiler/linker search paths
    // see if the Direct/X SDK matches the global var. if it does, use the var instead...
    if (gvar.Matches(DirectXPath))
    {
        project.AddIncludeDir(_T("$(#dx.include)"));
        project.AddLibDir(_T("$(#dx.lib)"));
    }
    else
    {
        project.AddIncludeDir(DirectXPath + _T("/include"));
        project.AddLibDir(DirectXPath + _T("/lib/x86"));
    }

    // set compiler options
    project.AddCompilerOption(_T("-DWIN32"));
    project.AddCompilerOption(_T("-D_WINDOWS"));
    project.AddCompilerOption(_T("-D_MBCS"));

    // set linker options
    project.AddLinkLib(_T("kernel32"));
    project.AddLinkLib(_T("user32"));
    project.AddLinkLib(_T("gdi32"));
    project.AddLinkLib(_T("winspool"));
    project.AddLinkLib(_T("comdlg32"));
    project.AddLinkLib(_T("advapi32"));
    project.AddLinkLib(_T("shell32"));
    project.AddLinkLib(_T("ole32"));
    project.AddLinkLib(_T("oleaut32"));
    project.AddLinkLib(_T("uuid"));
    project.AddLinkLib(_T("odbc32"));
    project.AddLinkLib(_T("odbccp32"));
    project.AddLinkLib(_T("d3d9"));

    // set additional path's for MS VC++ Toolkit
    if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("msvc*")))
    {
        // set project options for MS Visual C++ Toolkit
        project.AddIncludeDir(_T("$(#psdk.include)"));
        project.AddLibDir(_T("$(#psdk.lib)"));
    }

    // enable compiler warnings (project-wide)
    WarningsOn(project, Wizard.GetCompilerID());

    // Debug
    local target = project.GetBuildTarget(Wizard.GetDebugName());
    if (!IsNull(target))
    {
        target.SetTargetType(ttConsoleOnly); // ttConsoleOnly: console for debugging
        target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
        target.SetWorkingDir(Wizard.GetDebugOutputDir());
        // enable generation of debugging symbols for target
        DebugSymbolsOn(target, Wizard.GetCompilerID());
        if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("gcc")))
        {
            target.AddCompilerOption(_T("-D_DEBUG"));
            target.AddCompilerOption(_T("-ggdb")); // Build for GDB
            target.AddLinkLib(_T("d3dx9d"));
        }
    }

    // Release
    target = project.GetBuildTarget(Wizard.GetReleaseName());
    if (!IsNull(target))
    {
        target.SetTargetType(ttExecutable); // ttExecutable: no console
        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
        target.SetWorkingDir(Wizard.GetReleaseOutputDir());
        // enable optimizations for target
        OptimizationsOn(target, Wizard.GetCompilerID());
        if (GetCompilerFactory().CompilerInheritsFrom(Wizard.GetCompilerID(), _T("gcc")))
        {
            //target.AddCompilerOption(_T("-march=athlon-xp"));
            target.AddLinkLib(_T("d3dx9"));
            target.AddCompilerOption(_T("-DNDEBUG"));
        }
    }

    return true;
}