# 2023-10-09 ## Hallelujah I finally got a cross-platform build for kge [1] that builds binaries in Linux, MacOS, and Windows. I had to do some trickery with the Windows side, and it really only builds in CLion. That works for me; it builds on the command line in MacOS and Linux just fine. I mostly just want it to run in Windows on my desktop. There was something about copying SDL2.dll to system32, and I think a few other things. The other major Windows adjustment was to disable freetype. The way I came up to do this is to have find_package(Freetype) if (DEFINED FREETYPE_INCLUDE_DIRS) add_definitions(-DIMGUI_ENABLE_FREETYPE) set(FREETYPE_SOURCES ext/imgui/misc/freetype/imgui_freetype.cpp ext/imgui/misc/freetype/imgui_freetype.h) endif() Then, for example, you can later say something like the fourth line below: target_link_libraries(imgui PUBLIC OpenGL::GL $,Freetype::Freetype,> $ $,SDL2::SDL2,SDL2::SDL2-static>) I managed to do this without conan, which would just add more complications to the system. ## Shifting arrays Working on the Buffer class [2] in klib [3], I needed to shift the backing array left or right for insertions and deletions. This is fraught with peril (a phrase I used several times today in our team sync), but fortunately I remembered that memmove(3) exists. I'm sure there's a better C++ version, but this works for now. I did goof at first with one of the moves: // Wrong! memmove(this->contents+offset, this->contents+(offset+delta), this->length); // Fixed! memmove(this->contents+(offset+delta), this->contents+offset, this->length); There were a few minor goofs (an i++ instead of an i--, for example), but I've been testing it out with a simple test program that I can also run valgrind on. [1] https://git.wntrmute.dev/kyle/kge [2] https://git.wntrmute.dev/kyle/klib/src/branch/master/Buffer.h [3] https://git.wntrmute.dev/kyle/klib/