thisistherk / fast_obj

Fast C OBJ parser
MIT License
632 stars 48 forks source link

Including in another CMake build system project via ExternalProject #24

Open whatnick opened 3 years ago

whatnick commented 3 years ago

I am planning to include fast_obj in another Mesh data translator library (i3s-lib)as an example of mesh-format with LoD packed as a single file via CMake ExternalProject mechanism. Placing the header in the executable source's include path via this mechanism should work.

Has this been done previously for other projects ? Are there samples around ?

Please see : https://github.com/Esri/i3s-lib/issues/6

thisistherk commented 3 years ago

Not something I've ever used, don't see why it wouldn't work though. I tend to just drop the header in whatever I'm using then check it in with the rest of the source rather than keep it separate. The fast_obj CMake file is just for building the test app so won't be much use to you - don't know if that makes it more difficult.

whatnick commented 3 years ago

I have CMake automatically cloning this repo. Will look at adding the path to the header in the spot the cloned stuff sits in build directory and we should be good.

deccer commented 1 month ago

I use FetchContent like so

FetchContent_Declare(
    fast_obj
    GIT_REPOSITORY https://github.com/thisistherk/fast_obj.git
    GIT_TAG        master
    GIT_SHALLOW    TRUE
    GIT_PROGRESS   TRUE
)
FetchContent_MakeAvailable(fast_obj)
# in my project
target_link_libraries(MyProject
...
    PRIVATE fast_obj
...
)