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

FRUT compiles JUCE code again and again for multiple projects #615

Open
timuraudio opened this issue Mar 24, 2020 · 5 comments
Open

FRUT compiles JUCE code again and again for multiple projects #615

timuraudio opened this issue Mar 24, 2020 · 5 comments

Comments

@timuraudio
Copy link

Is there any way we can avoid that? Currently, the best approach we could find is to manually compile JUCE into a static library and then link that.

@cor3ntin
Copy link

We managed to build a Static Library using FRUT an it actually works pretty well.
One issue though. On mac the framework are linked privately which causes some link error down the road.

FRUT/cmake/Reprojucer.cmake

Lines 4764 to 4789 in cb78103

foreach(framework_name IN LISTS xcode_frameworks)
target_link_libraries(${target} PRIVATE "-framework ${framework_name}")
endforeach()
else()
foreach(config IN LISTS JUCER_PROJECT_CONFIGURATIONS)
set(CMAKE_FRAMEWORK_PATH "")
set(sdk_version "${JUCER_OSX_BASE_SDK_VERSION_${config}}")
set(sdk_path "${JUCER_MACOSX_SDK_PATH_${config}}")
if(IS_DIRECTORY "${sdk_path}")
set(CMAKE_FRAMEWORK_PATH "${sdk_path}/System/Library/Frameworks")
endif()
foreach(framework_name IN LISTS xcode_frameworks)
find_library(${framework_name}_framework_${sdk_version} ${framework_name})
target_link_libraries(${target} PRIVATE
"$<$<CONFIG:${config}>:${${framework_name}_framework_${sdk_version}}>"
)
endforeach()
endforeach()
endif()
endif()
if(JUCER_EXTRA_CUSTOM_FRAMEWORKS)
set(CMAKE_FIND_FRAMEWORK ONLY)
set(CMAKE_FRAMEWORK_PATH "${JUCER_FRAMEWORK_SEARCH_PATHS}")
foreach(framework_name IN LISTS JUCER_EXTRA_CUSTOM_FRAMEWORKS)

It would be very helpful for us if that could be changed. For now, we will link manually

@McMartin
Copy link
Owner

McMartin commented Mar 24, 2020

@timuraudio
Thanks a lot for using FRUT and for opening this issue!
Building a static library might indeed be the best approach for reducing the number of compiler invocations. I'll investigate how several projects can leverage the output of a shared "Static Library" project. It will be rather a hack, but it might be possible.

@cor3ntin
Linking against the macOS frameworks publicly would not solve the whole problem. Projects that link against the Static Library would still need to have their own AppConfig.h/JuceHeader.h files and all the other JUCE settings.

@cor3ntin
Copy link

@McMartin That's taken care of!

We wrapped JuceHeader.h in an header which defines the global settings, include all the juce headers corresponding to the modules included in the static lib, then the JuceHeader.h of the project consuming the static lib

@McMartin
Copy link
Owner

@cor3ntin
That's exactly what I meant with "would not solve the whole problem", you need to add some custom hacks/workarounds.

@cor3ntin
Copy link

@McMartin we did, it works for us!

However, it is unclear to me how much of what we do can be generalized as it can only works if the set of modules and some global settings are the same for all targets consuming the static library.

The frameworks things is one of the few things we had to duplicate to make it work though.
Other issue we had is that things like JUCER_VST3_SDK_FOLDER do not get set properly if juce_audio_processors is not included in the module list, so we had to do that manually, but that's not really an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants