FastNoiseSIMD icon indicating copy to clipboard operation
FastNoiseSIMD copied to clipboard

Rudimentary CMake support

Open torss opened this issue 6 years ago • 4 comments

Note that this changes FastNoiseSIMD.h to a CMake configured file (see line 42 in CMakeLists.txt). So it might be a slight inconvenience if someone doesn't want to use CMake. (I.e. perhaps you don't want to merge this.)

torss avatar Mar 11 '18 01:03 torss

Thank you for your work on this, I'm still figuring out cmake. I'm using it in FastNoise2 but I haven't hooked up any config or CI support.

Could you give a run down on what platform/config the CI builds cover and what setup will they need.

Also what are the cmake options and setup steps, I will need to add some info to the wiki.

Thanks again for your help with this.

Auburn avatar Mar 05 '20 00:03 Auburn

@torss Why has the open simplex change been included now?

Auburn avatar Mar 05 '20 00:03 Auburn

Oops, sorry, I completely forgot about this old PR from 2018. ;) Feel free to close it if the changes are potentially annoying.

I'm currently only using my fork in a private test project. I just merged @c0rp3n's fork because I noticed that it apparently extends CMake support (although I personally don't need that) and @KdotJPG's fork since I wanted to try out his OpenSimplex2. So @c0rp3n would have to tell you about the CI build part, I'm not familiar with that either.

BTW nice to see that you are working on a successor, didn't know about FastNoise2 yet!

torss avatar Mar 05 '20 15:03 torss

So with my fork I added support for find_package in CMake and config support, then it is just a basic CI setup building on both MSVC 2019 and GCC 7.4.

The config works by just calling configure_file in CMake it then replaces the #cmakedefine with #define when the option with the same name is enabled the new file with the replaced defines is then written to the include directory. See https://pastebin.com/Tk3CuGLY for an example output after the configure.

And for buiding it would just be

mkdir build
cd build
cmake -DFN_COMPILE_AVX2=ON -DFN_COMPILE_AVX512=OFF .. && make

and then to install

sudo make install

With windows it differs slightly need to pass you need to set where you want to install it to on configure so

cmake -DCMAKE_INSTALL_PREFIX="E:/deps" ..

There will then be an install target added to the VS project which you can then use to install the library.

Edit: You may also want to revert some of the readme changes as I just tried to make it less first person.

c0rp3n avatar Mar 05 '20 22:03 c0rp3n