Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Question about C-Hook developement


Recommended Posts

Hello Members,

 

I develope a C-Hook in VS 2010 for X5 and now for X6 and X6 64bit.

 

What is the best way to use the same code for all three Mastercamversions, because every version has different project-properties and sdk-directories?

 

One way will be to leave all the code in his place and the settings as they are, and rename everytime the sdk-directory manually and change output from X86 to X64 (Mastercam X6) manually before compiling. Then I have to manage three different sdk-directories.

 

Another way is to make for every mastercam-version in my chook-solution a different project-file and different solution-file. In my solution I have 6 projects. That means I have to manage 18 projectfiles and 3 solutionfiles to support 3 mastercamversions with the same code.

 

Perhaps someone has an advice for me how to differentiate simple between the three outputversions and projectsettings.

 

thank you in advance

Karsten

Link to comment
Share on other sites

Ultimately you need to rename the paths to where the .H and .LIB files are for each X# version you wish to build.

 

One way to change these paths without actually altering the Project files each time is by using System Environment variables.

Setting an Environment variables such as this ->

 

Set like this for X5 ->

SDK_X=C:\SDK\X5

 

Set like this to build for X6

SDK_X=C:\Program Files (x86)\mcamx6\SDK

 

Now you can tell Visual Studio to use this path defined by ‘SDK_X’

*You wrap the name of the Environment Variable name inside -> $(myVarName)

 

Configuration Properties -> C++ -> Additional Include Directories =>

$(SDK_X)\;$(SDK_X)\interfaces\gui;….

 

Configuration Properties -> Linker -> Additional Library Directories =>

$(SDK_X)\release

 

That will take care of the paths in the Projects.

 

You will course need to have both 32-bit and 64-bit Configurations when building for X6.

It does not matter that there are 64-bit configs when building for X5, as you will just not reference the 64-bit configs.

 

You could then create the required Build Configurations within single Solution/Project set.

 

*You must make sure that if building a CHook for use with X5 and you are using VS-2010, that the "Platform Toolset" is set to "v90"

Note that this requires that VS-2008 also be installed on the system.

 

Now you should be able to fire off the build specifying the Build Configuration to be run.

 

 

I would suggest checking out MSBUILD

 

All Programs -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt (2010)

At the cmd line prompt to show it’s options =>

MSBUILD /? [enter]

 

You can fire off a build of your Solution or Project via the command line (or Batch file, etc.) like this =>

MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release

 

You can also do builds using the command line with DEVENV

Link to comment
Share on other sites

Hi Roger,

 

thank you for reply.

 

To change settings with system environment variables before loading the solution is a great idea!

 

I will try this with batchfiles. Then I only have to change the outputplatformsetting X86<->X64 for X6 before compiling, thats ok and simple.

 

I don't use vs2008 anymore since vs2010 has arrived and I don't have it installed. I compile my c-hooks only with vs2010 and they works fine under X3/X4/X5. Probably I don't use relevant functions, which are in need of vs2008, so I got no working problems.

 

Thank you

 

Karsten

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.

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.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...