Skip to content

Add module interface file #395

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

Open
wants to merge 2 commits into
base: release
Choose a base branch
from
Open

Conversation

Mysvac
Copy link

@Mysvac Mysvac commented Jul 13, 2025

Add a module interface file tiny_obj_loader.cppm that re-exports the contents of tiny_obj_loader.h.

Also provide a simple example demonstrating its usage.

@syoyo syoyo requested a review from Copilot July 13, 2025 11:35
Copilot

This comment was marked as outdated.

@Mysvac
Copy link
Author

Mysvac commented Jul 13, 2025

  • Removed the duplicate using tinyobj::ParseTextureNameAndOption;
  • __line_t and __points_t are used internally by PrimGroup and explicitly exported for external visibility.
  • The example project cxxmodule has been tested on:
    • MSVC
    • Clang 20
    • GCC 15.1

@Mysvac Mysvac requested a review from Copilot July 13, 2025 17:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a C++20 module interface file for tinyobjloader and a simple example showing how to import and use it.

  • Introduces tiny_obj_loader.cppm to re-export symbols from tiny_obj_loader.h as a module
  • Supplies examples/cxxmodule/main.cc demonstrating import tinyobj;
  • Updates examples/cxxmodule/CMakeLists.txt to build the module-based example

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
tiny_obj_loader.cppm New C++20 module interface re-exporting the header’s API
examples/cxxmodule/main.cc Example showing how to import and use the tinyobj module
examples/cxxmodule/CMakeLists.txt CMake setup for compiling the module interface and example
Comments suppressed due to low confidence (2)

tiny_obj_loader.cppm:6

  • [nitpick] The module name tinyobj does not match the file name tiny_obj_loader.cppm; consider renaming the module to tiny_obj_loader for consistency.
export module tinyobj;

tiny_obj_loader.cppm:1

  • [nitpick] Consider adding a small build or unit test that imports this module and exercises key functions to validate that the module interface compiles, links, and exports definitions correctly.
module;

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@syoyo
Copy link
Collaborator

syoyo commented Jul 14, 2025

C++20 is not widely used as of 2025.
I might merge the PR after 3~4 years later.

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