Friday, July 14, 2017

Apple, CMake and a Flamethrower.

To start off, I would like to say that I had a week hiatus for development due to July 4th so coming back in had a slow start up. With that said though, Mac is truly the neediest of all the three platforms by far as I have discovered this week. Currently, we have generated a XCode project using CMake and the source files we've been using this entire time. On failed build 1, XCode was giving an error about the variable atomic being undefined which sounds ridiculous. Atomic, for those who don't know, is a variable in C/C++ systems which describes a certain variable as multi-thread safe as it could be locked and unlocked using mutexes. Atomic is a base system type name, all you need to do is be using a C/C++ environment and include the System's Atomic library. In the project, we were including atomic on the top but it was still not being recognized. Took me a day to figure out that CMake had to set the flag "-std=cxx0". With that set, atomic was being recognized but we had a second problem which was user-defined variables in the header were not being recognized in the cpp. The truly worse thing was that it didn't make any sense that it didn't recognize it when EVERY OTHER PLATFORM WORKED PERFECTLY FINE THIS WAY. After my rant, I checked to find out why it was doing this and noticed that the .mm files (which are files specific for Apple and XCode) was including the cpp within them. As a way to avoid circular inclusion, we took out the cpp and the build was successful. HOWEVER, the errors were still there and the cpp still could not recognize certain variables. I don't know why but after including the header file did the variables suddenly become known. So, we are now including the header file in an #if(_APPLE__) statement. A little more work has to be done but we're almost finished. All that is left is simply finishing the linking of all the libraries, testing the test suite, creating a script for command line building, and creating documentation. That's it. It's the end. I'll be posting a final post on my feeling and thoughts about CMake a week after being finished.

No comments:

Post a Comment