mnba / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

Native support for MSVC C++ 2010 Express #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The attached patch implements native support for shedskin under Windows 
using the latest MSVC C++ (it almost certainly won't work with earlier 
versions of MSVC due to unordered_map support).

There are a number of changes so I wanted to pass it to you first to see if 
you are OK with the implementation and if so I'm happy to continue to 
improve the library support under windows (will also publish prebuilt 
libraries for gc and pcre if need be)

Changes include:
* Rename __min,__max,__box to __minT,__maxT, __boxT due to name conflicts
* Implement defines for 'and', 'or' and 'not'
* Implement FLAG.<platform name> to pickup compiler options
* Need to set environment variables GC_HOME and PCRE_HOME
* Changes to unit.py to support windows in a 'nicer' fashion
* Implementation of "typeof" (new include file)
* Minor changes for template support
* Minor changes to library implementations (this needs more work)

All unit tests pass OK (with 2 exceptions that are minor output issues)-- 
however sure I've missed something..

Regards
Andy

Original issue reported on code.google.com by nzmill...@gmail.com on 18 Apr 2010 at 1:51

Attachments:

GoogleCodeExporter commented 9 years ago
thanks again! as discussed, let's try to get this in. would you be willing to 
submit
the changes one patch at a time, with the more uncontroversial changes going 
first?
(such as using three underscores and the time.strptime implementation - thanks 
btw!
:)). this so we can test (MinGW, ubuntu..), discuss, modify and commit the 
changes
one at a time. 

Original comment by mark.duf...@gmail.com on 20 Apr 2010 at 3:58

GoogleCodeExporter commented 9 years ago
btw, I guess we'd build separate MinGW and MSVC packages of shedskin, so it 
knows
what kind of Makefile it has to generate.

Original comment by mark.duf...@gmail.com on 20 Apr 2010 at 3:59

GoogleCodeExporter commented 9 years ago
It's great to build the MSVC packages of shedskin.
Thanks a lot!

Original comment by jason.mi...@gmail.com on 30 Apr 2010 at 1:53

GoogleCodeExporter commented 9 years ago

Original comment by mark.duf...@gmail.com on 18 May 2010 at 1:05

