|Lephenixnoir 0ee2016d1f||4 weeks ago|
|cmake||4 weeks ago|
|include/example||1 month ago|
|src||1 month ago|
|.gitignore||1 month ago|
|CMakeLists.txt||1 month ago|
|README.md||1 month ago|
|giteapc.make||1 month ago|
Here's how the files are used:
includeare your library's code and headers. Unless you have a single header, you'll want to keep the compiler's include folder clean and have all your headers included as
includehas a single subfolder
include/example/config.h.inthat gets transformed by CMake during build to insert the version number without hardcoding it. You can use it for other compile-time options.
CMakeLists.txtis a pretty standard CMake script that builds the library.
cmake/FindLibExample.cmakeis a script for add-ins using your library, so that they can
find_package(LibExample)and get all the compile and link options for free.
giteapc.makemakes it possible to build and install your library in a simple command using GiteaPC. If you don't want that you can delete it (along with the related
Not a lot to discuss here, this is pretty standard. See the tutorial on Planète Casio (in French) for an introduction to CMake in the context of add-ins. You might be interested in
install(), which are rarely used in add-ins.
The fxSDK provides two variables to help you install your files:
FXSDK_COMPILER_INSTALLis the install path for the compiler (
sh-elf-gcc -print-search-dirs), the libraries go there and the headers in the
FXSDK_CMAKE_MODULE_PATHis the path of an fxSDK folder storing built-in and user-provided CMake modules. These are made visible to anyone that configures with
cmake/FindLibExample.cmake is a module used to search for libexample. The user would request to
find_package(LibExample) and CMake will look for various options, one of which is a
Find<Package>.cmake file in one of the search directories.
The goal of a find module is to determine whether the library is available, its version, and there are a couple of options. Most of these are handled by
find_package_handle_standard_args(), including checking that the user-requested version and the installed version are compatible.
If the library is found, the find module defines an external target (called "imported") that provides the path to the library and suitable compile and link options. The user can run
target_link_libraries(addin LibExample::LibExample) and all the flags will be supplied automatically. Whenever you update your library, the library file or the find module will change and all user applications will automatically relink.
GiteaPC is a tool to automate building and installing repositories from the Planète Casio Gitea forge. It was designed to speed up library management in the fxSDK. A repository that has the
giteapc topic (topics can be added through the "Manage topics" link on the repository's front page) and provides
giteapc.make can be built, installed, and updated with a simple command.
% giteapc install Lephenixnoir/Template-gint-library
The job of
giteapc.make is simply to provide configure, build, install and uninstall commands. CMake does not support uninstall targets, but we can simply remove the files that CMake has recorded installing. This might leave empty directories, but it's a good start.
giteapc.make can also specify basic dependencies in the top comment.
giteapc-config.make file is for the user to customize the build by adding environment variables (such as setting
LIBEXAMPLE_CMAKEOPTS_FX to change compiler behaviour, or anything they might need). You can provide configurations of your own in
giteapc-config-<name>.cmake (they can be installed with
giteapc install Lephenixnoir/Template-gint-library:name), just remember to add the file in
.gitignore as it will be otherwise ignored. See sh-elf-gcc for an example of custom configurations.