Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows compatibility #5

Open
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

zmanuel
Copy link

@zmanuel zmanuel commented Feb 18, 2023

A lot of adaptions to the build system and source to make everything compatible with Windows

Conan: Optional on macOS and Linux as an alternative to fetching the dependencies via homebrew/macports/the linux package manager, sort-of-mandatory on Windows (manual installation should still be possible, but a pain)
CMake: Use modern constructs mostly and find_package exclusively (works best with Conan); make OpenAL optional as it is not readily available on Windows.
Documented preparation steps in BUILDING.
Code changes: Disable binreloc on Windows.
Move cMainWindow constructors to cpp file; having them in the header caused unexplainable linker errors.
String/Path adaptions.

This also includes the previous macOS adaptions.

so common header names like event.h and types.h in this source are found
Not sure whether binreloc is needed there, though.
Taken mostly from https://gitlab.kitware.com/cmake/cmake/-/issues/17834#note_435285
Constructed from cppreference notes: https://en.cppreference.com/w/cpp/filesystem#Notes
We ony handle the GCC case, the problem will go away with time.
Did not cause any error, the TTF and IMAGE includes are identical anyway
with USE_CONAN option, default off. Linux and Mac builds work just fine
without it, no need to burden them with a huge cache and binaries that
do not link to system libraries.
Conan, for some reason, puts libary include paths into the argument list
with -I, making them collide with our includes. Putting our includes
first fixes order problems.

Though, it is probably worth considering NOT naming includes "event.h"
or "types.h", or force clients to use #include <cerritos/event.h> to
avoid conflics.
for different configurations (build_debug, build_conan...)
and declare doxygen as a tool dependency
1.9.4 causes the conflicts with zlib
Just find them with find_package, add them to include and libs
with a :: qualified name.
Don't forget to declare the lib dependencies PUBLIC so the examles
get linked to them as well.
Restore old way for OpenAL library; the new way produces a valid linker
line, but then fails to link.
Add SDL2::SDL2.
Find alut, only if OpenAL was found, do not link with it blindly.
Somehow, below, it interferes badly with the BUILD_DOC option.
so taking that option out
Switch to cmake_find_package generator so the regular find_package works

Remove doxygen from conan; could not immediately get it to work

Detect alut include path

Make USE_CONAN parameter obsolete, we can just check for the conan include
file existence
because NOW they're telling me the options for sdl and sdl_ttf must
match...
As far as cmake is concerned. Compiling or linking will still fail.
Doing this for one of the examples would probably be enough...
Disable copy hack for non-windows
Even with the hack enabled, add the exe to the source file list
so the command does not fail if the DLL list is empty
On Windows, filesystem::path is natively using wstrings; however,
it has conversions to and from std::string. Use those instead of
forcing everyone to deal with string vs wstring.
I can't explain it, but on Windows with VC++, having them in the header causes linker failures with cMainWindow's vtables. Could be a compiler bug.
Some MinGW and Cygwin compiler configurations do not define _WIN32.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant