diff --git a/.gitignore b/.gitignore index 1ef46c913e3..17f7c481006 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,7 @@ fxbuild/ Makefile surge-*.make premake-stamp +cmake-stamp /Debug src/linux/ScalablePiggy* *.deb diff --git a/CMakeLists.txt b/CMakeLists.txt index f9061421c76..9faefa34938 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,18 +132,6 @@ set(SURGE_GUI_SOURCES src/common/gui/UIInstrumentation.cpp ) -set(SURGE_APPLE_SOURCES - src/mac/UserInteractionsMac.mm - ) - -set(SURGE_APPLE_GUI_SOURCES - src/mac/DisplayInfoMac.mm - src/mac/RuntimeFontMac.cpp - src/mac/cocoa_utils.mm - vstgui.surge/vstgui/vstgui_mac.mm - vstgui.surge/vstgui/vstgui_uidescription_mac.mm - ) - set(SURGE_VST3_SOURCES src/vst3/SurgeVst3Processor.cpp src/vst3/surgeentry.cpp @@ -224,6 +212,15 @@ set( SURGE_VST2_LIBRARY_SOURCES vstgui.surge/vstgui/plugin-bindings/aeffguieditor.cpp ) +set( SURGE_LV2_SOURCES + src/lv2/SurgeLv2Export.cpp + src/lv2/SurgeLv2Ui.cpp + src/lv2/SurgeLv2Util.cpp + src/lv2/SurgeLv2Vstgui.cpp + src/lv2/SurgeLv2Wrapper.cpp + vstgui.surge/vstgui/plugin-bindings/plugguieditor.cpp +) + # Includes and Compiler Flags set(SURGE_COMMON_INCLUDES libs/ @@ -243,59 +240,140 @@ set(SURGE_GUI_INCLUDES libs/nanosvg/src ) -# OS Specific Variables -set(APPLE_COMPILE_OPTIONS - -msse2 - "-D_aligned_malloc(x,a)=malloc(x)" - "-D_aligned_free(x)=free(x)" - ) -set(APPLE_INCLUDE_DIRECTORIES - src/mac - ) -set(APPLE_COMPILE_DEFINITIONS - MAC=1 - MAC_COCOA=1 - COCOA=1 - OBJC_OLD_DISPATCH_PROTOTYPES=1 - ) -set(APPLE_LINK_LIBRARIES - "-framework Accelerate" - "-framework ApplicationServices" - "-framework AudioUnit" - "-framework AudioToolbox" - "-framework Carbon" - "-framework CoreAudio" - "-framework CoreAudioKit" - "-framework CoreServices" - "-framework CoreText" - "-framework Cocoa" - "-framework CoreFoundation" - "-framework OpenGL" - "-framework QuartzCore" - ) +### OS SPECIFIC SECTION +if( APPLE ) + set(SURGE_OS_SOURCES + src/mac/UserInteractionsMac.mm + ) -set(LINUX_COMPILE_OPTIONS - -msse2 - "-D_aligned_malloc(x,a)=malloc(x)" - "-D_aligned_free(x)=free(x)" - ) + set(SURGE_OS_GUI_SOURCES + src/mac/DisplayInfoMac.mm + src/mac/RuntimeFontMac.cpp + src/mac/cocoa_utils.mm + vstgui.surge/vstgui/vstgui_mac.mm + vstgui.surge/vstgui/vstgui_uidescription_mac.mm + ) -set(LINUX_COMPILE_DEFINITIONS - LINUX=1 - ) + set(OS_COMPILE_OPTIONS + -msse2 + "-D_aligned_malloc(x,a)=malloc(x)" + "-D_aligned_free(x)=free(x)" + ) + set(OS_INCLUDE_DIRECTORIES + src/mac + ) + set(OS_COMPILE_DEFINITIONS + MAC=1 + MAC_COCOA=1 + COCOA=1 + OBJC_OLD_DISPATCH_PROTOTYPES=1 + ) + set(OS_LINK_LIBRARIES + "-framework Accelerate" + "-framework ApplicationServices" + "-framework AudioUnit" + "-framework AudioToolbox" + "-framework Carbon" + "-framework CoreAudio" + "-framework CoreAudioKit" + "-framework CoreServices" + "-framework CoreText" + "-framework Cocoa" + "-framework CoreFoundation" + "-framework OpenGL" + "-framework QuartzCore" + ) +elseif( UNIX AND NOT APPLE ) + set(SURGE_OS_SOURCES + src/linux/UserInteractionsLinux.cpp + ) -set(WINDOWS_COMPILE_DEFINITIONS - WINDOWS=1 - NOMINMAX=1 - ) + file(GLOB LINUX_VSTGUI_GLOB vstgui.surge/vstgui/lib/platform/linux/*.cpp ) + + set(SURGE_OS_GUI_SOURCES + src/linux/DisplayInfoLinux.cpp + src/linux/RuntimeFontLinux.cpp + src/linux/ConfigurationXml.S + src/linux/ScalablePiggy.S + vstgui.surge/vstgui/vstgui.cpp + vstgui.surge/vstgui/vstgui_uidescription.cpp + vstgui.surge/vstgui/lib/platform/common/genericoptionmenu.cpp + vstgui.surge/vstgui/lib/platform/common/generictextedit.cpp + ${LINUX_VSTGUI_GLOB} + ) + + find_package(PkgConfig REQUIRED) + pkg_check_modules(CAIRO REQUIRED cairo) + pkg_check_modules(XCB REQUIRED xcb) + pkg_check_modules(XCBCURSOR REQUIRED xcb-cursor) + pkg_check_modules(XCBUTIL REQUIRED xcb-util) + pkg_check_modules(XCBXKB REQUIRED xcb-xkb) + pkg_check_modules(XKBCOMMON REQUIRED xkbcommon) + pkg_check_modules(XKBX11COMMON REQUIRED xkbcommon-x11) + + set(OS_COMPILE_OPTIONS + -msse2 + "-D_aligned_malloc(x,a)=malloc(x)" + "-D_aligned_free(x)=free(x)" + -Wno-multichar + -fvisibility=hidden + -fvisibility-inlines-hidden + -fdata-sections + -ffunction-sections + + ${CAIRO_CFLAGS_OTHER} + ) + + set(OS_COMPILE_DEFINITIONS + LINUX=1 + RELEASE=1 + ) + + set(OS_INCLUDE_DIRECTORIES + src/linux + ${CAIRO_INCLUDE_DIRS} + ) + + set(OS_LINK_LIBRARIES + pthread + stdc++fs + gcc_s + gcc + dl + ${CAIRO_LDFLAGS} + ${XCB_LDFLAGS} + ${XCBCURSOR_LDFLAGS} + ${XCBUTIL_LDFLAGS} + ${XCBXKB_LDFLAGS} + ${XKBCOMMON_LDFLAGS} + ${XKBX11COMMON_LDFLAGS} + ) -set(WINDOWS_COMPILE_OPTIONS - /arch:SSE2 - "/FI precompiled.h" - /Zc:alignedNew - /bigobj + add_custom_target( generate-svg-embed ALL ) + add_custom_command( + TARGET generate-svg-embed + PRE_BUILD + COMMAND echo "Updating SVG Assets" + COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/linux/emit-vector-piggy.py ${CMAKE_CURRENT_SOURCE_DIR} ) +elseif( WINDOWS ) + + set(WINDOWS_COMPILE_DEFINITIONS + WINDOWS=1 + NOMINMAX=1 + ) + + set(WINDOWS_COMPILE_OPTIONS + /arch:SSE2 + "/FI precompiled.h" + /Zc:alignedNew + /bigobj + ) +else() + message( "UNKNOWN OS. Please use lin mac or win" ) +endif() + # # AUDIO UNIT @@ -305,8 +383,8 @@ if( BUILD_AU ) SHARED ${SURGE_COMMON_SOURCES} ${SURGE_GUI_SOURCES} - ${SURGE_APPLE_SOURCES} - ${SURGE_APPLE_GUI_SOURCES} + ${SURGE_OS_SOURCES} + ${SURGE_OS_GUI_SOURCES} ${SURGE_AU_SOURCES} ${SURGE_AU_LIBRARY_SOURCES} ) @@ -315,20 +393,20 @@ if( BUILD_AU ) target_compile_definitions(surge-au PRIVATE - ${APPLE_COMPILE_DEFINITIONS} + ${OS_COMPILE_DEFINITIONS} TARGET_AUDIOUNIT=1 ) target_compile_options(surge-au PRIVATE - ${APPLE_COMPILE_OPTIONS} + ${OS_COMPILE_OPTIONS} ) target_include_directories(surge-au PRIVATE ${SURGE_COMMON_INCLUDES} ${SURGE_GUI_INCLUDES} - ${APPLE_INCLUDE_DIRECTORIES} + ${OS_INCLUDE_DIRECTORIES} src/au libs/AUPublic libs/PublicUtility @@ -336,7 +414,7 @@ if( BUILD_AU ) target_link_libraries(surge-au PRIVATE - ${APPLE_LINK_LIBRARIES} + ${OS_LINK_LIBRARIES} ) add_custom_target( Surge.component ALL ) @@ -352,51 +430,78 @@ endif() # Currently this is MAC only VST3 if( BUILD_VST3 ) + if( UNIX AND NOT APPLE ) + # Sigh - vst3sdk ships with non-working code if you has it + get_filename_component(full_path_test_cpp ${CMAKE_CURRENT_SOURCE_DIR}/vst3sdk/base/source/timer.cpp ABSOLUTE) + list(REMOVE_ITEM SURGE_VST3_LIBRARY_SOURCES "${full_path_test_cpp}") + endif() + add_library(surge-vst3 SHARED ${SURGE_COMMON_SOURCES} ${SURGE_GUI_SOURCES} - ${SURGE_APPLE_SOURCES} - ${SURGE_APPLE_GUI_SOURCES} + ${SURGE_OS_SOURCES} + ${SURGE_OS_GUI_SOURCES} ${SURGE_VST3_SOURCES} ${SURGE_VST3_LIBRARY_SOURCES} ) target_compile_features(surge-vst3 PRIVATE cxx_std_17 ) + if( UNIX AND NOT APPLE ) + add_dependencies(surge-vst3 generate-svg-embed) + target_sources(surge-vst3 PUBLIC + vst3sdk/public.sdk/source/main/linuxmain.cpp + src/linux/LinuxVST3Helpers.cpp) + + endif() + target_compile_definitions(surge-vst3 PRIVATE - ${APPLE_COMPILE_DEFINITIONS} + ${OS_COMPILE_DEFINITIONS} TARGET_VST3=1 ) target_compile_options(surge-vst3 PRIVATE - ${APPLE_COMPILE_OPTIONS} + ${OS_COMPILE_OPTIONS} ) target_include_directories(surge-vst3 PRIVATE ${SURGE_COMMON_INCLUDES} ${SURGE_GUI_INCLUDES} - ${APPLE_INCLUDE_DIRECTORIES} + ${OS_INCLUDE_DIRECTORIES} src/vst3 vst3sdk/ ) target_link_libraries(surge-vst3 PRIVATE - ${APPLE_LINK_LIBRARIES} + ${OS_LINK_LIBRARIES} ) - add_custom_target( Surge.vst3 ALL ) - add_dependencies( Surge.vst3 surge-vst3 ) - add_custom_command( - TARGET Surge.vst3 - POST_BUILD - COMMAND echo "Packaging up VST3 component" - COMMAND (cd .. && ./scripts/macOS/package-vst3.sh ) - ) + if( APPLE ) + add_custom_target( Surge.vst3 ALL ) + add_dependencies( Surge.vst3 surge-vst3 ) + add_custom_command( + TARGET Surge.vst3 + POST_BUILD + COMMAND echo "Packaging up VST3 component" + COMMAND (cd .. && ./scripts/macOS/package-vst3.sh ) + ) + elseif( UNIX ) + add_custom_target( Surge.vst3 ALL ) + add_dependencies( Surge.vst3 surge-vst3 ) + add_custom_command( + TARGET Surge.vst3 + POST_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND echo "Packaging up VST3 component" + COMMAND pwd + COMMAND ./scripts/linux/package-vst3.sh + ) + endif() endif() @@ -405,38 +510,51 @@ if( BUILD_VST2 ) SHARED ${SURGE_COMMON_SOURCES} ${SURGE_GUI_SOURCES} - ${SURGE_APPLE_SOURCES} - ${SURGE_APPLE_GUI_SOURCES} + ${SURGE_OS_SOURCES} + ${SURGE_OS_GUI_SOURCES} ${SURGE_VST2_SOURCES} ${SURGE_VST2_LIBRARY_SOURCES} ) + if( UNIX AND NOT APPLE ) + add_dependencies(surge-vst2 generate-svg-embed) + target_sources(surge-vst2 PUBLIC src/linux/linux-aeffguieditor.cpp ) + + # Ideally we wouldn't define __cdecl on linux. It's not needed + # Alas, the VST2 SDK has in aeffgui a _GNUC define which requires + # it so without __cdecl blank defined on linux vst2, we don't get + # reliable builds. We considered defining it just where used but + # it is used also, indirectly, by the vst3 sdk, so the smallest + # change is this diff plus this comment. + target_compile_definitions( surge-vst2 PRIVATE "__cdecl=" ) + endif() + target_compile_features(surge-vst2 PRIVATE cxx_std_17 ) target_compile_definitions(surge-vst2 PRIVATE - ${APPLE_COMPILE_DEFINITIONS} + ${OS_COMPILE_DEFINITIONS} TARGET_VST2=1 VSTGUI_ENABLE_DEPRECATED_METHODS=0 ) target_compile_options(surge-vst2 PRIVATE - ${APPLE_COMPILE_OPTIONS} + ${OS_COMPILE_OPTIONS} ) target_include_directories(surge-vst2 PRIVATE ${SURGE_COMMON_INCLUDES} ${SURGE_GUI_INCLUDES} - ${APPLE_INCLUDE_DIRECTORIES} + ${OS_INCLUDE_DIRECTORIES} src/vst2 ${VST2SDK_DIR} ) target_link_libraries(surge-vst2 PRIVATE - ${APPLE_LINK_LIBRARIES} + ${OS_LINK_LIBRARIES} ) add_custom_target( Surge.vst2 ALL ) @@ -450,6 +568,62 @@ if( BUILD_VST2 ) endif() +if( BUILD_LV2 ) + add_library(surge-lv2 + SHARED + ${SURGE_COMMON_SOURCES} + ${SURGE_GUI_SOURCES} + ${SURGE_OS_SOURCES} + ${SURGE_OS_GUI_SOURCES} + ${SURGE_LV2_SOURCES} + ${SURGE_LV2_LIBRARY_SOURCES} + ) + + target_compile_features(surge-lv2 PRIVATE cxx_std_17 ) + + if( UNIX AND NOT APPLE ) + add_dependencies(surge-lv2 generate-svg-embed) + endif() + + target_compile_definitions(surge-lv2 + PRIVATE + ${OS_COMPILE_DEFINITIONS} + TARGET_LV2=1 + ) + + target_compile_options(surge-lv2 + PRIVATE + ${OS_COMPILE_OPTIONS} + ) + + target_include_directories(surge-lv2 + PRIVATE + ${SURGE_COMMON_INCLUDES} + ${SURGE_GUI_INCLUDES} + ${OS_INCLUDE_DIRECTORIES} + src/lv2 + libs/lv2 + ) + + target_link_libraries(surge-lv2 + PRIVATE + ${OS_LINK_LIBRARIES} + ) + + add_custom_target( Surge.lv2 ALL ) + add_dependencies( Surge.lv2 surge-lv2 ) + add_custom_command( + TARGET Surge.lv2 + POST_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND echo "Packaging up LV2 component" + COMMAND mkdir -p products/Surge.lv2 + COMMAND cp build/libsurge-lv2.so products/Surge.lv2/Surge.so + COMMAND python scripts/linux/generate-lv2-ttl.py products/Surge.lv2/Surge.so + ) + +endif() + if( BUILD_HEADLESS ) add_executable(surge-headless ${SURGE_COMMON_SOURCES} diff --git a/README.md b/README.md index bf730406231..010eaae7c05 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ tailored at Surge dev. *PLEASE BE AWARE WE ARE RIGHT NOW (like April 13 2020) IN THE MIDDLE OF MOVING TO CMAKE AND THESE DIRECTIONS ARE NOT YET UPDATED. If you are on MACOS you should use build-osx.sh like normal but don't need PREMAKE. +Simiklarly if you are on linux you should use build-linux.sh like normal but also dont need PREMAKE. Check https://github.com/surge-synthesizer/surge/issues/1206 for details* To build surge, you need [Git](https://git-scm.com/downloads) and [Premake 5](https://premake.github.io/download.html#v5) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 93c7642e997..b26c1edfa11 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -142,13 +142,6 @@ jobs: displayName: windows - run unit tests - bash: | - pushd $AGENT_TEMPDIRECTORY - export PREMAKE_LINUX=https://github.com/premake/premake-core/releases/download/v5.0.0-alpha13/premake-5.0.0-alpha13-linux.tar.gz - curl -L $PREMAKE_LINUX --output premake5.tar.gz - tar zxvf premake5.tar.gz - export PATH=$AGENT_TEMPDIRECTORY:$PATH - popd - sudo apt-get install -y xcb sudo apt-get install -y libxcb-util-dev sudo apt-get install -y libxcb-cursor-dev diff --git a/build-linux.sh b/build-linux.sh index 1bf1b974795..04eea78f5e9 100755 --- a/build-linux.sh +++ b/build-linux.sh @@ -10,7 +10,7 @@ Usage: $0 [options] Commands: - premake Run premake only. + cmake Run cmake only. build Run the builds without cleans. install Install built assets. @@ -46,104 +46,46 @@ prerequisite_check() echo exit 1 fi - - if [ ! $(which premake5) ]; then - echo - echo ${RED}ERROR: You do not have premake5 on your path${NC} - echo - echo Please download and install premake from https://premake.github.io per the Surge README.md - echo - exit 1 - fi } -run_premake() +run_cmake() { - premake5 --cc=gcc --os=linux gmake2 - touch premake-stamp + mkdir -p build + cmake . -Bbuild + touch cmake-stamp } -run_premake_if() +run_cmake_if() { - if [[ premake5.lua -nt premake-stamp ]]; then - run_premake + if [[ CMakeLists.txt -nt cmake-stamp ]]; then + run_cmake + fi + if [[ ! -d build ]]; then + run_cmake fi } run_clean() { - local project=$1 - echo - echo "Cleaning build - $project" - make clean -} - -run_build() -{ - local project=$1 - mkdir -p build_logs - - echo - echo Building surge-${project} with output in build_logs/build_${project}.log - - # Since these are piped we lose status from the tee and get wrong return code so - set -o pipefail - - if [[ -z "$option_verbose" ]]; then - make ${config} surge-${project} 2>&1 | tee build_logs/build_${project}.log - else - make ${config} surge-${project} verbose=1 2>&1 | tee build_logs/build_${project}.log - fi - - build_suc=$? - set +o pipefail - if [[ $build_suc = 0 ]]; then - echo ${GREEN}Build of surge-${project} succeeded${NC} - else - echo - echo ${RED}** Build of ${project} failed**${NC} - grep -i error build_logs/build_${project}.log - echo - echo ${RED}** Exiting failed ${project} build**${NC} - echo Complete information is in build_logs/build_${project}.log - - exit 2 + if [[ -d build ]]; then + cd build + make clean fi } -run_build_headless() +run_build() { - mkdir -p build_logs - - echo - echo Building surge-headless with output in build_logs/build_headless.log - - mkdir build - cmake . -Bbuild - - # Since these are piped we lose status from the tee and get wrong return code so - set -o pipefail - - if [[ -z "$option_verbose" ]]; then - make surge-headless -C build 2>&1 | tee build_logs/build_headless.log - else - make surge-headless verbose=1 -C build 2>&1 | tee build_logs/build_headless.log - fi - + local flavor=$1 + cd build + make -j 2 $flavor + build_suc=$? - set +o pipefail if [[ $build_suc = 0 ]]; then - echo ${GREEN}Build of surge-headless succeeded${NC} - mkdir -p "$headless_src_path" - cp build/surge-headless "${headless_src_path}/${dest_headless_name}" + echo ${GREEN}Build of ${flavor} succeeded${NC} else echo - echo ${RED}** Build of headless failed**${NC} - grep -i error build_logs/build_headless.log - echo - echo ${RED}** Exiting failed headless build**${NC} - echo Complete information is in build_logs/build_headless.log - + echo ${RED}** Build of ${flavor} failed**${NC} + exit 2 fi } @@ -151,22 +93,23 @@ run_build_headless() run_builds() { if [ ! -z "$option_vst2" ]; then - run_premake_if - run_build "vst2" + run_cmake_if + run_build "surge-vst2" fi if [ ! -z "$option_vst3" ]; then - run_premake_if - run_build "vst3" + run_cmake_if + run_build "Surge.vst3" fi if [ ! -z "$option_lv2" ]; then - run_premake_if - run_build "lv2" + run_cmake_if + run_build "Surge.lv2" fi if [ ! -z "$option_headless" ]; then - run_build_headless + run_cmake_if + run_build "surge-headless" fi } @@ -204,22 +147,7 @@ run_install() run_clean_builds() { - if [ ! -e "Makefile" ]; then - echo "No surge workspace; no builds to clean" - return 0 - fi - - if [ ! -z "$option_vst2" ]; then - run_clean "vst2" - fi - - if [ ! -z "$option_vst3" ]; then - run_clean "vst3" - fi - - if [ ! -z "$option_lv2" ]; then - run_clean "lv2" - fi + run_clean } run_clean_all() @@ -227,7 +155,7 @@ run_clean_all() run_clean_builds echo "Cleaning additional assets" - rm -rf Makefile surge-vst2.make surge-vst3.make surge-lv2.make surge-headless.make build_logs target obj premake-stamp build + rm -rf Makefile surge-vst2.make surge-vst3.make surge-lv2.make surge-headless.make build_logs target obj cmake-stamp build } run_uninstall() @@ -302,11 +230,11 @@ fi if [ -z "$option_debug" ]; then config="config=release_x64" - vst2_src_path="target/vst2/Release/Surge.so" + vst2_src_path="build/libsurge-vst2.so" vst3_src_path="products/Surge.vst3" lv2_bundle_name="Surge.lv2" - lv2_src_path="target/lv2/Release/$lv2_bundle_name" - headless_src_path="target/headless/Release/Surge" + lv2_src_path="products/$lv2_bundle_name" + headless_src_path="build/surge-headless" dest_plugin_name="Surge.so" dest_headless_name="Surge-Headless" else @@ -335,8 +263,8 @@ else fi case $1 in - premake) - run_premake + cmake) + run_cmake ;; build) run_builds diff --git a/scripts/linux/package-vst3.sh b/scripts/linux/package-vst3.sh index ce45dd8126a..124146ab2c8 100755 --- a/scripts/linux/package-vst3.sh +++ b/scripts/linux/package-vst3.sh @@ -2,11 +2,7 @@ OUTPUT_DIR=products -if [ $config = "debug_x64" ]; then - BUNDLE_NAME="Surge-Debug.vst3" -else - BUNDLE_NAME="Surge.vst3" -fi +BUNDLE_NAME="Surge.vst3" BUNDLE_DIR="$OUTPUT_DIR/$BUNDLE_NAME" echo "Creating Linux VST3 Bundle..." @@ -19,8 +15,4 @@ fi VST_SO_DIR="$BUNDLE_DIR/Contents/x86_64-linux" mkdir -p "$VST_SO_DIR" -if [ $config = debug_x64 ]; then - cp target/vst3/Debug/Surge-Debug.so "$VST_SO_DIR" -else - cp target/vst3/Release/Surge.so "$VST_SO_DIR" -fi +cp build/libsurge-vst3.so "$VST_SO_DIR"/Surge.so diff --git a/src/common/gui/SkinSupport.cpp b/src/common/gui/SkinSupport.cpp index 3304516118b..ba67578c063 100644 --- a/src/common/gui/SkinSupport.cpp +++ b/src/common/gui/SkinSupport.cpp @@ -99,12 +99,15 @@ void SkinDB::rescanForSkins(SurgeStorage* storage) { auto top = workStack.front(); workStack.pop_front(); - for (auto& d : fs::directory_iterator(top)) + if( fs::is_directory(top) ) { - if (fs::is_directory(d)) + for (auto& d : fs::directory_iterator(top)) { - alldirs.push_back(d); - workStack.push_back(d); + if (fs::is_directory(d)) + { + alldirs.push_back(d); + workStack.push_back(d); + } } } }