-
Notifications
You must be signed in to change notification settings - Fork 442
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
Rewrite FindOpenAL so it works with add_subdirectory'd OpenAL Soft sources #402
Comments
Nice, looking forward to this! |
Aaand there is an issue with a static build of OpenAL Soft as well (microsoft/vcpkg#10158 (comment)), so this also needs to correctly handle that, either by finding & linking to the exported target or adding |
Done in 25f7d79:
Everything seems to work on my end (and on all the CIs), please complain loudly if it doesn't behave as desired. |
Nice to see progress on this! It seems to fail with my current setup. |
It looks as if |
OpenAL Soft, right? Built by hand or using the binary distribution? Where is the dll located? the Find script expects it in diff --git a/modules/FindOpenAL.cmake b/modules/FindOpenAL.cmake
index d4cd66170..042021da1 100644
--- a/modules/FindOpenAL.cmake
+++ b/modules/FindOpenAL.cmake
@@ -130,7 +130,7 @@ find_path(OPENAL_INCLUDE_DIR NAMES al.h
if(CORRADE_TARGET_WINDOWS)
# TODO: debug?
find_file(OPENAL_DLL_RELEASE
- NAMES soft_oal.dll
+ NAMES OpenAL32.dll soft_oal.dll
PATH_SUFFIXES ${_OPENAL_DLL_PATH_SUFFIX})
endif()
|
I've tried the
Yup! To give a bit more info, I've renamed the output directory to be a custom name, and I'm building it by hand through the cmakelists the repo provides, I'm guessing the custom name would be the issue? |
Using the repo here: https://github.com/kcat/openal-soft |
Can you show me the directory layout, where the lib and dll is? In case of the binary distribution it's like this:
|
|
Ok, then this patch could do it I hope? diff --git a/modules/FindOpenAL.cmake b/modules/FindOpenAL.cmake
index d4cd66170..d933f4041 100644
--- a/modules/FindOpenAL.cmake
+++ b/modules/FindOpenAL.cmake
@@ -130,8 +130,8 @@ find_path(OPENAL_INCLUDE_DIR NAMES al.h
if(CORRADE_TARGET_WINDOWS)
# TODO: debug?
find_file(OPENAL_DLL_RELEASE
- NAMES soft_oal.dll
- PATH_SUFFIXES ${_OPENAL_DLL_PATH_SUFFIX})
+ NAMES OpenAL32.dll soft_oal.dll
+ PATH_SUFFIXES bin ${_OPENAL_DLL_PATH_SUFFIX})
endif()
include(FindPackageHandleStandardArgs)
|
Wait a sec... so it seems that the FindOpenAL.cmake file bundled in magnum/modules isn't being used at all, do I need to copy it in to my local |
Oh wait, nvm.... |
I think I've found the reason. It looks as if the cmake file is hitting here and just returning, never reaching the dll find logic. |
Ah, yep, that's the TODO there, haha. Your installation should have |
OpenALConfig.cmake:
OpenALConfig-relwithdebinfo.cmake
|
Great! Last patch to try, hopefully: diff --git a/modules/FindOpenAL.cmake b/modules/FindOpenAL.cmake
index d4cd66170..456b19544 100644
--- a/modules/FindOpenAL.cmake
+++ b/modules/FindOpenAL.cmake
@@ -69,6 +69,17 @@ if(TARGET OpenAL OR TARGET OpenAL::OpenAL)
# that ourselves.
get_target_property(_OPENAL_SOURCE_DIR OpenAL SOURCE_DIR)
set_target_properties(OpenAL::OpenAL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${_OPENAL_SOURCE_DIR}/include/AL)
+
+ # For the imported target get the DLL location
+ else()
+ if(CORRADE_TARGET_WINDOWS)
+ get_target_property(OPENAL_DLL_DEBUG OpenAL::OpenAL IMPORTED_LOCATION_DEBUG)
+ get_target_property(OPENAL_DLL_RELEASE OpenAL::OpenAL IMPORTED_LOCATION_RELEASE)
+ # Release not found, fall back to RelWithDebInfo
+ if(NOT OPENAL_DLL_RELEASE)
+ get_target_property(OPENAL_DLL_RELEASE OpenAL::OpenAL IMPORTED_LOCATION_RELWITHDEBINFO)
+ endif()
+ endif()
endif()
# Just to make FPHSA print some meaningful location, nothing else.
@@ -81,11 +92,6 @@ if(TARGET OpenAL OR TARGET OpenAL::OpenAL)
find_package_handle_standard_args("OpenAL" DEFAULT_MSG
_OPENAL_INTERFACE_INCLUDE_DIRECTORIES)
- if(CORRADE_TARGET_WINDOWS)
- # TODO: investigate if OpenAL Soft has IMPORTED_LOCATION_ / IMPLIB like
- # GLFW does so we can provide OPENAL_DLL
- endif()
-
return()
endif()
|
Looks great! |
Awesome, thanks a lot for the quick replies. Commited as 1b1347f, will update the Find module in other projects accordingly. |
Requested by @hsdk123. Currently the forked upstream FindOpenAL only works with bundled OpenAL Soft binaries, but not with sources.
EDIT: And also allow DLL copying like with FindSDL and FindGLFW.
The text was updated successfully, but these errors were encountered: