Author Topic: New wizard for Directx9  (Read 21493 times)

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
New wizard for Directx9
« on: May 31, 2007, 09:57:14 pm »
I've modified and extended the existing wizard script for DX9 and to support GCC more. Of course the template code should also be modified, I might do this some other time. It's no use for me now anyways.

Pls let me know how u like this new script:
Code
////////////////////////////////////////////////////////////////////////////////
//
// Direct/X project wizard
// modded by patlecat, may07
//
////////////////////////////////////////////////////////////////////////////////

// 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("-DNDEBUG"));
    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"));
        }
    }

    return true;
}

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New wizard for Directx9
« Reply #1 on: May 31, 2007, 10:25:29 pm »
Pls let me know how u like this new script:
Nice! :D
What about this one, which is even compatible to both, dx8 and dx9???
Code
////////////////////////////////////////////////////////////////////////////////
//
// Direct/X project wizard
//
////////////////////////////////////////////////////////////////////////////////

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

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/d3d8.h")))
        {
            DirectXVer = 8;
        }
        else if (IO.FileExists(dir_nomacro + _T("/include/d3d9.h")))
        {
            DirectXVer = 9;
        }
        else
        {
            ShowError(_T("The path you entered is valid, but this wizard " +
                         "requires at least the Direct/X 8/9 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("-DNDEBUG"));
    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"));
    if ( DirectXVer==9 )
    {
        project.AddLinkLib(_T("d3d9"));
    }
    else
    {
        project.AddLinkLib(_T("d3d8"));
    }

    // 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
            if ( DirectXVer==9 )
            {
                target.AddLinkLib(_T("d3dx9"));
            }
            else
            {
                target.AddLinkLib(_T("d3dx8"));
            }
        }
    }

    // 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")))
        {
            if ( DirectXVer==9 )
            {
                target.AddLinkLib(_T("d3dx9d"));
            }
            else
            {
                target.AddLinkLib(_T("d3dx8d"));
            }
        }
    }

    return true;
}
(What's missing is a selection from the user in case both versions are available... Biplab? ;-))
With regards, Morten.
« Last Edit: May 31, 2007, 10:28:41 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: New wizard for Directx9
« Reply #2 on: May 31, 2007, 10:34:41 pm »
Nice Morten, this was my first time fiddling with CB scripts. But u seem very proficient with it. Could you also add an option to create an empty project?

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: New wizard for Directx9
« Reply #3 on: May 31, 2007, 11:10:22 pm »
Could you also add an option to create an empty project?
Yes that would be verry useful.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: New wizard for Directx9
« Reply #4 on: June 01, 2007, 11:26:23 am »
(What's missing is a selection from the user in case both versions are available... Biplab? ;-))

We can set it to the Latest version as default. ;)

Could you also add an option to create an empty project?

Possible and will be done. :)
Be a part of the solution, not a part of the problem.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: New wizard for Directx9
« Reply #5 on: June 01, 2007, 12:29:43 pm »
I'm attaching the latest modification. You'll get the option to select DirectX 8 / DirectX 9 and setup the project accordingly. But default sample needs to be changed. So just remove the default generated file and attach your own code to the project.

BTW, I've never used DirectX for any of my project. So there could be errors in Project setup. Please feel free to modify it and post it.

I need couple of infos:
1. I'm using Win32-api-3.9 and MinGW runtime 3.12 to compile DirectX sample. 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

[attachment deleted by admin]
« Last Edit: June 01, 2007, 12:33:23 pm by Biplab »
Be a part of the solution, not a part of the problem.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New wizard for Directx9
« Reply #6 on: June 01, 2007, 01:25:18 pm »
1. I'm using Win32-api-3.9 and MinGW runtime 3.12 to compile DirectX sample. 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??
I use a DevPak for Direct/X This includes the DX8 and DX9 SDK and works together with MinGW. Anyways - when I searched the DevPak site for it it was no longer available...?! Google revealed that there were obviously some copyright stuff going on so it has been removed. Either you can find it somewhere yourself or I can make you a package accordingly (have to be at home for this). Tell me what you want/need.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: New wizard for Directx9
« Reply #7 on: June 01, 2007, 01:31:25 pm »
Google revealed that there were obviously some copyright stuff going on so it has been removed.

Then it's an issue. :)

Either you can find it somewhere yourself or I can make you a package accordingly (have to be at home for this). Tell me what you want/need.

If possible, you may test the wizard with your package and make changes accordingly. Or if you've good link to package, you may post it. :)

Regards,

Biplab
Be a part of the solution, not a part of the problem.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New wizard for Directx9
« Reply #8 on: June 01, 2007, 01:48:47 pm »
If possible, you may test the wizard with your package and make changes accordingly. Or if you've good link to package, you may post it. :)
Did that and revealed an issue:
If I choose the folder for the project the "resulting filename" is somehow broken. The drive letter is always missing - thus, if I continue I receive an error message the project could not be created. On second thoughts... this cannot be from the DX wizard, right?! Were there any relevant changes recently? I remember it was working last week (with other wizards I used)...

Or if you've good link to package, you may post it. :)
Here are two:
http://old.devpaks.org/show.php?devpak=140
http://www.g-productions.net/plug.php?p=downloads
I'll make a package at home...

With regards, Morten.

[attachment deleted by admin]
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: New wizard for Directx9
« Reply #9 on: June 01, 2007, 02:06:40 pm »
biplab you can use the project settings as above from me, this works well under gcc on windows. the directx-sdk is available online from either microsoft (http://msdn.microsoft.com/directx) or any directx book u can buy. my gcc alas only worked fine with dx9.0c from Aug06, no older version! i can craft you a template-code file for dx9 if you wish, i didnt care to look into the dx8 code, but i had to modify it for dx9 because it didnt run with dx9 out of the box.

and please dont add any dx10 stuff yet - unless there is someone who really knows his shit with it! it will surely break the code again.
« Last Edit: June 01, 2007, 02:08:41 pm by patlecat »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: New wizard for Directx9
« Reply #10 on: June 01, 2007, 03:52:17 pm »
Did that and revealed an issue:
If I choose the folder for the project the "resulting filename" is somehow broken. The drive letter is always missing - thus, if I continue I receive an error message the project could not be created. On second thoughts... this cannot be from the DX wizard, right?! Were there any relevant changes recently? I remember it was working last week (with other wizards I used)...

There are some changes made recently. But I've worked today with the latest revision and it worked fine. Have to check this.

biplab you can use the project settings as above from me, this works well under gcc on windows.

But in my system, libd3dx9.a doesn't exist. I'll look into it after this weekend.
« Last Edit: June 01, 2007, 04:02:43 pm by Biplab »
Be a part of the solution, not a part of the problem.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: New wizard for Directx9
« Reply #11 on: June 01, 2007, 04:34:11 pm »
Did that and revealed an issue:
If I choose the folder for the project the "resulting filename" is somehow broken. The drive letter is always missing - thus, if I continue I receive an error message the project could not be created. On second thoughts... this cannot be from the DX wizard, right?! Were there any relevant changes recently? I remember it was working last week (with other wizards I used)...

I've just rechecked. It's working fine. Did you try with a different folder? Or maybe it's a Unicode problem?
Be a part of the solution, not a part of the problem.

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: New wizard for Directx9
« Reply #12 on: June 01, 2007, 06:02:35 pm »
biplab you can use the project settings as above from me, this works well under gcc on windows.
But in my system, libd3dx9.a doesn't exist. I'll look into it after this weekend.
I never said that there is a file called libd3dx9.a :wink: See here what my directory (X:\Microsoft DirectX SDK (August 2006)\Lib\x86) contains:
Directory of X:\Microsoft DirectX SDK (August 2006)\Lib\x86

01.06.2007  18:02    <DIR>          .
01.06.2007  18:02    <DIR>          ..
15.07.2006  11:45             9'014 d3d10.lib
03.09.2004  16:18             2'704 d3d8.lib
03.09.2004  16:18             5'226 d3d9.lib
15.07.2006  11:45            47'502 d3dx10.lib
15.07.2006  12:30            47'692 d3dx10d.lib
31.03.2006  12:24            88'680 d3dx9.lib
31.03.2006  12:22            89'016 d3dx9d.lib
29.09.2004  17:47             1'746 d3dxof.lib
06.09.2004  21:58             4'540 ddraw.lib
03.09.2004  16:18           161'464 dinput.lib
03.09.2004  16:18           173'542 dinput8.lib
01.06.2007  18:02                 0 dirList.txt
03.09.2004  16:18             3'142 dplayx.lib
28.07.2006  08:45             5'998 dsetup.lib
03.09.2004  16:18             4'042 dsound.lib
28.07.2006  08:54         4'534'698 DxErr.lib
28.07.2006  08:53         1'210'560 DxErr8.lib
28.07.2006  08:54         4'360'038 DxErr9.lib
15.07.2006  11:42             3'074 dxgi.lib
28.07.2006  08:54           565'850 dxguid.lib
03.09.2004  16:18             3'700 dxtrans.lib
03.02.2006  08:30             2'050 X3DAudio.lib
31.03.2006  12:30             2'916 XInput.lib
              23 File(s)     11'327'194 bytes


Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: New wizard for Directx9
« Reply #13 on: June 01, 2007, 06:14:19 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. :)
« Last Edit: June 01, 2007, 06:17:09 pm by Biplab »
Be a part of the solution, not a part of the problem.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New wizard for Directx9
« Reply #14 on: June 01, 2007, 06:19:29 pm »
But GCC will not accept MS Compiler compiled Libraries. So the couple of necessary files are missing in Win32-api distributed for MinGW compilers.
GCC does accept MS compiled *.lib under certain circumstances (can't exactly recall which one but I successfully compiled the one or other application where it worked, e.g. Gnuplot) - just try it... ;-)
Anyways: To work with MS platform SDK and MS Direct/X SDK's I personally would use a MS compiler... but that's just me. For MinGW I' personally use the Direct/X DevPak I was referring to in the other post. This includes all *.a (100% MinGW compatible) libs.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: New wizard for Directx9
« Reply #15 on: June 01, 2007, 06:27:55 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)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: New wizard for Directx9
« Reply #16 on: June 01, 2007, 07:40:25 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/
Quote
Extract 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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: New wizard for Directx9
« Reply #17 on: June 01, 2007, 07:52:17 pm »
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.

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: New wizard for Directx9
« Reply #18 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!

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: New wizard for Directx9
« Reply #19 on: June 02, 2007, 05:25:14 pm »
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.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: New wizard for Directx9
« Reply #20 on: June 02, 2007, 07:16:05 pm »
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.

Offline patlecat

  • Multiple posting newcomer
  • *
  • Posts: 62
Re: New wizard for Directx9
« Reply #21 on: June 02, 2007, 07:21:17 pm »
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.
Code
////////////////////////////////////////////////////////////////////////////////
//
// 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;
}