Issue 13265 - Please detect the DXSDK when configuring sc.ini in the installer
Summary: Please detect the DXSDK when configuring sc.ini in the installer
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: installer (show other issues)
Version: D2
Hardware: x86_64 Windows
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-06 04:26 UTC by Manu
Modified: 2016-01-17 22:20 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Manu 2014-08-06 04:26:12 UTC
The DirectX SDK is a super common Microsoft library that will be present for most multimedia projects.
I particularly feel it needs to be detected by the installer to make the experience seamless between different versions of Visual Studio.

From VS2012, the DXSDK was rolled into the Windows SDK, which is detected by the installer. Prior to VS2012, the DXSDK was installed as a separate package.
The result is, if a user uses VS2012 or higher, their multimedia apps will compile as expected. If they happen to use VS2010 or lower (I still use 2010), then their apps will fail to compile without user intervention in sc.ini.
I'd like to see all versions of Visual Studio working reliably the same way out of the box, otherwise project build/setup instructions need to start having conditions and sub-sets of instructions throughout their wiki pages, ie, "If you're using VS2010 or below, follow these steps", etc.

The DXSDK is located here by default:
Include: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
Lib (x86): C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86
Lib (x64): C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64

The SDK installer also sets the DXSDK_DIR environment variable, so it's probably better to use: 
Include: %DXSDK_DIR%\Include
Lib (x86): %DXSDK_DIR%\Lib\x86
Lib (x64): %DXSDK_DIR%\Lib\x64
Comment 1 Brad Anderson 2014-08-06 04:40:06 UTC
> The SDK installer also sets the DXSDK_DIR environment variable, so it's  probably better to use: 
> Include: %DXSDK_DIR%\Include
> Lib (x86): %DXSDK_DIR%\Lib\x86
> Lib (x64): %DXSDK_DIR%\Lib\x64

If that's all that is needed we should just put them in the distributed sc.ini: https://github.com/D-Programming-Language/dmd/blob/master/ini/windows/bin/sc.ini


Under [Environment32] (could be useful if Rainer's 32-bit COFF support happens):
LIB=%LIB%;"%DXSDK_DIR%\Lib\x86"


Under [Environment64]:
LIB=%LIB%;"%DXSDK_DIR%\Lib\x64"


I'm not familiar enough with DirectX these days to test this but if you could test that doing that works, either you or I could make a quick pull request to implement this.
Comment 2 Manu 2014-08-06 04:57:22 UTC
(In reply to Brad Anderson from comment #1)
> > The SDK installer also sets the DXSDK_DIR environment variable, so it's  probably better to use: 
> > Include: %DXSDK_DIR%\Include
> > Lib (x86): %DXSDK_DIR%\Lib\x86
> > Lib (x64): %DXSDK_DIR%\Lib\x64
> 
> If that's all that is needed we should just put them in the distributed
> sc.ini:
> https://github.com/D-Programming-Language/dmd/blob/master/ini/windows/bin/sc.
> ini
> 
> 
> Under [Environment32] (could be useful if Rainer's 32-bit COFF support
> happens):
> LIB=%LIB%;"%DXSDK_DIR%\Lib\x86"

Yeah, here's hoping!
It's a gigantic gaping hole in the D ecosystem! :)

> Under [Environment64]:
> LIB=%LIB%;"%DXSDK_DIR%\Lib\x64"
> 
> 
> I'm not familiar enough with DirectX these days to test this but if you
> could test that doing that works, either you or I could make a quick pull
> request to implement this.

Precisely, my sc.ini simply adds:

; DirectX SDK
LIB=%LIB%;"%DXSDK_DIR%\Lib\x64"

At the very end of the file, below the "Platform libraries (Windows SDK 7 and 6)". It works for me for years, and I'm sure this would work on anybodies machines.

Do you reckon it's a good idea to add it, even if the SDK is not installed on the user's machine? Should we check to see if it's there, and add it at the same time as the various windows sdk's?
Comment 3 Brad Anderson 2014-08-06 05:03:05 UTC
(In reply to Manu from comment #2)
> Do you reckon it's a good idea to add it, even if the SDK is not installed
> on the user's machine? Should we check to see if it's there, and add it at
> the same time as the various windows sdk's?

Adding it there is fine. You'll note that the last 3 entries in the file are for SDK paths for SDKs that may or may not exist. DirectX wouldn't be special. It causing problems seems very unlikely.
Comment 4 Manu 2014-08-06 05:16:02 UTC
(In reply to Brad Anderson from comment #3)
> (In reply to Manu from comment #2)
> > Do you reckon it's a good idea to add it, even if the SDK is not installed
> > on the user's machine? Should we check to see if it's there, and add it at
> > the same time as the various windows sdk's?
> 
> Adding it there is fine. You'll note that the last 3 entries in the file are
> for SDK paths for SDKs that may or may not exist. DirectX wouldn't be
> special. It causing problems seems very unlikely.

Okay cool. Do you want to just paste my 2 lines at the bottom then?
Comment 5 Manu 2014-08-06 05:17:48 UTC
(In reply to Manu from comment #4)
> (In reply to Brad Anderson from comment #3)
> > (In reply to Manu from comment #2)
> > > Do you reckon it's a good idea to add it, even if the SDK is not installed
> > > on the user's machine? Should we check to see if it's there, and add it at
> > > the same time as the various windows sdk's?
> > 
> > Adding it there is fine. You'll note that the last 3 entries in the file are
> > for SDK paths for SDKs that may or may not exist. DirectX wouldn't be
> > special. It causing problems seems very unlikely.
> 
> Okay cool. Do you want to just paste my 2 lines at the bottom then?

... what actually happens if DXSDK_DIR is not set? Will the variable evaluate to an empty string? Will it effectively be: LIB=%LIB%;"\Lib\x64" ?
That doesn't seem like a good thing... and won't that be the case for the windows sdk's too?
Comment 6 Orvid King 2014-08-06 14:15:05 UTC
Yes, environment variables do evaluate to an empty string if they aren't set.

Also, while I don't have a problem with adding the DirectX SDK, as it is common 
enough, I just want to ask the question, what are the requirements to getting a 
path added?
Comment 7 Manu 2014-08-06 14:52:27 UTC
(In reply to Orvid King from comment #6)
> Yes, environment variables do evaluate to an empty string if they aren't set.

So, should we consider this a problem? The lib path looks like it will be filled with a bit of junk... although it's probably benign.

> Also, while I don't have a problem with adding the DirectX SDK, as it is
> common 
> enough, I just want to ask the question, what are the requirements to
> getting a 
> path added?

Well, I have only argued for the DXSDK, because it's an official Microsoft supplied lib with tight integration into their ecosystem, and it has since been merged into the Windows SDK, which created the disparity between new and old versions of Visual Studio.

Did you have one in mind? I haven't come in contact with any others that I feel make such a strong case.
Comment 8 Brad Anderson 2014-08-07 01:00:51 UTC
I don't foresee problems with the path. I just tested and it caused no problems on my DirectX SDK missing system.

https://github.com/D-Programming-Language/dmd/pull/3852
Comment 9 Rainer Schuetze 2016-01-17 22:20:57 UTC
The DXSDK_DIR lib paths have been added long time ago.