Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [4diac-dev] Exported functionblock files and CMakeLists.txt

Hi,


-- 

Ernst Blecha
LIT | Cyber-Physical Systems Lab

JOHANNES KEPLER
UNIVERSITY LINZ
Altenberger Straße 69
LIT Open Innovation Center
4040 Linz, Austria
ernst.blecha@xxxxxx
www.jku.at
 
>>> Jose Cabral <cabral@xxxxxxxxxxx> 06/18/20 6:14 AM >>>
> Hi,
> 
> I really like the idea of automating this phase. Maybe a middle point
> could be to have the contents of this CMakeLists.txt file as a CMake
> function in forte. Then in the IDE you could have the option to
> export the CMakeLists.txt file for a module (together with the
> Function Block exporter, or as a standalone, and warning of
> overwriting) and the user just needs to set the name of the Module
> (if not provided, maybe like you did, take it from the folder name).

Yes, this is a possible application.


I am using the directory name because that already has to be chosen
during export and does not add an additional grouping the user has to
remember and match to the symbol names in CMake.

> The exported CMakeLists.txt will call the function you created,
> basically adding all the .cpp and .h files.
> 
> If the module needs extra CMake commands (adding libraries, setting
> variables, ...), the user will just edit the generated file once
> (leaving the call to your function). The next time that more function
> blocks are exported to the module, the CMakeLists.txt doesn't need to
> be exported anymore, and since your function includes all .cpp and .h
> files, nothing else needs to be done.
> 
> One suggestion: I think it will be better to use
> forte_add_sourcefile_h, forte_add_sourcefile_c and
> forte_add_sourcefile_cpp instead of forte_add_sourcefile_hcpp, so the
> function will include all compilable files in the folder, and you can
> just drop files to the folder and they will be compiled.

Thank you for those suggestions, i tried to work them into the file.
Also i tried to incorporate Joergs comment about "less code"; Assuming
that it would be possible to add all the "helper" functions into the
forte distribution the resulting file could like the attached example
(except the INCLUDE-line)

Best regards,
Ernst

INCLUDE("helpers.cmake")

forte_add_directory_module()
forte_add_all_sourcefiles()

Attachment: helpers.cmake
Description: Binary data


Back to the top