SolveSpace Logo SOLVESPACE -- parametric 2d/3d CAD
Examples
Tutorials
Features
Download
Reference
Technology
Library
Forum
Contact
USER FORUM

(you are viewing a thread; or go back to list of threads)

Getting started with Programming SolveSpace (by Andrey)
First off a truly amazing accomplishment! Congrats and especially for making it opensource.

So for the newer programmers and ones that want to make sure they are doing it the correct way, can someone describe the process for setting up the programming environment and best practices?

eg. To start developing SolveSpace:
1) Install: Visual Studio 2012 Express for Windows Desktop. http://www.microsoft.com/visua...oads#d-express-windows-desktop

2) Download and unzip: solvespace-rel2.0.zip http://solvespace.com/download.pl

3) In Visual Studio: File>OpenProject> Now here is where I get stuck because there is no project file eg .sln to open to build the project.

4) Goto https://gitorious.org/ and create an account for yourself and login. Then goto the SolveSpace project at: https://gitorious.org/solvespa...e01d3f8b28b97fc19f35bb985577e8:

5) From here on, how the proper/preferred process to merge the data to the local machine and how to deal with versions, or lets say you actually fix a bug or make an improvement how to upload that for review and in a way not to make people angry etc.
Fri Oct 4 2013, 10:35:54
(no subject) (by Jonathan Westhues)
You can use an MSVC environment of your choice. I'd guess that Visual Studio 2012 Express would work, though I typically just use the command-line tools from the latest Platform SDK. You also need a local Perl install, with the GD module.

You can either download the latest source release, or clone the repository from git. There's no value in doing both. I'd suggest that you work from git, since we've made changes since that first release.

In the source from git, the command to build under Windows is "nmake -f Makefile.msvc", following some changes by Daniel Richard G to the build process in anticipation of a Linux port.

Don't worry about making anyone angry with a change. You shouldn't have permissions to push to gitorious, or otherwise do anything bad.

If you're interested in merging your changes with my mainline, then I'd suggest discussing them before you do the work, either here or by email. When you're done, you can send a patch, here, by email, or through the gitorious process, and I'll take a look.

Let me know if you have any other questions.
Sat Oct 5 2013, 04:22:43
(no subject) (by Andrey)
Still can not open project in MVSE2012. That's hard core that you just use command line tools. If someone can describe how they are opening and successfully using visual studio with SolveSpace that would help.
I typed perl -v in the command prompt and got:
This is perl, v5.10.1 (*) built for i686-cygwin-thread-multi-64int
Is that good enough or do I need to install the "GD module" what ever that is?
Sat Oct 5 2013, 14:36:31
(no subject) (by Jonathan Westhues)
The project is not developed under Microsoft Visual Studio's IDE. No project file for that exists, so whatever you're trying to open, it's not going to work.

I believe that Daniel was planning to add one at some point, or you could create one yourself. I'd suggest that you become familiar with makefiles and the commands to invoke the compiler from the command line, though, since all but the smallest projects are typically built that way.

Did you try setting up the compiler to work from the command prompt and typing "nmake -f Makefile.msvc"?
Sun Oct 6 2013, 15:31:47
(no subject) (by Andrey)
Thanks for the help. So working with Win7 64.
I was going to install windows sdk but apparently it's automatically installed with VS2012 and there are Visual Studio Tools from the start menu that give three command prompts:
Developer Command Prompt for VS2012
VS2012 x64 Cross Tool Command Prompt
VS2012 x86 Native Tool Command Prompt
I also read that if you have VS2010 installed it will not install and you have to uninstall VS2010 which I don't want to do. But if you want me to do it then ok.

I downloaded the latest project code from Gitorious.

Installed Perl by DWIN Perl hoping that it comes with GD and according to the DWIN tool:
Please type in a space-separated list of modules you want to find the installed versions for below.
> gd
The version of gd in C:/Dwimperl/perl/vendor/lib is 2.46
Press any key to exit.

Getting this error:
C:\Users\Skie\Documents\AndreyLibrary\Software\SolveSpace\MyCustomSolveSpace\MySS_1_1\solvespace-megaminds-solvespace>nmake -f Makefile.msvc

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

perl png2c.pl icons.h icons-proto.h
Can't locate GD.pm in @INC (@INC contains: /usr/lib/perl5/5.10/i686-cygwin /usr/
lib/perl5/5.10 /usr/lib/perl5/site_perl/5.10/i686-cygwin /usr/lib/perl5/site_per
l/5.10 /usr/lib/perl5/vendor_perl/5.10/i686-cygwin /usr/lib/perl5/vendor_perl/5.
10 /usr/lib/perl5/vendor_perl/5.10 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/v
endor_perl/5.8 .) at png2c.pl line 6.
BEGIN failed--compilation aborted at png2c.pl line 6.
NMAKE : fatal error U1077: '"C:\Program Files\Cygwin\bin\perl.EXE"' : return code '0x2'
Stop.

So I noticed it was using cygwin so that's not good but not sure what is happening and how to fix everything.
Tue Oct 8 2013, 02:41:07
(no subject) (by Jonathan Westhues)
You appear to have two independent versions of perl installed, each with its own set of modules. The DWIM version seems to have GD installed, and the cygwin version doesn't.

Your path defaults to the cygwin version, so the build process fails. You can probably fix that by editing your PATH environment variable to include only DWIM perl.
Tue Oct 8 2013, 02:51:09
(no subject) (by Andrey)
This is my PATH:
PATH on HPLaptop:
C:\Program Files\Python\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Broadcom\Broadcom 802.11\Driver;C:\VXIPNP\WinNT\Bin;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\proeWildfire 5.0\bin;C:\Program Files\proeWildfire 5.0\mech\bin;C:\Program Files\ptchelpWildfire 5.0\bin;C:\Program Files\PTC\Creo 1.0\Common Files\M010\mech\bin;C:\Program Files\Panda3D\Panda3D-1.8.0\python;C:\Program Files\Panda3D\Panda3D-1.8.0\bin;C:\Program Files\Cygwin\bin;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x86)\Common Files\Autodesk Shared\;C:\Program Files (x86)\Autodesk\Backburner\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Dwimperl\perl\bin;C:\Dwimperl\perl\site\bin;C:\Dwimperl\c\bin;

So I deleted C:\Program Files\Cygwin\bin;
I think that will totally disable Cygwin but I don't know what else to do. Turns out it worked for nmake though.

So I ran the nmake and got:

C:\Users\Skie\Documents\AndreyLibrary\Software\SolveSpace\MyCustomSolveSpace\MyS
S_1_1\solvespace-megaminds-solvespace>nmake -f Makefile.msvc

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

perl png2c.pl icons.h icons-proto.h
rc /foobj\resource.res win32\resource.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.2.9200.16384
Copyright (C) Microsoft Corporation. All rights reserved.

