Jump to content

Visual Studio Startup Project


Recommended Posts

I've did some research and build a nice start up solution for Visual Studio. I've created a git that you can clone or submodule into your projects, it is derived from mantragora's project in this thread.

https://bitbucket.or...startup-project

As I don't like going back and forth between VS2008 and VS2012, I found a way to get VS2012 to compile using the vc90 toolchain. It does unfortunately need VS2010 and VS2008 to be installed, but it works great.

Both the VS2008 and VS2012 projects save the .dll to the My Documents\houdini12.5\dso folder and debugging starts by starting the version configured in the environment variables. If you want to load up a scene while debugging, just do this:

- Right click your project, select properties

- Choose Configuration Properties -> Debugging

- Add the full path to the .hip file in the Command Arguments field

I hope that this may be of use to someone. If you have additions or fixes, be sure to send a pull request :)

Link to comment
Share on other sites

Guest mantragora

1) Coen posted some nice tutorial also inspired by this HDK thread from SESi forum. I think he found better way for debugging, but I haven't tested it yet.

2) I don't like this:

Output Directory = %UserProfile%\Documents\houdini12.5\dso\

What if you are using custom HOUDINI_DSO_PATH set in Houdini.env? I prefer to stay away from hard-coding directories in VS and just use variables where I can. For example I keep my DSO directory in Skydrive/Houdini folder that is not in %UserProfile% or houdini12.5 path at all. In fact I'm not using $HOME directory ever for anything beside setting houdini.env file. Icons, DSO, OTL, scripts, toolbar, desktop etc. all are stored in Skydrive/Houdini folder so hard-coding path in VS like this means that you will have to modify it later on if you would like to change place where your DSO directory is placed.

Keep it coming guys so I would not have to record tutorial :D.

Now all thats left is to find someone that could test Windows SDK way of compiling plugins for those who doesn't own VisualStudio.

EDIT:

As for "going back and forth between VS2008 and VS2012", maybe you could also benefit from this Windows SDK setup. I posted here link to some guy that managed to setup VS2008Express to work with SDK, maybe you could figure it out to make it work the same way with VS2012.

Edited by mantragora
Link to comment
Share on other sites

Thanks for the input! I'll take a look at Coen's way tomorrow. I like the way he uses the HOUDINI_DSO_PATH path instead of just dumping it all in one directory like I have now.

The reason why I hardcoded it in is that I'd rather change my visual studio project once than to keep changing my environment variables back and forth if I were to compile for multiple versions. I guess you could run the visual studio from a .bat file where we then set the actual environment variables but I did not like that aproach to much either..

Edited by WesleyE
Link to comment
Share on other sites

Guest mantragora

There is one more thing to add, because I see that Coen also had problems with flags when debugging. You shouldn't use the same flags for release/debug versions.

Basically, if you want to know what flags are needed, run hcustom command from Houdini Command Line Tools:

>hcustom
Usage: hcustom [-g] [-s] [-t] [-L libdir] [-I incdir]
[-l libname] [-i dir]
{ source_files | -c | -m }

This program will make custom plug-ins (DSO's) for Houdini.

Options:
-d Display CFLAGS environment variable passed to hcompile
-g Create debug version of the DSO
-e Echo the commands run by this program
-i dir Specify an install directory (default HOME\houdini12.5\dso)
-s Create a stand alone application instead of a DSO
-l libname Link with the library named libname; libraries are passed
to the compiler in the order in which they are given
-L libdir Add libdir to the library file search path
-I incdir Add incdir to the include file search path
-t Turn off creation of tagging information. At least one
object file in an archive must have the tagging
information for Houdini to load the .dll successfully
-c,--cflags Display compiler flags and exit.
-m,--ldflags Display linker flags and exit.
--no-embed-manifest Do not embed the manifest inside the dll. (only for DSOs).

Now, there are two flags we are interested:

-d so we can see what we need to setup later in our Project

-g this we need if we want to know what flags are needed for setting project for debug mode

After this we just have to run

hcustom -d foo.cpp

for release mode flags, and

hcustom -d -g foo.cpp

for debug mode flags.

!OPTIONAL STEP BEGIN!

You may want to output flags separately for compiler/linker, so instead of using -d flag you can use:

-c for compiler flags

-m for linker flags

Especially that linker flags in release/debug modes are the same :).

!OPTIONAL STEP END!

Than you can compare the two outputs and setup your project correctly. Below you can see compiler flags from my computer for:

RELEASE

-TP
-Zc:forScope
-nologo
-DVERSION="12.5.434"
-DI386
-DWIN32
-DSWAP_BITFIELDS
-D_WIN32_WINNT=0x0501
-DWINVER=0x0501
-DNOMINMAX
-D_USE_MATH_DEFINES
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
-D_SCL_SECURE_NO_WARNINGS
-DBOOST_ALL_NO_LIB
-I .
-I "c:/PROGRA~2/MICROS~1.0/VC/include"
-I "C:/Program Files/Microsoft SDKs/Windows/v6.0A/Include"
-I "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.434/toolkit/include"
-Ox
-MD
-EHsc
-GR
-bigobj
-wd4355
-w14996
-DSESI_LITTLE_ENDIAN
-DAMD64
-DSIZEOF_VOID_P=8
-DFBX_ENABLED=1
-DOPENCL_ENABLED=1
-DOPENVDB_ENABLED=1
-DMAKING_DSO
-Fo"foo.o"
-LD

DEBUG

-TP
-Zc:forScope
-nologo
-DVERSION="12.5.434"
-DI386
-DWIN32
-DSWAP_BITFIELDS
-D_WIN32_WINNT=0x0501
-DWINVER=0x0501
-DNOMINMAX
-D_USE_MATH_DEFINES
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
-D_SCL_SECURE_NO_WARNINGS
-DBOOST_ALL_NO_LIB
-I .
-I "c:/PROGRA~2/MICROS~1.0/VC/include"
-I "C:/Program Files/Microsoft SDKs/Windows/v6.0A/Include"
-I "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.434/toolkit/include"
-Od
-Z7
-DUT_ASSERT_LEVEL=2
-MD
-EHsc
-GR
-bigobj
-wd4355
-w14996
-DSESI_LITTLE_ENDIAN
-DAMD64
-DSIZEOF_VOID_P=8
-DFBX_ENABLED=1
-DOPENCL_ENABLED=1
-DOPENVDB_ENABLED=1
-DMAKING_DSO
-Fo"foo.o"
-LD

NOT EVERY FLAG IS NEEDED!

Some are passed by Visual Studio by default, for example we don't need -LD (if I remember correctly) because we already specified in our project that we are creating DLL not a program and -LD flag means create DLL.

Coen had problems with -Ox flag in debug mode (it enables full optimization of the code so it cannot be run in debug mode later) and if you look closely you will see that in debug mode there should be used different flag -Od. There are couple other flags that should be set but I leave it to you to investigate. For list of all flags and they meanings check here.

!IMPORTANT!

If something goes wrong with new Houdini version (not New build, just new version: H13 etc), you should repeat this step just to check is anything new was added. You don't have to set you solution completely new again, just compare flags. Between H12 and H12.5 there was a change so I had to modify project.

Edited by mantragora
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...