MADEAPPS / newton-dynamics

Newton Dynamics is an integrated solution for real time simulation of physics environments.
http://www.newtondynamics.com
Other
945 stars 182 forks source link

Static/shared library fixes #204

Closed sponji closed 4 years ago

sponji commented 4 years ago

Please test if this works correctly on your side. This should fix the problems when building static/shared libraries with different platforms. I added DG_LIBRARY_EXPORT and DG_LIBRARY_IMPORT to dgTypes.h so we don't have to repeat all those ifdefs, I hope that's ok? I tested all static/shared combinations with gcc, android, mingw and msvc and everything seemed to work nicely.

Compiling on Windows/Linux: cmake .. && cmake --build .

Crosscompiling from Linux to Windows: cmake -DCMAKE_TOOLCHAIN_FILE=path/to/your/mingw.toolchain.cmake .. && cmake --build .

To compile for Android you have to turn off the default plugins and pass the path to Android-NDK: cmake -DNEWTON_WITH_REFERENCE_GPU_PLUGIN=OFF -DNEWTON_WITH_AVX_PLUGIN=OFF -DCMAKE_ANDROID_NDK=/opt/android-ndk -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake .. && cmake --build .

JulioJerez commented 4 years ago

The path was applied. I see what you did. You unified the dll exports wich was different from project to project. very nice indeed. the cmake script works without problems in windows, which is the only platform I can build. I asume the others will work fine as well.

I had to edit some of the other hand made projects that I had for visual studio by adding the path to the dgCore library. This is in fact a good idea, there are really good algorithm than can be use directly now. The reason I hid it for all these years, was that you use them the user need to make an allocator. but I now realize that there is not reason protect the end user, if they want to use then they can figure it out.

excellent work!! thank you