Open dgavedissian opened 1 year ago
I was able to successfully build from source an x86 executable (lt32.exe) with just a small tweak to pull in a 32bit FMOD dependency. Here is my change:
diff --git a/libphx/cmake/External.cmake b/libphx/cmake/External.cmake
index a734a11..60aa10e 100644
--- a/libphx/cmake/External.cmake
+++ b/libphx/cmake/External.cmake
@@ -85,10 +85,17 @@ if (FMOD_ADDED)
add_library(fmod SHARED IMPORTED)
target_include_directories(fmod INTERFACE "${FMOD_SOURCE_DIR}/include")
if (WIN32)
+ if (ARCH_X86)
set_property(TARGET fmod PROPERTY IMPORTED_LOCATION
- "${FMOD_SOURCE_DIR}/lib/win/x86_64/fmod.dll")
+ "${FMOD_SOURCE_DIR}/lib/win/x86/fmod.dll")
set_property(TARGET fmod PROPERTY IMPORTED_IMPLIB
- "${FMOD_SOURCE_DIR}/lib/win/x86_64/fmod_vc.lib")
+ "${FMOD_SOURCE_DIR}/lib/win/x86/fmod_vc.lib")
+ else ()
+ set_property(TARGET fmod PROPERTY IMPORTED_LOCATION
+ "${FMOD_SOURCE_DIR}/lib/win/x86_64/fmod.dll")
+ set_property(TARGET fmod PROPERTY IMPORTED_IMPLIB
+ "${FMOD_SOURCE_DIR}/lib/win/x86_64/fmod_vc.lib")
+ endif ()
elseif (APPLE)
set_property(TARGET fmod PROPERTY IMPORTED_LOCATION
"${FMOD_SOURCE_DIR}/lib/macos/libfmod.dylib")
So far it works on Win10 and Win10 (Windows 7 compatibility mode). Might be worth a try?
Actually,, testing ARCH_X86 is not correct. But if we can detect 32/64bit windows then it should work.
This works ... or similar
if (WIN32)`
if (${CMAKE_GENERATOR_PLATFORM} STREQUAL "win32")
The built in WIN32 test is a bit misleading. The variable I used above is what we get from "-A
This is quite nice from the CMake -T argument:
${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}
will be either x64 or x86, but does require windows to always be using Visual Studio?
if (WIN32)
if (${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE} STREQUAL "x86")
set_property(TARGET fmod PROPERTY IMPORTED_LOCATION
"${FMOD_SOURCE_DIR}/lib/win/x86/fmod.dll")
set_property(TARGET fmod PROPERTY IMPORTED_IMPLIB
"${FMOD_SOURCE_DIR}/lib/win/x86/fmod_vc.lib")
else ()
set_property(TARGET fmod PROPERTY IMPORTED_LOCATION
"${FMOD_SOURCE_DIR}/lib/win/x86_64/fmod.dll")
set_property(TARGET fmod PROPERTY IMPORTED_IMPLIB
"${FMOD_SOURCE_DIR}/lib/win/x86_64/fmod_vc.lib")
endif ()
I feel like ARCH_X86
should be set correctly if the target architecture is x86. Perhaps the code where we set ARCH_X86 needs to be fixed?
Some members of the community have asked for us to support Windows 7. Whilst Windows 7 is no longer a supported OS, there isn't a particular reason why Limit Theory can't be compiled to support it on a best effort basis.
I think it's likely going to be too difficult to use Visual Studio to compile an executable that will work on Windows 7, so it might make sense to use CMake to generate makefiles using the mingw-w64 toolchain instead, which definitely comes with the GitHub Windows runner. mingw-w64 binaries should work fine on older Windows platforms.