cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

CMake Issue | New solution linked to the source file.

Organon
Contributor

Hello,

 

I have used CMake to create a new solution and apparently it had worked, but the new solution is as if it was linked to the source solution. When I modify something in the new solution the ExampleAddOn.sln file is modified as well and vice versa.

 

I chose the folder where the CMakeLists.txt file is located as source code.

 

CMake.png

 

Can someone explain to me what is the correct way to create a new solution based on the AddOn template using CMake? Thanks.

 

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

hope its ok when i chime in. i succsellfully created a few plugins. and i do it all the time the same way now:

evrything is based of this repo: 

https://github.com/GRAPHISOFT/archicad-addon-cmake

 

0. create a new folder in my file system where i want to have my plugin

1. open powershell

2. go to the directory where i want to have my plugin with the "Set-Location" command

3. clone this git repo with the command:

git clone https://github.com/GRAPHISOFT/archicad-addon-cmake.git --recurse-submodules

4. Open Visual Studio. EMTPY!

5. Use FILE > NEW > CMAKE... and choose the CMAKE.txt that you downloaded with the git command

6. Create the Visual Studio Solution with the  Command: 

cmake -B Build -G "Visual Studio 17 2022" -A x64 -T v142 -DAC_API_DEVKIT_DIR=<DevKitSupportDir>  

7. Go Instantly in to the new created Solution and Build it. Copy the apx into your archicad plugin folder to check if it works. 

8. Start Blasting with the development 

 

Plus Points for using github for your repo: 

 

1. Create a privte repo on gitgub

2. Upload your repo to github with the here mentioned commands

https://stackoverflow.com/questions/2765421/how-do-i-push-a-new-local-branch-to-a-remote-git-reposit...

3. if you dont want to have all the archicad template guys named als contributors for your repo, you just need to rename the branch. 

 

From my standpoints that all you need to know about cmake to succsessfully ship an archicad plugin. 

 

do you want to know more? 😉 

if you still want to know more: 

 

CMAKE is a powerfull software build system. if you want to master it you should make a little programm where you create your own cmake file. 

this is very helpfull to get a hang of cmake: 

https://cmake.org/cmake/help/latest/guide/tutorial/index.html

 

if you want to know more of cmake in the archicad plugin context, i found it interesting to check out the chache file of cmake. its in your repo folder and its named "CMakeCache.txt". there you can inspect a lot of the variables that are used to make your plugin. 

 

as an example: 

i found it very intresting to see the link to the ressource builder that gets his variables trough the python file in the solution. 

JoelBuehler_0-1708959458585.png

it shows impressive waht complicated system is in place to build a plugin. 😃 

 

if you analyze this file it should become clear that you cant just copy pase a template an use it for anothe plugin since all the variables are set in the chache file. i would not recommand to try to rename all the variables manually.   

 

i did on this answer an detailed step-by-step guid how to create a plugin: 

https://community.graphisoft.com/t5/Documentation/developing-an-add-on-on-c/m-p/395814#M61448

maybe you find one or another thing helpfull. 

 

 

 

View solution in original post

6 REPLIES 6
Organon
Contributor

Hello,

 

Solution:

  1. Download archicad-addon-cmake
  2. Copy the files from archicad-addon-cmake\Tools to archicad-addon-cmake-master\Tools
  3. Run CMake (source code from archicad-addon-cmake-master).

Regards,

Sorry, this is not the solution, this linking behavior keeps occurring. Does anyone know how to unlink the created solutions? Is there any changes I need to make to achieve this?

 

On the other hand, I have tried to create my own template to avoid all this CMake nightmare, but without success...

 

Add-on Template.png

 

Wouldn't it be easier for Graphisoft programmers just to create templates for each Archicad/Archicad API version?

 

Regards,

Hi Organon,


To me it seems you are using the template in a different way than it was intended. I use the CMake project directly with Visual Studio. Internally it creates a solution file, sure, but then I'm not adapting the solution file. If I want to change something in the build, I change the CMakeLists.txt project setup.
Would this be a possible way for you or do you need to work with a solution file?

 

Setting up your own template is quite an involved task because of all the things you have to get right. Especially resource compilation is not easy to setup in my eyes. A possible alternative would be grab some old API release and adapt these for newer AC/API SDK releases. The AC25 SDK was the last to provide Visual Studio Project files for the examples.

 


@Organon wrote:

Wouldn't it be easier for Graphisoft programmers just to create templates for each Archicad/Archicad API version?


I think Graphisoft is providing cmake templates since they can be used both on Windows and macOS without much adaption. If they were to create a Visual Studio template, they would also have to make a XCode template (which they have done in previous versions before switching to CMake).

Hope that helps,
Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

@BerndSchwarzenbacher ,

 

Hello,

 

Thanks for your observations.👍

 

Okay. Can you explain me the steps you follow to create a new add-on? Or can you point me to a link where it is well explained? I just want to understand this CMake thing. Thanks.

 

Yes, I tried with an outdated template and then modified it, I also tried to create a template from scratch, but none of the options worked.

 

Regards,

Solution

hope its ok when i chime in. i succsellfully created a few plugins. and i do it all the time the same way now:

evrything is based of this repo: 

https://github.com/GRAPHISOFT/archicad-addon-cmake

 

0. create a new folder in my file system where i want to have my plugin

1. open powershell

2. go to the directory where i want to have my plugin with the "Set-Location" command

3. clone this git repo with the command:

git clone https://github.com/GRAPHISOFT/archicad-addon-cmake.git --recurse-submodules

4. Open Visual Studio. EMTPY!

5. Use FILE > NEW > CMAKE... and choose the CMAKE.txt that you downloaded with the git command

6. Create the Visual Studio Solution with the  Command: 

cmake -B Build -G "Visual Studio 17 2022" -A x64 -T v142 -DAC_API_DEVKIT_DIR=<DevKitSupportDir>  

7. Go Instantly in to the new created Solution and Build it. Copy the apx into your archicad plugin folder to check if it works. 

8. Start Blasting with the development 

 

Plus Points for using github for your repo: 

 

1. Create a privte repo on gitgub

2. Upload your repo to github with the here mentioned commands

https://stackoverflow.com/questions/2765421/how-do-i-push-a-new-local-branch-to-a-remote-git-reposit...

3. if you dont want to have all the archicad template guys named als contributors for your repo, you just need to rename the branch. 

 

From my standpoints that all you need to know about cmake to succsessfully ship an archicad plugin. 

 

do you want to know more? 😉 

if you still want to know more: 

 

CMAKE is a powerfull software build system. if you want to master it you should make a little programm where you create your own cmake file. 

this is very helpfull to get a hang of cmake: 

https://cmake.org/cmake/help/latest/guide/tutorial/index.html

 

if you want to know more of cmake in the archicad plugin context, i found it interesting to check out the chache file of cmake. its in your repo folder and its named "CMakeCache.txt". there you can inspect a lot of the variables that are used to make your plugin. 

 

as an example: 

i found it very intresting to see the link to the ressource builder that gets his variables trough the python file in the solution. 

JoelBuehler_0-1708959458585.png

it shows impressive waht complicated system is in place to build a plugin. 😃 

 

if you analyze this file it should become clear that you cant just copy pase a template an use it for anothe plugin since all the variables are set in the chache file. i would not recommand to try to rename all the variables manually.   

 

i did on this answer an detailed step-by-step guid how to create a plugin: 

https://community.graphisoft.com/t5/Documentation/developing-an-add-on-on-c/m-p/395814#M61448

maybe you find one or another thing helpfull. 

 

 

 

@Joel Buehler 

 

Thanks for your time and answer.

 

Regards,

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!