cl /W3 /nologo /MT /D_DEBUG /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_
WARNINGS /I. /Iextlib /Zi /EHs /D_WIN32_WINNT=0x500 /DISOLATION_AWARE_ENABLED /D
_WIN32_IE=0x500 /DWIN32_LEAN_AND_MEAN /DWIN32 -DHAVE_SPACEWARE_INPUT /c /Foobj\
.\bsp.cpp .\clipboard.cpp .\confscreen.cpp .\constraint.cpp .\constrainteq.cpp .
\describescreen.cpp .\draw.cpp .\drawconstraint.cpp .\drawentity.cpp .\entity.cp
p .\export.cpp .\exportstep.cpp .\exportvector.cpp .\expr.cpp .\file.cpp .\gener
ate.cpp .\glhelper.cpp .\graphicswin.cpp .\group.cpp .\groupmesh.cpp .\mesh.cpp
.\modify.cpp .\mouse.cpp .\polygon.cpp .\request.cpp .\solvespace.cpp .\style.cp
p .\system.cpp .\textscreens.cpp .\textwin.cpp .\toolbar.cpp .\ttf.cpp .\undored
o.cpp .\util.cpp .\view.cpp
bsp.cpp
clipboard.cpp
confscreen.cpp
constraint.cpp
constrainteq.cpp
describescreen.cpp
draw.cpp
drawconstraint.cpp
drawentity.cpp
entity.cpp
export.cpp
exportstep.cpp
exportvector.cpp
expr.cpp
file.cpp
generate.cpp
glhelper.cpp
graphicswin.cpp
group.cpp
groupmesh.cpp
Generating Code...
Compiling...
mesh.cpp
modify.cpp
mouse.cpp
.\mouse.cpp(992) : warning C4101: 'e' : unreferenced local variable
polygon.cpp
request.cpp
solvespace.cpp
style.cpp
system.cpp
textscreens.cpp
textwin.cpp
toolbar.cpp
ttf.cpp
undoredo.cpp
util.cpp
view.cpp
Generating Code...
cl /W3 /nologo /MT /D_DEBUG /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_
WARNINGS /I. /Iextlib /Zi /EHs /D_WIN32_WINNT=0x500 /DISOLATION_AWARE_ENABLED /D
_WIN32_IE=0x500 /DWIN32_LEAN_AND_MEAN /DWIN32 -DHAVE_SPACEWARE_INPUT /c /Foobj\
srf\boolean.cpp srf\curve.cpp srf\merge.cpp srf\ratpoly.cpp srf\raycast.cpp srf\
surface.cpp srf\surfinter.cpp srf\triangulate.cpp
boolean.cpp
curve.cpp
merge.cpp
ratpoly.cpp
raycast.cpp
surface.cpp
surfinter.cpp
triangulate.cpp
Generating Code...
cl /W3 /nologo /MT /D_DEBUG /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_
WARNINGS /I. /Iextlib /Zi /EHs /D_WIN32_WINNT=0x500 /DISOLATION_AWARE_ENABLED /D
_WIN32_IE=0x500 /DWIN32_LEAN_AND_MEAN /DWIN32 -DHAVE_SPACEWARE_INPUT /c /Foobj\
win32\freeze.cpp win32\w32main.cpp win32\w32util.cpp
freeze.cpp
w32main.cpp
w32util.cpp
Generating Code...
cl /D_WIN32_WINNT=0x500 /DISOLATION_AWARE_ENABLED /D_WIN32_IE=0x500 /DWI
N32_LEAN_AND_MEAN /DWIN32 -DHAVE_SPACEWARE_INPUT /W3 /nologo /MT /D_DEBUG /D_CRT
_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /I. /Iextlib /Zi /EHs /Feobj\solv
espace.exe obj\bsp.obj obj\clipboard.obj obj\confscreen.obj obj\constraint.ob
j obj\constrainteq.obj obj\describescreen.obj obj\draw.obj obj\drawconstrain
t.obj obj\drawentity.obj obj\entity.obj obj\export.obj obj\exportstep.obj o
bj\exportvector.obj obj\expr.obj obj\file.obj obj\generate.obj obj\glhelper.
obj obj\graphicswin.obj obj\group.obj obj\groupmesh.obj obj\mesh.obj obj\mo
dify.obj obj\mouse.obj obj\polygon.obj obj\request.obj obj\solvespace.obj o
bj\style.obj obj\system.obj obj\textscreens.obj obj\textwin.obj obj\toolbar.
obj obj\ttf.obj obj\undoredo.obj obj\util.obj obj\view.obj obj\boolean.obj
obj\curve.obj obj\merge.obj obj\ratpoly.obj obj\raycast.obj obj\surface.obj
obj\surfinter.obj obj\triangulate.obj obj\freeze.obj obj\w32main.obj obj\w32
util.obj obj\resource.res user32.lib gdi32.lib comctl32.lib advapi32.lib shell32
.lib opengl32.lib glu32.lib extlib\libpng.lib extlib\zlib.lib extlib\si\siapp.l
ib
editbin /nologo /STACK:8388608 obj\solvespace.exe

1 file(s) copied.
solvespace.exe

C:\Users\Skie\Documents\AndreyLibrary\Software\SolveSpace\MyCustomSolveSpace\MyS
S_1_1\solvespace-megaminds-solvespace>

I ran the solvespace.exe and it seems to work.
Um now I feel stupid to ask but I still can only open single files and not a project in VS2012 and I have a command prompt but no idea what to do next to start working with the project.
Tue Oct 8 2013, 14:42:03
(no subject) (by Jonathan Westhues)
That looks like it worked, then. You can edit the source files in a text editor of your choice (including the Visual Studio IDE, if you prefer). If you run make again, then the program will be compiled with your changes.
Wed Oct 9 2013, 01:57:10
(no subject) (by Andrey)
Ah great! I was not sure. So how do you personally work with the files? You just open them up in like Notepad++ or ?? and just rack it out with no help or anything!? Wow how is that possible to remember code and to figure out stuff you don't know? Really curious how the pro's like you work.
Now for me I really need all the help and the easiest way to code. So just to be clear it does not matter that my VS2012 can not build the program. I just open each file and edit them and then when I need to build to see if my changes worked I run nmake -f Makefile.msvc again and open the solvespace.exe instead of Debug > Start Debugging (F5).
Wed Oct 9 2013, 03:06:18
(no subject) (by Jonathan Westhues)
Correct; you could, if you wanted, use the IDE only as an editor, and still build and run from the command line. You could also create a project file, though, to invoke the compiler in the same way that the makefile invokes it now.

