Archicad C++ API
About Archicad add-on development using the C++ API.

How to start api (c++) in 26?

LeeJaeYoung
Virtuoso

How to start api (c++) in 26?
There was a template up to 25, but if it was changed to cmake, how should I start?

LeeJaeYoung_0-1673852686637.png

 

AC27 on window 11
3 REPLIES 3
Karl Ottenstein
Moderator

Searching this forum for 'cmake' gives a lot of results, but perhaps these two topics may answer your question:

 

https://community.graphisoft.com/t5/Developer-forum/CMake-Template-for-Archicad-Add-Ons/m-p/220809

 

https://community.graphisoft.com/t5/Developer-forum/CMAKE-ADDON/m-p/252101

 

One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB

thank you so much ^^.

zip file from https://github.com/GRAPHISOFT/archicad-addon-cmake-template

to C:\Users\----------------\Documents\Visual Studio 2019\Templates Can I just copy it to \ProjectTemplates\Visual C++ Project?

 

LeeJaeYoung_0-1675002701717.png

Can't find it?

1. Where should I copy it?
2. How to find it?

 

 

AC27 on window 11

If you haven't already, install cmake 3.16+ and Python 2.7+ or 3.8+.

After that, create a directory called Build inside the extracted folder and start a command prompt inside that new folder. Input the command to generate the project using cmake.

The shortest version of that command would be something along the lines of:

cmake -G "Visual Studio 16 2019" -A "x64" -DAC_API_DEVKIT_DIR="Replace with the full path to your Archicad devkit Support folder" ..

You can add the optional parameters listed on the README of the cmake template repository in order to populate those settings when generating the project.

If you're using a different Visual Studio Version you can change the value of the -G parameter as per the cmake docs


Anyway, running this command will generate the project files. Bear in mind that while this will create Visual Studio project files (.proj) and a Visual Studio solution file (.sln), you should not open them directly on Visual Studio. What you should use instead is the built-in Visual Studio support for cmake.

 

In order to do that, you must have the C++ Cmake tools for Windows installed (you can install it through the Visual Studio Installer). After that is done, open Visual Studio and choose the option to open a local folder, pointing it to the project folder. If you've never worked with them together, you should check out the official docs about using cmake with Visual Studio.

 

That's the gist of it. There are some Visual Studio specific setup you can make to streamline some of that stuff (such as defining the API_DEVKIT var on the CmakeSettings.json that Visual Studio creates in order to build for different AC versions and so on), but that's something that depends on your own particular needs.