1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

CMake: Make IDE folder structure mirror disk structure

This commit is contained in:
reuk 2020-06-01 15:56:00 +01:00
parent 766f6cbf16
commit f79c49a171
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
5 changed files with 33 additions and 5 deletions

View file

@ -20,6 +20,9 @@ project(JUCE VERSION 6.0.0 LANGUAGES C CXX)
set_property(GLOBAL PROPERTY USE_FOLDERS YES)
set(JUCE_MODULES_DIR "${JUCE_SOURCE_DIR}/modules" CACHE INTERNAL
"The path to JUCE modules")
include(extras/Build/CMake/JUCEHelperTargets.cmake)
include(extras/Build/CMake/JUCEUtils.cmake)
@ -97,7 +100,7 @@ configure_package_config_file("${JUCE_CMAKE_UTILS_DIR}/JUCEConfig.cmake.in"
INSTALL_DESTINATION "${JUCE_INSTALL_DESTINATION}")
set(JUCE_EXPORT_FILE_NAME "JUCEBuildTree.cmake")
set(JUCE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/modules")
set(JUCE_MODULE_PATH "${JUCE_MODULES_DIR}")
export(EXPORT JUCE NAMESPACE juce:: FILE "${JUCE_EXPORT_FILE_NAME}")
set(UTILS_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extras/Build/CMake")
get_target_property(JUCEAIDE_PATH juceaide IMPORTED_LOCATION)

View file

@ -14,6 +14,8 @@
#
# ==============================================================================
set(CMAKE_FOLDER examples)
add_subdirectory(CMake)
add_subdirectory(DemoRunner)

View file

@ -30,6 +30,9 @@ endif()
check_required_components("@PROJECT_NAME@")
set(JUCE_MODULES_DIR "@PACKAGE_JUCE_MODULE_PATH@" CACHE INTERNAL
"The path to JUCE modules")
include("@PACKAGE_UTILS_INSTALL_DIR@/JUCEUtils.cmake")
set(_juce_modules

View file

@ -497,8 +497,6 @@ function(juce_add_module module_path)
endif()
endif()
source_group(Modules FILES ${all_module_sources})
if(${module_name} STREQUAL "juce_audio_processors")
add_library(juce_vst3_headers INTERFACE)
target_include_directories(juce_vst3_headers INTERFACE
@ -1321,6 +1319,19 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
endif()
endfunction()
# Place plugin wrapper targets alongside the shared code target in IDEs
function(_juce_set_plugin_folder_property shared_target wrapper_target)
get_target_property(folder_to_use "${shared_target}" FOLDER)
if(folder_to_use STREQUAL "folder_to_use-NOTFOUND")
set(folder_to_use "${shared_target}")
else()
set(folder_to_use "${folder_to_use}/${shared_target}")
endif()
set_target_properties("${wrapper_target}" PROPERTIES FOLDER "${folder_to_use}")
endfunction()
# Convert the cmake plugin kind ids to strings understood by ProjectType::Target::typeFromName
function(_juce_get_plugin_kind_name kind out_var)
if(kind STREQUAL "AU")
@ -1367,6 +1378,8 @@ function(_juce_link_plugin_wrapper shared_code_target kind)
_juce_set_output_name(${target_name} $<TARGET_PROPERTY:${shared_code_target},JUCE_PRODUCT_NAME>)
_juce_set_plugin_folder_property("${shared_code_target}" "${target_name}")
_juce_get_plugin_kind_name(${kind} juce_kind_string)
set_target_properties(${target_name} PROPERTIES
XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO
@ -1375,7 +1388,6 @@ function(_juce_link_plugin_wrapper shared_code_target kind)
VISIBILITY_INLINES_HIDDEN TRUE
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
FOLDER ${shared_code_target}
JUCE_TARGET_KIND_STRING "${juce_kind_string}")
add_dependencies(${shared_code_target}_All ${target_name})
@ -1523,7 +1535,7 @@ function(_juce_configure_plugin_targets target)
# A convenience target for building all plugin variations at once
add_custom_target(${target}_All)
set_target_properties(${target}_All PROPERTIES FOLDER ${target})
_juce_set_plugin_folder_property("${target}" "${target}_All")
_juce_get_platform_plugin_kinds(plugin_kinds)
@ -1926,6 +1938,13 @@ function(_juce_initialise_target target)
_juce_write_generate_time_info(${target})
_juce_link_optional_libraries(${target})
file(GLOB juce_module_folders RELATIVE "${JUCE_MODULES_DIR}" "${JUCE_MODULES_DIR}/*")
foreach(module_folder IN LISTS juce_module_folders)
file(GLOB_RECURSE juce_module_files "${JUCE_MODULES_DIR}/${module_folder}/*")
source_group(TREE "${JUCE_MODULES_DIR}" PREFIX "Modules" FILES ${juce_module_files})
endforeach()
endfunction()
# ==================================================================================================

View file

@ -14,6 +14,7 @@
#
# ==============================================================================
set(CMAKE_FOLDER extras)
add_subdirectory(AudioPerformanceTest)
add_subdirectory(AudioPluginHost)
add_subdirectory(BinaryBuilder)