I personally build only from the command line, and edit source files with gvim. I almost never use a debugger, but when I do I use WinDbg. This is a matter of personal preference, though.
Wed Oct 9 2013, 04:53:26
(no subject) (by Andrey)
I have been doing research on how to best work with the code in VS and it's very confusing and most of the info is about old versions of VS working with makefiles. So some guys say make a new project and rebuild everything into a new solution. But what I am concerned with is when you make changes to the master code how do I easily merge that. Other guys say to create a new project in VS with the Makefile project option. Not sure about the problems I will face but I will get more functionality like coding hints from VS which is a major thing for me. Here are some links:
http://stackoverflow.com/quest...-under-visual-studio-2005?rq=1
http://stackoverflow.com/quest...akefiles-in-visual-studio?rq=1
http://stackoverflow.com/quest...dio-c-that-has-makefile-o?rq=1
http://msdn.microsoft.com/en-us/library/txcwa2xx.aspx

I get stuck when creating a Makefile project on the Application Settings. The options are:
Build command line:
Preprocessor definitions:
Clean commands:
Include search path:
Rebuild command line:
Forced included files:
Output (for debugging):
CLR Assembly search path:
Forced using .NET assemblies:

Explained here http://msdn.microsoft.com/en-us/library/a4w8ya3w.aspx

Best guesses to try what should go in each?
Thu Oct 10 2013, 23:27:24
(no subject) (by Jonathan Westhues)
Just look at how the compiler gets invoked from the makefile, and set your project up for the same--so same compiler flags, same build sequence, etc.

You'll have to manually update your build process if someone makes a change that affects the makefile (e.g., to add a new source file). That's a minority of changes, though, so your project shouldn't break too often.
Tue Oct 15 2013, 03:31:39
How to get started (by Rune)
I was downloading the project, and just to get started Id like to compile, and as Andrey said, It seem pretty complicated.
Could you provide a step by step summary of how to compile to get up and running please.
Mon Nov 10 2014, 07:54:43
Works with 2012 but not 2013 (by Dale Wheat)
I can confirm that it is possible to compile SolveSpace from the source available from the repository using Microsoft Visual Studio Express 2012 and Strawberry Perl using the command line tools. I'm using Windows 8.1.

I can also confirm that it is NOT possible to do so using the current (2013) version of the same tools.

I get a 'weird' error complaining about a template type ("_Ty") from the math.h header file. What's weird about it is that it has no problem with the same construct on the previous lines.

Now on to adding import and scripting options to SolveSpace! Wish me luck.

Dale
Mon Feb 9 2015, 12:07:24
SolveSpace 2.0 as a Microsoft Visual Studio Express (2012 or 2013) project (by Dale Wheat)
I have successfully created a Visual Studio project for SolveSpace 2.0. It includes the project and solution files needed to build and debug SolveSpace using Microsoft Visual Studio Express 2012 or 2013.

You will also need to install perl on your machine. I used Strawberry Perl for Windows and it seems to work fine.

I have not extensively tested this yet.

All zipped up, it's about 13 MB, so too large to attach here. I will try to get it published on my web site when I can find my own log-in credentials (d'oh!), which will probably be this evening. Google Mail prevents me from sending it as an attachment because of all the prohibited file extensions (it is truly executable content).

If anyone is interested in getting started on their own SolveSpace experiments, this should make it a bit easier.
Mon Feb 9 2015, 12:49:17
(no subject) (by yugami)
The bulk of that is probably the databases stuff it can regenerate if you delete it the project files themselves should be tiny. If the project is based around the source structure from git then you should only need to distribute the project files themselves
Mon Feb 9 2015, 22:28:43
Smaller is better (by Dale Wheat)
@yugami: Yes, deleting the .SDF file (which can be regenerated) sheds ~80% of the ZIP file size.

