[SDK] Preparing Visual Studio C++ for multiple 3ds max SDKs?


#1

Hello,
How do You prepare your workflow in Visual Studio to compile plugins for different 3ds max versions?
Do You automate it in some way? or enter change all internal compiler variables?
I must say I have some problems, In Configuration Manager I make new Configuration called for example ‘2020’ and I want it to copy all settings from Release mode. It not copying everything, so I must change a lot of thing myself, and all variables in MACROS…


#2

i have a folder for each max version
this folders contain the .sln, .vcxproj and .vcxproj.filters file
so 3 files per folder

source files are outside in a common folder

you have an initial project for some version, set there all needed path, i have set path for intermediate files to point into each folder for a max-version,
open the .vcxproj file in a text-editor, aka. notepad

edit at only 2 locations
in <PropertyGroup Label=“Globals”>
there is a <MaxSDK> entry
i have <MaxSDK>$(ADSK_3DSMAX_SDK_2020)</MaxSDK>
“ADSK_3DSMAX_SDK_2020” is an environment-varaible set when installing the SDK (or you did by hand)
to have it for “2019” just change “2020” to ‘2019’

2nd part is in <PropertyGroup>
<OutDir>$(ADSK_3DSMAX_x64_2020)\plugins&lt;/OutDir>
here too just change 2020 to 2019
“ADSK_3DSMAX_x64_2020” is an env-variable set by your max-installation

shortcut, search 2020 and replace to 2019

do this for any version you need
if you use the property-sheets that come with the sdk, all other things should be picked up from there

looks complicated at first look, but when done once, all you need for new projects to copy prj-files and edit them at 2 places


#3

much the same as above, though I use my own property sheets which preserve some commonality from previous versions of visual studio…


#4

But what if project will need a new dependency .lib introduced after a while?
Will it require to edit all project files or all project files can somehow depend on single external ‘list’ of these .lib?
What’s the advantage to have multiple projects vs multiple configurations in a single project?


#5

for me any additional lib/dependencies have their own property sheet.

What’s the advantage to have multiple projects vs multiple configurations in a single project?

dunno just the way i like to work

for example our exporter requires some dx9 legacy support code

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <_ProjectFileVersion>11.0.61030.0</_ProjectFileVersion>
    <_PropertySheetDisplayName>directx9_64</_PropertySheetDisplayName>
  </PropertyGroup>
  <ItemDefinitionGroup>
    <ClCompile>
      <AdditionalIncludeDirectories>$(DirectX9IncludeDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
      <AdditionalDependencies>d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>$(DirectX9LibDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
    </Link>
  </ItemDefinitionGroup>
  <PropertyGroup Label="UserMacros">
    <DirectX9IncludeDir>C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include</DirectX9IncludeDir>
    <DirectX9LibDir>C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64</DirectX9LibDir>
  </PropertyGroup>
</Project>

#6

Thanks for all your answers…

At first I just wanted to make additional configurations in Configuration Manager, but the changes didn’t save, I think its some kind of bug because I make a very new VC project and the changes was saved as it should…

Cheers!


#7

additinal, I was told about using CMake to make different variation of compilation, but its another thing to learn and too much time consuming, the copying project files “brute force” should be enough :slight_smile:


#8

For tyFlow I just use the configuration manager to specify all the different max versions I support. Then each version I specify the SDK to point to, output name, etc. Furthermore I edit the .vcproj file to make certain libs/directories shared between builds, and certain includes/libs separate for different builds. Then I use the Build->Batch Build menu to build them all at once. Super easy, and no need for separate solutions/projects.

build


#9

Thanks!
Yes, I wanted to use this feature at first… but there must be a bug in my project files or something…

When I wanted to change values in new configurations nothing was saving. The values where changing globally, I tried at the very new win32 project and it worked… so I will just stay at the project files copying by now…

Congrats for tyFlow anyway! Great stuff!! I also made my plugin to work with tyFlow… :slight_smile:


#10

Thanks!

As for your settings issue…pop open your .vcxproj file in your text editor of choice and set the proper conditions for your settings. Sometimes if VS doesn’t initially set the configuration tags properly, it’ll stay that way and changing the settings in one configuration will affect them all (I’ve had that happen before)…once you manually set things properly in your .vcxproj file, VS should respect the conditions for that particular setting from then on out.

Here’s what I mean:

If the circled conditions were missing, the setting would be applied to all builds. No doubt in your .vcxproj you’re missing the conditions and VS didn’t add them for whatever reason.


#11

Interesting thread! I recently had the same question and while researching I found the BabylonJS-Exporter which can be found on github: https://github.com/BabylonJS/Exporters/tree/master/3ds%20Max/Max2Babylon

I used to do the build process like @ivanisavich wrote above but for me it seems a bit clearer to to it like those people of the BabylonJS exporter. Just take a look at it! It’s C# but the principle should apply to C++ as well. It’s Visual Studio overall. :slight_smile:

The difference is that you have a subfolder for each 3dsmax version with it’s own project file. You are doing mainly the same thing but it removes the need to fiddle with the configuration names which gets even more complicated when using a lot of references. You end up with a solution with different projects inside for every 3dsmax version but the projects ar synced and you can also build the solution as a whole to compile the versions batched.

By the way: thanks @ivanisavich for TyFlow! I wished it was available for older 3dsmax versions as well… :confused:
Looking at your screenshot I can see that you are compiling for 2016 as well? The downloads are for 217 and above… :disappointed_relieved:


#12

Great! Thanks!
Ps. What VS do you use? I AM working on 2017 and couldnt compile my projekt for max 2016 after switching to 2016 SDK… got some errors about wrong targeting or versions, it suggested me switching to VS 2012


#13

There is tyFlow for 2016, just click the dropdown list at download page…


#14

Im am using VS 2019 but I guess that doesn’t count because I am developing in c#… :wink:


#15

tyFlow is available for 2016…just click the “VRay NEXT or no Vray” dropdown. It’s not available in the other package because it doesn’t support VRay 3.x for 2016.

I use VS 2017…for older versions of max you just have to adjust the compilation platform in the configuration settings.