-
Notifications
You must be signed in to change notification settings - Fork 120
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
Various improvements #5
Conversation
- Build library and example. - Generate tinyply.pc for pkg-config support. - Generate CMake package configuration files. - Install relevant files.
We could also remove the |
I also found a possible source of error. |
Just FYI: still on my list of things to review. Just a busy time of the year right now! |
hi i tried your patch and it has bug, when i try to load mesh i got memcheck error at i found that error, if you don't specify but i thought this parameter is optional, because i cannot specify it because i don't know file format |
@maruncz thanks for the feedback, I'll fix that ASAP. Could you provide an example PLY and the few property registration lines you used to get that error?
You mean you don't know the number of elements for that specific property? |
@bchretien https://github.com/maruncz/VR-pointcloud-viewer/blob/master/src/readers/plyreader.cpp https://marun.uk.to/owncloud/s/SgXer13EtxGjEsC here is testing file |
The rationale behind the support of variable-length lists is the following one: if we take the faces for example, they could be stored as triangles (3 indices) or quads (4 indices), or even both in the same file (cf. #3). Thus, we need to be able to distinguish all those cases: either the length of the list is known and fixed (e.g. only triangles are supported, so In your reader, you only support faces with triangles, correct? |
yes i support only triangles but should'd be default |
I don't think it should since we don't want to break the existing behavior. Also:
Now, there might be some checks/exceptions missing though. |
hi do you still plan to merge this request? |
I don't think so. I just finished a re-write of the API and some of the parsing functionality (i'll put it on a 2.0 branch soon) because I wasn't happy with the way the variable-length list support was introduced here... I made some questionable design decisions early on and this made some of these changes by @bchretien more complex than I would have liked. I do like the CI + cmake + testing + other bugfixes, so I'll manually cherry pick those eventually. |
ok thanks for reply |
@ddiakopoulos all good for me, keep me posted once your API re-work is on-par with this MR :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bchretien I wanted a CMakeLists.txt
as well and saw you had a PR open already. I added some comments above, take em or leave em 😉
The only other thing I would add to your CMake setup is to default to Release. Something like
# Set a default build configuration to Release
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
@@ -0,0 +1,65 @@ | |||
cmake_minimum_required(VERSION 3.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To the best of my knowledge, you need 3.1.3
for CMAKE_CXX_STANDARD
. Or at least that's the first version it's actually documented in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! 👍
include_directories("${CMAKE_SOURCE_DIR}/source") | ||
|
||
# Library | ||
add_library(tinyply source/tinyply.cpp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be easier to, instead of include_directories
, just add the header to the add_library
call. It shouldn't make a huge difference either way, the primary reason for this comment is to enable shared or static libraries. It would look something like this:
# Default to shared library, allow bypass for static if desired
option(TINYPLY_BUILD_SHARED "Build as a shared library?" ON)
if (TINYPLY_BUILD_SHARED)
set(TINYPLY_LIBRARY_TYPE "SHARED")
else()
set(TINYPLY_LIBRARY_TYPE "STATIC")
endif()
# The library consists of two files
add_library(
tinyply
${TINYPLY_LIBRARY_TYPE}
"${CMAKE_CURRENT_SOURCE_DIR}/source/tinyply.h"
"${CMAKE_CURRENT_SOURCE_DIR}/source/tinyply.cpp"
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I'll add that.
|
||
# Example | ||
add_executable(example source/example.cpp) | ||
target_link_libraries(example PRIVATE tinyply) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this excellent explanation on private linkage. It doesn't surface here because example.cpp
does #include "tinyply.h
(as opposed to #include <tinyply.h>
). In short, PRIVATE
vs PUBLIC
here shouldn't matter at all if you get rid of include_directories
, and everything remains in the same folder (which it should). In my personal scrapped together CMake (where I don't care about installation, I build it from the parent project), I did something like
# Build the example when no parent project
get_directory_property(TINYPLY_HAS_PARENT PARENT_DIRECTORY)
if (NOT TINY_PLY_HAS_PARENT)
add_executable(tinyply-core "${CMAKE_CURRENT_SOURCE_DIR}/source/example.cpp")
target_link_libraries(tinyply-core tinyply)
endif()
It may or may not be appropriate here since you aren't installing the executable (nor does it really make sense to).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Indeed private linkage here is irrelevant, I don't really know why I wrote that back then...
@svenevs thanks for the review, I completely missed the notification so sorry for the long delay! I integrated your changes, and I'll fix conflicts with EDIT: apparently a lot has been going on on the |
Most, if not all, of the features and bugfixes documented here have been added over the past ~2 years! |
tinyply
now supports variable-length lists (fix Variable-length lists are not supported #3).is_binary()
method that allows user to know whether the PLY being read is in ASCII or binary format.