I have attached the whole project here, which remains a 'makefile' project under Visual Studio.

One correction: This project does NOT compile under Microsoft Visual Studio Express for Desktop 2013. I'm still trying to figure that one out. Works great under the 2012 version.
Tue Feb 10 2015, 09:31:34, download attachment ssvs.zip
(no subject) (by yugami)
If you want to use the bash that comes with GIT I made a batch file that uses the VCVARS32 batch file and launches bash so you have the complete environment for compiling

call "%VS120COMNTOOLS%vsvars32.bat" >NUL:
START "" "C:\Program Files (x86)\Git\bin\sh.exe" --login -i
Tue Feb 10 2015, 10:17:15
(no subject) (by Rune)
I have sucessfully made a clone of the solvespace project. It compiles using both Visual Studio 2013 and CodeBlocks with the integrated MingW. I found the sourcecode for the libraries and have compiled them as well.
It would be good to collect the various solutions so people can get up and running in no time and contribute with improvements. Personally I found the biggest hurdle is to set up an integrated development environment to be able to debug and understand the program. More documentation would also be good.
It's really a good program base that Jonathan have developed, but it needs a lot of improvements to keep up with the giant cad programs.
What do you think?
Fri Feb 13 2015, 03:21:02
(no subject) (by Dale Wheat)
Good work! I think the next step for Visual Studio users is to convert it from a 'makefile project' to a proper VS project, so that all the command line options can be selected from the IDE.

I agree that Jonathan has created an impressive tool that can be used today. There will always be additional features that are desirable by different groups of users. I think it would be wise to consider those areas that benefit the largest user base first.
Fri Feb 13 2015, 09:53:32
SolveSpace 2.0 as a Microsoft Visual Studio Express (2012 or 2013) project (by John Griessen)
I think the next step for Visual Studio users is to convert it from a 'makefile project' to a proper VS project

Or one could create a script that translates the usual way the core developer does it to another way. Why assume the core developer needs to change their ways?

I spent some time to get it installed in a windows VM on linux. I will
probably spend some time and get it to compile with GCC soon and drop that.

There is no one way to do things.

John Griessen
Austin TX engineer
Sat Feb 14 2015, 23:04:44
(no subject) (by Dale Wheat)
@John:

I agree. There are any number of ways to do this. That's one of the great things about Open Software in general and this project in particular.

I suggested converting the build mechanism from a makefile project to a VS project to leverage the strengths of VS, for those that want to go in that direction. Some will, some won't. If people want to work from the command line, batch file or makefile (as Jonathan does), that trail has already been blazed.

A GCC port would be a Good Thing for this project, IMHO. Today it would still be quite Windows-centric, due to the user interface choices, but it would open up a lot of possibilities for portability to other platforms.

I'm just happy to be able to compile on my existing machine. :D
Mon Feb 16 2015, 09:38:11
(no subject) (by yugami)
The provided solution files muck up the standard git repository format.

Attached are modified files that build with the default repository. Just checkout the git source and drop these into the main directory (the one with Makefile.msvc)
Tue Feb 17 2015, 11:06:47, download attachment solvespace.sln
(no subject) (by yugami)
2nd post for 2nd file. These are the only two files needed, everything else gets regenerated upon opening.
Tue Feb 17 2015, 11:07:21, download attachment solvespace.vcxproj
(no subject) (by Rune)
Hi Yugami, could you elaborate a bit on "muck up.."
With joined forces we could organize the files like in the project:http://sourceforge.net/p/win32...code/HEAD/tree/new%20projects/

In that project there is a folder with all possible compilers to keep everyone happy.

For expert programmers its not a problem but for the occasional programmer (like myself) it's convenient to find turnkey solutions. It took me quite some time to get running with VS2013 and CodeBlocks. I'd be happy to contribute with a couple of things.
Wed Feb 18 2015, 09:37:40
(no subject) (by yugami)
The project file he posted only work with his directory structure which is not based on the solvespace repository structure. (its based on a standard wizard generated project format in Visual Studio)

The files I posted can be dumped into the raw GIT repository without any modifications to the directory structure.

However there was a problem with the Release build on the other vsxproj file I posted, this one is corrected
Wed Feb 18 2015, 11:15:23, download attachment solvespace.vcxproj
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2022 SolveSpace contributors. Most recent update June 2 2022.