Skip to content

Commit

Permalink
* update SDK conversion for VS2013 and Windws SDK 8.1
Browse files Browse the repository at this point in the history
  * change some default colors when using dark theme in VS 2012+ (restart required)
  * Windows SDK 8.0/8.1 detection
  * fix bad "\n" in default x64 library search path
  * x64 executable and library search path not correctly saved for next VS start
  * improve project automation to mute NuGet (still empty project pretended)
  * changes to build with dmd 2.066alpha
  • Loading branch information
rainers committed Feb 9, 2014
1 parent b1d8eb5 commit 082186c
Show file tree
Hide file tree
Showing 23 changed files with 828 additions and 149 deletions.
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -607,3 +607,10 @@ unreleased Version 0.3.38
* fixed project and completion icons being converted to 16 color bitmaps
* completion box now displays appropriate icons and tooltip with dparser
* tool tips now expand some Ddoc macros for better readability

* update SDK conversion for VS2013 and Windws SDK 8.1
* change some default colors when using dark theme in VS 2012+ (restart required)
* Windows SDK 8.0/8.1 detection
* fix bad "\n" in default x64 library search path
* x64 executable and library search path not correctly saved for next VS start
* improve project automation to mute NuGet (still empty project pretended)
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ $(VSI2D_EXE) : $(VSI2D_SRC)
$(DMD2_) -d -map $@.map -of$@ -version=vsi $(VSI2D_SRC)

sdk\vsi_sources: $(VSI2D_EXE)
$(VSI2D_EXE) -vsi="$(VSISDK)" -win="$(WINSDK)\Include" -dte="$(DTE_IDL_PATH)" -sdk=sdk
$(VSI2D_EXE) --vsi="$(VSISDK)" --win="$(WINSDK)\Include" --dte="$(DTE_IDL_PATH)" --sdk=sdk

# $(VSI_LIB) : sdk\vsi_sources
vsi_lib:
Expand All @@ -133,14 +133,24 @@ cpp2d_exe:
idl2d_exe: $(VSI2D_EXE)
copy $(VSI2D_EXE) ..\downloads\idl2d.exe

prerequisites:
devenv /Project "build" /Build "Release|Win32" visuald_vs10.sln

visuald_vs:
devenv /Project "visuald" /Build "Release|Win32" visuald_vs10.sln

vdserver:
devenv /Project "vdserver" /Build "Release|Win32" visuald_vs10.sln

dparser:
cd vdc\abothe && $(MSBUILD) vdserver.sln /p:Configuration=Release /t:Rebuild

mago:
cd ..\..\mago && devenv /Build "Release|Win32" magodbg.sln
cd ..\..\mago && devenv /Build "Release|Win32" /Project "MagoNatDE" magodbg_2010.sln

cv2pdb:
cd ..\..\cv2pdb\trunk && devenv /Build "Release|Win32" src\cv2pdb.sln
cd ..\..\cv2pdb\trunk && devenv /Project "cv2pdb" /Build "Release|Win32" src\cv2pdb_vs12.sln
cd ..\..\cv2pdb\trunk && devenv /Project "dviewhelper" /Build "Release|Win32" src\cv2pdb_vs12.sln

##################################
# create installer
Expand All @@ -149,6 +159,9 @@ install: all cpp2d_exe idl2d_exe
cd nsis && "$(NSIS)\makensis" /V1 visuald.nsi
"$(ZIP)" -j ..\downloads\visuald_pdb.zip bin\release\visuald.pdb bin\release\vdserver.pdb

#prerequisites
install_vs: visuald_vs vdserver cv2pdb dparser mago install_only

install_only:
cd nsis && "$(NSIS)\makensis" /V1 visuald.nsi

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#define VERSION_MINOR 3
#define VERSION_REVISION 38
#define VERSION_BETA -beta
#define VERSION_BUILD 2
#define VERSION_BUILD 3
5 changes: 3 additions & 2 deletions build/sdk.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ if not exist %DTE_IDL_PATH%\nul md %DTE_IDL_PATH%

