reinterpretcat / utymap

Highly customizable library for procedural world generation based on real map data
Apache License 2.0
963 stars 151 forks source link

How do I use the plugin on OSX? #10

Closed dkniffin closed 8 years ago

dkniffin commented 8 years ago

Hey. I know this library is still in development, but I was hoping to try it out. I'm on OSX. I know you don't have build instructions for OSX, but I think the following works:

# First, edit core/src/meshing/MeshBuilder.cpp to have the following:
#include <stdlib.h>
#include <string.h>

# ensure that correct compiler is selected
if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../core
make
mv shared/libUtyMapLib.dylib shared/libUtyMapLib.bundle

However, I'm not really sure how to test it. Is there any chance you can provide a short tutorial of how to use this in a Unity project?

reinterpretcat commented 8 years ago

Hi, thanks for feedback. Unfortunately, I don't have OSX to try to build and test so far. However, if you are able to compile library, unity example should just work: you need to copy compiled library into Assets/Plugins folder (probably, copy zlib shared library as well) and import project.

So far, source code and demo scene is the best example of usage. Unfortunately, I don't have capacity to describe all details and use cases, even add more scenes, but shortly: the project aims to render our Earth at different zoom levels starting from globe till surface with all available details. What to render and how is specified via mapcss file and can be changed dynamically. Dynamic zoom changes are possible to implement on top of demo example, but it is out of scope due to complexity: you have to overcome the problem of floating point precision.

Target platforms: mobile devices. Core part is written on C++11 and has no Unity3D dependency: you can use it with other game/rendering engines. Also performance is always in focus on development to fit mobile requirements.

As a short summary, try to run demo scene. Also you may check integration tests in unity.Tests project to understand minimal code needed to use library.

I would happy to hear any feedback.

dkniffin commented 8 years ago

Hmm. When you say "demo scene" do you mean this one? I put the bundle file in a Plugins directory inside Assets and it doesn't seem to work.

I also tried to get it working in my own project, by putting the .bundle file in Assets/Plugins, but I'm not sure how to reference your classes in my c# files.

Forgive me if I'm overlooking something fairly basic. I'm very new to Unity, and to C#. I come from a web development background, where we don't have dll's or using 😛

reinterpretcat commented 8 years ago

No problem, you're just first who contacted to me trying to integrate the library, so such questions are valid if it is not working out of box.

Yes, I meant StreetLevelScene which should just work by default.

Built library should be copied as it is, without renaming it:

Additionally, please make sure that zlib which was used to build the library is accessible as well (it can be just copy pasted to plugin folder).

If it is still not working, can you show me error message to understand whether Unity cannot load dynamic library or it is something else.

Btw, I set up a chat room for instant messaging: https://gitter.im/reinterpretcat/utymap

RMKD commented 7 years ago

@dkniffin can you provide more details about the cmake commands you ran to build on OSX? Maybe PR them to the README?

dkniffin commented 7 years ago

@RMKD I basically just used the Linux instructions. Under the hood, OSX and Linux are very similar.

RMKD commented 7 years ago

Ah, thanks. Turns out I had a CMakeCache.txt file from an earlier attempt that was preventing some setup with protobuf

CMake Error at CMakeLists.txt:3 (PROTOBUF_GENERATE_CPP):
  Unknown CMake command "PROTOBUF_GENERATE_CPP".

if you've reached this page for a similar error, here's the fix (assuming you have homebrew setup ):

rm CMakeCache.txt
brew install boost
brew install protobuf
#zlib should be in OSX - homebrew recommends using that rather than homebrew/dupes/zlib

then follow the instructions to build the core library, etc