diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..94f480de9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf \ No newline at end of file diff --git a/.github/workflows/build_ios.yml b/.github/workflows/build_ios.yml index 2c9e38c88..1c5944051 100644 --- a/.github/workflows/build_ios.yml +++ b/.github/workflows/build_ios.yml @@ -9,6 +9,8 @@ on: - "**/modules/**" - "**/tests/**" - "**/thirdparty/**" + - "!**/native/generated/**" + - "!**/native/java*/**" - "!**/native/*_android.*" - "!**/native/*_emscripten.*" - "!**/native/*_linux.*" diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 69a5c7422..2dd97d945 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -10,6 +10,8 @@ on: - "**/modules/**" - "**/tests/**" - "**/thirdparty/**" + - "!**/native/generated/**" + - "!**/native/java*/**" - "!**/native/*_android.*" - "!**/native/*_apple.*" - "!**/native/*_emscripten.*" diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml index e323c4a39..83b8c8691 100644 --- a/.github/workflows/build_macos.yml +++ b/.github/workflows/build_macos.yml @@ -10,6 +10,8 @@ on: - "**/modules/**" - "**/tests/**" - "**/thirdparty/**" + - "!**/native/generated/**" + - "!**/native/java*/**" - "!**/native/*_android.*" - "!**/native/*_emscripten.*" - "!**/native/*_linux.*" @@ -20,12 +22,9 @@ on: - "**" concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - DEVELOPER_DIR: /Applications/Xcode_15.1.app/Contents/Developer - jobs: configure: runs-on: macos-latest diff --git a/.github/workflows/build_wasm.yml b/.github/workflows/build_wasm.yml index 1804d0fdb..b88c425e7 100644 --- a/.github/workflows/build_wasm.yml +++ b/.github/workflows/build_wasm.yml @@ -10,6 +10,8 @@ on: - "**/modules/**" - "**/tests/**" - "**/thirdparty/**" + - "!**/native/generated/**" + - "!**/native/java*/**" - "!**/native/*_android.*" - "!**/native/*_apple.*" - "!**/native/*_linux.*" diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 35e257003..56801352a 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -10,6 +10,8 @@ on: - "**/modules/**" - "**/tests/**" - "**/thirdparty/**" + - "!**/native/generated/**" + - "!**/native/java*/**" - "!**/native/*_android.*" - "!**/native/*_apple.*" - "!**/native/*_emscripten.*" diff --git a/.github/workflows/clang_format.yml b/.github/workflows/clang_format.yml index 71214737a..30f060126 100644 --- a/.github/workflows/clang_format.yml +++ b/.github/workflows/clang_format.yml @@ -36,6 +36,7 @@ jobs: **/*.hpp **/*.mm **/*.m + !**/pybind11/** !**/thirdparty/** - name: Run clang-format diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 36d6bd10f..0c0652eb2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -9,6 +9,8 @@ on: - "**/cmake/**" - "**/modules/**" - "**/tests/**" + - "!**/native/generated/**" + - "!**/native/java*/**" - "!**/native/*_android.*" - "!**/native/*_apple.*" - "!**/native/*_emscripten.*" @@ -26,6 +28,8 @@ on: - "**/cmake/**" - "**/modules/**" - "**/tests/**" + - "!**/native/generated/**" + - "!**/native/java*/**" - "!**/native/*_android.*" - "!**/native/*_apple.*" - "!**/native/*_emscripten.*" @@ -46,10 +50,10 @@ env: libasound2-dev libjack-jackd2-dev ladspa-sdk libcurl4-openssl-dev libfreetype6-dev libx11-dev libxcomposite-dev libxcursor-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxrender-dev libglu1-mesa-dev libegl1-mesa-dev mesa-common-dev lcov - IGNORE_ERRORS: "mismatch,gcov,source,negative,unused,empty" + IGNORE_ERRORS: "mismatch,gcov,source,negative,unused,empty,format,corrupt" jobs: - coverage: + cpp-coverage: runs-on: ubuntu-latest steps: @@ -79,25 +83,27 @@ jobs: working-directory: ${{ runner.workspace }}/build run: cmake --build . --target coverage_clean - - name: Run Tests + - name: Run C++ Tests working-directory: ${{ runner.workspace }}/build/tests/Debug run: ./yup_tests --gtest_output=xml:test_results.xml - - name: Generate Combined Coverage Report + - name: Generate C++ Coverage Report working-directory: ${{ runner.workspace }}/build run: | - lcov --directory . --capture --output-file coverage/coverage.info --ignore-errors mismatch,gcov,source,negative,unused,empty + mkdir -p coverage + lcov --directory . --capture --output-file coverage/coverage.info --ignore-errors ${IGNORE_ERRORS} lcov --remove coverage/coverage.info \ + "*/pybind11/*" \ "*/thirdparty/*" \ "*/build/*" \ "*/tests/*" \ "*/usr/*" \ "*/opt/*" \ "*/CMakeFiles/*" \ - --output-file coverage/coverage_final.info --ignore-errors mismatch,gcov,source,negative,unused,empty + --output-file coverage/coverage_final.info --ignore-errors ${IGNORE_ERRORS} lcov --list coverage/coverage_final.info - - name: Upload Overall Coverage to Codecov + - name: Upload Coverage to Codecov uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/python_linux.yml b/.github/workflows/python_linux.yml new file mode 100644 index 000000000..00ea8c306 --- /dev/null +++ b/.github/workflows/python_linux.yml @@ -0,0 +1,77 @@ +name: Linux Python + +on: + push: + paths: + - "CMakeLists.txt" + - "**/workflows/python_linux.yml" + - "**/cmake/**" + - "**/modules/**" + - "**/thirdparty/**" + - "**/python/**" + - "!**/native/generated/**" + - "!**/native/java*/**" + - "!**/native/*_android.*" + - "!**/native/*_apple.*" + - "!**/native/*_emscripten.*" + - "!**/native/*_ios.*" + - "!**/native/*_mac.*" + - "!**/native/*_wasm.*" + - "!**/native/*_windows.*" + branches: + - "**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build_python: + name: build_cp${{matrix.python}}-${{ matrix.platform_id }} + runs-on: ${{ matrix.os }} + continue-on-error: false + + strategy: + fail-fast: true + matrix: + include: + - { os: ubuntu-latest, python: 311, platform_id: manylinux_x86_64, cibw_archs: x86_64 } + #- { os: ubuntu-latest, python: 311, platform_id: manylinux_aarch64, cibw_archs: aarch64 } + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + if: matrix.cibw_archs == 'aarch64' + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Setup and install python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Build wheels + uses: pypa/cibuildwheel@v3.0.0 + env: + CIBW_ARCHS: ${{matrix.cibw_archs}} + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + CIBW_TEST_SKIP: "*-manylinux_aarch64" + CIBW_DEBUG_TRACEBACK: TRUE + CIBW_ENVIRONMENT: CIBW_DEBUG_TRACEBACK=TRUE + with: + package-dir: python + + - name: Store failures artifacts + if: failure() + uses: actions/upload-artifact@v4 + with: + name: compare-data + path: | + ./python/wheelhouse/compare_data/ + !./python/wheelhouse/compare_data/.gitignore + if-no-files-found: ignore + retention-days: 5 + compression-level: 0 + overwrite: true diff --git a/.github/workflows/python_macos.yml b/.github/workflows/python_macos.yml new file mode 100644 index 000000000..9fb101e05 --- /dev/null +++ b/.github/workflows/python_macos.yml @@ -0,0 +1,70 @@ +name: MacOS Python + +on: + push: + paths: + - "CMakeLists.txt" + - "**/workflows/python_macos.yml" + - "**/cmake/**" + - "**/modules/**" + - "**/thirdparty/**" + - "**/python/**" + - "!**/native/generated/**" + - "!**/native/java*/**" + - "!**/native/*_android.*" + - "!**/native/*_emscripten.*" + - "!**/native/*_linux.*" + - "!**/native/*_ios.*" + - "!**/native/*_wasm.*" + - "!**/native/*_windows.*" + branches: + - "**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build_python: + name: build_cp${{matrix.python}}-${{ matrix.platform_id }} + runs-on: ${{ matrix.os }} + continue-on-error: false + + strategy: + fail-fast: true + matrix: + include: + - { os: macos-15, python: 311, platform_id: macosx_universal2, cibw_archs: universal2 } + + steps: + - uses: actions/checkout@v4 + + - name: Setup and install python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Build wheels + uses: pypa/cibuildwheel@v3.0.0 + env: + CIBW_ARCHS: ${{matrix.cibw_archs}} + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + #CIBW_TEST_SKIP: "*-macosx_x86_64 *-macosx_universal2:x86_64" + CIBW_DEBUG_TRACEBACK: TRUE + CIBW_ENVIRONMENT: | + CIBW_DEBUG_TRACEBACK=TRUE MACOSX_DEPLOYMENT_TARGET=11.0 YUP_OSX_DEPLOYMENT_TARGET=11.0 YUP_OSX_ARCHITECTURES="x86_64;arm64" + with: + package-dir: python + + - name: Store failures artifacts + if: failure() + uses: actions/upload-artifact@v4 + with: + name: compare-data + path: | + python/tests/compare_data/ + !python/tests/compare_data/.gitignore + if-no-files-found: ignore + retention-days: 5 + compression-level: 0 + overwrite: true diff --git a/.github/workflows/python_windows.yml b/.github/workflows/python_windows.yml new file mode 100644 index 000000000..ae90b3a7f --- /dev/null +++ b/.github/workflows/python_windows.yml @@ -0,0 +1,72 @@ +name: Windows Python + +on: + push: + paths: + - "CMakeLists.txt" + - "**/workflows/python_windows.yml" + - "**/cmake/**" + - "**/modules/**" + - "**/thirdparty/**" + - "**/python/**" + - "!**/native/generated/**" + - "!**/native/java*/**" + - "!**/native/*_android.*" + - "!**/native/*_apple.*" + - "!**/native/*_emscripten.*" + - "!**/native/*_linux.*" + - "!**/native/*_ios.*" + - "!**/native/*_mac.*" + - "!**/native/*_posix.*" + - "!**/native/*_wasm.*" + branches: + - "**" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build_python: + name: build_cp${{matrix.python}}-${{ matrix.platform_id }} + runs-on: ${{ matrix.os }} + continue-on-error: false + + strategy: + fail-fast: true + matrix: + include: + - { os: windows-latest, python: 311, platform_id: win_amd64, cibw_archs: AMD64 } + - { os: windows-latest, python: 311, platform_id: win_arm64, cibw_archs: ARM64 } + + steps: + - uses: actions/checkout@v4 + + - name: Setup and install python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Build wheels + uses: pypa/cibuildwheel@v3.0.0 + env: + CIBW_ARCHS: ${{matrix.cibw_archs}} + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + CIBW_TEST_SKIP: "*-win_arm64" + CIBW_DEBUG_TRACEBACK: TRUE + CIBW_ENVIRONMENT: CIBW_DEBUG_TRACEBACK=TRUE + with: + package-dir: python + + - name: Store failures artifacts + if: failure() + uses: actions/upload-artifact@v4 + with: + name: compare-data + path: | + python/tests/compare_data/ + !python/tests/compare_data/.gitignore + if-no-files-found: ignore + retention-days: 5 + compression-level: 0 + overwrite: true diff --git a/.gitignore b/.gitignore index 6165143ef..2b0288631 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,6 @@ cmake-build* out/* # Ides -.vscode/ +.vscode .idea .vs diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d2ba6003..217f1113a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,15 +20,15 @@ cmake_minimum_required (VERSION 3.28) include (cmake/yup.cmake) -_yup_setup_platform() +_yup_get_project_version_string (${CMAKE_CURRENT_LIST_DIR}/modules yup_version) +_yup_message (STATUS "Building project version ${yup_version}") -if (YUP_PLATFORM_OSX) +if (YUP_PLATFORM_MAC) set (CMAKE_OSX_DEPLOYMENT_TARGET 11.0) set (CMAKE_XCODE_GENERATE_SCHEME OFF) endif() -project (yup VERSION 1.0) - +project (yup VERSION ${yup_version}) set_property (GLOBAL PROPERTY USE_FOLDERS ON) # Options @@ -36,12 +36,30 @@ option (YUP_TARGET_ANDROID "Target Android project" OFF) option (YUP_TARGET_ANDROID_BUILD_GRADLE "When building for Android, build the gradle infrastructure" OFF) option (YUP_ENABLE_PROFILING "Enable the profiling code using Perfetto SDK" OFF) option (YUP_ENABLE_COVERAGE "Enable code coverage collection for tests" OFF) +option (YUP_EXPORT_MODULES "Export the modules to the parent project" ON) +option (YUP_ENABLE_STATIC_PYTHON_LIBS "Use static Python libraries" OFF) option (YUP_BUILD_JAVA_SUPPORT "Build the Java support" OFF) option (YUP_BUILD_EXAMPLES "Build the examples" ${PROJECT_IS_TOP_LEVEL}) option (YUP_BUILD_TESTS "Build the tests" ${PROJECT_IS_TOP_LEVEL}) +option (YUP_BUILD_WHEEL "Build the wheel" OFF) # Dependencies modules -_yup_add_default_modules (${CMAKE_CURRENT_LIST_DIR}) +if (YUP_EXPORT_MODULES) + _yup_message (STATUS "Exporting modules") + + if (YUP_PLATFORM_DESKTOP) + _yup_message (STATUS "Enabling python module support") + set (enable_python ON) + if (YUP_PLATFORM_LINUX) + set (YUP_ENABLE_STATIC_PYTHON_LIBS OFF) + endif() + else() + _yup_message (STATUS "Disabling python module support") + set (enable_python OFF) + endif() + + yup_add_default_modules (${CMAKE_CURRENT_LIST_DIR} ENABLE_PYTHON ${enable_python}) +endif() # Enable profiling if (YUP_ENABLE_PROFILING) @@ -64,3 +82,8 @@ if (YUP_BUILD_TESTS AND NOT YUP_PLATFORM_MOBILE) _yup_message (STATUS "Building tests") add_subdirectory (tests) endif() + +if (YUP_BUILD_WHEEL) + _yup_message (STATUS "Building wheel") + add_subdirectory (python) +endif() diff --git a/README.md b/README.md index d01c82a15..b6672b4de 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ Available recipes: ios PLATFORM="OS64" # generate and open project for iOS using Xcode ios_simulator PLATFORM="SIMULATORARM64" # generate and open project for iOS Simulator macOS using Xcode linux PROFILING="OFF" # generate project in Linux using Ninja - osx PROFILING="OFF" # generate and open project in macOS using Xcode + mac PROFILING="OFF" # generate and open project in macOS using Xcode win PROFILING="OFF" # generate and open project in Windows using Visual Studio ``` diff --git a/cmake/platforms/osx/Info.plist b/cmake/platforms/mac/Info.plist similarity index 100% rename from cmake/platforms/osx/Info.plist rename to cmake/platforms/mac/Info.plist diff --git a/cmake/yup.cmake b/cmake/yup.cmake index d564360ea..1e117b580 100644 --- a/cmake/yup.cmake +++ b/cmake/yup.cmake @@ -50,8 +50,8 @@ function (_yup_setup_platform) list (APPEND platforms "emscripten" "posix" "web") elseif (APPLE) - set (platform "osx") - list (APPEND platforms "osx" "apple" "posix" "desktop") + set (platform "mac") + list (APPEND platforms "mac" "apple" "posix" "desktop") elseif (WIN32) if (CMAKE_SYSTEM_NAME MATCHES "WindowsStore") @@ -93,3 +93,8 @@ include (${CMAKE_CURRENT_LIST_DIR}/yup_standalone.cmake) include (${CMAKE_CURRENT_LIST_DIR}/yup_audio_plugin.cmake) include (${CMAKE_CURRENT_LIST_DIR}/yup_embed_binary.cmake) include (${CMAKE_CURRENT_LIST_DIR}/yup_android_java.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/yup_python.cmake) + +#============================================================================== + +_yup_setup_platform() diff --git a/cmake/yup_audio_plugin.cmake b/cmake/yup_audio_plugin.cmake index 521e97ee3..4d80314c0 100644 --- a/cmake/yup_audio_plugin.cmake +++ b/cmake/yup_audio_plugin.cmake @@ -143,7 +143,7 @@ function (yup_audio_plugin) set (SMTG_ENABLE_VST3_PLUGIN_EXAMPLES OFF) set (SMTG_ENABLE_VSTGUI_SUPPORT OFF) set (SMTG_CREATE_PLUGIN_LINK OFF) - if (NOT YUP_PLATFORM_OSX OR XCODE) + if (NOT YUP_PLATFORM_MAC OR XCODE) set (SMTG_RUN_VST_VALIDATOR ON) else() set (SMTG_RUN_VST_VALIDATOR OFF) @@ -183,7 +183,7 @@ function (yup_audio_plugin) ${additional_libraries} ${YUP_ARG_MODULES}) - if (YUP_PLATFORM_OSX) + if (YUP_PLATFORM_MAC) smtg_target_set_bundle (${target_name}_vst3_plugin BUNDLE_IDENTIFIER org.kunitoki.yup.${target_name} COMPANY_NAME "kunitoki") @@ -246,7 +246,7 @@ endfunction() #============================================================================== function (yup_audio_plugin_copy_bundle target_name plugin_type) - if (NOT YUP_PLATFORM_OSX) + if (NOT YUP_PLATFORM_MAC) return() endif() diff --git a/cmake/yup_dependencies.cmake b/cmake/yup_dependencies.cmake index fd854db4d..9dcfdeabd 100644 --- a/cmake/yup_dependencies.cmake +++ b/cmake/yup_dependencies.cmake @@ -111,3 +111,34 @@ function (_yup_fetch_perfetto) add_library (perfetto::perfetto ALIAS perfetto) endfunction() + +#============================================================================== + +macro (_yup_fetch_python use_static_libs modules) + if (TARGET Python::Python OR TARGET Python::Module) + return() + endif() + + set (Python_USE_STATIC_LIBS "${use_static_libs}") + + find_package (Python QUIET COMPONENTS ${modules}) + + if (NOT Python_FOUND) + string (REPLACE "Development.Module" "Development" fallback_modules "${modules}") + if (NOT "${fallback_modules}" STREQUAL "${modules}") + find_package (Python QUIET COMPONENTS ${fallback_modules}) + endif() + + if (NOT Python_FOUND) + find_package (Python QUIET COMPONENTS Interpreter Development) + endif() + + if (NOT Python_FOUND) + find_package (Python QUIET COMPONENTS Interpreter) + endif() + endif() + + if (NOT Python_FOUND) + find_package (Python REQUIRED COMPONENTS ${modules}) + endif() +endmacro() diff --git a/cmake/yup_embed_binary.cmake b/cmake/yup_embed_binary.cmake index 4e7b714a1..fd432977b 100644 --- a/cmake/yup_embed_binary.cmake +++ b/cmake/yup_embed_binary.cmake @@ -79,7 +79,7 @@ function (yup_add_embedded_binary_resources library_name) file (APPEND "${full_resource_unit_path}" "const uint8_t ${resource_name}_data[] = \n" "{\n" - "#include \"${resource_name}.inc\"\n" + " #include \"${resource_name}.inc\"\n" "};\n" "\n" "const std::size_t ${resource_name}_size = sizeof (${resource_name}_data);\n" diff --git a/cmake/yup_modules.cmake b/cmake/yup_modules.cmake index 1d9e54c78..92f41ad74 100644 --- a/cmake/yup_modules.cmake +++ b/cmake/yup_modules.cmake @@ -90,8 +90,7 @@ function (_yup_module_collect_sources folder output_variable) list (FILTER found_source_files EXCLUDE REGEX "${base_path}*_ios${extension}") endif() - if (NOT YUP_PLATFORM_OSX) - list (FILTER found_source_files EXCLUDE REGEX "${base_path}*_osx${extension}") + if (NOT YUP_PLATFORM_MAC) list (FILTER found_source_files EXCLUDE REGEX "${base_path}*_mac${extension}") endif() @@ -169,6 +168,7 @@ function (_yup_module_setup_target module_name module_defines module_sources module_libs + module_libs_paths module_link_options module_frameworks module_dependencies @@ -191,7 +191,7 @@ function (_yup_module_setup_target module_name CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON) - if (YUP_PLATFORM_OSX OR YUP_PLATFORM_IOS) + if (YUP_PLATFORM_APPLE) set_target_properties (${module_name} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC ${module_arc_enabled} XCODE_GENERATE_SCHEME OFF) @@ -209,6 +209,9 @@ function (_yup_module_setup_target module_name target_include_directories (${module_name} INTERFACE ${module_include_paths}) + target_link_directories (${module_name} INTERFACE + ${module_libs_paths}) + target_link_libraries (${module_name} INTERFACE ${module_libs} ${module_frameworks} @@ -258,6 +261,7 @@ function (_yup_module_setup_plugin_client target_name plugin_client_target folde get_target_property (module_defines ${plugin_client_target} YUP_MODULE_DEFINES) get_target_property (module_options ${plugin_client_target} YUP_MODULE_OPTIONS) get_target_property (module_libs ${plugin_client_target} YUP_MODULE_LIBS) + get_target_property (module_libs_paths ${plugin_client_target} YUP_MODULE_LIBS_PATHS) get_target_property (module_link_options ${plugin_client_target} YUP_MODULE_LINK_OPTIONS) get_target_property (module_frameworks ${plugin_client_target} YUP_MODULE_FRAMEWORK) get_target_property (module_dependencies ${plugin_client_target} YUP_MODULE_DEPENDENCIES) @@ -298,6 +302,7 @@ function (_yup_module_setup_plugin_client target_name plugin_client_target folde "${module_defines}" "${module_sources}" "${module_libs}" + "${module_libs_paths}" "${module_link_options}" "${module_frameworks}" "${module_dependencies}" @@ -312,7 +317,7 @@ endfunction() #============================================================================== -function (yup_add_module module_path module_group) +function (yup_add_module module_path modules_definitions module_group) get_filename_component (module_path ${module_path} ABSOLUTE) get_filename_component (module_name ${module_path} NAME) @@ -336,7 +341,7 @@ function (yup_add_module module_path module_group) _yup_module_parse_config ("${module_header}" module_configs module_user_configs) # ==== Assign Configurations Dynamically - set (global_properties "dependencies|defines|options|searchpaths") + set (global_properties "dependencies|defines|libs|options|searchpaths") set (platform_properties "^(.*)Deps$|^(.*)Defines$|^(.*)Libs$|^(.*)Frameworks$|^(.*)WeakFrameworks$|^(.*)Options$|^(.*)LinkOptions$|^(.*)Packages$|^(.*)Searchpaths$|^(.*)CppStandard$") set (parsed_config "") @@ -356,11 +361,14 @@ function (yup_add_module module_path module_group) set (module_cpp_standard "${value}") elseif (${key} MATCHES "^enableARC$") _yup_boolean_property ("${value}" module_arc_enabled) + elseif (${key} MATCHES "^needsPython$") + _yup_boolean_property ("${value}" module_needs_python) endif() endforeach() _yup_set_default (module_cpp_standard "17") _yup_set_default (module_arc_enabled OFF) + _yup_set_default (module_needs_python OFF) _yup_resolve_variable_paths ("${module_searchpaths}" module_searchpaths) # ==== Setup Platform-Specific Configurations @@ -407,30 +415,30 @@ function (yup_add_module module_path module_group) _yup_module_prepare_frameworks ("${module_appleFrameworks}" "${module_appleWeakFrameworks}" module_appleFrameworks) list (APPEND module_frameworks ${module_appleFrameworks}) - elseif (YUP_PLATFORM_OSX) + elseif (YUP_PLATFORM_MAC) if (module_appleCppStandard) set (module_cpp_standard "${module_appleCppStandard}") endif() - list (APPEND module_dependencies ${module_osxDeps}) + list (APPEND module_dependencies ${module_macDeps}) list (APPEND module_dependencies ${module_appleDeps}) - list (APPEND module_defines ${module_osxDefines}) + list (APPEND module_defines ${module_macDefines}) list (APPEND module_defines ${module_appleDefines}) - list (APPEND module_options ${module_osxOptions}) + list (APPEND module_options ${module_macOptions}) list (APPEND module_options ${module_appleOptions}) - list (APPEND module_libs ${module_osxLibs}) - list (APPEND module_link_options ${module_osxLinkOptions}) + list (APPEND module_libs ${module_macLibs}) + list (APPEND module_link_options ${module_macLinkOptions}) list (APPEND module_libs ${module_appleLibs}) list (APPEND module_link_options ${module_appleLinkOptions}) - _yup_resolve_variable_paths ("${module_osxSearchpaths}" module_osxSearchpaths) - list (APPEND module_searchpaths ${module_osxSearchpaths}) + _yup_resolve_variable_paths ("${module_macSearchpaths}" module_macSearchpaths) + list (APPEND module_searchpaths ${module_macSearchpaths}) _yup_resolve_variable_paths ("${module_appleSearchpaths}" module_appleSearchpaths) list (APPEND module_searchpaths ${module_appleSearchpaths}) - _yup_module_prepare_frameworks ("${module_osxFrameworks}" "${module_osxWeakFrameworks}" module_osxFrameworks) - list (APPEND module_frameworks ${module_osxFrameworks}) + _yup_module_prepare_frameworks ("${module_macFrameworks}" "${module_macWeakFrameworks}" module_macFrameworks) + list (APPEND module_frameworks ${module_macFrameworks}) _yup_module_prepare_frameworks ("${module_appleFrameworks}" "${module_appleWeakFrameworks}" module_appleFrameworks) list (APPEND module_frameworks ${module_appleFrameworks}) - if (module_osxCppStandard) - set (module_cpp_standard "${module_osxCppStandard}") + if (module_macCppStandard) + set (module_cpp_standard "${module_macCppStandard}") endif() elseif (YUP_PLATFORM_LINUX) @@ -496,6 +504,11 @@ function (yup_add_module module_path module_group) endif() endif() + # ==== Add module definitions + foreach (module_definition ${modules_definitions}) + list (APPEND module_defines ${module_definition}) + endforeach() + # ==== Prepare include paths get_filename_component (module_include_path ${module_path} DIRECTORY) list (APPEND module_include_paths "${module_include_path}") @@ -508,6 +521,25 @@ function (yup_add_module module_path module_group) endif() endforeach() + # ==== Fetch Python if needed + if (module_needs_python) + if (NOT YUP_BUILD_WHEEL) + list (APPEND module_libs Python::Python) + if (YUP_PLATFORM_MAC) + list (APPEND module_link_options "-Wl,-weak_reference_mismatches,weak") + endif() + else() + list (APPEND module_libs Python::Module) + endif() + + if (NOT "${Python_INCLUDE_DIRS}" STREQUAL "") + list (APPEND module_include_paths "${Python_INCLUDE_DIRS}") + endif() + if (NOT "${Python_LIBRARY_DIRS}" STREQUAL "") + list (APPEND module_libs_paths "${Python_LIBRARY_DIRS}") + endif() + endif() + # ==== Scan sources to include _yup_module_collect_sources ("${module_path}" module_sources) @@ -520,6 +552,7 @@ function (yup_add_module module_path module_group) "${module_defines}" "${module_sources}" "${module_libs}" + "${module_libs_paths}" "${module_link_options}" "${module_frameworks}" "${module_dependencies}" @@ -545,6 +578,7 @@ function (yup_add_module module_path module_group) YUP_MODULE_DEFINES "${module_defines}" YUP_MODULE_SOURCES "${module_sources}" YUP_MODULE_LIBS "${module_libs}" + YUP_MODULE_LIBS_PATHS "${module_libs_paths}" YUP_MODULE_LINK_OPTIONS "${module_link_options}" YUP_MODULE_FRAMEWORK "${module_frameworks}" YUP_MODULE_DEPENDENCIES "${module_dependencies}" @@ -559,47 +593,79 @@ endfunction() #============================================================================== -function (_yup_add_default_modules modules_path) - # Thirdparty modules +macro (yup_add_default_modules modules_path) + get_filename_component (modules_path "${modules_path}" ABSOLUTE) + _yup_message (STATUS "Adding default modules from ${modules_path}") + + # ==== Fetch options + set (options "") + set (one_value_args ENABLE_PYTHON) + set (multi_value_args DEFINITIONS) + cmake_parse_arguments (YUP_ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) + _yup_set_default (YUP_ARG_TARGET_DEFINITIONS "") + _yup_set_default (YUP_ARG_ENABLE_PYTHON OFF) + set (modules_definitions "${YUP_ARG_DEFINITIONS}") + + # ==== Thirdparty modules set (thirdparty_group "Thirdparty") - yup_add_module (${modules_path}/thirdparty/zlib ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/glad ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/harfbuzz ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/libpng ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/libwebp ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/sheenbidi ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/yoga_library ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/rive ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/rive_decoders ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/rive_renderer ${thirdparty_group}) - yup_add_module (${modules_path}/thirdparty/oboe_library ${thirdparty_group}) - - # Yup modules + yup_add_module (${modules_path}/thirdparty/zlib "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/glad "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/harfbuzz "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/libpng "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/libwebp "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/sheenbidi "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/yoga_library "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/rive "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/rive_decoders "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/rive_renderer "${modules_definitions}" ${thirdparty_group}) + yup_add_module (${modules_path}/thirdparty/oboe_library "${modules_definitions}" ${thirdparty_group}) + + # ==== Yup modules set (modules_group "Modules") - yup_add_module (${modules_path}/modules/yup_core ${modules_group}) + yup_add_module (${modules_path}/modules/yup_core "${modules_definitions}" ${modules_group}) add_library (yup::yup_core ALIAS yup_core) - yup_add_module (${modules_path}/modules/yup_events ${modules_group}) + yup_add_module (${modules_path}/modules/yup_events "${modules_definitions}" ${modules_group}) add_library (yup::yup_events ALIAS yup_events) - yup_add_module (${modules_path}/modules/yup_data_model ${modules_group}) + yup_add_module (${modules_path}/modules/yup_data_model "${modules_definitions}" ${modules_group}) add_library (yup::yup_data_model ALIAS yup_data_model) - yup_add_module (${modules_path}/modules/yup_audio_basics ${modules_group}) + yup_add_module (${modules_path}/modules/yup_audio_basics "${modules_definitions}" ${modules_group}) add_library (yup::yup_audio_basics ALIAS yup_audio_basics) - yup_add_module (${modules_path}/modules/yup_audio_devices ${modules_group}) + yup_add_module (${modules_path}/modules/yup_audio_devices "${modules_definitions}" ${modules_group}) add_library (yup::yup_audio_devices ALIAS yup_audio_devices) - yup_add_module (${modules_path}/modules/yup_audio_processors ${modules_group}) + yup_add_module (${modules_path}/modules/yup_audio_processors "${modules_definitions}" ${modules_group}) add_library (yup::yup_audio_processors ALIAS yup_audio_processors) - yup_add_module (${modules_path}/modules/yup_audio_plugin_client ${modules_group}) + yup_add_module (${modules_path}/modules/yup_audio_plugin_client "${modules_definitions}" ${modules_group}) add_library (yup::yup_audio_plugin_client ALIAS yup_audio_plugin_client) - yup_add_module (${modules_path}/modules/yup_graphics ${modules_group}) + yup_add_module (${modules_path}/modules/yup_graphics "${modules_definitions}" ${modules_group}) add_library (yup::yup_graphics ALIAS yup_graphics) - yup_add_module (${modules_path}/modules/yup_gui ${modules_group}) + yup_add_module (${modules_path}/modules/yup_gui "${modules_definitions}" ${modules_group}) add_library (yup::yup_gui ALIAS yup_gui) -endfunction() + + if (YUP_ARG_ENABLE_PYTHON) + if (NOT YUP_BUILD_WHEEL) + set (python_modules "Interpreter;Development.Embed") + else() + set (python_modules "Interpreter;Development.Module") + endif() + + _yup_fetch_python ("${YUP_ENABLE_STATIC_PYTHON_LIBS}" "${python_modules}") + _yup_message (STATUS "Found python modules: ${python_modules}") + _yup_message (STATUS "* Python_EXECUTABLE: ${Python_EXECUTABLE}") + _yup_message (STATUS "* Python_VERSION_MAJOR: ${Python_VERSION_MAJOR}") + _yup_message (STATUS "* Python_VERSION_MINOR: ${Python_VERSION_MINOR}") + _yup_message (STATUS "* Python_INCLUDE_DIR: ${Python_INCLUDE_DIR}") + _yup_message (STATUS "* Python_LIBRARY_DIRS: ${Python_LIBRARY_DIRS}") + _yup_message (STATUS "* Python_ROOT_DIR: ${Python_ROOT_DIR}") + + yup_add_module (${modules_path}/modules/yup_python "${modules_definitions}" ${modules_group}) + add_library (yup::yup_python ALIAS yup_python) + endif() +endmacro() diff --git a/cmake/yup_python.cmake b/cmake/yup_python.cmake new file mode 100644 index 000000000..317170d68 --- /dev/null +++ b/cmake/yup_python.cmake @@ -0,0 +1,56 @@ +# ============================================================================== +# +# This file is part of the YUP library. +# Copyright (c) 2024 - kunitoki@gmail.com +# +# YUP is an open source library subject to open-source licensing. +# +# The code included in this file is provided under the terms of the ISC license +# http://www.isc.org/downloads/software-support-policy/isc-license. Permission +# To use, copy, modify, and/or distribute this software for any purpose with or +# without fee is hereby granted provided that the above copyright notice and +# this permission notice appear in all copies. +# +# YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER +# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE +# DISCLAIMED. +# +# ============================================================================== + +#============================================================================== + +function (yup_prepare_python_stdlib target_name python_tools_path output_variable) + set (options "") + set (one_value_args "") + set (multi_value_args IGNORED_LIBRARY_PATTERNS) + + cmake_parse_arguments (YUP_ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) + + set (default_ignored_library_patterns "lib2to3" "pydoc_data" "_xxtestfuzz*") + + set (ignored_library_patterns ${default_ignored_library_patterns}) + list (APPEND ignored_library_patterns ${YUP_ARG_IGNORED_LIBRARY_PATTERNS}) + + get_filename_component (python_tools_path "${python_tools_path}" REALPATH) + + set (python_standard_library "${CMAKE_CURRENT_BINARY_DIR}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.zip") + + _yup_message (STATUS "Executing python stdlib archive generator tool") + _yup_message (STATUS " * CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}") + _yup_message (STATUS " * Python_EXECUTABLE: ${Python_EXECUTABLE}") + _yup_message (STATUS " * Python_LIBRARY_DIRS: ${Python_LIBRARY_DIRS}") + _yup_message (STATUS " * Python_VERSION_MAJOR: ${Python_VERSION_MAJOR}") + _yup_message (STATUS " * Python_VERSION_MINOR: ${Python_VERSION_MINOR}") + _yup_message (STATUS " * python_tools_path: ${python_tools_path}") + _yup_message (STATUS " * ignored_library_patterns: ${ignored_library_patterns}") + + execute_process ( + COMMAND + "${Python_EXECUTABLE}" "${python_tools_path}/ArchivePythonStdlib.py" + -l "${Python_LIBRARY_DIRS}" -o "${CMAKE_CURRENT_BINARY_DIR}" -M "${Python_VERSION_MAJOR}" -m "${Python_VERSION_MINOR}" + -x "\"${ignored_library_patterns}\"" + COMMAND_ECHO STDOUT + COMMAND_ERROR_IS_FATAL ANY) + + set (${output_variable} ${python_standard_library} PARENT_SCOPE) +endfunction () diff --git a/cmake/yup_standalone.cmake b/cmake/yup_standalone.cmake index 46c6e11cd..e4c4aa632 100644 --- a/cmake/yup_standalone.cmake +++ b/cmake/yup_standalone.cmake @@ -24,7 +24,7 @@ function (yup_standalone_app) set (options "") set (one_value_args # Globals - TARGET_NAME TARGET_VERSION TARGET_CONSOLE TARGET_IDE_GROUP TARGET_APP_NAMESPACE TARGET_ICON TARGET_CXX_STANDARD + TARGET_NAME TARGET_VERSION TARGET_CONSOLE TARGET_IDE_GROUP TARGET_APP_NAMESPACE TARGET_ICON TARGET_WHEEL TARGET_CXX_STANDARD # Emscripten INITIAL_MEMORY PTHREAD_POOL_SIZE CUSTOM_PLIST CUSTOM_SHELL) set (multi_value_args @@ -44,6 +44,7 @@ function (yup_standalone_app) set (target_icon "${YUP_ARG_TARGET_ICON}") set (target_app_namespace "${YUP_ARG_TARGET_APP_NAMESPACE}") set (target_app_identifier "${target_app_namespace}.${target_name}") + set (target_wheel "${YUP_ARG_TARGET_WHEEL}") set (target_resources "") set (target_cxx_standard "${YUP_ARG_TARGET_CXX_STANDARD}") set (additional_definitions "") @@ -52,6 +53,7 @@ function (yup_standalone_app) set (additional_link_options "") _yup_set_default (target_console OFF) + _yup_set_default (target_wheel OFF) _yup_make_short_version ("${target_version}" target_version_short) # ==== Output status @@ -92,13 +94,15 @@ function (yup_standalone_app) if (NOT "${target_console}") if (YUP_PLATFORM_WINDOWS) set (executable_options "WIN32") - elseif (YUP_PLATFORM_OSX) + elseif (YUP_PLATFORM_MAC) set (executable_options "MACOSX_BUNDLE") endif() endif() if (YUP_PLATFORM_ANDROID) add_library (${target_name} SHARED) + elseif (target_wheel) + add_library (${target_name} MODULE) else() add_executable (${target_name} ${executable_options}) endif() @@ -106,8 +110,8 @@ function (yup_standalone_app) target_compile_features (${target_name} PRIVATE cxx_std_${target_cxx_standard}) # ==== Per platform configuration - if (YUP_PLATFORM_OSX OR YUP_PLATFORM_IOS) - if (NOT "${target_console}") + if (YUP_PLATFORM_APPLE) + if (NOT "${target_console}" AND NOT "${target_wheel}") _yup_set_default (YUP_ARG_CUSTOM_PLIST "${CMAKE_SOURCE_DIR}/cmake/platforms/${YUP_PLATFORM}/Info.plist") _yup_valid_identifier_string ("${target_app_identifier}" target_app_identifier) @@ -195,6 +199,9 @@ function (yup_standalone_app) "${CMAKE_SOURCE_DIR}/cmake/platforms/${YUP_PLATFORM}/mini-coi.js" "${target_copy_dest}/mini-coi.js") + elseif (YUP_PLATFORM_LINUX) + set_target_properties (${target_name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + endif() if (YUP_ARG_TARGET_IDE_GROUP) diff --git a/cmake/yup_utilities.cmake b/cmake/yup_utilities.cmake index 1e0fac825..07cd797cb 100644 --- a/cmake/yup_utilities.cmake +++ b/cmake/yup_utilities.cmake @@ -94,6 +94,17 @@ endfunction() #============================================================================== +function (_yup_get_project_version_string modules_path output_variable) + get_filename_component (root_modules_path "${modules_path}" ABSOLUTE) + file (STRINGS "${root_modules_path}/yup_core/system/yup_StandardHeader.h" YUP_CORE_MODULE) + string (REGEX REPLACE "(.*)(YUP_MAJOR_VERSION )([0-9]+)(.*)" "\\3" MAJOR_NUMBER ${YUP_CORE_MODULE}) + string (REGEX REPLACE "(.*)(YUP_MINOR_VERSION )([0-9]+)(.*)" "\\3" MINOR_NUMBER ${YUP_CORE_MODULE}) + string (REGEX REPLACE "(.*)(YUP_BUILDNUMBER )([0-9]+)(.*)" "\\3" BUILD_NUMBER ${YUP_CORE_MODULE}) + set (${output_variable} "${MAJOR_NUMBER}.${MINOR_NUMBER}.${BUILD_NUMBER}" PARENT_SCOPE) +endfunction() + +#============================================================================== + function (_yup_boolean_property input_bool output_variable) string (STRIP "${input_bool}" ${input_bool}) string (TOLOWER "${input_bool}" ${input_bool}) @@ -137,7 +148,7 @@ function (_yup_file_to_byte_array file_path output_variable) file (READ "${file_path}" hex_contents HEX) string (REGEX MATCHALL "([A-Fa-f0-9][A-Fa-f0-9])" separated_hex ${hex_contents}) - list (JOIN separated_hex ", 0x" formatted_hex) + list (JOIN separated_hex ",0x" formatted_hex) string (PREPEND formatted_hex "0x") string (APPEND formatted_hex "") @@ -159,11 +170,11 @@ endfunction() #============================================================================== -function (_yup_get_package_config_libs package_name output_variable) +macro (_yup_get_package_config_libs package_name output_variable) find_package (PkgConfig REQUIRED) pkg_check_modules (${package_name} REQUIRED IMPORTED_TARGET ${package_name}) - set (${output_variable} "PkgConfig::${package_name}" PARENT_SCOPE) -endfunction() + set (${output_variable} "PkgConfig::${package_name}") +endmacro() #============================================================================== diff --git a/examples/app/CMakeLists.txt b/examples/app/CMakeLists.txt index 75a7c4823..b79fc8cc4 100644 --- a/examples/app/CMakeLists.txt +++ b/examples/app/CMakeLists.txt @@ -28,8 +28,7 @@ project (${target_name} VERSION ${target_version}) # ==== Prepare Android build if (ANDROID) include (../../cmake/yup.cmake) - _yup_setup_platform() - _yup_add_default_modules ("${CMAKE_CURRENT_LIST_DIR}/../..") + yup_add_default_modules ("${CMAKE_CURRENT_LIST_DIR}/../..") endif() # ==== Prepare target diff --git a/examples/console/CMakeLists.txt b/examples/console/CMakeLists.txt index 9a32b1cf3..28d202b08 100644 --- a/examples/console/CMakeLists.txt +++ b/examples/console/CMakeLists.txt @@ -28,8 +28,7 @@ project (${target_name} VERSION ${target_version}) # ==== Prepare Android build if (ANDROID) include (../../cmake/yup.cmake) - _yup_setup_platform() - _yup_add_default_modules ("${CMAKE_CURRENT_LIST_DIR}/../..") + yup_add_default_modules ("${CMAKE_CURRENT_LIST_DIR}/../..") endif() # ==== Prepare target diff --git a/examples/graphics/CMakeLists.txt b/examples/graphics/CMakeLists.txt index 02c32094a..74df7eeb8 100644 --- a/examples/graphics/CMakeLists.txt +++ b/examples/graphics/CMakeLists.txt @@ -31,8 +31,7 @@ set (rive_file "data/alien.riv") set (link_libraries "") if (ANDROID) include (../../cmake/yup.cmake) - _yup_setup_platform() - _yup_add_default_modules ("${CMAKE_CURRENT_LIST_DIR}/../..") + yup_add_default_modules ("${CMAKE_CURRENT_LIST_DIR}/../..") yup_add_embedded_binary_resources ( "${target_name}_binary_data" @@ -48,6 +47,11 @@ if (ANDROID) endif() # ==== Prepare target +set (additional_modules "") +if (YUP_PLATFORM_DESKTOP) + set (additional_modules yup::yup_python) +endif() + yup_standalone_app ( TARGET_NAME ${target_name} TARGET_VERSION ${target_version} @@ -68,6 +72,7 @@ yup_standalone_app ( yup::yup_audio_processors libpng libwebp + ${additional_modules} ${link_libraries}) # ==== Prepare sources diff --git a/examples/graphics/source/examples/Artboard.h b/examples/graphics/source/examples/Artboard.h index f59761c7d..f1f6506a1 100644 --- a/examples/graphics/source/examples/Artboard.h +++ b/examples/graphics/source/examples/Artboard.h @@ -21,8 +21,7 @@ #pragma once -namespace yup -{ +//============================================================================== class ArtboardDemo : public yup::Component { @@ -38,7 +37,7 @@ class ArtboardDemo : public yup::Component if (factory == nullptr) return false; -#if JUCE_ANDROID +#if YUP_ANDROID yup::MemoryInputStream is (yup::RiveFile_data, yup::RiveFile_size, false); auto artboardFile = yup::ArtboardFile::load (is, *factory); @@ -100,7 +99,7 @@ class ArtboardDemo : public yup::Component } } - void paint (Graphics& g) override + void paint (yup::Graphics& g) override { g.setFillColor (findColor (yup::DocumentWindow::Style::backgroundColorId).value_or (yup::Colors::dimgray)); g.fillAll(); @@ -111,5 +110,3 @@ class ArtboardDemo : public yup::Component int totalRows = 1; int totalColumns = 1; }; - -} // namespace yup diff --git a/examples/graphics/source/examples/Audio.h b/examples/graphics/source/examples/Audio.h index c79e6d7ca..34c60fbe9 100644 --- a/examples/graphics/source/examples/Audio.h +++ b/examples/graphics/source/examples/Audio.h @@ -158,7 +158,7 @@ class AudioExample , public yup::AudioIODeviceCallback { public: - AudioExample (const yup::Font& font) + AudioExample() : Component ("AudioExample") { // Initialize the audio device diff --git a/examples/graphics/source/examples/FileChooser.h b/examples/graphics/source/examples/FileChooser.h index e2e457a2b..76e8c1d31 100644 --- a/examples/graphics/source/examples/FileChooser.h +++ b/examples/graphics/source/examples/FileChooser.h @@ -21,6 +21,8 @@ #pragma once +//============================================================================== + class FileChooserDemo : public yup::Component { public: diff --git a/examples/graphics/source/examples/LayoutFonts.h b/examples/graphics/source/examples/LayoutFonts.h index 4cd9b8554..de7fcee74 100644 --- a/examples/graphics/source/examples/LayoutFonts.h +++ b/examples/graphics/source/examples/LayoutFonts.h @@ -26,9 +26,9 @@ class LayoutFontsExample : public yup::Component { public: - LayoutFontsExample (const yup::Font& font) + LayoutFontsExample() : Component ("LayoutFontsExample") - , font (font) + , font (yup::ApplicationTheme::getGlobalTheme()->getDefaultFont()) { } diff --git a/examples/graphics/source/examples/OpaqueDemo.h b/examples/graphics/source/examples/OpaqueDemo.h index f568c6ae5..e3a7927b3 100644 --- a/examples/graphics/source/examples/OpaqueDemo.h +++ b/examples/graphics/source/examples/OpaqueDemo.h @@ -19,26 +19,26 @@ ============================================================================== */ -namespace yup -{ +#pragma once //============================================================================== -class OpaqueDemo : public Component + +class OpaqueDemo : public yup::Component { public: OpaqueDemo() { - auto theme = ApplicationTheme::getGlobalTheme(); + auto theme = yup::ApplicationTheme::getGlobalTheme(); exampleFont = theme->getDefaultFont(); // Title label - titleLabel = std::make_unique