set WINSDKINC=%WindowsSdkDir%\include
set VSISDKINC=
if "%VSISDKINC%" == "" if not "%VSSDK120Install%" == "" set VSISDKINC=%VSSDK120Install%
if "%VSISDKINC%" == "" if not "%VSSDK110Install%" == "" set VSISDKINC=%VSSDK110Install%
if "%VSISDKINC%" == "" if not "%VSSDK100Install%" == "" set VSISDKINC=%VSSDK100Install%
if "%VSISDKINC%" == "" if not "%VSSDK90Install%" == "" set VSISDKINC=%VSSDK90Install%
Expand All @@ -30,8 +31,8 @@ if "%VSISDKINC%" == "" (echo could not detect the Visual Studio SDK && exit /B 1
if not exist "%VSISDKINC%\VisualStudioIntegration\Common\Inc\textmgr.h" (echo unexpected Visual Studio SDK installation at %VSISDKINC% && exit /B 1)

echo Translating Windows SDK and Visual Studio SDK to D, this can take several minutes. Please be patient.
echo %VSI2D% -vsi="%VSISDKINC:\=/%" -win="%WINSDKINC:\=/%" -dte="%DTE_IDL_PATH%" -sdk=..\sdk
%VSI2D% -vsi="%VSISDKINC:\=/%" -win="%WINSDKINC:\=/%" -dte="%DTE_IDL_PATH%" -sdk=..\sdk
echo %VSI2D% --vsi="%VSISDKINC:\=/%" --win="%WINSDKINC:\=/%" --dte="%DTE_IDL_PATH%" --sdk=..\sdk
%VSI2D% --vsi="%VSISDKINC:\=/%" --win="%WINSDKINC:\=/%" --dte="%DTE_IDL_PATH%" --sdk=..\sdk
if errorlevel 1 exit /B 1

echo Translation successful!
Expand Down
2 changes: 2 additions & 0 deletions build/sdk_libs.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ set LIBS=kernel32.lib user32.lib winspool.lib advapi32.lib
set LIBS=%LIBS% comdlg32.lib gdi32.lib ole32.lib rpcrt4.lib shell32.lib winmm.lib
set LIBS=%LIBS% wsock32.lib comctl32.lib oleaut32.lib ws2_32.lib odbc32.lib

echo WindowsSdkDir=%WindowsSdkDir%
set WINSDKLIB=
if "%WINSDKLIB%" == "" if exist "%WindowsSdkDir%\lib\winv6.3\um\x86\kernel32.lib" set WINSDKLIB=%WindowsSdkDir%\lib\winv6.3\um\x86
if "%WINSDKLIB%" == "" if exist "%WindowsSdkDir%\lib\win8\um\x86\kernel32.lib" set WINSDKLIB=%WindowsSdkDir%\lib\win8\um\x86
if "%WINSDKLIB%" == "" if exist "%WindowsSdkDir%\lib\kernel32.lib" set WINSDKLIB=%WindowsSdkDir%\lib
if "%WINSDKLIB%" == "" (echo could not detect the Windows SDK library folder && exit /B 1)
Expand Down
43 changes: 42 additions & 1 deletion c2d/idl2d.d
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ class idl2d
"threadpoolprivateapiset.h", "threadpoolapiset.h", "bemapiset.h", "wow64apiset.h",
"jobapi.h", "timezoneapi.h", "datetimeapi.h", "stringapiset.h",
"libloaderapi.h", "securitybaseapi.h", "namespaceapi.h", "systemtopologyapi.h", "processtopologyapi.h",
"securityappcontainer.h", "realtimeapiset.h", "unknwnbase.idl", "objidlbase.idl", "combaseapi.h"
"securityappcontainer.h", "realtimeapiset.h", "unknwnbase.idl", "objidlbase.idl", "combaseapi.h",
// Win SDK 8.1
"mprapidef.h", "lmerr.h", "lmcons.h",
])
win_idl_files ~= f ~ "*"; // make it optional

Expand Down Expand Up @@ -1215,6 +1217,11 @@ version(all)
replaceTokenSequence(tokens, "typedef struct DECLSPEC_ALIGN($_num)", "align($_num) typedef struct", true);
replaceTokenSequence(tokens, "typedef union DECLSPEC_ALIGN($_num)", "align($_num) typedef union", true);
replaceTokenSequence(tokens, "struct DECLSPEC_ALIGN($_num)", "align($_num) struct", true);

// win 8.1: remove template _ENUM_FLAG_INTEGER_FOR_SIZE
replaceTokenSequence(tokens, "template $args _ENUM_FLAG_INTEGER_FOR_SIZE;", "/*$0*/", true);
replaceTokenSequence(tokens, "template <> struct _ENUM_FLAG_INTEGER_FOR_SIZE <$arg> { $def };", "/*$0*/", true);
replaceTokenSequence(tokens, "template <$arg> struct _ENUM_FLAG_SIZED_INTEGER { $def };", "/*$0*/", true);
}

if(currentModule == "commctrl")
Expand Down Expand Up @@ -1494,6 +1501,9 @@ version(none) version(vsi)
replaceTokenSequence(tokens, "OLECMDIDF_REFRESH_PROMPTIFOFFLINE = 0x2000, OLECMDIDF_REFRESH_THROUGHSCRIPT = 0x4000 $_not,",
"OLECMDIDF_REFRESH_PROMPTIFOFFLINE = 0x2000,\nOLECMDIDF_REFRESH_THROUGHSCRIPT = 0x4000, $_not", true);
replaceTokenSequence(tokens, "OLECMDIDF_REFRESH_PROMPTIFOFFLINE = 0x2000 $_not,", "OLECMDIDF_REFRESH_PROMPTIFOFFLINE = 0x2000, $_not", true);