GoogleCodeExporter commented 9 years ago
Actually, on my WIN7_64/MVSC2010 machine, this patch works after the 
following 
changes.
1.comment out the "#include <dirent.h>", this header is only in Mingw
2.comment out this func: list<str *> *listdir(str *path), because it use some 
routines in dirent.h, some cases in unit.py failed because of this
3.edit the unit.py, replace the line os.system('nmake /C /S') with 
os.system('env 
__COMPAT_LAYER=0 nmake /C /S'). reason: in my win7 x64 system the sub shell 
created 
by os.system has an extra env "__COMPAT_LAYER=WinXPSp2", which will fail MSVC 
compiler. I don't know if other windows os has this issue.

Hope these tips can help for building MSVC support.

Another suggestion: there is not necessary to build separate MinGW and MSVC 
packages 
of shedskin. Only add a env var such as "SHEDSKIN_TARGET=MSVC10" 
and "SHEDSKIN_TARGET=MINGW" before invoke shedskin. The installer can query 
user 
which compiler to use and add this var to system env during installation.

BTW, although I agree that windows is not a real OS, but more than half of 
people in 
the world working on windows platform. Adding MSVC support will make shedskin 
more 
complete/popular.

Thanks
Jason

Original comment by jason.mi...@gmail.com on 23 May 2010 at 3:28

GoogleCodeExporter commented 9 years ago
hi jason,

thanks! actually I merged most of andy's patch yesterday, and added a -v option 
to
unit.py and shedskin itself, to work in 'msvc' mode. today I'm going to look 
into a
second patch he sent. perhaps you'd like to test things again after I merge 
this?

note that previous windows releases use MinGW, which is much less work than 
going
through MSVC and in my opinion the way to go to support windows. I'm happy to 
merge
MSVC patches of course, if I receive them.

Original comment by mark.duf...@gmail.com on 23 May 2010 at 9:38

GoogleCodeExporter commented 9 years ago
Sure, I'll try it when you finish merging :)

Original comment by jason.mi...@gmail.com on 23 May 2010 at 10:46

GoogleCodeExporter commented 9 years ago
I'm done for today, so.. :)

Original comment by mark.duf...@gmail.com on 23 May 2010 at 11:27

GoogleCodeExporter commented 9 years ago
Compile failed, seems like you didn't merge the files under shedskin/lib/os/

details:

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl  /Ox  /EHsc /TP /MD /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /Gm-
 /EHsc /GS /Gy /fp:precise
/Zc:wchar_t /Zc:forScope /D "and"="&&" /D "or"="||" /D "not"="!" /D "WIN32" /D 
"_CONS
OLE" /D "ALL_IN
TERIOR_POINTERS" /D "GC_NOT_DLL" /D "_UNICODE" /I. 
/IC:\Downloads\tools\shedskin\shed
skin-r1493\libs
_for_shedskin /IC:\Downloads\tools\shedskin\shedskin-r1493\libs_for_shedskin 
-I. -
IC:/Downloads/tool
s/shedskin/shedskin-r1493/shedskin/lib main.cpp 
C:/Downloads/tools/shedskin/shedskin-
r1493/shedskin
/lib/stat.cpp C:/Downloads/tools/shedskin/shedskin-r1493/shedskin/lib/sys.cpp 
C:/Downloads/tools/she
dskin/shedskin-r1493/shedskin/lib/builtin.cpp 
C:/Downloads/tools/shedskin/shedskin-
r1493/shedskin/li
b/time.cpp C:/Downloads/tools/shedskin/shedskin-r1493/shedskin/lib/getopt.cpp 
config.cpp C:/Downloads
/tools/shedskin/shedskin-r1493/shedskin/lib/os/__init__.cpp 
C:/Downloads/tools/shedskin/shedskin-r14
93/shedskin/lib/os/path.cpp C:/Downloads/tools/shedskin/shedskin-
r1493/shedskin/lib/re.cpp  /link gc
.lib pcre.lib user32.lib /libpath:C:\Downloads\tools\shedskin\shedskin-r1493
\libs_for_shedskin /libp
ath:C:\Downloads\tools\shedskin\shedskin-r1493
\libs_for_shedskin /NODEFAULTLIB:"libcmt" /subsystem:c
onsole  /OPT:REF /OPT:ICF /out:main.exe
main.cpp
stat.cpp
sys.cpp
builtin.cpp
time.cpp
getopt.cpp
config.cpp
__init__.cpp
C:/Downloads/tools/shedskin/shedskin-r1493/shedskin/lib/os/__init__.cpp(10) : 
fatal 
error C1083: Can
not open include file: 'sys/time.h': No such file or directory
path.cpp
C:/Downloads/tools/shedskin/shedskin-r1493/shedskin/lib/os/path.cpp(712) : 
error 
C2039: '__ss_S_ISDI
R' : is not a member of '__stat__'
C:/Downloads/tools/shedskin/shedskin-r1493/shedskin/lib/os/path.cpp(712) : 
error 
C3861: '__ss_S_ISDI
R': identifier not found
C:/Downloads/tools/shedskin/shedskin-r1493/shedskin/lib/os/path.cpp(726) : 
error 
C2039: '__ss_S_ISRE
G' : is not a member of '__stat__'
C:/Downloads/tools/shedskin/shedskin-r1493/shedskin/lib/os/path.cpp(726) : 
error 
C3861: '__ss_S_ISRE
G': identifier not found
re.cpp
NMAKE : fatal error U1077: 'cl' : return code '0x2'

Original comment by jason.mi...@gmail.com on 23 May 2010 at 12:12

GoogleCodeExporter commented 9 years ago
ah right, yes, I'm hoping andy can send new patches for os/.. thanks! 

Original comment by mark.duf...@gmail.com on 23 May 2010 at 1:16

GoogleCodeExporter commented 9 years ago
the patch in shedskin_win.zip cotain changes to os/.., did you merge that?

Original comment by jason.mi...@gmail.com on 23 May 2010 at 1:50

GoogleCodeExporter commented 9 years ago
I merged almost everything except the changes in os/. hopefully that will come 
later..

Original comment by mark.duf...@gmail.com on 23 May 2010 at 2:02

GoogleCodeExporter commented 9 years ago
Okay, 1 more reminder for MSVC support:
the minilight and mastermind program in examples dir should change name to be 
compatible with MSVC, because the ml/minilight.cpp has name conflict with 
minilight.cpp when compiling in one group. May be can change the top level one 
to 
something like minilight_main.py

Original comment by jason.mi...@gmail.com on 23 May 2010 at 2:14

GoogleCodeExporter commented 9 years ago

Original comment by mark.duf...@gmail.com on 5 Oct 2010 at 2:06

GoogleCodeExporter commented 9 years ago
are you guys still interested in this? does shedskin GIT still work with MSVC 
at the moment? is there anything (simple.. :-)) I can do to help..? 

Original comment by mark.duf...@gmail.com on 25 May 2011 at 7:51

GoogleCodeExporter commented 9 years ago
I just changed the names of the two examples, thanks!

I'm closing this issue for now. please reopen or file a new issue if you'd like 
to discuss/improve msvc support further.

Original comment by mark.duf...@gmail.com on 22 Jul 2011 at 6:55