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 C++20 module build target v2 #1410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Oct 31, 2024

  1. Add C++20 module build target

    Usage in client cmake:
    ```cmake
    set(FLECS_M0DULE ON CACHE BOOL "Build flecs module" FORCE)
    add_subdirectory(path/to/flecs)
    target_compile_features(flecs-module PUBLIC cxx_std_23)
    target_link_libraries(
       someProjectName
       PRIVATE
       flecs-module
    )
    ```
    
    In the code, it is then possible to use `import flecs;` to import all the flecs symbols.
    The current version includes everything in the `flecs` namespace, but avoids including anything in the `_` namespace.
    
    Maintainance:
    - namespaces that contain symbols to exported must be tagged with FLECS_API_NAMESPACE
    - namespaces that should be excluded should be seperate in order to avoid exporting symbols
    - static globals must be tagged with `FLECS_STATIC_IN_HEADER`, which becomes `static` in headers, but not in the module
    - some rare symbols outside namesapces are necessary for compilation, such as operator new / delete, and must be tagged FLECS_API_DEPENDENCY
    Gaspard-- committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    8a02c98 View commit details
    Browse the repository at this point in the history