OpenAssetIO / OpenAssetIO

An open-source interoperability standard for tools and content management systems used in media production.
Apache License 2.0
281 stars 31 forks source link

[Investigation] Windows build improvements #538

Open feltech opened 2 years ago

feltech commented 2 years ago

What

Update Windows CMake to support Windows as a first-class deployment target.

Why

Currently the Windows platform is supported in hacky ways. For example, we have

if(WIN32)
    install(TARGETS openassetio-core
        DESTINATION "${OPENASSETIO_PYTHON_SITEDIR}/openassetio")

which won't work if OPENASSETIO_ENABLE_PYTHON is disabled.

Also targets that depend on the variables defined by include(GNUInstallDirs) (e.g. CMAKE_INSTALL_LIBDIR) don't make as much sense in Windows.

Acceptance Criteria

Out of scope

foundrytom commented 1 year ago

Can we hijack this to look at things such as https://github.com/OpenAssetIO/OpenAssetIO/pull/663#discussion_r1001788888 too?

elliotcmorris commented 6 months ago

What we want from this pretty much is to do a squiz through our windows environment setup, and make sure there's nothing egregious/fix any windows specific warnings that may have accumulated.

If we manage to squash any and all warnings, consider enabling warning as errors internally so windows keeps being okay.

feltech commented 3 months ago

Re. the duplicate dll issue. Worth a read of the 3.8+ behaviour

DLL dependencies for extension modules and DLLs loaded with ctypes on Windows are now resolved more securely. Only the system paths, the directory containing the DLL or PYD file, and directories added with ~os.add_dll_directory are searched for load-time dependencies. Specifically, PATH and the current working directory are no longer used, and modifications to these will no longer have any effect on normal DLL resolution. If your application relies on these mechanisms, you should check for ~os.add_dll_directory and if it exists, use it to add your DLLs directory while loading your library.