Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake options EMBED_RESOURCE_FILES and USE_ONLY_EMBEDDED_RESOURCE_FILES for proj.db and proj.ini embedding #4265

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

rouault
Copy link
Member

@rouault rouault commented Oct 3, 2024

Implements #4274

@rouault rouault added this to the 9.6.0 milestone Oct 3, 2024
@rouault rouault marked this pull request as draft October 3, 2024 17:26
cmake/FileEmbed.cmake Outdated Show resolved Hide resolved
cmake/FileEmbed.cmake Outdated Show resolved Hide resolved
const uint8_t ${c_name}_data[] = {
${output_c}
}\;
unsigned ${c_name}_size = sizeof(${c_name}_data)\;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use size_t instead of unsigned?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not going to embed more than 2 GB, so unsigned is fine

#define ${c_name}_H
#include \"stdint.h\"
extern const uint8_t ${c_name}_data[]\;
extern unsigned ${c_name}_size\;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle the ..._size constant isn't needed. It isn't generated by the #embed directive either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are accessing the resource through the .h file, we cannot do a sizeof(proj_db_data), so we need a variable giving the size. We do need the size to pass it to the SQLite3 memvfs

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh.

@rouault rouault marked this pull request as ready for review October 7, 2024 15:03
@rouault rouault marked this pull request as draft October 7, 2024 15:03
@rouault rouault force-pushed the embed branch 6 times, most recently from af1e1df to f26ff65 Compare October 9, 2024 15:58
@rouault rouault changed the title Add CMake options EMBED_RESOURCE_FILES and USE_ONLY_EMBEDDED_RESOURCE_FILES for proj.db embedding Add CMake options EMBED_RESOURCE_FILES and USE_ONLY_EMBEDDED_RESOURCE_FILES for proj.db and proj.ini embedding Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants