how to use my ".a" library (aka let ESP-IDF generate a ".h" file)
Posted: Sat Dec 09, 2017 8:16 pm
Hi ESP-IDF,
This is really an ancient question. I've tried to ask really awesome questions which can descript my problem without pain. And this is my new try.
Now I'm trying to port a library that uses "cmake" built it self firstly. I've successful let ESP-IDF drive cmake did most of the job. (This is the demo project, P.s:take care, it uses git submodule, if you check that out)
After the compiling, I got the result I need:
If I don't turn on this library's compiling feature: "Amalgamation", which will generate "open62541.h/.c" file. What i got is only the "libopen62541.a". And I don't know how to use the APIs in it. If I add "#include "open62541.h" in my "main.c" The compiler can not find it as I expected.
What I've done is: Just copy/past the generated open62541.h and open62541.c from the first compiling result (this compiling breaked out because of the missing open62541.h) into "/main" and recompile it again. It works, but still not awesome.
I believe I should spent some time on the component.mk. But I still missing the eye balls of a really senior level developer.
So am I have the correct suspection? Any possible tip to don't use "AMALGAMATION" feature, and call APIs from "libopen62541.a" directly?
Cheers
Gfast2
This is really an ancient question. I've tried to ask really awesome questions which can descript my problem without pain. And this is my new try.
Now I'm trying to port a library that uses "cmake" built it self firstly. I've successful let ESP-IDF drive cmake did most of the job. (This is the demo project, P.s:take care, it uses git submodule, if you check that out)
After the compiling, I got the result I need:
Code: Select all
gfast2@gfast2-VB:~/workspace/open62541_port03/build/open62541$ ll
total 2132
drwxrwxr-x 8 gfast2 gfast2 4096 Dez 9 20:55 ./
drwxrwxr-x 48 gfast2 gfast2 4096 Dez 9 20:56 ../
drwxrwxr-x 2 gfast2 gfast2 4096 Dez 9 20:55 bin/
drwxrwxr-x 2 gfast2 gfast2 4096 Dez 9 20:55 cmake/
-rw-rw-r-- 1 gfast2 gfast2 21937 Dez 9 20:55 CMakeCache.txt
drwxrwxr-x 14 gfast2 gfast2 4096 Dez 9 20:55 CMakeFiles/
-rw-rw-r-- 1 gfast2 gfast2 5865 Dez 9 20:55 cmake_install.cmake
-rw-rw-r-- 1 gfast2 gfast2 6085 Dez 9 20:55 cmake_toolchain_file.txt
-rw-rw-r-- 1 gfast2 gfast2 519 Dez 9 20:55 component_project_vars.mk
-rw-r--r-- 1 gfast2 gfast2 3910 Dez 9 20:55 CPackConfig.cmake
-rw-r--r-- 1 gfast2 gfast2 4409 Dez 9 20:55 CPackSourceConfig.cmake
drwxrwxr-x 3 gfast2 gfast2 4096 Dez 9 20:55 doc/
drwxrwxr-x 2 gfast2 gfast2 4096 Dez 9 20:55 doc_src/
-rw-rw-r-- 1 gfast2 gfast2 8 Dez 9 20:55 libopen62541.a
-rw-rw-r-- 1 gfast2 gfast2 13465 Dez 9 20:55 Makefile
-rw-rw-r-- 1 gfast2 gfast2 1513283 Dez 9 20:55 open62541.c
-rw-r--r-- 1 gfast2 gfast2 1269 Dez 9 20:55 open62541ConfigVersion.cmake
-rw-rw-r-- 1 gfast2 gfast2 544521 Dez 9 20:55 open62541.h
drwxrwxr-x 2 gfast2 gfast2 4096 Dez 9 20:55 src_generated/
What I've done is: Just copy/past the generated open62541.h and open62541.c from the first compiling result (this compiling breaked out because of the missing open62541.h) into "/main" and recompile it again. It works, but still not awesome.
I believe I should spent some time on the component.mk. But I still missing the eye balls of a really senior level developer.
So am I have the correct suspection? Any possible tip to don't use "AMALGAMATION" feature, and call APIs from "libopen62541.a" directly?
Cheers
Gfast2