This is because CMake (and most C++ compilers on other platforms!) assume that .C is a C++ file (yeah I don't know why either)
This now compiles in a (mostly) clean manner while still letting a few MSVC extensions make its way through. A lot more work is needed to make it compile cleanly with clang-tidy or even just clang with no warnings enabled.
There are a few warnings that are legitimate bugs but these are not the focus of this change.
I've also adjusted the README to support the workflow I'm using for this regarding configure+build steps.
What's left to do (in other PRs!):
[ ] Add install() calls to put all binary files into their correct location
[ ] Generate CPack information so that a binary zip can be dropped into place as a "portable" build
[ ] Generate optional installers via CPack
[ ] Get any TOOLS/ building as part of the process
However what's been provided here should work as a good starting base.
This change incorporates a few things from @clemenswasser and @frank-weindel, who deserve credit for figuring a few things out I had not run into yet, or who had solved a similar issue or two that I adopted to reduce conflicts or breakage.
Furthermore, a brief explanation of why I chose to use the file(GLOB) feature: speed. I doubt new files are going to be added anytime soon, the overhead (even on windows) of using the glob feature are 0.2s when building, and more time is spent linking and compiling than building the list of necessary files. If putting the files explicitly in every location is desired, I'll leave that up to someone else.
Additionally, I've written multiple versions in the past of cmake/ExtractVersion.cmake which contains a "magic regex" to find almost every version number in existence for executables. This should come in handy if needed to lock down external tooling to a minimum version range. This is just a copy paste from a personal project, and I'm giving it here under the MIT License instead of the Apache license so that additional licensing isn't needed.
The ClangTidy and CCache find packages were written from scratch using a blog post I wrote at the very tail end of 2020. This can be used as a reference to understand why things are declared the way they are.
Lastly, the BRender and AudioMan find_package files are intended to act as a shim so that if the source for other BRender implementations are ever "massaged" to work with 3DMMForever, they can be dropped in place whether prebuilt or pulled in via CMake's FetchContent module. AudioMan is also given this treatment, to keep the CMakeLists.txt file more uniform
A brief summary of squash commits that are all within this one:
šØ Fix linker warning regarding default libraries šØ Enable C compiler in CMake šØ Add CMakePresets.json šØ Add cmake/FindAudioMan.cmake šØ Add cmake/FindClangTidy.cmake šØ Add cmake/FindCCache.cmake šØ Add cmake/FindBRender.cmake ā»ļø Remove DLL form of MSVC_RUNTIME_LIBRARY š Fix missing C files for BRender library š Fix typo in cmake/FindBRender.cmake š©¹ Add temporary stub files for audioman within kauai library š Move BREN/*.C files to be lowercase
Explanation
This is because CMake (and most C++ compilers on other platforms!) assume that .C is a C++ file (yeah I don't know why either)
This now compiles in a (mostly) clean manner while still letting a few MSVC extensions make its way through. A lot more work is needed to make it compile cleanly with clang-tidy or even just clang with no warnings enabled.
There are a few warnings that are legitimate bugs but these are not the focus of this change.
I've also adjusted the README to support the workflow I'm using for this regarding configure+build steps.
What's left to do (in other PRs!):
However what's been provided here should work as a good starting base.
This change incorporates a few things from @clemenswasser and @frank-weindel, who deserve credit for figuring a few things out I had not run into yet, or who had solved a similar issue or two that I adopted to reduce conflicts or breakage.
Furthermore, a brief explanation of why I chose to use the
file(GLOB)
feature: speed. I doubt new files are going to be added anytime soon, the overhead (even on windows) of using the glob feature are 0.2s when building, and more time is spent linking and compiling than building the list of necessary files. If putting the files explicitly in every location is desired, I'll leave that up to someone else.Additionally, I've written multiple versions in the past of
cmake/ExtractVersion.cmake
which contains a "magic regex" to find almost every version number in existence for executables. This should come in handy if needed to lock down external tooling to a minimum version range. This is just a copy paste from a personal project, and I'm giving it here under the MIT License instead of the Apache license so that additional licensing isn't needed.The ClangTidy and CCache find packages were written from scratch using a blog post I wrote at the very tail end of 2020. This can be used as a reference to understand why things are declared the way they are.
Lastly, the BRender and AudioMan
find_package
files are intended to act as a shim so that if the source for other BRender implementations are ever "massaged" to work with 3DMMForever, they can be dropped in place whether prebuilt or pulled in via CMake'sFetchContent
module. AudioMan is also given this treatment, to keep the CMakeLists.txt file more uniform