// win SDK 8.1: double define
replaceTokenSequence(tokens, "typedef struct tagPAGESET {} PAGESET;", "", true);
}

//vsshell.idl
Expand Down Expand Up @@ -1526,6 +1536,23 @@ version(none) version(vsi)
{
replaceTokenSequence(tokens, "typedef enum CWMO_FLAGS", "typedef enum tagCWMO_FLAGS", true);
}
if(currentModule == "lmcons")
{
replaceTokenSequence(tokens, "alias NERR_BASE MIN_LANMAN_MESSAGE_ID;", "enum MIN_LANMAN_MESSAGE_ID = 2100;", true); // missing lmerr.h
}
if(currentModule == "winnt")
{
// Win SDK 8.1: remove translation to intrinsics
replaceTokenSequence(tokens, "alias _InterlockedAnd InterlockedAnd;", "/+ $*", true);
replaceTokenSequence(tokens, "InterlockedCompareExchange($args __in LONG ExChange, __in LONG Comperand);", "$* +/", true);
replaceTokenSequence(tokens, "InterlockedOr(&Barrier, 0);", "InterlockedExchangeAdd(&Barrier, 0);", true); // InterlockedOr exist only as intrinsic
}
if(currentModule == "ocidl")
{
// move alias out of interface declaration, it causes circular definitions with dmd 2.065+
replaceTokenSequence(tokens, "interface IOleUndoManager : IUnknown { alias IID_IOleUndoManager SID_SOleUndoManager; $data }",
"interface IOleUndoManager : IUnknown { $data }\n\nalias IID_IOleUndoManager SID_SOleUndoManager;", true);
}

replaceTokenSequence(tokens, "extern const __declspec(selectany)", "dconst", true);
replaceTokenSequence(tokens, "EXTERN_C $args;", "/+EXTERN_C $args;+/", true);
Expand Down Expand Up @@ -1723,6 +1750,10 @@ version(none)
replaceTokenSequence(tokens, "$_not . UIHierarchyItems*", "$_not . UIHierarchyItems*", true);
replaceTokenSequence(tokens, "Collection([$data] ProjectItems $arg)", "Collection([$data] .ProjectItems $arg)", true);
}
if(currentModule == "dte80a")
{
replaceTokenSequence(tokens, "[id($_num), propputref $attr] HRESULT Value", "[id($_num), propputref $attr]\nHRESULT putref_Value", true);
}
// VS2012 SDK
if(currentModule == "webproperties")
{
Expand Down Expand Up @@ -1874,6 +1905,11 @@ version(all) {
replaceTokenSequence(tokens, "_Acquires_exclusive_lock_($args)", "/+$*+/", true);
replaceTokenSequence(tokens, "_Acquires_shared_lock_($args)", "/+$*+/", true);

// Win SDK 8.1
replaceTokenSequence(tokens, "_Post_satisfies_($args)", "/+$*+/", true);
replaceTokenSequence(tokens, "_Post_readable_byte_size_($args)", "/+$*+/", true);
replaceTokenSequence(tokens, "_Ret_reallocated_bytes_($args)", "/+$*+/", true);

replaceTokenSequence(tokens, "__assume_bound($args);", "/+$*+/", true);
replaceTokenSequence(tokens, "__asm{$args}$_opt;", "assert(false, \"asm not translated\"); asm{naked; nop; /+$args+/}", true);
replaceTokenSequence(tokens, "__asm $_not{$stmt}", "assert(false, \"asm not translated\"); asm{naked; nop; /+$_not $stmt+/} }", true);
Expand Down Expand Up @@ -2170,6 +2206,11 @@ else
case "_Ret_maybenull_":
case "_Ret_opt_":
case "_Printf_format_string_":

// Windows SDK 8.1
case "_Field_z_":
case "_Pre_notnull_":
case "_Frees_ptr_":
return "/*" ~ text ~ "*/";

case "__checkReturn": return "/*__checkReturn*/";
Expand Down
2 changes: 2 additions & 0 deletions sdk/port/base.d
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ alias void WriteULongPtrRelease;
alias void WriteULongPtrNoFence;
alias void WriteULongPtrRaw;

extern(C) DWORD __readfsdword (DWORD Offset) { asm { naked; mov EAX,[ESP+4]; mov EAX, FS:[EAX]; } }

enum TRUE = 1;
public import sdk.win32.winbase;
//enum FALSE = 0;
Expand Down
Loading

0 comments on commit 082186c

Please sign in to comment.