License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

Location of AddOn SourceCode for compilation

dushyant
Enthusiast
Hi
Where do you keep the source-code of the addon to be compiled? Does it have to be in the 'Examples' folder of the API Kit?

Thanks
10 REPLIES 10
Ralph Wessel
Mentor
It can be anywhere you like provided the relative path to the API dev-kit is correctly defined. When the project compiles, it will expect to find the headers, libraries etc for the devkit at those paths.

I'd definitely recommend not putting any of you work within the devkit structure because it makes updates harder. It's simpler if you can simply replace an old devkit with a new one without worrying about what was in the old one – treat the devkit folder as read-only.

We use our own naming convention for the top level of the devkit which includes the AC version and reference it from projects using environment variables so changing versions (or incorporating multiple target versions) is easy.
Ralph Wessel BArch
Software Engineer Speckle Systems
dushyant
Enthusiast
Hi Ralph,

Thanks a lot for that suggestion. It would indeed be more comfortable having the source files in a different location than the API-kit. (The only comfort in having it in the 'Examples' directory was that no explicit linking of API libraries was needed..)
The idea of linking the source to an API version selectively also sounds good.
Can you tell how to set up the environment variables in Visual Studio for the API kit? Does the entire 'Support' directory need to be referenced?

Thanks.
dushyant
Enthusiast
I found two places to specify the external libraries/headers path in Project Configuration Properties:
1. C/C++ > General > Additional Include Directories
2. Linker > General > Additional Library Directories

The 2nd one is empty in the Archicad Addon template.

Is there anywhere else that the files need to be linked or external path to be set? Where to set up those environment variables you mentioned and what directories they would link to?

Thanks.
Anonymous
Not applicable
dushyant wrote:
I found two places to specify the external libraries/headers path in Project Configuration Properties:
1. C/C++ > General > Additional Include Directories
2. Linker > General > Additional Library Directories

The 2nd one is empty in the Archicad Addon template.

Is there anywhere else that the files need to be linked or external path to be set? Where to set up those environment variables you mentioned and what directories they would link to?

Thanks.
Hi, I think maybe you should set the configuration properties of *.grc *Fix.grc *.rc2. You can check the examples in the SDK. I used to forget to set them and get trapped here for a long time. Hope it may help.
dushyant
Enthusiast
I changed the 'Additional Include Directories' paths (in Project Properties > Configuration Properties > C/C++) to point to the API-Kit stored locally. Also in the Visual Studio Solution, the 'filters' file needs to be edited. In projectName.vcxproj.filters file, change the path of the Include attribute in the <Library></Library> tags in reference to the path of the local API-Kit.
With absolute paths in both 'Project Properties' and the 'filters' file, the VS-project solution can be stored anywhere locally and should find the API library files..
I would like to able to have a single variable having the path to the local API-Kit that could be read in both the 'Project Properties' and the 'filters' file. If anyone knows how to achieve this, please share.

Thanks.
Ralph Wessel
Mentor
dushyant wrote:
I would like to able to have a single variable having the path to the local API-Kit that could be read in both the 'Project Properties' and the 'filters' file. If anyone knows how to achieve this, please share.
Add a property page to the target that (for example) defines a user macro for target version number, e.g. "23". If your dev-kit paths are consistently named (with the version number) you can build a path using the macro version number. If you have multiple targets in the same project, just have a unique page for each version type (it can be shared across projects) so it automatically accesses the right dev-kit for the target
Ralph Wessel BArch
Software Engineer Speckle Systems
Ralph Wessel
Mentor
NB - we always define dev-kit paths relative to the project so you can move it around to different machines or directory levels and it always works
Ralph Wessel BArch
Software Engineer Speckle Systems
dushyant
Enthusiast
Thanks for sharing that info Ralph.

I had made a PropertySheet (.props file) and added Macros in 'User Macros' for each of the required directories (Attached screenshot).

Then in the new addon project property manager, added that property sheet containing the macros. Then I added these Macro names the project-properties > Config Properties > C/C++ > General > Additional Include Directores, like so: $(AC_Inc);$(AC_GSRoot);$(AC_imp);$(AC_GSUtils); ...

I think it does not work if you just add the Support/Modules dir alone..

Please share your comment if this method could be optimised.

Thanks.
Ralph Wessel
Mentor
There are many ways you could organise this. We use a hierarchy of property sheets, which the base level defining nothing more than the Archicad version. We define macros on top of that pointing to core folders in the dev-kit Support folder, but not drilling down into each module (because the names change across different API releases). We just add things like "include" directories by prefixing the module path the name of each module for that particular dev-kit release - then it can be varied per target as the API changes.

But you could do it with property sheets as well - either way is fine.
Ralph Wessel BArch
Software Engineer Speckle Systems

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!