Compile fanvanzh's 3dtiles in Linux
Working for fanvanzh's 3dtiles Linux compilation for days. Some items for reminding everybody how wants to do the same thing.
liwei0705 did a good move in making fanvanzh's 3dtiles converter works. But if you are using a new version of OSG and GDAL, pay attention to the following summarised reminders when building your own version of "_3dtile"
- Delete 3dtiles/bin, it is for windows only
- Compile your own OpenSceneGraph
- Copy OpenSceneGraph /lib to 3dtiles
- Copy OpenSceneGraph /include/* to 3dtiles/src/osg/*
- If not compile OpenSceneGraph on your own, you can install "openscenegraph" and "libopenscenegraph-dev" instead
- Delete /lib in 3dtiles (the /lib is for self-compiled OSG, GDAL actually)
- Delete 3dtiles/src/osg/ (no need to provide OSG header, use the one in libopenscenegraphi-dev)
- Install gdal-bin, libgdal-dev
- rm -rf 3dtiles/src/gdal (we will use libraries and header by gdal-bin and libgdal-dev)
- Source file: src/tileset.cpp
- Hide up #ifdef _WIN32, turn on "epsg_convert" and "wkt_convert"
- Comment out GDAL_DATA:
- // CPLSetConfigOption("GDAL_DATA", path);
- For epsg_convert( )
- Don't use importFromEPSG(), use:
- // For 2326 Input (Hard code the input SRS) (Ref)
- inRs.importFromProj4("+proj=tmerc +lat_0=22.3121333333333 +lon_0=114.178555555556 +k=1 +x_0=836694.05 +y_0=819069.8 +ellps=intl +towgs84=-162.619,-276.959,-161.764,-0.067753,2.243648,1.158828,-1.094246 +units=m +no_defs +type=crs");
- // for 4326 Output (Hard code the output SRS) (Ref)
- outRs.importFromProj4("+proj=longlat +datum=WGS84 +no_defs +type=crs");
- Source file: src/earcut.hpp
- Add header files
- #include <stdexcept>
- #include <limits>
- Source file: build.rs
- In linux bulid config, add:
- println!("cargo:rustc-link-lib=gdal");
- When running the ./target/release/_3dtile
- export LD_LIBRARY_PATH=./lib
- Side notes, if you use "cargo run" for debugging and when to rebuild the project when some CPP files are modified, add the following in linux build config (build.rs): (reference)
- println!("cargo:rerun-if-changed=./src/tileset.cpp");
Comments
Post a Comment