diff --git a/.github/actions/meson_build/action.yml b/.github/actions/meson_build/action.yml new file mode 100644 index 000000000000..4ee703464939 --- /dev/null +++ b/.github/actions/meson_build/action.yml @@ -0,0 +1,34 @@ +name: 'Build Godot' +description: 'Build Godot with the provided options' +inputs: + buildtype: + description: 'The meson buildtype (debug/debugoptimized/optimized/minsize)' + required: true + default: 'debugoptimized' + tools: + description: 'If tools are to be built' + required: true + default: true + platform: + description: 'The Godot platform to build. This is currently unused' + required: false + meson: + description: 'The meson binary to run (in case we need upstream/downstram patches to the build system).' + required: true + default: 'meson' + destination: + required: true + default: 'builddir' + mesonflags: + default: '' +runs: + using: "composite" + steps: + - name: Meson Configure + shell: bash + run: | + ${{ inputs.meson }} ${{ inputs.destination }} ${{ inputs.mesonflags }} -Dbuildtype=${{ inputs.buildtype }} -Dtools=${{ inputs.tools }} + - name: Meson compile + shell: bash + run: | + ${{ inputs.meson }} compile -C ${{ inputs.destination }} diff --git a/.github/actions/meson_install/action.yml b/.github/actions/meson_install/action.yml new file mode 100644 index 000000000000..7d770ce1ad16 --- /dev/null +++ b/.github/actions/meson_install/action.yml @@ -0,0 +1,30 @@ +name: 'Setup python meson ninja.' +description: 'Setup python installation, and install pip version of meson and ninja.' +inputs: + python-version: + description: 'The python version to use' + required: true + default: '3.x' + python-arch: + description: 'The python architecture' + required: true + default: 'x64' +runs: + using: "composite" + steps: + # Use python 3.x release (works cross platform) + - name: Set up Python 3.x + uses: actions/setup-python@v2 + with: + # Semantic version range syntax or exact version of a Python version + python-version: ${{ inputs.python-version }} + # Optional - x64 or x86 architecture, defaults to x64 + architecture: ${{ inputs.python-arch }} + - name: Setup meson and ninja + shell: bash + run: | + python -c "import sys; print(sys.version)" + python -m pip install meson ninja + python --version + meson --version + ninja --version diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml new file mode 100644 index 000000000000..95269a242a6d --- /dev/null +++ b/.github/workflows/meson.yml @@ -0,0 +1,200 @@ +name: 💠 Meson Builds +on: [push, pull_request] + +# Global Settings +env: + GODOT_BASE_BRANCH: master + MESONFLAGS: '' + EM_VERSION: 2.0.27 + EM_CACHE_FOLDER: 'emsdk-cache' + +concurrency: + group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-meson + cancel-in-progress: true + +jobs: + meson: + strategy: + fail-fast: false + matrix: + include: + - name: 🤖 Android (release, armv7a) + os: ubuntu-20.04 + platform: android + target: release + tools: false + mesonflags: '--cross-file cross/android.gen.txt' + arch: armv7a + + - name: 🤖 Android (release, armv64v8) + os: ubuntu-20.04 + platform: android + target: release + tools: false + mesonflags: '--cross-file cross/android.gen.txt' + arch: aarch64 + + - name: 🍏 iOS (release) + os: macos-latest + platform: iphone + target: release + tools: false + mesonflags: '--cross-file cross/iphone.txt' + + - name: 🌐 JavaScript (minsize) + os: ubuntu-20.04 + platform: javascript + target: minsize + tools: false + meson: './meson-upstream/' + mesonflags: '--cross-file cross/emscripten -Dbuiltin_pcre2_with_jit=false' + + - name: 🐧 Linux (debug, asan+ubsan, tests) + os: ubuntu-20.04 + platform: linuxbsd + target: debug + tools: true + tests: true + mesonflags: -Dtests=true -Duse_asan=true -Duse_ubsan=true + + - name: 🐧 Linux (release_debug, tests) + os: ubuntu-20.04 + platform: linuxbsd + target: debugoptimized + tools: true + tests: true + mesonflags: -Dtests=true + + - name: 🐧 Linux (release) + os: ubuntu-20.04 + platform: linuxbsd + target: release + tools: false + + - name: 🍎 macOS (release_debug, tests) + os: macos-latest + platform: osx + target: debugoptimized + tools: true + tests: true + mesonflags: -Dtests=true + + - name: 🍎 macOS (release) + os: macos-latest + platform: osx + target: debugoptimized + tools: false + + - name: 🏁 Windows (release_debug, tests) + os: windows-latest + platform: windows + target: debugoptimized + tools: true + tests: true + mesonflags: -Dtests=true + + - name: 🏁 Windows (release) + os: windows-latest + platform: windows + target: release + tools: false + + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Set up Java 8 + uses: actions/setup-java@v1 + if: ${{ matrix.platform == 'android' }} + with: + java-version: 8 + + - name: Setup python and meson + uses: ./.github/actions/meson_install + + - name: Generate meson cross compilation file (${{ matrix.arch }}). + if: ${{ matrix.platform == 'android' }} + run: | + python3 misc/scripts/make_android_cross.py "$ANDROID_NDK_ROOT" -m ${{ matrix.arch }} -o cross/android.gen.txt + + # Additional cache for Emscripten generated system libraries + - name: Load Emscripten cache + id: javascript-template-emscripten-cache + if: ${{ matrix.platform == 'javascript' }} + uses: actions/cache@v2 + with: + path: ${{env.EM_CACHE_FOLDER}} + key: ${{env.EM_VERSION}}-${{github.job}} + + - name: Set up Emscripten ${{env.EM_VERSION}} + if: ${{ matrix.platform == 'javascript' }} + uses: mymindstorm/setup-emsdk@v10 + with: + version: ${{env.EM_VERSION}} + actions-cache-folder: ${{env.EM_CACHE_FOLDER}} + + - name: Verify Emscripten setup + if: ${{ matrix.platform == 'javascript' }} + run: | + emcc -v + + # TODO remove once meson in pip is updated to master + - name: Download meson upstream branch (pip version does not support godot) + if: ${{ matrix.platform == 'javascript' }} + run: | + git clone https://github.com/mesonbuild/meson.git meson-upstream + cd meson-upstream + cp meson.py meson + + # Azure repositories are not reliable, we need to prevent azure giving us packages. + - name: Make apt sources.list use the default Ubuntu repositories + if: ${{ matrix.platform == 'linuxbsd' }} + run: | + sudo rm -f /etc/apt/sources.list.d/* + sudo cp -f misc/ci/sources.list /etc/apt/sources.list + sudo apt-get update + + # Install all packages (except scons) + - name: Configure dependencies + if: ${{ matrix.platform == 'linuxbsd' }} + run: | + sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \ + libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm \ + xvfb wget unzip + + - name: Setup MSVC. + if: ${{ matrix.platform == 'windows' }} + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: amd64 + + - name: Compilation (${{ matrix.platform }} ${{ matrix.arch }}) + if: ${{ matrix.platform != 'windows' }} + uses: ./.github/actions/meson_build + with: + mesonflags: ${{ env.MESONFLAGS }} ${{ matrix.mesonflags }} + buildtype: ${{ matrix.target }} + meson: ${{ matrix.meson }}meson + tools: ${{ matrix.tools }} + + # Differnt build for windows due to github/MSVC messing up shell vars. + - name: Meson configure (win) + if: ${{ matrix.platform == 'windows' }} + run: | + meson builddir ${{ env.MESONFLAGS }} ${{ matrix.mesonflags }} -Dbuildtype=${{ matrix.target }} -Dtools=${{ matrix.tools }} + + - name: Meson build (win) + if: ${{ matrix.platform == 'windows' }} + run: | + meson compile -C builddir + + # Execute unit tests for the editor + - name: Unit Tests + if: ${{ matrix.tests && matrix.platform == 'linuxbsd' }} + run: | + ./builddir/godot --headless --test + + #- name: Upload Artifact + # uses: ./.github/actions/upload-artifact diff --git a/core/config/meson.build b/core/config/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/config/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/core_builders.py b/core/core_builders.py old mode 100644 new mode 100755 index 004475faa701..51f5f1f5d8e1 --- a/core/core_builders.py +++ b/core/core_builders.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + """Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/core/crypto/meson.build b/core/crypto/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/crypto/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/debugger/meson.build b/core/debugger/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/debugger/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/error/meson.build b/core/error/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/error/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/extension/meson.build b/core/extension/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/extension/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/input/input_builders.py b/core/input/input_builders.py old mode 100644 new mode 100755 index 748ec0613307..1c9b88138547 --- a/core/input/input_builders.py +++ b/core/input/input_builders.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + """Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/core/input/meson.build b/core/input/meson.build new file mode 100644 index 000000000000..ea64be6e96eb --- /dev/null +++ b/core/input/meson.build @@ -0,0 +1,13 @@ +# generated input mappings +_default_controller_mappings_target = custom_target( + 'default_controller_mappings', + output: ['default_controller_mappings.gen.cpp'], + input: ['gamecontrollerdb.txt', 'godotcontrollerdb.txt'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_default_controller_mappings', SCRIPT_INPUT_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true +) + +SOURCES += [_default_controller_mappings_target] + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/io/meson.build b/core/io/meson.build new file mode 100644 index 000000000000..eda4921317b6 --- /dev/null +++ b/core/io/meson.build @@ -0,0 +1,16 @@ +# generated certs + +_certs_target = custom_target( + 'certs', + output: ['certs_compressed.gen.h'], + input: [meson.project_source_root() + '/thirdparty/certs/ca-certificates.crt'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_certs_header', SCRIPT_CORE_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@', '-e', + 'builtin_certs=' + (get_option('builtin_certs') ? 'true' : 'false'), + 'system_certs_path=' + get_option('system_certs_path')], + build_by_default: true +) + +SOURCES += [_certs_target] + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/math/meson.build b/core/math/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/math/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/meson.build b/core/meson.build new file mode 100644 index 000000000000..55130e2af363 --- /dev/null +++ b/core/meson.build @@ -0,0 +1,127 @@ +DEPENDENCIES += [DEP_MBEDTLS, DEP_ZLIB, DEP_ZSTD, DEP_MINIZIP, DEP_MISC] + +################################################################################ +# MISC LIB FOR CORE - BEGIN +################################################################################ + +# random misc sources, we are going to build these as a small static lib +_core_misc_srcs = files([ + # c sources + '../thirdparty/misc/fastlz.c', + '../thirdparty/misc/r128.c', + '../thirdparty/misc/smaz.c', + # cpp sources + '../thirdparty/misc/pcg.cpp', + '../thirdparty/misc/polypartition.cpp', + '../thirdparty/misc/clipper.cpp', + '../thirdparty/misc/smolv.cpp', +]) + +_core_misc_c_args = [] +_core_misc_cpp_args = [] + +if meson.get_compiler('c').get_id() == 'msvc' + _core_misc_c_args += '/wd4090' +elif meson.get_compiler('c').get_id() == 'gcc' + _core_misc_c_args += [ + '-Wno-discarded-qualifiers', + '-Wno-incompatible-pointer-types', + ] +endif + +if meson.get_compiler('cpp').get_id() == 'msvc' + _core_misc_cpp_args += '/wd4003' +endif + +_lib_core_misc = static_library('builtin_core_misc', _core_misc_srcs, c_args: _core_misc_c_args, cpp_args: _core_misc_cpp_args, include_directories: INCDIRS) + +################################################################################ +# MISC LIB FOR CORE - END +################################################################################ + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +# generated version file +version_arr = meson.project_version().split('.') +version_cdata = configuration_data() +version_cdata.set_quoted('VERSION_SHORT_NAME', 'Godot') +version_cdata.set_quoted('VERSION_NAME', 'Godot Engine') +version_cdata.set('VERSION_MAJOR', version_arr[0]) +version_cdata.set('VERSION_MINOR', version_arr[1]) +version_cdata.set('VERSION_PATCH', version_arr[2]) +version_cdata.set_quoted('VERSION_STATUS', 'dev') +version_cdata.set_quoted('VERSION_BUILD', 'custom_build') +version_cdata.set_quoted('VERSION_MODULE_CONFIG', '') +version_cdata.set('VERSION_YEAR', 2020) +version_cdata.set_quoted('VERSION_WEBSITE', 'https://godotengine.org') +configure_file(output: 'version_generated.gen.h', + configuration: version_cdata) +version_hash_data = configuration_data() +version_hash_data.set_quoted('VERSION_HASH', '') +configure_file(output: 'version_hash.gen.h', + configuration: version_hash_data) + +# generated input mappings +_encryption_key_target = custom_target( + 'encryption_key', + output: ['script_encryption_key.gen.cpp'], + command: [SCRIPT_ENCRYPTION_KEY, '@OUTPUT@'], + env: SCRIPTS_ENV, + build_by_default: true +) +SOURCES += [_encryption_key_target] + +# generated authors file +_authors_target = custom_target( + 'authors', + output: ['authors.gen.h'], + input: ['../AUTHORS.md'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_authors_header', SCRIPT_CORE_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true +) +SOURCES += [_authors_target] + +# generated donors file +_donors_target = custom_target( + 'donors', + output: ['donors.gen.h'], + input: ['../DONORS.md'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_donors_header', SCRIPT_CORE_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true +) +SOURCES += [_donors_target] + +# generated license file +_license_target = custom_target( + 'license', + output: ['license.gen.h'], + input: ['../COPYRIGHT.txt', '../LICENSE.txt'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_license_header', SCRIPT_CORE_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true +) +SOURCES += [_license_target] + +# Do any subdir's here (for any custom target they might have...) +subdir('config') +subdir('crypto') +subdir('debugger') +subdir('error') +subdir('extension') +subdir('input') +subdir('io') +subdir('multiplayer') +subdir('math') +subdir('object') +subdir('os') +subdir('string') +subdir('templates') +subdir('variant') + +cdata = configuration_data() +configure_file(output: 'disabled_classes.gen.h', + configuration: cdata) + DEP_CORE_MISC = declare_dependency(link_with: _lib_core_misc) + DEPENDENCIES += [DEP_CORE_MISC] diff --git a/core/multiplayer/meson.build b/core/multiplayer/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/multiplayer/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/object/make_virtuals.py b/core/object/make_virtuals.py old mode 100644 new mode 100755 index 86c2891e5dbd..0b2927d5e087 --- a/core/object/make_virtuals.py +++ b/core/object/make_virtuals.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + proto = """ #define GDVIRTUAL$VER($RET m_name $ARG) \\ StringName _gdvirtual_##m_name##_sn = #m_name;\\ diff --git a/core/object/meson.build b/core/object/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/object/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/os/meson.build b/core/os/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/os/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/string/meson.build b/core/string/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/string/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/templates/meson.build b/core/templates/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/templates/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/core/variant/meson.build b/core/variant/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/core/variant/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/cross/android-base b/cross/android-base new file mode 100644 index 000000000000..649b77753f98 --- /dev/null +++ b/cross/android-base @@ -0,0 +1,32 @@ +[constants] +sdk = '@NDK_PATH@' +host_os = '@HOST_OS@' +host_arch = '@HOST_ARCH@' +arch = '@ANDROID_ARCH@' +android_abi_name = '@ANDROID_ABI_NAME@' +android_abi = '@ANDROID_ABI@' +android_tools_prefix = '@ANDROID_AR_PREFIX@' + +toolchain = sdk / 'toolchains' / 'llvm' / 'prebuilt' / host_os + '-' + host_arch / 'bin' +tools_triple = android_tools_prefix + '-' + host_os + '-' + android_abi_name +compiler_triple = arch + '-' + host_os + '-' + android_abi_name + android_abi + +[binaries] +c = toolchain / compiler_triple + '-clang' +cpp = toolchain / compiler_triple + '-clang++' +ar = toolchain / tools_triple + '-ar' +strip = toolchain / tools_triple + '-strip' + +[built-in options] +c_args = [] +cpp_args = [] +c_link_args = [] +cpp_link_args = [] + +[properties] + +[host_machine] +system = 'android' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little' diff --git a/cross/emscripten b/cross/emscripten new file mode 100644 index 000000000000..c838497d8ba0 --- /dev/null +++ b/cross/emscripten @@ -0,0 +1,25 @@ +[binaries] +c = 'emcc' +cpp = 'em++' +objc = 'emcc' +ar = 'emar' + +[built-in options] +c_args = ['-s', 'USE_PTHREADS=1'] +c_link_args = ['-s', 'USE_PTHREADS=1', '-s', 'PTHREAD_POOL_SIZE=8', '-s', 'WASM_MEM_MAX=2048MB'] +cpp_args = ['-s', 'USE_PTHREADS=1'] +cpp_link_args = ['-s', 'USE_PTHREADS=1', '-s', 'PTHREAD_POOL_SIZE=8', '-s', 'WASM_MEM_MAX=2048MB'] + +[properties] +platform = 'javascript' +object_suffix = 'bc' +static_lib_suffix = 'a' +shared_lib_suffix = 'wasm' +shared_module_suffix = 'js' +exe_suffix = 'js' + +[host_machine] +system = 'emscripten' +cpu_family = 'wasm32' +cpu = 'wasm32' +endian = 'little' diff --git a/cross/iphone.txt b/cross/iphone.txt new file mode 100644 index 000000000000..83dbf687e66b --- /dev/null +++ b/cross/iphone.txt @@ -0,0 +1,24 @@ +[binaries] +c = 'clang' +cpp = 'clang++' +objc = 'clang' +objcpp = 'clang++' +ar = 'ar' +strip = 'strip' + +[built-in options] +c_args = ['-arch', 'arm64', '-miphoneos-version-min=11.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +cpp_args = ['-arch', 'arm64', '-miphoneos-version-min=11.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +c_link_args = ['-arch', 'arm64', '-miphoneos-version-min=11.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +cpp_link_args = ['-arch', 'arm64', '-miphoneos-version-min=11.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +objc_args = ['-arch', 'arm64', '-miphoneos-version-min=11.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +objcpp_args = ['-arch', 'arm64', '-miphoneos-version-min=11.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] + +[properties] + +[host_machine] +system = 'darwin' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little' + diff --git a/cross/linux-mingw-win64 b/cross/linux-mingw-win64 new file mode 100644 index 000000000000..a38d42f40156 --- /dev/null +++ b/cross/linux-mingw-win64 @@ -0,0 +1,23 @@ +[binaries] +c = '/usr/bin/x86_64-w64-mingw32-gcc-posix' +cpp = '/usr/bin/x86_64-w64-mingw32-g++-posix' +objc = '/usr/bin/x86_64-w64-mingw32-gcc-posix' +ar = '/usr/bin/x86_64-w64-mingw32-ar' +strip = '/usr/bin/x86_64-w64-mingw32-strip' +pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' +windres = '/usr/bin/x86_64-w64-mingw32-windres' +#exe_wrapper = 'wine64' +#cmake = '/usr/bin/cmake' + +[properties] +platform = 'windows' +# Directory that contains 'bin', 'lib', etc +root = '/usr/x86_64-w64-mingw32' +# Directory that contains 'bin', 'lib', etc for the toolchain and system libraries +sys_root = '/usr/x86_64-w64-mingw32/sys-root/mingw' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' diff --git a/drivers/alsa/meson.build b/drivers/alsa/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/drivers/alsa/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/alsamidi/meson.build b/drivers/alsamidi/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/drivers/alsamidi/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/coreaudio/meson.build b/drivers/coreaudio/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/drivers/coreaudio/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/coremidi/meson.build b/drivers/coremidi/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/drivers/coremidi/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/meson.build b/drivers/meson.build new file mode 100644 index 000000000000..e92fda4b79ce --- /dev/null +++ b/drivers/meson.build @@ -0,0 +1,33 @@ +# OS Drivers + +subdir('windows') +subdir('unix') + + +# Sound Drivers +subdir('alsa') +subdir('coreaudio') +subdir('pulseaudio') + +if PLATFORM == 'windows' + subdir('wasapi') +endif + +if get_option('xaudio2') + subdir('xaudio2') +endif + +# MIDI Drivers +subdir('alsamidi') +subdir('coremidi') +subdir('winmidi') # NOE: should this be PLATFORM guarded? + +# Graphics Drivers +if PLATFORM != 'server' and PLATFORM != 'javascript' + subdir('vulkan') +endif + +# Core dependencies +subdir('png') + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/png/meson.build b/drivers/png/meson.build new file mode 100644 index 000000000000..370560b1ca63 --- /dev/null +++ b/drivers/png/meson.build @@ -0,0 +1,2 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) +DEPENDENCIES += [DEP_LIBPNG] diff --git a/drivers/pulseaudio/meson.build b/drivers/pulseaudio/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/drivers/pulseaudio/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/unix/meson.build b/drivers/unix/meson.build new file mode 100644 index 000000000000..f231c731fd79 --- /dev/null +++ b/drivers/unix/meson.build @@ -0,0 +1,5 @@ +if meson.get_compiler('cpp').has_header('mntent.h') + CPP_ARGS += ['-DHAVE_MNTENT'] +endif + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/vulkan/meson.build b/drivers/vulkan/meson.build new file mode 100644 index 000000000000..1d0d629a94d4 --- /dev/null +++ b/drivers/vulkan/meson.build @@ -0,0 +1,15 @@ +DEPENDENCIES += [DEP_VULKAN, DEP_SPIRV_REFLECT] + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + files('../../thirdparty/volk/volk.c') + +if PLATFORM == 'android' + CPP_ARGS += '-DVK_USE_PLATFORM_ANDROID_KHR' +elif PLATFORM == 'iphone' + CPP_ARGS += '-DVK_USE_PLATFORM_IOS_MVK' +elif PLATFORM == 'linuxbsd' + CPP_ARGS += '-DVK_USE_PLATFORM_XLIB_KHR' +elif PLATFORM == 'osx' + CPP_ARGS += '-DVK_USE_PLATFORM_MACOS_MVK' +elif PLATFORM == 'windows' + CPP_ARGS += '-DVK_USE_PLATFORM_WIN32_KHR' +endif diff --git a/drivers/wasapi/meson.build b/drivers/wasapi/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/drivers/wasapi/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/windows/meson.build b/drivers/windows/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/drivers/windows/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/winmidi/meson.build b/drivers/winmidi/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/drivers/winmidi/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/drivers/xaudio2/meson.build b/drivers/xaudio2/meson.build new file mode 100644 index 000000000000..f2ffc5ec634b --- /dev/null +++ b/drivers/xaudio2/meson.build @@ -0,0 +1,9 @@ +# This entire driver confuses me... + +CPP_FLAGS += ['-DXAUDIO2_ENABLED'] + +_lib_xaudio2 = meson.get_compiler('cpp').find_library('xaudio2') + +DEPENDENCIES += [_lib_xaudio2] + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/editor/debugger/debug_adapter/meson.build b/editor/debugger/debug_adapter/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/editor/debugger/debug_adapter/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/editor/debugger/meson.build b/editor/debugger/meson.build new file mode 100644 index 000000000000..352f742e93fe --- /dev/null +++ b/editor/debugger/meson.build @@ -0,0 +1,2 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) +subdir('debug_adapter') diff --git a/editor/editor_builders.py b/editor/editor_builders.py old mode 100644 new mode 100755 index ff0daa86ffac..c4faf6948a45 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + """Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/editor/fileserver/meson.build b/editor/fileserver/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/editor/fileserver/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/editor/icons/editor_icons_builders.py b/editor/icons/editor_icons_builders.py old mode 100644 new mode 100755 index d7145abe5001..06acbfdc4beb --- a/editor/icons/editor_icons_builders.py +++ b/editor/icons/editor_icons_builders.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + """Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/editor/import/meson.build b/editor/import/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/editor/import/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/editor/meson.build b/editor/meson.build new file mode 100644 index 000000000000..af0404fcdba1 --- /dev/null +++ b/editor/meson.build @@ -0,0 +1,125 @@ +if get_option('tools') + + # NOTE: do not use files() here + _exporter_list = [ + 'android', + 'iphone', + 'javascript', + 'linuxbsd', + 'osx', + 'uwp', + 'windows' + ] + + _exporter_target = custom_target( + 'register_exporters', + output: ['register_exporters.gen.cpp'], + command: [SCRIPT_REGISTER_EXPORTERS, _exporter_list, '@OUTPUT@'], + build_by_default: true + ) + SOURCES += [_exporter_target] + + # need to built the sources + SOURCES += files(run_command(GLOB, '../platform/*/export/*.cpp').stdout().split('\n')) + ################################################################################ + # Doc generation + ################################################################################ + + # Currently, this will only build once. If you need to regenerate the doc files, + # either delete the generated doc files, or reconfigure. + # This is because we glob the files in the directories. + + # We can fix this by having doc_tool output a class_list.xml file (or the like) + # that we can depend on, and auto detect doc changes and rebuild the docs. + + # generated version file + + # TODO But we can do better, need some py scripts refactoring. + #_docs_target_srcs = [] + #foreach mp : MODULE_BUILD_PATHS + # _tmp_module_docs = run_command(GLOB, meson.project_source_root() / mp / 'doc_classes' / '*.xml').stdout() + # # If GLOB returns empty meson fails -.- . + # if _tmp_module_docs != '' + # _docs_target_srcs += files(_tmp_module_docs.split('\n')) + # endif + #endforeach + + #_other_docs_target = custom_target( + # 'other-docs', + # input: _docs_target_srcs, + # output: 'other_doc_data_compressed.gen.h', + # env: SCRIPTS_ENV, + # command: [SCRIPT_COMPAT, 'make_doc_header', SCRIPT_EDITOR_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'] + #) + #SOURCES += [_other_docs_target] + + _docs_target = custom_target( + 'docs', + output: ['doc_data_class_path.gen.h', 'doc_data_compressed.gen.h'], + input: [MODULES_DB_FILE], + command: [SCRIPT_DOCS, '@INPUT@', meson.project_source_root(), '@OUTPUT@'], + build_by_default: true + ) + SOURCES += [_docs_target] + + + # Translations also will run once + + _doc_translations_target_srcs = files(run_command(GLOB, meson.project_source_root() / 'doc/translations/*.po').stdout().split('\n')) + _doc_translations_target = custom_target( + 'doc_translations', + input: _doc_translations_target_srcs, + output: ['doc_translations.gen.h'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_doc_translations_header', SCRIPT_EDITOR_BUILDERS, '-i','@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true + ) + SOURCES += [_doc_translations_target] + + _editor_translations_target_srcs = files(run_command(GLOB, 'translations/*.po').stdout().split('\n')) + _editor_translations_target = custom_target( + 'editor_translations', + input: _editor_translations_target_srcs, + output: ['editor_translations.gen.h'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_editor_translations_header', SCRIPT_EDITOR_BUILDERS, '-i','@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true + ) + SOURCES += [_editor_translations_target] + + # ...and so will fonts + + _fonts_target_srcs = files(run_command(GLOB, meson.project_source_root() / 'thirdparty/fonts/*.ttf').stdout().split('\n')) + builtin_fonts_gen = custom_target( + 'fonts', + input: _fonts_target_srcs, + output: ['builtin_fonts.gen.h'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_fonts_header', SCRIPT_EDITOR_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true + ) + SOURCES += [builtin_fonts_gen] + MAIN_SOURCES += [builtin_fonts_gen] + + # ...aaaaaaaaaaaaaaand editor icons + _editor_icons_srcs = files(run_command(GLOB, 'icons/*.svg').stdout().split('\n')) + _editor_icons_target = custom_target( + 'editor_icons', + input: _editor_icons_srcs, + output: ['editor_icons.gen.h'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_editor_icons_action', SCRIPT_EDITOR_ICON_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true + ) + SOURCES += [_editor_icons_target] + + + # Add our sources + SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + + subdir('debugger') + subdir('fileserver') + subdir('import') + subdir('plugins') + +endif diff --git a/editor/plugins/meson.build b/editor/plugins/meson.build new file mode 100644 index 000000000000..7b30e0d331e0 --- /dev/null +++ b/editor/plugins/meson.build @@ -0,0 +1,2 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) +subdir('tiles') diff --git a/editor/plugins/tiles/meson.build b/editor/plugins/tiles/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/editor/plugins/tiles/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/glsl_builders.py b/glsl_builders.py old mode 100644 new mode 100755 index 57aaed5f9fd4..d70377208551 --- a/glsl_builders.py +++ b/glsl_builders.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + """Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/main/main_builders.py b/main/main_builders.py old mode 100644 new mode 100755 index c880bfa3c439..46d4075bc21f --- a/main/main_builders.py +++ b/main/main_builders.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + """Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/main/meson.build b/main/meson.build new file mode 100644 index 000000000000..af45d64d16ce --- /dev/null +++ b/main/meson.build @@ -0,0 +1 @@ +MAIN_SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/meson.build b/meson.build new file mode 100644 index 000000000000..8c5974e824e7 --- /dev/null +++ b/meson.build @@ -0,0 +1,386 @@ +project( + 'godot', + ['cpp', 'c'], + version: '4.0.0', + license: 'MIT', + meson_version: '>= 0.57', + default_options: [ + 'c_std=c11', + 'cpp_std=c++17', + 'warning_level=0', + 'default_library=static', + 'b_vscrt=md' + ] +) + +GLOB = find_program('scripts/sourceglobber.py') + +cc = meson.get_compiler('c') +cpp = meson.get_compiler('cpp') + +if host_machine.system() == 'darwin' + add_languages('objc', 'objcpp') +endif + +# The list of modules that will not be included in the build + +################################################################################ +# Determine Platform +################################################################################ + +# First, let us determine what platform we are from a cross or native file +# if it has been specified. Otherwise, fallback to the host machine. +PLATFORM = meson.get_external_property('platform', 'none') +if PLATFORM == 'none' + PLATFORM = 'linuxbsd' + if host_machine.system() == 'windows' + PLATFORM = 'windows' + elif host_machine.system() == 'darwin' + # Not strictly speaking true, but will work for now. + PLATFORM = meson.is_cross_build() ? 'iphone' : 'osx' + elif host_machine.system() == 'android' + PLATFORM = 'android' + endif +endif + +################################################################################ +# Check Options +################################################################################ + +# TODO - temporary way to do proper debug without /ZI on msvc (there is a PR for removing ZI already in meson) +IS_DEBUG_BUILD = get_option('debug') + + +# This is one of the very few, if only, times we will add defines to the entire project +# WINVER is required for quite a few thirdparty libs when building, especially when using mingw +if PLATFORM == 'windows' + add_project_arguments( + '-DWINVER=' + get_option('windows_version'), + '-D_WIN32_WINNT=' + get_option('windows_version'), + language: ['c', 'cpp'] + ) +endif +if cc.get_id() == 'msvc' + add_project_arguments('/utf-8', language: ['c', 'cpp']) +endif + +if get_option('tools') and not IS_DEBUG_BUILD # get_option('debug') - TODO change when ZI issue fixed + error('tools can only be built with debug symbols') +endif + +if get_option('disable_3d') and get_option('tools') + error('disable_3d can only be enabled when tools are disabled') +endif + +if get_option('disable_advanced_gui') and get_option('tools') + error('disable_advanced_gui can only be enabled when tools are disabled') +endif + +if get_option('builtin_freetype') or get_option('builtin_libpng') or get_option('builtin_zlib') + if not get_option('builtin_freetype') or not get_option('builtin_libpng') or not get_option('builtin_zlib') + error('builtin_freetype, builtin_libpng, and builtin_zlib must all be on if one is on.') + endif +endif + +if not get_option('builtin_libtheora') + # Needed to link against system libtheora + if get_option('builtin_libogg') + error('When builtin_libtheora is off, builtin_libogg must be off.') + endif + if get_option('builtin_libvorbis') + error('When builtin_libtheora is off, builtin_libvorbis must be off.') + endif +endif + +################################################################################ +# Load Scripts +################################################################################ + +MESON_SOURCE_ROOT = meson.current_source_dir() +MESON_BUILD_ROOT = meson.current_build_dir() +SCRIPTS_ENV = ['MESON_SOURCE_ROOT=' + MESON_SOURCE_ROOT, 'MESON_BUILD_ROOT=' + MESON_BUILD_ROOT] +subdir('scripts') + +################################################################################ +# Figure out what modules we are building +################################################################################ + +MODULE_SEARCH_PATHS = ['modules/'] + get_option('module_search_paths') +MODULES_DB_FILE = meson.project_build_root() / 'modules_db.json' + +# Create the modules_db file +_module_script_args = [ + 'create_db', MODULES_DB_FILE, + '--platform', PLATFORM, + '--cpu_family', host_machine.cpu_family() +] + +if get_option('tools') + _module_script_args += '--tools_enabled' +endif + +foreach msp : MODULE_SEARCH_PATHS + _module_script_args += ['--module_search_path', msp] +endforeach + +foreach dm : get_option('disabled_modules') + _module_script_args += ['--module_disabled', dm] +endforeach + +if get_option('disable_all_modules') + _module_script_args += ['--disable_all_modules'] +endif + +_module_output = run_command(SCRIPT_MODULE_DB, _module_script_args) +if _module_output.returncode() != 0 or _module_output.stderr() != '' + error(_module_output.stderr()) +endif + +# Get the list of enabled modules +_module_enabled_output = run_command(SCRIPT_MODULE_DB, ['get_enabled_modules', MODULES_DB_FILE]) +if _module_enabled_output.returncode() != 0 + error(_module_enabled_output.stderr()) +endif + +MODULES_ENABLED = _module_enabled_output.stdout().strip().split(',') + + +# Get the list of disabled modules +_module_disabled_output = run_command(SCRIPT_MODULE_DB, ['get_disabled_modules', MODULES_DB_FILE]) +if _module_disabled_output.returncode() != 0 + error(_module_disabled_output.stderr()) +endif + +MODULES_DISABLED = _module_disabled_output.stdout().strip().split(',') + +_module_get_build_paths = run_command(SCRIPT_MODULE_DB, ['get_module_build_paths', MODULES_DB_FILE]) +MODULE_BUILD_PATHS = _module_get_build_paths.stdout().strip().split(',') + +#_module_list = run_command(SCRIPT_MODULE_DB, ['print_modules', MODULES_DB_FILE]) +#message(_module_list.stdout()) + +################################################################################ +# COMPILER FLAGS - DEFINED BEFORE ANY TARGETS +################################################################################ + + +# MSVC specific compiler settings +_cpp_compiler_id = cpp.get_id() +_cpp_argsyntax = cpp.get_argument_syntax() + +CPP_ARGS = [] +OBJCPP_ARGS = [] +LINK_ARGS = [] + +# do we want to show our #warnings ? +if not get_option('godot_warnings') + if _cpp_compiler_id == 'gcc' + CPP_ARGS += '-Wno-cpp' + endif +endif + +if _cpp_compiler_id == 'msvc' + msvc_nonessential_warnings = [ + '/wd4267', + '/wd4244', + '/wd4305', + '/wd4018', + '/wd4800', + ] + + CPP_ARGS += msvc_nonessential_warnings + + # disable the Windows SDK #define expansion, caused in the newest SDK + # Microsoft defect + add_project_arguments('/wd5105', language: ['c', 'cpp']) +endif + +if _cpp_compiler_id == 'clang' or _cpp_compiler_id == 'clang-cl' + CPP_ARGS += ['-Wdeprecated-declarations'] +endif + + +if IS_DEBUG_BUILD # TODO # get_option(debug) # using IS_DEBUG_BUILD to create a fast debug build under MSVC without ZI + CPP_ARGS += [ + '-DDEBUG_ENABLED', + #'-DDEBUG_MEMORY_ALLOC', # This is unused anywhere... + '-DDISABLE_FORCED_INLINE', + ] + + # only, only, only add this in if its not msvc. you will break msvc's linking if you set this manually + # add this in at the PROJECT LEVEL. We have to pass this through to our thirdparties + if _cpp_compiler_id != 'msvc' + add_project_arguments('-D_DEBUG', language: ['c', 'cpp']) + endif + # DEBUG is only used by thirdparties, and most use it in conjuction with _DEBUG. + # If it does need to be added, it has to be added as a project argument + # CPP_ARGS += '-DDEBUG' + +else + # NDEBUG is only used by thirdparties. Im going to not add it in. + # If it does need to be added, it has to be added as a project argument + # CPP_ARGS += '-DNDEBUG' +endif + +if get_option('no_editor_splash') + CPP_ARGS += '-DNO_EDITOR_SPLASH' +endif + +if get_option('use_precise_math_checks') + CPP_ARGS += '-DPRECISE_MATH_CHECKS' +endif + +if not get_option('deprecated') + CPP_ARGS += '-DDISABLE_DEPRECATED' +endif + +if get_option('tools') + CPP_ARGS += '-DTOOLS_ENABLED' + + if get_option('disable_3d') + CPP_ARGS += '-D_3D_DISABLED' + endif + + if get_option('disable_advanced_gui') + CPP_ARGS += '-DADVANCED_GUI_DISABLED' + endif + + if 'minizip' in MODULES_ENABLED + CPP_ARGS += '-DMINIZIP_ENABLED' + endif +endif + +if get_option('tests') + CPP_ARGS += '-DTESTS_ENABLED' +endif + +################################################################################ +# Custom optimization/debug params +################################################################################ +if _cpp_argsyntax == 'msvc' + + if get_option('optimization') not in ['0', 'g'] + LINK_ARGS += '/OPT:REF' + endif + + # TODO: this was only added on release, adding it here everywhere because + # this should not change based off of buildtype. + # However, the question is whether or not we should have this at all. + LINK_ARGS += '/ENTRY:mainCRTStartup' + + # Following flags always added + CPP_ARGS += [ + # '/Gd', # TODO: Gd and Gr are incompatible, no idea why both are passed. Seems like the warning was being hidden. + #'/Gr', # Not needed /Gr is the default. + # '/TP', # not needed since all thirdparties handle their c sources propery now + ] +endif + +# global constants +# To match other platforms +STACK_SIZE = 8388608 + +################################################################################ +# FINALLY - GET OUR SOURCES +################################################################################ + +DIR_PLATFORM = 'platform' / PLATFORM + +MAIN_SOURCES = [] + +INCDIRS = include_directories('.', 'thirdparty', DIR_PLATFORM) +SOURCES = [] +HEADERS = [] +DEPENDENCIES = [] + +# generator first +subdir('splash') + +gdivirtuals_gen = custom_target('gdivirtuals.gen', + output: 'gdvirtual.gen.inc', + command: [SCRIPT_COMPAT, 'run', SCRIPT_VIRTUALS, '-o', '@OUTPUT@', '-t', 'core/object'], + build_by_default: true, + env: SCRIPTS_ENV +) +SOURCES += gdivirtuals_gen + +_modules_enabled_gen = custom_target( + 'modules_enabled', + output: ['modules_enabled.gen.h'], + input: [MODULES_DB_FILE], + command: [SCRIPT_MODULES_GEN, 'modules_enabled', '@INPUT@', MESON_BUILD_ROOT, '@OUTPUT@'], + build_by_default: true, + env: SCRIPTS_ENV +) +SOURCES += [_modules_enabled_gen] + +_modules_tests_gen = custom_target( + 'modules_tests', + output: ['modules_tests.gen.h'], + input: [MODULES_DB_FILE], + command: [SCRIPT_MODULES_GEN, 'modules_tests', '@INPUT@', MESON_BUILD_ROOT, MESON_SOURCE_ROOT, '@OUTPUT@'], + build_by_default: true, + env: SCRIPTS_ENV +) +SOURCES += [_modules_tests_gen] + +# then thirdparty +subdir('thirdparty') + +# generate the module include files +subdir('modules') + +# get all of godot except main +subdir('platform') +subdir('core') +subdir('scene') +subdir('drivers') +subdir('servers') +subdir('editor') + +_godot_all = library('godot_all', + SOURCES + HEADERS, + include_directories: INCDIRS, + dependencies: DEPENDENCIES, + cpp_args: CPP_ARGS, + objcpp_args: OBJCPP_ARGS, + link_args: LINK_ARGS) + +DEP_GODOT_ALL = declare_dependency(link_with: _godot_all, include_directories: INCDIRS, compile_args: CPP_ARGS, link_args: LINK_ARGS) + +# Tests if needed +if get_option('tests') + subdir('tests') +endif + +# build up our module list +MODULE_DEPENDENCIES = [] +foreach mp : MODULE_BUILD_PATHS + subdir(mp) +endforeach + +# finally, get the sources for main separately +subdir('main') + +# assemble our exe +if PLATFORM == 'android' + EXEC_GODOT = shared_library('godot', MAIN_SOURCES, + dependencies: [DEP_GODOT_ALL, + MODULE_DEPENDENCIES, + DEPENDENCIES, + ANDROID_NDK_DEPS] + ) +elif PLATFORM == 'iphone' or PLATFORM == 'tvos' + EXEC_GODOT = static_library('godot', MAIN_SOURCES, + dependencies: [DEP_GODOT_ALL, MODULE_DEPENDENCIES, DEPENDENCIES] + ) +else + EXEC_GODOT = executable('godot', MAIN_SOURCES, + dependencies: [DEP_GODOT_ALL, MODULE_DEPENDENCIES, DEPENDENCIES], + win_subsystem: get_option('windows_subsystem') + ) +endif + +# Output some final messages to the users +message('Modules Enabled: ' + ', '.join(MODULES_ENABLED)) +message('Modules Disabled: ' + ', '.join(MODULES_DISABLED)) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000000..b5585ba80685 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,74 @@ +option('tools', type: 'boolean', value: true, description: 'Build the tools (a.k.a. the Godot editor)') +option('tests', type: 'boolean', value: false, description: 'Build the unit tests') + +# Compile options +option('godot_warnings', type: 'boolean', value: false, description: 'Enable godot-compile time warnings (#warning, #pragma warning)') + +# Components +option('deprecated', type: 'boolean', value: true, description: 'Enable deprecated features') +option('minizip', type: 'boolean', value: true, description: 'Enable ZIP archive support using minizip') +option('xaudio2', type: 'boolean', value: false, description: 'Enable the XAudio2 audio driver') +option('android_neon', type: 'boolean', value: true, description: 'Enable NEON support (armv7 only)') +option('custom_modules', type: 'array', value: [], description: 'A list of comma-separated directory paths containing custom modules to build') +# add text_server_fb to disabled modules +option('disabled_modules', type: 'array', value: ['mono'], description: 'A list of modules that are to be disabled') +option('disable_all_modules', type: 'boolean', value: false, description: 'A boolean that disables ALL modules.') + +# Advanced options +option('use_precise_math_checks', type: 'boolean', value: false, description: 'Math checks use very precise epsilon (debug option)') +option('disable_3d', type: 'boolean', value: false, description: 'Disable 3D nodes for a smaller executable') +option('disable_advanced_gui', type: 'boolean', value: false, description: 'Disabled advanced GUI nodes and behaviors') +option('no_editor_splash', type: 'boolean', value: false, description: 'Don\'t use the custom spash screen for the editor') +option('system_certs_path', type: 'string', value: '', description: 'Use this path as SSL certificates default for editor (for package maintainers)') +option('module_search_paths', type: 'array', value: [], description: 'List of additional subdirectories scan for modules.') + +# Windows options +option('windows_version', type: 'string', value: '0x0601', description: 'Targeted Windows version, >= 0x0601 (Windows 7)') +option('windows_subsystem', type: 'combo', value: 'console', choices: ['console', 'windows'], description: 'Windows subsystem') + +# Thirdparty libraries +option('builtin_bullet', type: 'boolean', value: true, description: 'Use the built-in Bullet library') +option('builtin_certs', type: 'boolean', value: true, description: 'Use the built-in SSL certificates bundles') +option('builtin_enet', type: 'boolean', value: true, description: 'Use the built-in ENet library') +option('builtin_freetype', type: 'boolean', value: true, description: 'Use the built-in FreeType librar') +option('builtin_glslang', type: 'boolean', value: true, description: 'Use the built-in glslang library') +option('builtin_libogg', type: 'boolean', value: true, description: 'Use the built-in libogg library') +option('builtin_libpng', type: 'boolean', value: true, description: 'Use the built-in libpng library') +option('builtin_libtheora', type: 'boolean', value: true, description: 'Use the built-in libtheora library') +option('builtin_libvorbis', type: 'boolean', value: true, description: 'Use the built-in libvorbis library') +option('builtin_libwebp', type: 'boolean', value: true, description: 'Use the built-in libwebp library') +option('builtin_wslay', type: 'boolean', value: true, description: 'Use the built-in wslay library') +option('builtin_mbedtls', type: 'boolean', value: true, description: 'Use the built-in mbedTLS library') +option('builtin_miniupnpc', type: 'boolean', value: true, description: 'Use the built-in miniupnpc library') +option('builtin_opus', type: 'boolean', value: true, description: 'Use the built-in Opus library') +option('builtin_pcre2', type: 'boolean', value: true, description: 'Use the built-in PCRE2 library') +option('builtin_pcre2_with_jit', type: 'boolean', value: true, description: 'Use JIT compiler for the built-in PCRE2 library') +option('builtin_squish', type: 'boolean', value: true, description: 'Use the built-in squish library') +option('builtin_vulkan', type: 'boolean', value: true, description: 'Use the built-in Vulkan loader library and headers') +option('builtin_wslay', type: 'boolean', value: true, description: 'Use the built-in wslay library') +option('builtin_zlib', type: 'boolean', value: true, description: 'Use the built-in zlib library') +option('builtin_zstd', type: 'boolean', value: true, description: 'Use the built-in zstd library') + +option('builtin_harfbuzz', type: 'boolean', value: true, description: 'Use the built-in harfbuzz library') +option('builtin_graphite', type: 'boolean', value: true, description: 'Use the built-in graphite library') +option('builtin_icu', type: 'boolean', value: true, description: 'Use the built-in icu library') + +# Vulkan options +option('use_volk', type: 'boolean', value: true, description: 'Use the volk library to load the Vulkan loader dynamically') + +# Mono options +option('mono_glue', type: 'boolean', value: true, description: 'Enable mono glue') + +# Javascript Options +option('initial_wasm_memory', type: 'integer', value: 16, description: 'Initial WASM memory (in MiB)') +option('use_assertions', type: 'boolean', value: false, description: 'Use Emscripten runtime assertions') +option('use_thinlto', type: 'boolean', value: false, description: 'Use ThinLTO') +option('use_ubsan', type: 'boolean', value: false, description: 'Use Emscripten undefined behavior sanitizer (UBSAN)') +option('use_asan', type: 'boolean', value: false, description: 'Use Emscripten address sanitizer (ASAN)') +option('use_lsan', type: 'boolean', value: false, description: 'Use Emscripten leak sanitizer (LSAN)') +option('use_safe_heap', type: 'boolean', value: false, description: 'Use Emscripten SAFE_HEAP sanitizer') +# eval() can be a security concern, so it can be disabled. +option('javascript_eval', type: 'boolean', value: true, description: 'Enable JavaScript eval interface') +option('threads_enabled', type: 'boolean', value: true, description: 'Enable WebAssembly Threads support (limited browser support)') +option('gdnative_enabled', type: 'boolean', value: false, description: 'Enable WebAssembly GDNative support (produces bigger binaries)') +option('use_closure_compiler', type: 'boolean', value: false, description: 'Use closure compiler to minimize JavaScript code') diff --git a/misc/scripts/make_android_cross.py b/misc/scripts/make_android_cross.py new file mode 100644 index 000000000000..157249e6e3a4 --- /dev/null +++ b/misc/scripts/make_android_cross.py @@ -0,0 +1,38 @@ +#!/usr/bin/python3 + +import platform, argparse, os, sys + +# e.g. linux +system = platform.system().lower() +# e.g. x86_64 +machine = platform.machine() + + +def replace(instr, ndk, host, machine, android_arch, android_abi): + REPLACES = { + "@NDK_PATH@": ndk, + "@HOST_OS@": host, + "@HOST_ARCH@": machine, + "@ANDROID_ARCH@": android_arch, + "@ANDROID_ABI@": android_abi, + "@ANDROID_ABI_NAME@": "androideabi" if android_arch == "armv7a" else "android", + "@ANDROID_AR_PREFIX@": "arm" if android_arch == "armv7a" else android_arch, + } + for k, v in REPLACES.items(): + instr = instr.replace(k, v) + return instr + + +if __name__ == "__main__": + cross_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "cross", "android-base") + parser = argparse.ArgumentParser() + parser.add_argument("ndk_path") + parser.add_argument("-o", "--output", default="") + parser.add_argument("-a", "--android-abi", default="24") + parser.add_argument("-m", "--android-arch", default="aarch64", choices=["armv7a", "aarch64", "i686", "x86_64"]) + parser.add_argument("-i", "--input", default=cross_path) + + args = parser.parse_args() + with open(args.input, "r") as r, (open(args.output, "w") if args.output else sys.stdout) as w: + for l in r.readlines(): + w.write(replace(l, args.ndk_path, system, machine, args.android_arch, args.android_abi)) diff --git a/modules/basis_universal/meson.build b/modules/basis_universal/meson.build new file mode 100644 index 000000000000..96575bfaa7f8 --- /dev/null +++ b/modules/basis_universal/meson.build @@ -0,0 +1,12 @@ +_module_basis_universal_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +if not DEP_BASIS_UNIVERSAL.found() + error('module basis_universal requires DEP_BASIS_UNIVERSAL') +endif + +_lib_module_basis_universal = library('module_basis_universal', _module_basis_universal_srcs, + dependencies: [DEP_GODOT_ALL, DEP_BASIS_UNIVERSAL] +) + +DEP_MODULE_BASIS_UNIVERSAL = declare_dependency(link_with: _lib_module_basis_universal) + +MODULE_DEPENDENCIES += DEP_MODULE_BASIS_UNIVERSAL diff --git a/modules/bmp/meson.build b/modules/bmp/meson.build new file mode 100644 index 000000000000..c91540f04ec2 --- /dev/null +++ b/modules/bmp/meson.build @@ -0,0 +1,9 @@ +_module_bmp_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +_lib_module_bmp = library('module_bmp', _module_bmp_srcs, + dependencies: DEP_GODOT_ALL, +) + +DEP_MODULE_BMP = declare_dependency(link_with: _lib_module_bmp) + +MODULE_DEPENDENCIES += DEP_MODULE_BMP diff --git a/modules/bullet/meson.build b/modules/bullet/meson.build new file mode 100644 index 000000000000..6cc69de132ee --- /dev/null +++ b/modules/bullet/meson.build @@ -0,0 +1,10 @@ +_module_bullet_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +if not DEP_BULLET.found() + error('module bullet requires bullet as a dependency') +endif + +_lib_module_bullet = library('module_bullet', _module_bullet_srcs, dependencies: [DEP_GODOT_ALL, DEP_BULLET]) + +DEP_MODULE_BULLET = declare_dependency(link_with: _lib_module_bullet) + +MODULE_DEPENDENCIES += [DEP_MODULE_BULLET] diff --git a/modules/camera/meson.build b/modules/camera/meson.build new file mode 100644 index 000000000000..b5f4457b67d4 --- /dev/null +++ b/modules/camera/meson.build @@ -0,0 +1,17 @@ +_modules_camera_srcs = files([ + 'register_types.cpp' +]) + +if PLATFORM == 'windows' + _modules_camera_srcs += files(['camera_win.cpp']) +elif PLATFORM == 'osx' + _modules_camera_srcs += files(['camera_osx.mm']) +endif + +_lib_module_camera = library('module_camera', _modules_camera_srcs, + dependencies: DEP_GODOT_ALL +) + +DEP_MODULE_CAMERA = declare_dependency(link_with: _lib_module_camera) + +MODULE_DEPENDENCIES += DEP_MODULE_CAMERA diff --git a/modules/camera_iphone/meson.build b/modules/camera_iphone/meson.build new file mode 100644 index 000000000000..3fa800993426 --- /dev/null +++ b/modules/camera_iphone/meson.build @@ -0,0 +1,16 @@ +_module_camera_iphone_srcs = files([ + 'camera_ios.mm', + 'camera_module.cpp', +]) + +_module_camera_iphone_cpp_args = ['-fmodules', '-fcxx-modules'] + +# static lib for ios +_lib_module_camera_iphone = static_library('module_camera', _module_camera_iphone_srcs, + dependencies: DEP_GODOT_ALL, + cpp_args: _module_camera_iphone_cpp_args +) + +DEP_MODULE_CAMERA_IPHONE = declare_dependency(link_with: _lib_module_camera_iphone) + +MODULE_DEPENDENCIES += DEP_MODULE_CAMERA_IPHONE diff --git a/modules/csg/meson.build b/modules/csg/meson.build new file mode 100644 index 000000000000..45cf614e8dd8 --- /dev/null +++ b/modules/csg/meson.build @@ -0,0 +1,8 @@ +_module_csg_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_csg = library('module_csg', + _module_csg_srcs, + dependencies: DEP_GODOT_ALL) + +DEP_MODULE_CSG = declare_dependency(link_with: _lib_module_csg) + +MODULE_DEPENDENCIES += DEP_MODULE_CSG diff --git a/modules/cvtt/meson.build b/modules/cvtt/meson.build new file mode 100644 index 000000000000..a2d07b68c290 --- /dev/null +++ b/modules/cvtt/meson.build @@ -0,0 +1,6 @@ +_module_cvtt_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_cvtt = library('module_cvtt', _module_cvtt_srcs, dependencies: [DEP_GODOT_ALL, DEP_CVTT]) + +DEP_MODULE_CVTT = declare_dependency(link_with: _lib_module_cvtt) + +MODULE_DEPENDENCIES += DEP_MODULE_CVTT diff --git a/modules/dds/meson.build b/modules/dds/meson.build new file mode 100644 index 000000000000..93f7dda88b2e --- /dev/null +++ b/modules/dds/meson.build @@ -0,0 +1,8 @@ +_module_dds_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_dds = library('module_dds', _module_dds_srcs, + dependencies: [DEP_GODOT_ALL] +) + +DEP_MODULE_DDS = declare_dependency(link_with: _lib_module_dds) + +MODULE_DEPENDENCIES += DEP_MODULE_DDS diff --git a/modules/denoise/meson.build b/modules/denoise/meson.build new file mode 100644 index 000000000000..b27e82a5fb80 --- /dev/null +++ b/modules/denoise/meson.build @@ -0,0 +1,8 @@ +_module_denoise_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_denoise = library('module_denoise', _module_denoise_srcs, + dependencies: [DEP_GODOT_ALL, DEP_OIDN] +) + +DEP_MODULE_DENOISE = declare_dependency(link_with: _lib_module_denoise) + +MODULE_DEPENDENCIES += DEP_MODULE_DENOISE diff --git a/modules/enet/meson.build b/modules/enet/meson.build new file mode 100644 index 000000000000..27db11220b50 --- /dev/null +++ b/modules/enet/meson.build @@ -0,0 +1,8 @@ +_module_enet_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_enet = library('module_enet', _module_enet_srcs, + dependencies: [DEP_GODOT_ALL, DEP_ENET] +) + +DEP_MODULE_ENET = declare_dependency(link_with: _lib_module_enet) + +MODULE_DEPENDENCIES += DEP_MODULE_ENET diff --git a/modules/etcpak/meson.build b/modules/etcpak/meson.build new file mode 100644 index 000000000000..2bf5f2e112a4 --- /dev/null +++ b/modules/etcpak/meson.build @@ -0,0 +1,12 @@ +_module_etcpak_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_module_etcpak_deps = [DEP_ETCPAK] + +lib_module_etcpak = library('module_etcpak', + _module_etcpak_srcs, + _certs_target, + dependencies: [DEP_GODOT_ALL, DEP_ETCPAK] +) + +DEP_MODULE_ETCPAK = declare_dependency(link_with: lib_module_etcpak) + +MODULE_DEPENDENCIES += DEP_MODULE_ETCPAK diff --git a/modules/fbx/meson.build b/modules/fbx/meson.build new file mode 100644 index 000000000000..4652baede9a5 --- /dev/null +++ b/modules/fbx/meson.build @@ -0,0 +1,16 @@ +_module_fbx_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_module_fbx_srcs += files(run_command(GLOB, 'data/*.cpp').stdout().split('\n')) +_module_fbx_srcs += files(run_command(GLOB, 'fbx_parser/*.cpp').stdout().split('\n')) +_module_fbx_srcs += files(run_command(GLOB, 'tools/*.cpp').stdout().split('\n')) + +# add our current directory into the include path +_module_fbx_incdirs = include_directories('.') + +lib_module_fbx = library('module_fbx', + _module_fbx_srcs, + include_directories: _module_fbx_incdirs, + dependencies: [DEP_GODOT_ALL, DEP_ZLIB]) + +DEP_MODULE_FBX = declare_dependency(link_with: lib_module_fbx) + +MODULE_DEPENDENCIES += DEP_MODULE_FBX diff --git a/modules/gdnative/android/meson.build b/modules/gdnative/android/meson.build new file mode 100644 index 000000000000..466cdba25204 --- /dev/null +++ b/modules/gdnative/android/meson.build @@ -0,0 +1 @@ +module_gdnative_srcs += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/modules/gdnative/gdnative/meson.build b/modules/gdnative/gdnative/meson.build new file mode 100644 index 000000000000..466cdba25204 --- /dev/null +++ b/modules/gdnative/gdnative/meson.build @@ -0,0 +1 @@ +module_gdnative_srcs += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/modules/gdnative/include/meson.build b/modules/gdnative/include/meson.build new file mode 100644 index 000000000000..a4a411994599 --- /dev/null +++ b/modules/gdnative/include/meson.build @@ -0,0 +1,9 @@ +# generated api structs +#_gdnative_api_structs_header_target = custom_target( +# 'gndative_api_structs_header', +# input: ['../gdnative_api.json'], +# output: [ 'gdnative_api_struct.gen.h'], +# command: [SCRIPT_GDNATIVE_API_GEN, '@INPUT@', 'gen_header', '@OUTPUT@'], +# build_by_default: true +#) +#module_gdnative_srcs += [_gdnative_api_structs_header_target] diff --git a/modules/gdnative/meson.build b/modules/gdnative/meson.build new file mode 100644 index 000000000000..f40b03068ec3 --- /dev/null +++ b/modules/gdnative/meson.build @@ -0,0 +1,46 @@ + +module_gdnative_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +# XXX Could use compat, but module will be removed, so no need to spend time on it. +#SCRIPT_GDNATIVE_API_GEN = find_program('scripts/gdnative_api_struct_gen.py') + +# generated api structs +#_gdnative_api_structs_source_target = custom_target( +# 'gndative_api_structs_source', +# input: ['gdnative_api.json'], +# output: [ 'gdnative_api_struct.gen.cpp'], +# command: [SCRIPT_GDNATIVE_API_GEN, '@INPUT@', 'gen_source', '@OUTPUT@'], +# build_by_default: true +#) +#module_gdnative_srcs += [_gdnative_api_structs_source_target] + +# generate the header file here... +subdir('include') + +module_gdnative_link_args = [] +module_gdnative_cpp_args = [] + +subdir('android') +subdir('gdnative') +subdir('nativescript') +subdir('net') +subdir('pluginscript') +subdir('videodecoder') +#subdir('xr') +subdir('text') + +_module_gdnative_incdirs = include_directories('include') + +lib_module_gdnative = library('module_gdnative', + module_gdnative_srcs, + link_args: module_gdnative_link_args, + cpp_args: module_gdnative_cpp_args, + include_directories: _module_gdnative_incdirs, + dependencies: [DEP_GODOT_ALL] +) + +DEP_MODULE_GDNATIVE = declare_dependency(link_with: lib_module_gdnative, + sources: _gdnative_api_structs_header_target, + include_directories: _module_gdnative_incdirs) + +MODULE_DEPENDENCIES += DEP_MODULE_GDNATIVE diff --git a/modules/gdnative/nativescript/meson.build b/modules/gdnative/nativescript/meson.build new file mode 100644 index 000000000000..6410546da3e9 --- /dev/null +++ b/modules/gdnative/nativescript/meson.build @@ -0,0 +1,5 @@ +module_gdnative_srcs += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +if PLATFORM == 'linuxbsd' or PLATFORM == 'iphone' + module_gdnative_link_args += ['-rdynamic'] +endif diff --git a/modules/gdnative/net/meson.build b/modules/gdnative/net/meson.build new file mode 100644 index 000000000000..2ed46c29700e --- /dev/null +++ b/modules/gdnative/net/meson.build @@ -0,0 +1,5 @@ +module_gdnative_srcs += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +if 'webrtc' in MODULES_ENABLED + module_gdnative_cpp_args += ['-DWEBRTC_GDNATIVE_ENABLED'] +endif diff --git a/modules/gdnative/pluginscript/meson.build b/modules/gdnative/pluginscript/meson.build new file mode 100644 index 000000000000..466cdba25204 --- /dev/null +++ b/modules/gdnative/pluginscript/meson.build @@ -0,0 +1 @@ +module_gdnative_srcs += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/modules/gdnative/text/meson.build b/modules/gdnative/text/meson.build new file mode 100644 index 000000000000..466cdba25204 --- /dev/null +++ b/modules/gdnative/text/meson.build @@ -0,0 +1 @@ +module_gdnative_srcs += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/modules/gdnative/videodecoder/meson.build b/modules/gdnative/videodecoder/meson.build new file mode 100644 index 000000000000..466cdba25204 --- /dev/null +++ b/modules/gdnative/videodecoder/meson.build @@ -0,0 +1 @@ +module_gdnative_srcs += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py index 61ce6185a5cc..54b2495b867d 100644 --- a/modules/gdscript/config.py +++ b/modules/gdscript/config.py @@ -15,3 +15,7 @@ def get_doc_classes(): def get_doc_path(): return "doc_classes" + + +def module_dependencies() -> dict: + return {"jsonrpc": {"required": False}} diff --git a/modules/gdscript/meson.build b/modules/gdscript/meson.build new file mode 100644 index 000000000000..1bf09b45f047 --- /dev/null +++ b/modules/gdscript/meson.build @@ -0,0 +1,42 @@ +_module_gdscript_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +_module_gdscript_cpp_args = [] +_module_gdscript_deps = [DEP_GODOT_ALL] + +# do we have tools? +if get_option('tools') + _module_gdscript_srcs += files([ + 'editor/gdscript_highlighter.cpp', + 'editor/gdscript_translation_parser_plugin.cpp', + ]) + + if 'jsonrpc' in MODULES_ENABLED and 'websocket' in MODULES_ENABLED + _module_gdscript_srcs += files([ + 'language_server/gdscript_extend_parser.cpp', + 'language_server/gdscript_language_protocol.cpp', + 'language_server/gdscript_language_server.cpp', + 'language_server/gdscript_text_document.cpp', + 'language_server/gdscript_workspace.cpp', + ]) + _module_gdscript_deps += [DEP_MODULE_JSONRPC] + else + _module_gdscript_cpp_args += ['-DGDSCRIPT_NO_LSP'] + endif +endif + +# do we have tests? +if get_option('tests') + _module_gdscript_cpp_args += ['-DTESTS_ENABLED'] + _module_gdscript_srcs += files(run_command(GLOB, 'tests/*.cpp').stdout().split('\n')) + _module_gdscript_deps += DEP_TESTS +endif + +lib_gdscript = library('module_gdscript', + _module_gdscript_srcs, + cpp_args: _module_gdscript_cpp_args, + dependencies: _module_gdscript_deps +) + +DEP_MODULE_GDSCRIPT = declare_dependency(link_with: lib_gdscript) + +MODULE_DEPENDENCIES += DEP_MODULE_GDSCRIPT diff --git a/modules/glslang/meson.build b/modules/glslang/meson.build new file mode 100644 index 000000000000..fe7a154454ba --- /dev/null +++ b/modules/glslang/meson.build @@ -0,0 +1,6 @@ +_modules_glslang_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_modules_glslang = library('modules_glslang', _modules_glslang_srcs, dependencies: [DEP_GODOT_ALL, DEP_GLSLANG], build_by_default:true) + +DEP_MODULE_GLSLANG = declare_dependency(link_with: _lib_modules_glslang) + +MODULE_DEPENDENCIES += [DEP_MODULE_GLSLANG] diff --git a/modules/gltf/meson.build b/modules/gltf/meson.build new file mode 100644 index 000000000000..2517a04d827d --- /dev/null +++ b/modules/gltf/meson.build @@ -0,0 +1,6 @@ +_module_gltf_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_gltf = library('module_gltf', _module_gltf_srcs, dependencies: [DEP_GODOT_ALL]) + +DEP_MODULE_GLTF = declare_dependency(link_with: lib_module_gltf) + +MODULE_DEPENDENCIES += DEP_MODULE_GLTF diff --git a/modules/gridmap/meson.build b/modules/gridmap/meson.build new file mode 100644 index 000000000000..28bc9e54ce6f --- /dev/null +++ b/modules/gridmap/meson.build @@ -0,0 +1,9 @@ +_module_gridmap_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_gridmap = library('module_gridmap', + _module_gridmap_srcs, + include_directories: '../..', + dependencies: [DEP_GODOT_ALL]) + +DEP_MODULE_GRIDMAP = declare_dependency(link_with: _lib_module_gridmap) + +MODULE_DEPENDENCIES += DEP_MODULE_GRIDMAP diff --git a/modules/hdr/meson.build b/modules/hdr/meson.build new file mode 100644 index 000000000000..753cef7e9d2e --- /dev/null +++ b/modules/hdr/meson.build @@ -0,0 +1,9 @@ +_module_hdr_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +_lib_module_hdr = library('module_hdr', _module_hdr_srcs, + dependencies: [DEP_GODOT_ALL] +) + +DEP_MODULE_HDR = declare_dependency(link_with: _lib_module_hdr) + +MODULE_DEPENDENCIES += DEP_MODULE_HDR diff --git a/modules/icloud/meson.build b/modules/icloud/meson.build new file mode 100644 index 000000000000..18227ca2bace --- /dev/null +++ b/modules/icloud/meson.build @@ -0,0 +1,14 @@ +_module_icloud_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_module_icloud_srcs = files(run_command(GLOB, '*.mm').stdout().split('\n')) + +_module_icloud_cpp_args = ['-fmodules', '-fcxx-modules'] + +# static lib for ios +_lib_module_icloud = static_library('module_icloud', _module_icloud_srcs, + dependencies: DEP_GODOT_ALL, + cpp_args: _module_icloud_cpp_args +) + +DEP_MODULE_ICLOUD = declare_dependency(link_with: _lib_module_icloud) + +MODULE_DEPENDENCIES += DEP_MODULE_ICLOUD diff --git a/modules/jpg/meson.build b/modules/jpg/meson.build new file mode 100644 index 000000000000..34bbeb369d01 --- /dev/null +++ b/modules/jpg/meson.build @@ -0,0 +1,9 @@ +_module_jpg_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +_lib_module_jpg = library('module_jpg', _module_jpg_srcs, + dependencies: [DEP_GODOT_ALL, DEP_JPEG_COMPRESSOR] +) + +DEP_MODULE_JPG = declare_dependency(link_with: _lib_module_jpg) + +MODULE_DEPENDENCIES += DEP_MODULE_JPG diff --git a/modules/jsonrpc/meson.build b/modules/jsonrpc/meson.build new file mode 100644 index 000000000000..1b15bccba9d1 --- /dev/null +++ b/modules/jsonrpc/meson.build @@ -0,0 +1,6 @@ +_module_jsonrpc_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_jsonrpc = library('module_jsonrpc', _module_jsonrpc_srcs, dependencies: [DEP_GODOT_ALL]) + +DEP_MODULE_JSONRPC = declare_dependency(link_with: _lib_module_jsonrpc) + +MODULE_DEPENDENCIES += DEP_MODULE_JSONRPC diff --git a/modules/lightmapper_rd/meson.build b/modules/lightmapper_rd/meson.build new file mode 100644 index 000000000000..b6b2eb3910f2 --- /dev/null +++ b/modules/lightmapper_rd/meson.build @@ -0,0 +1,24 @@ +_module_lmrd_src = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +# NOTE: do not use files() here +_module_lmrd_raw_shaders = run_command(GLOB, '*.glsl').stdout().split('\n') + +#build_raw_headers + +foreach glsl_file : _module_lmrd_raw_shaders + _raw_target = custom_target( + 'raw_target_' + glsl_file, + input: files(glsl_file), + output: '@PLAINNAME@.gen.h', + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'build_raw_headers', SCRIPT_GLSL_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true + ) + + _module_lmrd_src += [_raw_target] +endforeach + +lib_module_lmrd = library('module_lightmapper_rd', _module_lmrd_src, gdivirtuals_gen, dependencies: [DEP_GODOT_ALL]) + +DEP_MODULE_LIGHTMAPPER_RD = declare_dependency(link_with: lib_module_lmrd) + +MODULE_DEPENDENCIES += DEP_MODULE_LIGHTMAPPER_RD diff --git a/modules/mbedtls/meson.build b/modules/mbedtls/meson.build new file mode 100644 index 000000000000..e3e0990d0ddd --- /dev/null +++ b/modules/mbedtls/meson.build @@ -0,0 +1,17 @@ +_module_mbedtls_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_module_mbedtls_deps = [DEP_GODOT_ALL, DEP_MBEDTLS] + +if get_option('tests') + _module_mbedtls_srcs += files(run_command(GLOB, 'tests/*.cpp').stdout().split('\n')) + _module_mbedtls_deps += DEP_TESTS +endif + +lib_module_mbedtls = library('module_mbedtls', + _module_mbedtls_srcs, + _certs_target, + dependencies: [DEP_GODOT_ALL, DEP_MBEDTLS] +) + +DEP_MODULE_MBEDTLS = declare_dependency(link_with: lib_module_mbedtls) + +MODULE_DEPENDENCIES += DEP_MODULE_MBEDTLS diff --git a/modules/meshoptimizer/meson.build b/modules/meshoptimizer/meson.build new file mode 100644 index 000000000000..3cb1d57447a0 --- /dev/null +++ b/modules/meshoptimizer/meson.build @@ -0,0 +1,7 @@ +_module_meshoptimizer_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +lib_module_meshoptimizer = library('module_meshoptimizer', _module_meshoptimizer_srcs, gdivirtuals_gen, dependencies: [DEP_GODOT_ALL, DEP_MESHOPTIMIZER]) + +DEP_MODULE_MESHOPTIMIZER = declare_dependency(link_with: lib_module_meshoptimizer) + +MODULE_DEPENDENCIES += DEP_MODULE_MESHOPTIMIZER diff --git a/modules/meson.build b/modules/meson.build new file mode 100644 index 000000000000..0791ebc6376e --- /dev/null +++ b/modules/meson.build @@ -0,0 +1,8 @@ +_register_module_types_target = custom_target( + 'register_module_types', + output: ['register_module_types.gen.cpp'], + input: [MODULES_DB_FILE], + command: [SCRIPT_MODULES_GEN, 'register_module_types', '@INPUT@', MESON_SOURCE_ROOT, '@OUTPUT@'], + build_by_default: true +) +SOURCES += [_register_module_types_target] diff --git a/modules/minimp3/meson.build b/modules/minimp3/meson.build new file mode 100644 index 000000000000..3a644f857963 --- /dev/null +++ b/modules/minimp3/meson.build @@ -0,0 +1,6 @@ +_module_minimp3_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_minimp3 = library('module_minimp3', _module_minimp3_srcs, dependencies: [DEP_GODOT_ALL, DEP_MINIMP3]) + +DEP_MODULE_MINIMP3 = declare_dependency(link_with: lib_module_minimp3) + +MODULE_DEPENDENCIES += DEP_MODULE_MINIMP3 diff --git a/modules/mobile_vr/meson.build b/modules/mobile_vr/meson.build new file mode 100644 index 000000000000..ca78e529eb7b --- /dev/null +++ b/modules/mobile_vr/meson.build @@ -0,0 +1,8 @@ +_module_mobile_vr_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_mobile_vr = library('module_mobile_vr', _module_mobile_vr_srcs, + dependencies: [DEP_GODOT_ALL] +) + +DEP_MODULE_MOBILE_VR = declare_dependency(link_with: lib_module_mobile_vr) + +MODULE_DEPENDENCIES += DEP_MODULE_MOBILE_VR diff --git a/modules/msdfgen/meson.build b/modules/msdfgen/meson.build new file mode 100644 index 000000000000..d1c2078dde99 --- /dev/null +++ b/modules/msdfgen/meson.build @@ -0,0 +1,8 @@ +_module_msdfgen_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_msdfgen = library('module_msdfgen', _module_msdfgen_srcs, + dependencies: [DEP_GODOT_ALL, DEP_MSDF] +) + +DEP_MODULE_MSDFGEN = declare_dependency(link_with: _lib_module_msdfgen) + +MODULE_DEPENDENCIES += DEP_MODULE_MSDFGEN diff --git a/modules/navigation/meson.build b/modules/navigation/meson.build new file mode 100644 index 000000000000..85c3c8f41092 --- /dev/null +++ b/modules/navigation/meson.build @@ -0,0 +1,9 @@ +_module_gdnaviation_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +_lib_module_gdnavigation = library('module_gdnavigation', + _module_gdnaviation_srcs, + dependencies: [DEP_GODOT_ALL, DEP_RECAST, DEP_RVO2]) + +DEP_MODULE_GDNAVIGATION = declare_dependency(link_with: _lib_module_gdnavigation) + +MODULE_DEPENDENCIES += [DEP_MODULE_GDNAVIGATION] diff --git a/modules/ogg/meson.build b/modules/ogg/meson.build new file mode 100644 index 000000000000..46d3b90847cb --- /dev/null +++ b/modules/ogg/meson.build @@ -0,0 +1,12 @@ +ogg_sources = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +ogg_lib = library('ogg', + ogg_sources, + gdivirtuals_gen, + include_directories: [INCDIRS], + cpp_args: CPP_ARGS, + dependencies: DEP_LIBOGG) + +DEP_MODULE_OGG = declare_dependency(link_with: ogg_lib) + +MODULE_DEPENDENCIES += DEP_MODULE_OGG diff --git a/modules/opensimplex/meson.build b/modules/opensimplex/meson.build new file mode 100644 index 000000000000..1e9eef6d440e --- /dev/null +++ b/modules/opensimplex/meson.build @@ -0,0 +1,10 @@ +_module_opensimplex_srcs = files(['../../thirdparty/misc/open-simplex-noise.c']) +_module_opensimplex_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +lib_module_opensimplex = library('module_opensimplex', _module_opensimplex_srcs, + dependencies: [DEP_GODOT_ALL] +) + +DEP_MODULE_OPENSIMPLEX = declare_dependency(link_with: lib_module_opensimplex) + +MODULE_DEPENDENCIES += DEP_MODULE_OPENSIMPLEX diff --git a/modules/pvr/meson.build b/modules/pvr/meson.build new file mode 100644 index 000000000000..357c8ef4b254 --- /dev/null +++ b/modules/pvr/meson.build @@ -0,0 +1,9 @@ +_module_pvr_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +lib_module_pvr = library('module_pvr', _module_pvr_srcs, + dependencies: [DEP_GODOT_ALL, DEP_PVRTCCOMPRESSOR] +) + +DEP_MODULE_PVR = declare_dependency(link_with: lib_module_pvr) + +MODULE_DEPENDENCIES += DEP_MODULE_PVR diff --git a/modules/regex/meson.build b/modules/regex/meson.build new file mode 100644 index 000000000000..b59934bf3631 --- /dev/null +++ b/modules/regex/meson.build @@ -0,0 +1,6 @@ +_regex_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_regex = library('module_regex', _regex_srcs, dependencies: [DEP_GODOT_ALL, DEP_PCRE2]) + +DEP_MODULE_REGEX = declare_dependency(link_with: _lib_module_regex) + +MODULE_DEPENDENCIES += [DEP_MODULE_REGEX] diff --git a/modules/sample_config.py b/modules/sample_config.py new file mode 100644 index 000000000000..6dda1fc42a53 --- /dev/null +++ b/modules/sample_config.py @@ -0,0 +1,21 @@ +# Required +def can_build(env: dict, platform: str) -> bool: + return True + + +def get_name() -> str: + return "some_module" + + +def get_doc_classes() -> [str]: + return [ + "SomeModule", + ] + + +def get_doc_path() -> str: + return "doc_classes" + + +def module_dependencies() -> dict: + return {"some_dependency": {"required": False}} diff --git a/modules/squish/meson.build b/modules/squish/meson.build new file mode 100644 index 000000000000..87ff89d829ba --- /dev/null +++ b/modules/squish/meson.build @@ -0,0 +1,6 @@ +_module_squish_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_squish = library('module_squish', _module_squish_srcs, dependencies: [DEP_GODOT_ALL, DEP_SQUISH]) + +DEP_MODULE_SQUISH = declare_dependency(link_with: lib_module_squish) + +MODULE_DEPENDENCIES += DEP_MODULE_SQUISH diff --git a/modules/svg/meson.build b/modules/svg/meson.build new file mode 100644 index 000000000000..54ec6d5a84eb --- /dev/null +++ b/modules/svg/meson.build @@ -0,0 +1,6 @@ +_module_svg_sourcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_svg = library('module_svg', _module_svg_sourcs, gdivirtuals_gen, dependencies: [DEP_GODOT_ALL, DEP_NANOSVG]) + +DEP_MODULE_SVG = declare_dependency(link_with: _lib_module_svg) + +MODULE_DEPENDENCIES += DEP_MODULE_SVG diff --git a/modules/text_server_adv/icu_data/meson.build b/modules/text_server_adv/icu_data/meson.build new file mode 100644 index 000000000000..3cb03ff1a2bf --- /dev/null +++ b/modules/text_server_adv/icu_data/meson.build @@ -0,0 +1,17 @@ +if get_option('tools') + _module_tsa_icu_data_name = DEP_ICU.get_variable(internal: 'icu_data_name', default_value: 'icudt69l.dat') + _module_tsa_icu_file = files('../../../thirdparty/icu4c' / _module_tsa_icu_data_name) + + _script_icu_data_gen = find_program('../scripts/icu_data.py') + _icu_data_gen_target = custom_target( + 'icu_data_gen', + output: ['icudata.gen.h'], + input: [_module_tsa_icu_file], + command: [_script_icu_data_gen, '@INPUT@', '@OUTPUT@'], + env: SCRIPTS_ENV, + build_by_default: true + ) + module_tsa_srcs += [_icu_data_gen_target] +else + module_tsa_srcs += files('icudata_stub.cpp') +endif diff --git a/modules/text_server_adv/meson.build b/modules/text_server_adv/meson.build new file mode 100644 index 000000000000..7a096ea96656 --- /dev/null +++ b/modules/text_server_adv/meson.build @@ -0,0 +1,17 @@ +module_tsa_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +subdir('icu_data') + +_module_tsa_compile_args = ['-DMODULE_FREETYPE_ENABLED'] +if get_option('tools') + _module_tsa_compile_args += '-DICU_STATIC_DATA' +endif + +lib_module_tsa = library('module_text_server_adv', module_tsa_srcs, + dependencies: [DEP_GODOT_ALL, DEP_HARFBUZZ, DEP_ICU, DEP_FREETYPE, DEP_GRAPHITE, DEP_MSDF], + cpp_args: _module_tsa_compile_args +) + +DEP_MODULE_TEXT_SERVER_ADV = declare_dependency(link_with: lib_module_tsa) + +MODULE_DEPENDENCIES += DEP_MODULE_TEXT_SERVER_ADV diff --git a/modules/text_server_adv/scripts/icu_data.py b/modules/text_server_adv/scripts/icu_data.py new file mode 100644 index 000000000000..54adede64ff9 --- /dev/null +++ b/modules/text_server_adv/scripts/icu_data.py @@ -0,0 +1,45 @@ +#!/usr/bin/python3 + +import argparse +import os + + +def fix_path(name: str, dest: str): + return os.path.join(os.getenv("MESON_BUILD_ROOT"), dest, os.path.basename(name)) + + +def _make_icu_data(input_data_file: str, output_gen_file: str): + import os + + f = fix_path(output_gen_file, os.path.join("thirdparty", "icu4c")) + g = open(f, "w", encoding="utf-8") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n") + g.write("/* License & terms of use: https://www.unicode.org/copyright.html */\n") + g.write("#ifndef _ICU_DATA_H\n") + g.write("#define _ICU_DATA_H\n") + g.write('#include "unicode/utypes.h"\n') + g.write('#include "unicode/udata.h"\n') + g.write('#include "unicode/uversion.h"\n') + + f = open(input_data_file, "rb") + buf = f.read() + import os.path + + g.write('extern "C" U_EXPORT const size_t U_ICUDATA_SIZE = ' + str(len(buf)) + ";\n") + g.write('extern "C" U_EXPORT const unsigned char U_ICUDATA_ENTRY_POINT[] = {\n') + for i in range(len(buf)): + g.write("\t" + str(buf[i]) + ",\n") + + g.write("};\n") + g.write("#endif") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate the icu data header.") + parser.add_argument("input_data_file", type=str) + parser.add_argument("output_gen_file", type=str) + + args = parser.parse_args() + _make_icu_data(args.input_data_file, args.output_gen_file) diff --git a/modules/text_server_fb/meson.build b/modules/text_server_fb/meson.build new file mode 100644 index 000000000000..f9e0fe33fb22 --- /dev/null +++ b/modules/text_server_fb/meson.build @@ -0,0 +1,11 @@ +_module_tsf_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +lib_module_tsf = library('module_text_server_fb', + _module_tsf_srcs, + cpp_args: ['-DMODULE_FREETYPE_ENABLED'], + dependencies: [DEP_GODOT_ALL, DEP_FREETYPE, DEP_MSDF] +) + +DEP_MODULE_TEXT_SERVER_FB = declare_dependency(link_with: lib_module_tsf) + +MODULE_DEPENDENCIES += DEP_MODULE_TEXT_SERVER_FB diff --git a/modules/tga/meson.build b/modules/tga/meson.build new file mode 100644 index 000000000000..e93d47bcb8b0 --- /dev/null +++ b/modules/tga/meson.build @@ -0,0 +1,6 @@ +_module_tga_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_tga = library('module_tga', _module_tga_srcs, gdivirtuals_gen, dependencies: [DEP_GODOT_ALL]) + +DEP_MODULE_TGA = declare_dependency(link_with: lib_module_tga) + +MODULE_DEPENDENCIES += DEP_MODULE_TGA diff --git a/modules/theora/meson.build b/modules/theora/meson.build new file mode 100644 index 000000000000..798de808be59 --- /dev/null +++ b/modules/theora/meson.build @@ -0,0 +1,8 @@ +_module_theora_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_theora = library('module_theora', _module_theora_srcs, + dependencies: [DEP_GODOT_ALL, DEP_LIBTHEORA, DEP_LIBOGG, DEP_LIBVORBIS] +) + +DEP_MODULE_THEORA = declare_dependency(link_with: lib_module_theora) + +MODULE_DEPENDENCIES += DEP_MODULE_THEORA diff --git a/modules/tinyexr/meson.build b/modules/tinyexr/meson.build new file mode 100644 index 000000000000..9b5d928abdaa --- /dev/null +++ b/modules/tinyexr/meson.build @@ -0,0 +1,6 @@ +_module_tinyexr_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_tinyexr = library('module_tinyexr', _module_tinyexr_srcs, dependencies: [DEP_GODOT_ALL, DEP_TINYEXR]) + +DEP_MODULE_TINYEXR = declare_dependency(link_with: lib_module_tinyexr) + +MODULE_DEPENDENCIES += DEP_MODULE_TINYEXR diff --git a/modules/upnp/meson.build b/modules/upnp/meson.build new file mode 100644 index 000000000000..87b0158b060c --- /dev/null +++ b/modules/upnp/meson.build @@ -0,0 +1,6 @@ +_module_upnp_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_upnp = library('module_upnp', _module_upnp_srcs, dependencies: [DEP_GODOT_ALL, DEP_MINIUPNPC]) + +DEP_MODULE_UPNP = declare_dependency(link_with: lib_module_upnp) + +MODULE_DEPENDENCIES += DEP_MODULE_UPNP diff --git a/modules/vhacd/meson.build b/modules/vhacd/meson.build new file mode 100644 index 000000000000..6f05c6d6a8a7 --- /dev/null +++ b/modules/vhacd/meson.build @@ -0,0 +1,7 @@ +_module_vhacd_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +lib_module_vhacd = library('module_vhacd', _module_vhacd_srcs, dependencies: [DEP_GODOT_ALL, DEP_VHACD]) + +DEP_MODULE_VHACD = declare_dependency(link_with: lib_module_vhacd) + +MODULE_DEPENDENCIES += DEP_MODULE_VHACD diff --git a/modules/visual_script/meson.build b/modules/visual_script/meson.build new file mode 100644 index 000000000000..838e290d09b9 --- /dev/null +++ b/modules/visual_script/meson.build @@ -0,0 +1,9 @@ +_module_visual_script_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_visual_script = library('module_visual_script', + _module_visual_script_srcs, + include_directories: '../..', + dependencies: [DEP_GODOT_ALL]) + +DEP_MODULE_VISUAL_SCRIPT = declare_dependency(link_with: lib_module_visual_script) + +MODULE_DEPENDENCIES += DEP_MODULE_VISUAL_SCRIPT diff --git a/modules/vorbis/meson.build b/modules/vorbis/meson.build new file mode 100644 index 000000000000..de08a8f4a8fd --- /dev/null +++ b/modules/vorbis/meson.build @@ -0,0 +1,6 @@ +_module_vorbis_sourcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_lib_module_vorbis = library('module_vorbis', _module_vorbis_sourcs, gdivirtuals_gen, dependencies: [DEP_GODOT_ALL, DEP_LIBVORBIS, DEP_LIBOGG]) + +DEP_MODULE_VORBIS = declare_dependency(link_with: _lib_module_vorbis) + +MODULE_DEPENDENCIES += DEP_MODULE_VORBIS diff --git a/modules/webp/meson.build b/modules/webp/meson.build new file mode 100644 index 000000000000..ecee1e67a314 --- /dev/null +++ b/modules/webp/meson.build @@ -0,0 +1,6 @@ +_module_webp_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_webp = library('module_webp', _module_webp_srcs, dependencies: [DEP_GODOT_ALL, DEP_LIBWEBP]) + +DEP_MODULE_WEBP = declare_dependency(link_with: lib_module_webp) + +MODULE_DEPENDENCIES += DEP_MODULE_WEBP diff --git a/modules/webrtc/config.py b/modules/webrtc/config.py index 3281415f38a5..29dc52eba94d 100644 --- a/modules/webrtc/config.py +++ b/modules/webrtc/config.py @@ -16,3 +16,7 @@ def get_doc_classes(): def get_doc_path(): return "doc_classes" + + +def module_dependencies() -> dict: + return {"gdnative": {"required": False}} diff --git a/modules/webrtc/meson.build b/modules/webrtc/meson.build new file mode 100644 index 000000000000..a364d73f0c0e --- /dev/null +++ b/modules/webrtc/meson.build @@ -0,0 +1,23 @@ +_module_webrtc_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_module_webrtc_compile_args = [] +_module_webrtc_deps = [DEP_GODOT_ALL] + +DEP_MODULE_WEBRTC = [] + +if 'gdnative' in MODULES_ENABLED + _module_webrtc_compile_args += '-DWEBRTC_GDNATIVE_ENABLED' + _module_webrtc_deps += DEP_MODULE_GDNATIVE +endif + +if PLATFORM == 'javascript' + DEP_MODULE_WEBRTC += cpp.find_library('library_godot_webrtc.js', dirs: [meson.current_source_dir()]) +endif + +lib_module_webrtc = library('module_webrtc', + _module_webrtc_srcs, + dependencies: _module_webrtc_deps, + cpp_args: _module_webrtc_compile_args) + +DEP_MODULE_WEBRTC += declare_dependency(link_with: lib_module_webrtc) + +MODULE_DEPENDENCIES += DEP_MODULE_WEBRTC diff --git a/modules/websocket/meson.build b/modules/websocket/meson.build new file mode 100644 index 000000000000..0a18c09713cc --- /dev/null +++ b/modules/websocket/meson.build @@ -0,0 +1,18 @@ +_module_websocket_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +_module_websocket_deps = [DEP_GODOT_ALL] + +DEP_MODULE_WEBSOCKET = [] + +if PLATFORM == 'javascript' + DEP_MODULE_WEBSOCKET += cpp.find_library('library_godot_websocket.js', dirs: [meson.current_source_dir()]) +else + _module_websocket_deps += DEP_WSLAY +endif + +lib_module_websocket = library('module_websocket', + _module_websocket_srcs, + dependencies: _module_websocket_deps) + +DEP_MODULE_WEBSOCKET += declare_dependency(link_with: lib_module_websocket) + +MODULE_DEPENDENCIES += DEP_MODULE_WEBSOCKET diff --git a/modules/webxr/meson.build b/modules/webxr/meson.build new file mode 100644 index 000000000000..a55bffcba11b --- /dev/null +++ b/modules/webxr/meson.build @@ -0,0 +1,13 @@ +_module_webxr_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +DEP_MODULE_WEBXR = [] +if PLATFORM == 'javascript' + DEP_MODULE_WEBXR += cpp.find_library('library_godot_webxr.js', dirs: [meson.current_source_dir() / 'native']) + +endif + +lib_module_webxr = library('module_webxr', _module_webxr_srcs, dependencies: [DEP_GODOT_ALL]) + +DEP_MODULE_WEBXR += declare_dependency(link_with: lib_module_webxr) + +MODULE_DEPENDENCIES += DEP_MODULE_WEBXR diff --git a/modules/xatlas_unwrap/meson.build b/modules/xatlas_unwrap/meson.build new file mode 100644 index 000000000000..a9b5c8e47510 --- /dev/null +++ b/modules/xatlas_unwrap/meson.build @@ -0,0 +1,6 @@ +_module_xatlas_unwrap_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) +lib_module_xatlas_unwrap = library('module_xatlas_unwrap', _module_xatlas_unwrap_srcs, dependencies: [DEP_GODOT_ALL, DEP_XATLAS]) + +DEP_MODULE_XATLAS_UNWARP = declare_dependency(link_with: lib_module_xatlas_unwrap) + +MODULE_DEPENDENCIES += DEP_MODULE_XATLAS_UNWARP diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/meson.build b/platform/android/java/lib/src/org/godotengine/godot/plugin/meson.build new file mode 100644 index 000000000000..b1e05eba1a77 --- /dev/null +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/meson.build @@ -0,0 +1,15 @@ +_module_arkit_srcs = files([ + 'arkit_interface.mm', + 'arkit_module.cpp', + 'arkit_session_delegate.mm' +]) + +# NOTE: should probably check the compiler here, but only iphone targets anyways... +_module_arkit_cpp_flags = ['-fmodules', '-fcxx-modules'] + +# force static lib for ios +_lib_module_arkit = static_library('module_arkit', _module_arkit_srcs, dependencies: DEP_GODOT_ALL, cpp_flags: _module_arkit_cpp_flags) + +DEP_MODULE_ARKIT = declare_dependency(link_with: _lib_module_arkit) + +MODULE_DEPENDENCIES += DEP_MODULE_ARKIT diff --git a/platform/android/meson.build b/platform/android/meson.build new file mode 100644 index 000000000000..805a8a8581b3 --- /dev/null +++ b/platform/android/meson.build @@ -0,0 +1,99 @@ +# The libraries and defines added in this file are the *requirements* that are +# needed to build on the selected platform. Do not add debug/release/optional +# compilation flags here. + +################################################################################ +# Commands to always run +################################################################################ +_target_android_logo = custom_target( + 'android_logo', + output: ['logo.gen.h'], + input: ['logo.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'android'], + build_by_default: true +) +SOURCES += [_target_android_logo] + +_target_android_run_icon = custom_target( + 'android_run_icon', + output: ['run_icon.gen.h'], + input: ['run_icon.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'android'], + build_by_default: true +) + +if PLATFORM != 'android' + subdir_done() +endif + +#add_languages('java') +# +#jar('godot', +# 'java/lib/src/org/godotengine/godot/Dictionary.java', +# 'java/lib/src/org/godotengine/godot/FullScreenGodotApp.java', +# 'java/lib/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java', +# 'java/lib/src/org/godotengine/godot/GodotDownloaderService.java', +# 'java/lib/src/org/godotengine/godot/GodotGLRenderView.java', +# 'java/lib/src/org/godotengine/godot/GodotHost.java', +# 'java/lib/src/org/godotengine/godot/GodotInstrumentation.java', +# 'java/lib/src/org/godotengine/godot/GodotIO.java', +# 'java/lib/src/org/godotengine/godot/Godot.java', +# 'java/lib/src/org/godotengine/godot/GodotLib.java', +# 'java/lib/src/org/godotengine/godot/GodotRenderer.java', +# 'java/lib/src/org/godotengine/godot/GodotRenderView.java', +# 'java/lib/src/org/godotengine/godot/GodotVulkanRenderView.java', +# 'java/lib/src/org/godotengine/godot/input/GodotEditText.java', +# 'java/lib/src/org/godotengine/godot/input/GodotGestureHandler.java', +# 'java/lib/src/org/godotengine/godot/input/GodotInputHandler.java', +# 'java/lib/src/org/godotengine/godot/input/GodotTextInputWrapper.java', +# 'java/lib/src/org/godotengine/godot/input/InputManagerCompat.java', +# 'java/lib/src/org/godotengine/godot/input/InputManagerV16.java', +# 'java/lib/src/org/godotengine/godot/input/Joystick.java', +# 'java/lib/src/org/godotengine/godot/plugin/GodotPluginInfoProvider.java', +# 'java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java', +# 'java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java', +# 'java/lib/src/org/godotengine/godot/plugin/SignalInfo.java', +# 'java/lib/src/org/godotengine/godot/plugin/UsedByGodot.java', +# 'java/lib/src/org/godotengine/godot/utils/Crypt.java', +# 'java/lib/src/org/godotengine/godot/utils/GLUtils.java', +# 'java/lib/src/org/godotengine/godot/utils/GodotNetUtils.java', +# 'java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java', +# 'java/lib/src/org/godotengine/godot/xr/ovr/OvrConfigChooser.java', +# 'java/lib/src/org/godotengine/godot/xr/ovr/OvrContextFactory.java', +# 'java/lib/src/org/godotengine/godot/xr/ovr/OvrWindowSurfaceFactory.java', +# 'java/lib/src/org/godotengine/godot/xr/regular/RegularConfigChooser.java', +# 'java/lib/src/org/godotengine/godot/xr/regular/RegularContextFactory.java', +# 'java/lib/src/org/godotengine/godot/xr/regular/RegularFallbackConfigChooser.java', +# 'java/lib/src/org/godotengine/godot/xr/XRMode.java', +#) + +################################################################################ +# Host Machine Specifics +################################################################################ +android_sources = files( + 'android_keys_utils.cpp', + 'api/api.cpp', + 'audio_driver_opensl.cpp', + 'dir_access_jandroid.cpp', + 'display_server_android.cpp', + 'file_access_android.cpp', + 'java_class_wrapper.cpp', + 'java_godot_io_wrapper.cpp', + 'java_godot_lib_jni.cpp', + 'java_godot_view_wrapper.cpp', + 'java_godot_wrapper.cpp', + 'jni_utils.cpp', + 'net_socket_android.cpp', + 'os_android.cpp', + #'plugin/godot_plugin_jni.cpp', + 'thread_jandroid.cpp', + 'vulkan/vulkan_context_android.cpp', +) + +SOURCES += [_target_android_run_icon, android_sources] +CPP_ARGS += ['-DANDROID_ENABLED', '-DNO_STATVFS', '-DUNIX_ENABLED'] + +ANDROID_NDK_DEPS = [cc.find_library('android'), + cc.find_library('OpenSLES'), + cc.find_library('log'), + ] diff --git a/platform/iphone/meson.build b/platform/iphone/meson.build new file mode 100644 index 000000000000..72c73d09a408 --- /dev/null +++ b/platform/iphone/meson.build @@ -0,0 +1,50 @@ +# The libraries and defines added in this file are the *requirements* that are +# needed to build on the selected platform. Do not add debug/release/optional +# compilation flags here. + +################################################################################ +# Commands to always run +################################################################################ +_target_iphone_logo = custom_target( + 'iphone_logo', + output: ['logo.gen.h'], + input: ['logo.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'iphone'], + build_by_default: true +) +SOURCES += [_target_iphone_logo] + + +################################################################################ +# Host Machine Specifics +################################################################################ +if PLATFORM == 'iphone' + MAIN_SOURCES += files('godot_iphone.mm') + ios_deps = dependency('AppleFrameworks', modules: ['UIKit', + # + ]) + # All Vulkan files commented out. + iphone_sources = files( + 'godot_iphone.mm', + 'os_iphone.mm', + 'main.m', + 'app_delegate.mm', + 'view_controller.mm', + 'ios.mm', + 'vulkan_context_iphone.mm', + 'display_server_iphone.mm', + #'joypad_iphone.mm', + 'godot_view.mm', + 'display_layer.mm', + 'godot_app_delegate.m', + 'godot_view_renderer.mm', + 'godot_view_gesture_recognizer.mm', + 'device_metrics.m', + 'keyboard_input_view.mm', + ) + + SOURCES += iphone_sources + CPP_ARGS += ['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DCOREAUDIO_ENABLED', '-DVULKAN_ENABLED'] + OBJCPP_ARGS += ['-fobjc-arc', '-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DCOREAUDIO_ENABLED', '-DVULKAN_ENABLED'] + DEPENDENCIES += ios_deps +endif diff --git a/platform/javascript/meson.build b/platform/javascript/meson.build new file mode 100644 index 000000000000..8373dea4a5ec --- /dev/null +++ b/platform/javascript/meson.build @@ -0,0 +1,69 @@ +# The libraries and defines added in this file are the *requirements* that are +# needed to build on the selected platform. Do not add debug/release/optional +# compilation flags here. + +################################################################################ +# Commands to always run +################################################################################ +_target_javascript_logo = custom_target( + 'javascript_logo', + output: ['logo.gen.h'], + input: ['logo.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'javascript'], + build_by_default: true +) +SOURCES += [_target_javascript_logo] + +_target_javascript_run_icon = custom_target( + 'javascript_run_icon', + output: ['run_icon.gen.h'], + input: ['run_icon.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'javascript'], + build_by_default: true +) +SOURCES += [_target_javascript_run_icon] + + +################################################################################ +# Host Machine Specifics +################################################################################ +if PLATFORM == 'javascript' +dir_base = meson.current_source_dir() + _js_deps = [ + cpp.find_library('library_godot_audio.js', dirs: [meson.current_source_dir() / 'js/libs']), + cpp.find_library('library_godot_audio.js', dirs: [meson.current_source_dir() / 'js/libs']), + cpp.find_library('library_godot_display.js', dirs: [meson.current_source_dir() / 'js/libs']), + cpp.find_library('library_godot_fetch.js', dirs: [meson.current_source_dir() / 'js/libs']), + cpp.find_library('library_godot_os.js', dirs: [meson.current_source_dir() / 'js/libs']), + cpp.find_library('library_godot_runtime.js', dirs: [meson.current_source_dir() / 'js/libs']), + cpp.find_library('library_godot_javascript_singleton.js', dirs: [meson.current_source_dir() / 'js/libs']) + ] + + # add the javascript main to main sources + MAIN_SOURCES += files('javascript_runtime.cpp') + + # the src files for the javascript *platform* library + _javascript_srcs = files([ + 'audio_driver_javascript.cpp', + 'display_server_javascript.cpp', + 'http_client_javascript.cpp', + 'javascript_singleton.cpp', + 'javascript_main.cpp', + 'os_javascript.cpp', + 'api/javascript_tools_editor_plugin.cpp', + ]) + + DEPENDENCIES += _js_deps + + # Explicit IDBFS dependency + DEPENDENCIES += declare_dependency(link_args: '-lidbfs.js') + + CPP_ARGS += [ + '-DJAVASCRIPT_ENABLED', + '-DUNIX_ENABLED', + '-DJAVASCRIPT_EVAL_ENABLED', # TODO + '-DPTHREAD_NO_RENAME' + ] + + SOURCES += _javascript_srcs +endif diff --git a/platform/linuxbsd/meson.build b/platform/linuxbsd/meson.build new file mode 100644 index 000000000000..757ba0f4265f --- /dev/null +++ b/platform/linuxbsd/meson.build @@ -0,0 +1,63 @@ +# The libraries and defines added in this file are the *requirements* that are +# needed to build on the selected platform. Do not add debug/release/optional +# compilation flags here. + +################################################################################ +# Commands to always run +################################################################################ +_target_linuxbsd_logo = custom_target( + 'linuxbsd_logo', + output: ['logo.gen.h'], + input: ['logo.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'linuxbsd'], + build_by_default: true +) +SOURCES += [_target_linuxbsd_logo] + + +################################################################################ +# Host Machine Specifics +################################################################################ +if PLATFORM == 'linuxbsd' + + # add the godot linuxbsd main to main sources + MAIN_SOURCES += files('godot_linuxbsd.cpp') + + # the src files for the linux *platform* + _linuxbsd_srcs = files([ + 'crash_handler_linuxbsd.cpp', + 'os_linuxbsd.cpp', + 'joypad_linux.cpp', + 'context_gl_x11.cpp', + 'detect_prime_x11.cpp', + 'display_server_x11.cpp', + 'vulkan_context_x11.cpp', + 'key_mapping_x11.cpp', + ]) + + # get all of our dependencies + _cpp = meson.get_compiler('cpp') + _linuxbsd_deps = [ + _cpp.find_library('dl'), + dependency('threads'), + + dependency('x11'), + dependency('xcursor'), + dependency('xinerama'), + dependency('xext'), + dependency('xrandr'), + dependency('xrender'), + dependency('xi'), + #dependency('vulkan') + #_cpp.find_library('vulkan'), + ] + + CPP_ARGS += [ + '-DUNIX_ENABLED', + '-DVULKAN_ENABLED', + '-DX11_ENABLED', + ] + + DEPENDENCIES += _linuxbsd_deps + SOURCES += _linuxbsd_srcs +endif diff --git a/platform/meson.build b/platform/meson.build new file mode 100644 index 000000000000..4aa43f2e9930 --- /dev/null +++ b/platform/meson.build @@ -0,0 +1,28 @@ + +_platform_apis = [ + 'android', + 'javascript' +] + +_register_platform_apis_target = custom_target( + 'register_platform_apis', + output: ['register_platform_apis.gen.cpp'], + command: [SCRIPT_REGISTER_PLATFORM_APIS, _platform_apis, '@OUTPUT@'], + build_by_default: true +) +SOURCES += [_register_platform_apis_target] + +# platform apis +SOURCES += files([ + 'android/api/api.cpp', + 'javascript/api/api.cpp' +]) + +subdir('android') +subdir('iphone') +subdir('javascript') +subdir('linuxbsd') +subdir('osx') +#subdir('server') +subdir('uwp') +subdir('windows') diff --git a/platform/osx/meson.build b/platform/osx/meson.build new file mode 100644 index 000000000000..558b01229bc8 --- /dev/null +++ b/platform/osx/meson.build @@ -0,0 +1,51 @@ +# The libraries and defines added in this file are the *requirements* that are +# needed to build on the selected platform. Do not add debug/release/optional +# compilation flags here. + +################################################################################ +# Commands to always run +################################################################################ +_target_osx_logo = custom_target( + 'osx_logo', + output: ['logo.gen.h'], + input: ['logo.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'osx'], + build_by_default: true +) +SOURCES += [_target_osx_logo] + + +################################################################################ +# Host Machine Specifics +################################################################################ +if PLATFORM == 'osx' + MAIN_SOURCES += files('godot_main_osx.mm') + + _osx_srcs = files('joypad_osx.cpp', + #'context_gl_osx.mm', + 'crash_handler_osx.mm', + 'dir_access_osx.mm', + 'display_server_osx.mm', + 'godot_main_osx.mm', + 'os_osx.mm', + 'vulkan_context_osx.mm', + ) + CPP_ARGS += ['-DUNIX_ENABLED', '-DVULKAN_ENABLED', '-DOSX_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED', '-DCOREMIDI_ENABLED'] + OBJCPP_ARGS += ['-DUNIX_ENABLED', '-DVULKAN_ENABLED', '-DOSX_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED', '-DCOREMIDI_ENABLED'] + SOURCES += _osx_srcs + DEPENDENCIES += dependency('appleframeworks', modules: ['AppKit', + 'IOKit', + 'CoreAudio', + 'CoreMidi', + 'CoreVideo', + 'CoreMedia', + 'QuartzCore', + 'CoreServices', + 'Carbon', + 'GameController', + 'CoreHaptics', + 'ForceFeedback', + 'AVFoundation', + 'AudioToolbox', + 'foundation']) +endif diff --git a/platform/uwp/meson.build b/platform/uwp/meson.build new file mode 100644 index 000000000000..ed0636c00f6d --- /dev/null +++ b/platform/uwp/meson.build @@ -0,0 +1,23 @@ +# The libraries and defines added in this file are the *requirements* that are +# needed to build on the selected platform. Do not add debug/release/optional +# compilation flags here. + +################################################################################ +# Commands to always run +################################################################################ +_target_uwp_logo = custom_target( + 'uwp_logo', + output: ['logo.gen.h'], + input: ['logo.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'uwp'], + build_by_default: true +) +SOURCES += [_target_uwp_logo] + + +################################################################################ +# Host Machine Specifics +################################################################################ +if PLATFORM == 'uwp' + error('uwp not implemented yet') +endif diff --git a/platform/windows/meson.build b/platform/windows/meson.build new file mode 100644 index 000000000000..88da5df52caf --- /dev/null +++ b/platform/windows/meson.build @@ -0,0 +1,114 @@ +# The libraries and defines added in this file are the *requirements* that are +# needed to build on the selected platform. Do not add debug/release/optional +# compilation flags here. + +################################################################################ +# Commands to always run +################################################################################ +_target_windows_logo = custom_target( + 'windows_logo', + output: ['logo.gen.h'], + input: ['logo.png'], + command: [SCRIPT_PLATFORM_LOGO, '@INPUT@', '@OUTPUT@', 'windows'], + build_by_default: true +) +SOURCES += [_target_windows_logo] + +################################################################################ +# Host Machine Specifics +################################################################################ +if PLATFORM == 'windows' + # add the windows main to main sources + MAIN_SOURCES += files('godot_windows.cpp') + + # the src files for the windows *platform* library + _windows_srcs = files([ + 'context_gl_windows.cpp', + 'crash_handler_windows.cpp', + 'display_server_windows.cpp', + 'joypad_windows.cpp', + 'key_mapping_windows.cpp', + 'os_windows.cpp', + 'vulkan_context_win.cpp', + 'windows_terminal_logger.cpp' + ]) + + # get all of our dependencies + _cpp = meson.get_compiler('cpp') + + # common deps between msvc and mingw + # Only need to define those that are not part of Meson's defaultlibs, + # which has things like kernel32 et al. + _windows_deps = [ + _cpp.find_library('avrt'), + _cpp.find_library('bcrypt'), + _cpp.find_library('dinput8'), + _cpp.find_library('dsound'), + _cpp.find_library('dwmapi'), + _cpp.find_library('dxguid'), + _cpp.find_library('imm32'), + _cpp.find_library('iphlpapi'), + _cpp.find_library('shlwapi'), + _cpp.find_library('winmm'), + _cpp.find_library('ws2_32'), + _cpp.find_library('wsock32'), + _cpp.find_library('opengl32'), + _cpp.find_library('ksuser'), + ] + + CPP_ARGS += [ + '-DVULKAN_ENABLED', + '-DWINDOWS_ENABLED', + '-DWASAPI_ENABLED', + '-DWINMIDI_ENABLED', + '-DWIN32', + ] + + if get_option('windows_subsystem') == 'console' + CPP_ARGS += '-DWINDOWS_SUBSYSTEM_CONSOLE' + endif + + # TODO: Check if this is needed, msvc will define this, I assume we also define it because of mingw/clang-cl. + # But I would assume it does already. + if host_machine.cpu_family() == 'x86_64' + CPP_ARGS += '-D_WIN64' + endif + + # Native windows compile + if _cpp.get_id() == 'msvc' + + CPP_ARGS += [ + '-DMSVC', + '-DNOMINMAX', + '-DTYPED_METHOD_BIND', + #'-DWIN32', #? + ] + + # TODO: stack size is only used on windows platform...? (1/2) + LINK_ARGS += [ + '/STACK:' + STACK_SIZE.to_string() + ] + # Cross compile with mingw + elif _cpp.get_id() == 'gcc' + _windows_deps += [ + _cpp.find_library('d3d9'), # TODO - not sure why mingw32 needs d3d9 ? + _cpp.find_library('mingw32'), + ] + + CPP_ARGS += [ + '-mwindows', + '-DMINGW_ENABLED', + '-DMINGW_HAS_SECURE_API=1', + ] + + # TODO: stack size is only used on windows platform...? (2/2) + LINK_ARGS += [ + '-Wl,--stack,' + STACK_SIZE.to_string(), + '-static' + ] + endif + + DEPENDENCIES += _windows_deps + SOURCES += _windows_srcs + +endif diff --git a/scene/2d/meson.build b/scene/2d/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/scene/2d/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/scene/3d/meson.build b/scene/3d/meson.build new file mode 100644 index 000000000000..5126ec9a6b44 --- /dev/null +++ b/scene/3d/meson.build @@ -0,0 +1,8 @@ +if get_option('disable_3d') + SOURCES += files([ + 'node_3d.cpp', + 'skeleton_3d.cpp' + ]) +else + SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) +endif diff --git a/scene/animation/meson.build b/scene/animation/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/scene/animation/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/scene/audio/meson.build b/scene/audio/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/scene/audio/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/scene/debugger/meson.build b/scene/debugger/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/scene/debugger/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/scene/gui/meson.build b/scene/gui/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/scene/gui/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/scene/main/meson.build b/scene/main/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/scene/main/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/scene/meson.build b/scene/meson.build new file mode 100644 index 000000000000..25f61d4f738c --- /dev/null +++ b/scene/meson.build @@ -0,0 +1,18 @@ +# thirdparty misc sources +DEPENDENCIES += [ DEP_FREETYPE ] + +SOURCES += files([ + # C sources + '../thirdparty/misc/mikktspace.c', +]) + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +subdir('2d') +subdir('3d') +subdir('animation') +subdir('audio') +subdir('debugger') +subdir('gui') +subdir('main') +subdir('resources') diff --git a/scene/resources/default_theme/default_theme_builders.py b/scene/resources/default_theme/default_theme_builders.py old mode 100644 new mode 100755 index 0455d6d24667..9db56ad9184e --- a/scene/resources/default_theme/default_theme_builders.py +++ b/scene/resources/default_theme/default_theme_builders.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + """Functions used to generate source files during build time All such functions are invoked in a subprocess on Windows to prevent build flakiness. diff --git a/scene/resources/default_theme/meson.build b/scene/resources/default_theme/meson.build new file mode 100644 index 000000000000..b2d845a64967 --- /dev/null +++ b/scene/resources/default_theme/meson.build @@ -0,0 +1,11 @@ +# The theme data will only be triggered when it does not exist. + +_generated_font = custom_target('default_font', + input: '../../../thirdparty/fonts/OpenSans_SemiBold.ttf', + output: 'default_font.gen.h', + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_fonts_header', SCRIPT_DEFAULT_THEME_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@']) + +SOURCES += [_generated_font] + +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/scene/resources/meson.build b/scene/resources/meson.build new file mode 100644 index 000000000000..8b9c3fda68b1 --- /dev/null +++ b/scene/resources/meson.build @@ -0,0 +1,3 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +subdir('default_theme') diff --git a/scripts/docs.py b/scripts/docs.py new file mode 100644 index 000000000000..410706c8f0b8 --- /dev/null +++ b/scripts/docs.py @@ -0,0 +1,92 @@ +#!/usr/bin/python3 + + +import module_db +import utils + +import argparse +import glob +import os +import zlib + + +def __make_doc_data_class_path_header(doc_class_to_path: [(str, str)], output: str): + num_doc_classes = len(doc_class_to_path) + + with open(output, "w", encoding="utf-8") as f: + f.write("static const int _doc_data_class_path_count = " + str(num_doc_classes) + ";\n") + f.write("struct _DocDataClassPath { const char* name; const char* path; };\n") + + f.write("static const _DocDataClassPath _doc_data_class_paths[" + str(num_doc_classes + 1) + "] = {\n") + + for doc_class, doc_path in doc_class_to_path: + f.write('\t{"' + doc_class + '", "' + utils.forward_slashes(doc_path) + '"},\n') + + f.write("\t{nullptr, nullptr}\n") + f.write("};\n") + + +def __make_doc_data_header(doc_xml_paths: [str], project_root: str, output: str): + with open(output, "w", encoding="utf-8") as g: + + buf = "" + docbegin = "" + docend = "" + for doc_xml_path in doc_xml_paths: + with open(os.path.join(project_root, doc_xml_path), "r", encoding="utf-8") as f: + content = f.read() + buf += content + + buf = (docbegin + buf + docend).encode("utf-8") + decomp_size = len(buf) + + buf = zlib.compress(buf) + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _DOC_DATA_RAW_H\n") + g.write("#define _DOC_DATA_RAW_H\n") + g.write("static const int _doc_data_compressed_size = " + str(len(buf)) + ";\n") + g.write("static const int _doc_data_uncompressed_size = " + str(decomp_size) + ";\n") + g.write("static const unsigned char _doc_data_compressed[] = {\n") + for i in range(len(buf)): + g.write("\t" + str(buf[i]) + ",\n") + g.write("};\n") + + g.write("#endif") + + +def __make_doc_generated_files( + module_db_file: str, project_root: str, output_data_class_path: str, output_doc_data_compressed: str +): + mdb = module_db.load_db(module_db_file) + doc_paths: [str] = mdb.get_doc_paths() + + docs: [str] = [] + doc_class_to_path: [(str, str)] = [] + + for doc_path in doc_paths: + glob_path = os.path.join(project_root, doc_path, "*.xml") + + doc_xmls = [os.path.relpath(doc_xml, project_root) for doc_xml in glob.glob(glob_path)] + + docs += doc_xmls + doc_class_to_path += [(os.path.splitext(os.path.basename(doc_xml))[0], doc_path) for doc_xml in doc_xmls] + + __make_doc_data_class_path_header(doc_class_to_path, output_data_class_path) + + __make_doc_data_header(docs, project_root, output_doc_data_compressed) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser("Doc file generators.") + + parser.add_argument("module_db", type=str, help="The module database json file") + parser.add_argument("project_root", type=str, help="The project root directory") + parser.add_argument("output_data_class_path", type=str, help="The output generated doc_data file.") + parser.add_argument("output_doc_data_compressed", type=str, help="The output generated doc_data file.") + + args = parser.parse_args() + + __make_doc_generated_files( + args.module_db, args.project_root, args.output_data_class_path, args.output_doc_data_compressed + ) diff --git a/scripts/encryption_key.py b/scripts/encryption_key.py new file mode 100644 index 000000000000..b5964a1247a2 --- /dev/null +++ b/scripts/encryption_key.py @@ -0,0 +1,42 @@ +#!/usr/bin/python3 + +import os +import argparse + +# Generate AES256 script encryption key + + +def __make_encryption_key(output: str): + txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" + if "SCRIPT_AES256_ENCRYPTION_KEY" in os.environ: + e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"] + txt = "" + ec_valid = True + if len(e) != 64: + ec_valid = False + else: + + for i in range(len(e) >> 1): + if i > 0: + txt += "," + txts = "0x" + e[i * 2 : i * 2 + 2] + try: + int(txts, 16) + except: + ec_valid = False + txt += txts + if not ec_valid: + txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0" + print("Invalid AES256 encryption key, not 64 bits hex: " + e) + + # NOTE: It is safe to generate this file here, since this is still executed serially + with open(output, "w") as f: + f.write('#include "core/config/project_settings.h"\nuint8_t script_encryption_key[32]={' + txt + "};\n") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate the script encryption key.") + parser.add_argument("input", type=str) + + args = parser.parse_args() + __make_encryption_key(args.input) diff --git a/scripts/meson.build b/scripts/meson.build new file mode 100644 index 000000000000..39769ca4ecdf --- /dev/null +++ b/scripts/meson.build @@ -0,0 +1,32 @@ +################################################################################ +# Tools Scripts +################################################################################ +# TODO part in editor/SCsub, part in editor/editor_builders.py +SCRIPT_DOCS = find_program('docs.py') +# In core/SCsub +SCRIPT_ENCRYPTION_KEY = find_program('encryption_key.py') +# Those 2 are heavily customized for meson, this is fine. +SCRIPT_MODULE_DB = find_program('module_db.py') +SCRIPT_MODULES_GEN = find_program('modules_gen.py') +# TODO use methods.save_active_platforms +SCRIPT_PLATFORM_LOGO = find_program('platform_logo.py') +# In editor/SCsub +SCRIPT_REGISTER_EXPORTERS = find_program('register_exporters.py') +# In platforms/SCsub +SCRIPT_REGISTER_PLATFORM_APIS = find_program('register_platform_apis.py') +# TODO use methods.update_version +SCRIPT_VERSION = find_program('version.py') + +SCRIPT_GLSL_BUILDERS = find_program(MESON_SOURCE_ROOT / 'glsl_builders.py').full_path() +SCRIPT_DEFAULT_THEME_BUILDERS = find_program( + MESON_SOURCE_ROOT / 'scene' / 'resources' / 'default_theme' / 'default_theme_builders.py' +).full_path() +SCRIPT_INPUT_BUILDERS = find_program(MESON_SOURCE_ROOT / 'core' / 'input' / 'input_builders.py').full_path() +SCRIPT_EDITOR_BUILDERS = find_program(MESON_SOURCE_ROOT / 'editor' / 'editor_builders.py').full_path() +SCRIPT_EDITOR_ICON_BUILDERS = find_program( + MESON_SOURCE_ROOT / 'editor' / 'icons' / 'editor_icons_builders.py' +).full_path() +SCRIPT_CORE_BUILDERS = find_program(MESON_SOURCE_ROOT / 'core' / 'core_builders.py').full_path() +SCRIPT_MAIN_BUILDERS = find_program(MESON_SOURCE_ROOT / 'main' / 'main_builders.py').full_path() +SCRIPT_VIRTUALS = find_program(MESON_SOURCE_ROOT / 'core' / 'object' / 'make_virtuals.py').full_path() +SCRIPT_COMPAT = find_program('scons_compat.py') diff --git a/scripts/module_db.py b/scripts/module_db.py new file mode 100644 index 000000000000..d66a40c1aa61 --- /dev/null +++ b/scripts/module_db.py @@ -0,0 +1,432 @@ +#!/usr/bin/python3 + +import utils + +import argparse +import runpy +import glob +import os +import sys +import json +import functools +from typing import Dict, Set +from types import SimpleNamespace +from collections import defaultdict + + +def error(*args): + print(args, file=sys.stderr) + + +class Environment: + def __init__(self): + self.platform: str = "" + self.cpu_family: str = "" + self.tools_enabled: bool = False + + +class Module: + def __init__(self, name: str = "", path: str = "", build: bool = True): + self.name = name + self.path = path + self.build = build + self.module_dependencies: dict = {} + self.doc_path: str = "" + self.doc_classes: [str] = [] + self.build_info: [str] = [] + + def _encode(self) -> dict(): + return self.__dict__ + + def _decode(self, data: dict): + for key, value in data.items(): + self.__setattr__(key, value) + + +# uses the graph/topo sort from: +# https://www.geeksforgeeks.org/python-program-for-topological-sorting/ +# albeit highly modified +class ModuleDepGraph: + def __init__(self, modules: [Module]): + self.graph = dict() + self.vertices = [m.name for m in modules] + + # construct the edges + for m in modules: + self.graph[m.name] = [] + for dep_name in m.module_dependencies.keys(): + self.graph[m.name].append(dep_name) + + # A recursive function used by dependency_sort + def topological_sort_util(self, v, visited, stack): + + # Mark the current node as visited. + visited[v] = True + + # Recur for all the vertices adjacent to this vertex + for i in self.graph[v]: + if i in visited and visited[i] == False: + self.topological_sort_util(i, visited, stack) + + # Push current vertex to stack which stores result + stack.insert(0, v) + + # The function to performs a topological sort, and then reverses it to obtain the dependency sort. + def dependency_sort(self) -> []: + # Mark all the vertices as not visited + visited = dict() + for v in self.vertices: + visited[v] = False + + stack = [] + + # Call the recursive helper function to store Topological + # Sort starting from all vertices one by one + for v in self.vertices: + if visited[v] == False: + self.topological_sort_util(v, visited, stack) + + # reverse the topological sort + stack.reverse() + return stack + + +class ModuleDb: + def __init__(self): + self.modules: Dict[str, Module] = dict() + self.modules_enabled: [Module] = [] + self.modules_disabled: [Module] = [] + return + + def _encode(self) -> dict(): + d = dict() + d["modules_enabled"] = self.get_modules_enabled_names() + d["modules_disabled"] = self.get_modules_disabled_names() + d["modules"] = dict() + for module in self.get_modules(): + d["modules"][module.name] = module._encode() + + return d + + def _decode(self, data: dict): + for module_dict in data["modules"].values(): + module = Module() + module._decode(module_dict) + self.modules[module.name] = module + + for mname in data["modules_enabled"]: + self.modules_enabled.append(self.get_module(mname)) + + for mname in data["modules_disabled"]: + self.modules_disabled.append(self.get_module(mname)) + return + + def get_modules(self) -> iter: + return self.modules.values() + + def get_modules_dependency_sorted(self) -> iter: + graph = ModuleDepGraph(self.modules.values()) + dep_sorted_names = graph.dependency_sort() + + dep_modules = [self.modules[x] for x in dep_sorted_names] + return dep_modules + + def get_module(self, module_name: str) -> Module: + return self.modules[module_name] + + def has_module(self, module_name: str) -> bool: + return module_name in self.modules + + def get_doc_paths(self) -> [str]: + dpset = set() + for module in self.modules.values(): + if not module.doc_path or len(module.doc_classes) == 0: + continue + dpset.add(os.path.join(module.path, module.doc_path)) + + dplist: [str] = list(dpset) + dplist.sort() + + return dplist + + def get_modules_enabled_names(self) -> [str]: + em: [str] = [module.name for module in self.get_modules() if module.build] + em.sort() + return em + + def get_modules_disabled_names(self) -> [str]: + dm: [str] = [module.name for module in self.get_modules() if not module.build] + dm.sort() + return dm + + def get_module_build_paths(self) -> [str]: + bp: [str] = [module.path for module in self.get_modules_dependency_sorted() if module.build] + return bp + + +def load_db(module_db_file: str) -> ModuleDb: + if not os.path.isfile(module_db_file): + return None + + mdb: ModuleDb = ModuleDb() + with open(module_db_file, "r") as f: + data = json.load(f) + mdb._decode(data) + + return mdb + + +def write_db(out_file: str, mdb: ModuleDb): + with open(out_file, "w") as f: + json.dump(mdb._encode(), f, indent="\t") + return + + +################################################################################ +# PRIVATE FUNCTIONS FOR THE TOOL +################################################################################ + +# Load the config.py for the module and obtain the information we seek for the module + + +def __parse_module_config(config_path: str, env: Environment) -> Module: + module_path = os.path.dirname(config_path) + + config = runpy.run_path(config_path) + + module_name = "" + if "get_name" in config: + module_name = config["get_name"]() + else: + module_name = os.path.basename(os.path.dirname(config_path)) + + module: Module = Module(name=module_name, path=module_path, build=True) + + if "can_build" in config: + print("xxx", config_path) + + class CompatDict: + def __init__(self, env): + self.d = { + "tools": env.tools_enabled, + "platform": env.platform, + "disable_3d": False, # TODO + "bits": "64" if "64" in env.cpu_family else "32", + "arch": env.cpu_family, + "android_arch": env.cpu_family, + } + + def __getitem__(self, prop): + return self.d[prop] + + def __setitem__(self, prop, value): + self.d[prop] = value + + def module_check_dependencies(self, name, dep): + if name == "msdfgen" and dep == ["freetype"]: + return True # TODO + if name == "vorbis" and dep == ["ogg"]: + return True # TODO + raise ValueError("Unsupported module compat dependency check: name=%s, dep=%s" % [name, dep]) + + compat_env = CompatDict(env) + can_build = False + # TODO hardcoded disables + if module_name not in ["opus", "webm", "theora", "gdnative"]: + can_build = config["can_build"](compat_env, env.platform) + else: + print("xxx", "%s has been manually disabled in meson" % config_path) + pass + module.build &= can_build + if not can_build: + module.build_info.append("The can_build() check failed.") + else: + error("%s has no can_build() method" % config_path) + return None + + if "module_dependencies" in config: + module.module_dependencies = config["module_dependencies"]() + + if "get_doc_path" in config: + module.doc_path = config["get_doc_path"]() + + if "get_doc_classes" in config: + module.doc_classes = config["get_doc_classes"]() + + build_file: str = os.path.join(module_path, "meson.build") + if not os.path.isfile(build_file): + module.build = False + module.build_info.append("The meson.build file for this module is missing.") + + return module + + +# This function verifies all module dependencies (after they have been added to the db) +# and marks the 'build' var if the dependencies are not met. +def __check_module_dependencies(mdb: ModuleDb): + deps_checked: Set[str] = set() + + # Function used recursively to figure out if a module has all of its dependencies + def check_deps(module: Module) -> bool: + # Another module might have checked us + if module.name in deps_checked: + return module.build + + # We are visiting it now + deps_checked.add(module.name) + + # Go through our dependencies + for dep_name, dep_options in module.module_dependencies.items(): + required = dep_options["required"] if "required" in dep_options else True + + # If a module with the name doesn't exist, we have a problem + if not mdb.has_module(dep_name): + module.build = False + module.build_info.append("Dependent module " + dep_name + " not found.") + return False + + # Check if the module we refer to has its dependencies met + elif not check_deps(mdb.get_module(dep_name)) and required: + module.build = False + module.build_info.append('Cannot build module due do dependency "' + dep_name + '" not building.') + + return module.build + + for module in mdb.get_modules(): + check_deps(module) + + +# Create the module database file +def __create_db_file(args): + output = args.output + module_search_paths: [str] = args.module_search_path + modules_disabled: [str] = args.module_disabled + + configs = [] + for msp in module_search_paths: + configs += glob.glob(os.path.join(msp, "**", "config.py")) + + mdb: ModuleDb = ModuleDb() + + for config in configs: + # make a new env for every config, incase someone mutates it + env: Environment = Environment() + env.platform = args.platform + env.cpu_family = args.cpu_family + env.tools_enabled = args.tools_enabled + + module: Module = __parse_module_config(config, env) + if module: + mdb.modules[module.name] = module + else: + error("Failed to parse module config file: %s" % config) + + for module in mdb.get_modules(): + if module.name in modules_disabled: + module.build = False + module.build_info.append("Module was disabled from the command line.") + + __check_module_dependencies(mdb) + + # BRUTE FORCE DISABLE ALL + if args.disable_all: + for module in mdb.get_modules(): + module.build = False + module.build_info.append("Disabled due to disable_all argument") + + for module in mdb.get_modules(): + if module.build: + mdb.modules_enabled.append(module.name) + else: + mdb.modules_disabled.append(module.name) + + write_db(output, mdb) + + +def __print_modules_enabled(module_db_file: str): + mdb: ModuleDb = load_db(module_db_file) + print(",".join(mdb.get_modules_enabled_names())) + + +def __print_modules_disabled(module_db_file: str): + mdb: ModuleDb = load_db(module_db_file) + print(",".join(mdb.get_modules_disabled_names())) + + +def __print_module_build_paths(module_db_file: str): + mdb: ModuleDb = load_db(module_db_file) + print(",".join(mdb.get_module_build_paths())) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Modules tools.") + + subparsers = parser.add_subparsers(help="sub-command help", dest="command") + + # create the database creator parser + create_db_parser = subparsers.add_parser("create_db", help="create_db help") + create_db_parser.add_argument("output", type=str, help="The output modules db.") + create_db_parser.add_argument("--platform", type=str, required=True, help="The current platform being built.") + create_db_parser.add_argument("--cpu_family", type=str, required=True, help="The current cpu_family being built.") + create_db_parser.add_argument( + "--tools_enabled", + dest="tools_enabled", + action="store_true", + help="Whether or not tooling is enabled for this build.", + ) + create_db_parser.add_argument( + "--module_search_path", + type=str, + nargs="+", + action="append", + help=( + "The module search paths to check for config.py's\n" + "This can be specified multiple times for each path, but must be specified at least once." + ), + ) + create_db_parser.add_argument( + "--module_disabled", + type=str, + nargs="*", + action="append", + help=( + "The modules to be disabled for building.\n" + "This can be specified multiple times for each module to be disabled." + ), + ) + create_db_parser.add_argument( + "--disable_all_modules", dest="disable_all", action="store_true", help="Override to disable all modules." + ) + create_db_parser.set_defaults(disable_all=False) + + # modules enabled printer + modules_enabled_parser = subparsers.add_parser("get_enabled_modules", help="get_enabled_modules help") + modules_enabled_parser.add_argument("database_file", type=str, help="The input modules_db file") + + # modules disabled printer + modules_disabled_parser = subparsers.add_parser("get_disabled_modules", help="get_disabled_modules help") + modules_disabled_parser.add_argument("database_file", type=str, help="The input modules_db file") + + # module buld_files printer + modules_bp_parser = subparsers.add_parser("get_module_build_paths", help="get_module_build_paths help") + modules_bp_parser.add_argument("database_file", type=str, help="The input modules_db file") + + args = parser.parse_args() + + # Go through each module and check its configuration + if args.command == "create_db": + args.module_disabled = [x[0] for x in args.module_disabled] + args.module_search_path = [x[0] for x in args.module_search_path] + + __create_db_file(args) + + # Get the list of enabled modules + elif args.command == "get_enabled_modules": + __print_modules_enabled(args.database_file) + + # Get this list of disabled modules + elif args.command == "get_disabled_modules": + __print_modules_disabled(args.database_file) + + elif args.command == "get_module_build_paths": + __print_module_build_paths(args.database_file) diff --git a/scripts/modules_gen.py b/scripts/modules_gen.py new file mode 100644 index 000000000000..dafa87a89e5a --- /dev/null +++ b/scripts/modules_gen.py @@ -0,0 +1,147 @@ +#!/usr/bin/python3 + +import module_db + +import argparse +import os + + +def __make_modules_tests_header(module_db_file: dict, build_root: str, source_root: str, output: str): + import glob + + mdb = module_db.load_db(module_db_file) + with open(os.path.join(build_root, "modules", output), "w") as f: + for module in mdb.get_modules(): + if not module.build: + continue + path = os.path.join(os.path.join(source_root, module.path, "tests")) + headers = glob.glob(os.path.join(path, "*.h")) + for h in headers: + f.write('#include "%s"\n' % (os.path.normpath(h))) + + +def __make_modules_enabled_header(module_db_file: dict, build_root: str, output: str): + mdb = module_db.load_db(module_db_file) + modules_enabled: [str] = mdb.get_modules_enabled_names() + + with open(os.path.join(build_root, "modules", output), "w") as f: + f.write("#ifndef MODULE_GUARD_DEFINES\n") + f.write("#define MODULE_GUARD_DEFINES\n\n") + for module in modules_enabled: + f.write("#define %s\n" % ("MODULE_" + module.upper() + "_ENABLED")) + f.write("\n#endif\n") + + +def __make_register_module_types_cpp(module_db_file: dict, build_root: str, output: str): + includes_cpp = "" + preregister_cpp = "" + register_cpp = "" + unregister_cpp = "" + + mdb = module_db.load_db(module_db_file) + + for module in mdb.get_modules(): + name = module.name + path = module.path + with open(os.path.join(build_root, path, "register_types.h")): + includes_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n" + includes_cpp += '#include "' + path + '/register_types.h"\n' + includes_cpp += "#endif\n" + preregister_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n" + preregister_cpp += "#ifdef MODULE_" + name.upper() + "_HAS_PREREGISTER\n" + preregister_cpp += "\tpreregister_" + name + "_types();\n" + preregister_cpp += "#endif\n" + preregister_cpp += "#endif\n" + register_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n" + register_cpp += "\tregister_" + name + "_types();\n" + register_cpp += "#endif\n" + unregister_cpp += "#ifdef MODULE_" + name.upper() + "_ENABLED\n" + unregister_cpp += "\tunregister_" + name + "_types();\n" + unregister_cpp += "#endif\n" + + modules_cpp = """// register_module_types.gen.cpp +/* THIS FILE IS GENERATED DO NOT EDIT */ +#include "modules/register_module_types.h" + +#include "modules/modules_enabled.gen.h" + +%s + +void preregister_module_types() { +%s +} + +void register_module_types() { +%s +} + +void unregister_module_types() { +%s +} +""" % ( + includes_cpp, + preregister_cpp, + register_cpp, + unregister_cpp, + ) + + # NOTE: It is safe to generate this file here, since this is still executed serially + with open(output, "w") as f: + f.write(modules_cpp) + + return + + +# TODO: I dont like this... +# We should register tests into the module db instead of globbing. +# def __make_modules_tests(module_db_file: str, output: str): + +# module_db_data = module_db.load_module_db(module_db_file) + +# with open(output, 'w') as f: +# for module_data in module_db['modules'].values(): +# if + +# for name, path in env.module_list.items(): +# headers = glob.glob(os.path.join(path, "tests", "*.h")) +# for h in headers: +# f.write('#include "%s"\n' % (os.path.normpath(h))) + + +if __name__ == "__main__": + + parser = argparse.ArgumentParser(description="Module file generators") + + subparsers = parser.add_subparsers(help="sub-command help", dest="command") + + # module enabled + module_enabled_parser = subparsers.add_parser("modules_enabled", help="Generate the modules_enabled file") + module_enabled_parser.add_argument("module_db_file", type=str, help="The module db json file.") + module_enabled_parser.add_argument("build_root", type=str, help="The project build root") + module_enabled_parser.add_argument("output", type=str, help="The output header file.") + + # module tests + module_enabled_tests = subparsers.add_parser("modules_tests", help="Generate the modules_tests file") + module_enabled_tests.add_argument("module_db_file", type=str, help="The module db json file.") + module_enabled_tests.add_argument("build_root", type=str, help="The project build root") + module_enabled_tests.add_argument("source_root", type=str, help="The project build root") + module_enabled_tests.add_argument("output", type=str, help="The output header file.") + + # register module type + register_module_type_parser = subparsers.add_parser( + "register_module_types", help="Generate the register_module_types file" + ) + register_module_type_parser.add_argument("module_db_file", type=str, help="The module db json file.") + register_module_type_parser.add_argument("build_root", type=str, help="The project source root") + register_module_type_parser.add_argument("output", type=str, help="The output cpp file.") + + args = parser.parse_args() + + if args.command == "modules_enabled": + __make_modules_enabled_header(args.module_db_file, args.build_root, args.output) + elif args.command == "register_module_types": + __make_register_module_types_cpp(args.module_db_file, args.build_root, args.output) + elif args.command == "modules_tests": + __make_modules_tests_header(args.module_db_file, args.build_root, args.source_root, args.output) + else: + sys.exit(255) diff --git a/scripts/platform_logo.py b/scripts/platform_logo.py new file mode 100644 index 000000000000..d880cc75cfaf --- /dev/null +++ b/scripts/platform_logo.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 + +import argparse +import os + + +def __make_platform_logo(input: str, output: str, platform: str): + filedata: str = "" + filename, _ = os.path.splitext(os.path.basename(input)) + with open(input, "rb") as pngf: + filedata = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n" + filedata += " static const unsigned char _" + platform + "_" + filename + "[]={" + + png_binary = pngf.read(1) + while len(png_binary) == 1: + filedata += hex(ord(png_binary)) + png_binary = pngf.read(1) + if len(png_binary) == 1: + filedata += "," + + filedata += "};\n" + + with open(output, "w") as pngw: + pngw.write(filedata) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser("Generator for platform logos.") + + parser.add_argument("input", type=str, help="The input image binary file.") + parser.add_argument("output", type=str, help="The output generated header file.") + parser.add_argument("platform", type=str, help="The platform this logo is for.") + + args = parser.parse_args() + + __make_platform_logo(args.input, args.output, args.platform) diff --git a/scripts/register_exporters.py b/scripts/register_exporters.py new file mode 100644 index 000000000000..88572a138441 --- /dev/null +++ b/scripts/register_exporters.py @@ -0,0 +1,29 @@ +#!/usr/bin/python3 + +import argparse + + +def __make_register_exporters_cpp(platforms: [str], output: str): + reg_exporters_inc = '#include "editor/register_exporters.h"\n\n' + reg_exporters = "void register_exporters() {\n" + for platform in platforms: + reg_exporters += "\tregister_" + platform + "_exporter();\n" + reg_exporters_inc += '#include "platform/' + platform + '/export/export.h"\n' + reg_exporters_inc += "\n" + reg_exporters += "}\n" + + # NOTE: It is safe to generate this file here, since this is still executed serially + with open(output, "w", encoding="utf-8") as f: + f.write(reg_exporters_inc) + f.write(reg_exporters) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate regester_exporters.") + + parser.add_argument("platform", nargs="+", type=str, help="The platforms that have exporters.") + parser.add_argument("output", type=str, help="The output generated file.") + + args = parser.parse_args() + + __make_register_exporters_cpp(args.platform, args.output) diff --git a/scripts/register_platform_apis.py b/scripts/register_platform_apis.py new file mode 100644 index 000000000000..c0f6723baccf --- /dev/null +++ b/scripts/register_platform_apis.py @@ -0,0 +1,34 @@ +#!/usr/bin/python3 + +import argparse + + +def __make_register_platform_apis(platforms: [str], output: str): + # Register platform-exclusive APIs + reg_apis_inc = '#include "platform/register_platform_apis.h"\n' + reg_apis = "void register_platform_apis() {\n" + unreg_apis = "void unregister_platform_apis() {\n" + for platform in platforms: + reg_apis += "\tregister_" + platform + "_api();\n" + unreg_apis += "\tunregister_" + platform + "_api();\n" + reg_apis_inc += '#include "platform/' + platform + '/api/api.h"\n' + + reg_apis_inc += "\n" + reg_apis += "}\n\n" + unreg_apis += "}\n" + + with open(output, "w", encoding="utf-8") as f: + f.write(reg_apis_inc) + f.write(reg_apis) + f.write(unreg_apis) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate the platform apis.") + + parser.add_argument("platform", type=str, nargs="+", help="The platforms whose API's we must register") + parser.add_argument("output", type=str, help="The generated api file.") + + args = parser.parse_args() + + __make_register_platform_apis(args.platform, args.output) diff --git a/scripts/scons_compat.py b/scripts/scons_compat.py new file mode 100755 index 000000000000..ef678613fe9d --- /dev/null +++ b/scripts/scons_compat.py @@ -0,0 +1,56 @@ +#!/usr/bin/python3 + +import os, sys, importlib.util +from importlib.machinery import SourceFileLoader + + +def fix_path(name: str, dest: str, base: str): + return os.path.join(os.getenv(base), dest, os.path.basename(name)) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("method") + parser.add_argument("script") + parser.add_argument("-s", "--source-fix-path", default="") + parser.add_argument("-t", "--target-fix-path", default="") + parser.add_argument("-i", "--inputs", nargs="+", default=[]) + parser.add_argument("-o", "--outputs", nargs="+", default=[]) + parser.add_argument("-e", "--scons-env", nargs="+", default=[]) + + args = parser.parse_args() + + script = args.script + if "MESON_SOURCE_ROOT" in os.environ: + sys.path.append(os.getenv("MESON_SOURCE_ROOT")) + script = os.path.join(os.getenv("MESON_SOURCE_ROOT"), script) + + sources = [] + if args.source_fix_path: + for s in args.inputs: + sources.append(fix_path(s, args.source_fix_path, "MESON_SOURCE_ROOT")) + else: + sources = args.inputs + + targets = [] + if args.target_fix_path: + for t in args.outputs: + targets.append(fix_path(t, args.target_fix_path, "MESON_BUILD_ROOT")) + else: + targets = args.outputs + + env = None + if args.scons_env: + env = dict() + for v in args.scons_env: + key, val = v.split("=", 1) + if val == "true": + val = True + elif val == "false": + val = False + env[key] = val + + mymodule = SourceFileLoader("script", script).load_module() + getattr(mymodule, args.method)(targets, sources, env) diff --git a/scripts/sourceglobber.py b/scripts/sourceglobber.py new file mode 100644 index 000000000000..d60095bf20cb --- /dev/null +++ b/scripts/sourceglobber.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +import sys, os +from glob import glob + + +def glob_pattern(what): + return sorted(glob(what)) + + +def glob_and_print(what): + files = glob_pattern(what) + if not files: + return + for f in files[:-1]: + print(f) + print(files[-1], end="") + + +if __name__ == "__main__": + glob_and_print(sys.argv[1]) diff --git a/scripts/utils.py b/scripts/utils.py new file mode 100644 index 000000000000..b83fe6b70202 --- /dev/null +++ b/scripts/utils.py @@ -0,0 +1,25 @@ +import os, sys + + +def escape_string(s: str) -> str: + def charcode_to_c_escapes(c): + rev_result = [] + while c >= 256: + c, low = (c // 256, c % 256) + rev_result.append("\\%03o" % low) + rev_result.append("\\%03o" % c) + return "".join(reversed(rev_result)) + + result = "" + if isinstance(s, str): + s = s.encode("utf-8") + for c in s: + if not (32 <= c < 127) or c in (ord("\\"), ord('"')): + result += charcode_to_c_escapes(c) + else: + result += chr(c) + return result + + +def forward_slashes(s: str) -> str: + return s.replace("\\", "/") diff --git a/scripts/version.py b/scripts/version.py new file mode 100644 index 000000000000..456735ac97bf --- /dev/null +++ b/scripts/version.py @@ -0,0 +1,77 @@ +#!/usr/bin/python3 + +import argparse +import json +import os + +modules_to_show_in_version = ["mono"] + + +def __make_version_header(json_version_file: str, out_version_file: str, out_hash_file: str, built_modules: [str]): + version = {} + with open(json_version_file, "r") as f: + version = json.load(f) + + build_name = "custom_build" + if os.getenv("BUILD_NAME") != None: + build_name = os.getenv("BUILD_NAME") + print("Using custom build name: " + build_name) + + version_modules = [x for x in built_modules if x in modules_to_show_in_version] + + f = open(out_version_file, "w") + f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + f.write("#ifndef VERSION_GENERATED_GEN_H\n") + f.write("#define VERSION_GENERATED_GEN_H\n") + f.write('#define VERSION_SHORT_NAME "' + str(version["short_name"]) + '"\n') + f.write('#define VERSION_NAME "' + str(version["name"]) + '"\n') + f.write("#define VERSION_MAJOR " + str(version["major"]) + "\n") + f.write("#define VERSION_MINOR " + str(version["minor"]) + "\n") + f.write("#define VERSION_PATCH " + str(version["patch"]) + "\n") + f.write('#define VERSION_STATUS "' + str(version["status"]) + '"\n') + f.write('#define VERSION_BUILD "' + str(build_name) + '"\n') + + version_array = [str(version["module_config"])] + version_modules + + f.write('#define VERSION_MODULE_CONFIG "' + ".".join(version_array) + '"\n') + f.write("#define VERSION_YEAR " + str(version["year"]) + "\n") + f.write('#define VERSION_WEBSITE "' + str(version["website"]) + '"\n') + f.write("#endif // VERSION_GENERATED_GEN_H\n") + f.close() + + # NOTE: It is safe to generate this file here, since this is still executed serially + fhash = open(out_hash_file, "w") + fhash.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + fhash.write("#ifndef VERSION_HASH_GEN_H\n") + fhash.write("#define VERSION_HASH_GEN_H\n") + githash = "" + gitfolder = ".git" + + if os.path.isfile(".git"): + module_folder = open(".git", "r").readline().strip() + if module_folder.startswith("gitdir: "): + gitfolder = module_folder[8:] + + if os.path.isfile(os.path.join(gitfolder, "HEAD")): + head = open(os.path.join(gitfolder, "HEAD"), "r", encoding="utf8").readline().strip() + if head.startswith("ref: "): + head = os.path.join(gitfolder, head[5:]) + if os.path.isfile(head): + githash = open(head, "r").readline().strip() + else: + githash = head + + fhash.write('#define VERSION_HASH "' + githash + '"\n') + fhash.write("#endif // VERSION_HASH_GEN_H\n") + fhash.close() + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate the version header") + parser.add_argument("json_version_file", type=str) + parser.add_argument("out_version_file", type=str) + parser.add_argument("out_hash_file", type=str) + parser.add_argument("built_modules", type=str, nargs="*") + + args = parser.parse_args() + __make_version_header(args.json_version_file, args.out_version_file, args.out_hash_file, args.built_modules) diff --git a/servers/audio/effects/meson.build b/servers/audio/effects/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/servers/audio/effects/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/servers/audio/meson.build b/servers/audio/meson.build new file mode 100644 index 000000000000..85559d3400d9 --- /dev/null +++ b/servers/audio/meson.build @@ -0,0 +1,3 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +subdir('effects') diff --git a/servers/camera/meson.build b/servers/camera/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/servers/camera/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/servers/meson.build b/servers/meson.build new file mode 100644 index 000000000000..acf3d109e20b --- /dev/null +++ b/servers/meson.build @@ -0,0 +1,8 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +subdir('audio') +subdir('camera') +subdir('physics_2d') +subdir('physics_3d') +subdir('rendering') +subdir('xr') diff --git a/servers/physics_2d/meson.build b/servers/physics_2d/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/servers/physics_2d/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/servers/physics_3d/joints/meson.build b/servers/physics_3d/joints/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/servers/physics_3d/joints/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/servers/physics_3d/meson.build b/servers/physics_3d/meson.build new file mode 100644 index 000000000000..4cb5df5a2799 --- /dev/null +++ b/servers/physics_3d/meson.build @@ -0,0 +1,3 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +subdir('joints') diff --git a/servers/rendering/meson.build b/servers/rendering/meson.build new file mode 100644 index 000000000000..9bbb4eb956be --- /dev/null +++ b/servers/rendering/meson.build @@ -0,0 +1,3 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +subdir('renderer_rd') diff --git a/servers/rendering/renderer_rd/forward_clustered/meson.build b/servers/rendering/renderer_rd/forward_clustered/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/servers/rendering/renderer_rd/forward_clustered/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/servers/rendering/renderer_rd/forward_mobile/meson.build b/servers/rendering/renderer_rd/forward_mobile/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/servers/rendering/renderer_rd/forward_mobile/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/servers/rendering/renderer_rd/meson.build b/servers/rendering/renderer_rd/meson.build new file mode 100644 index 000000000000..0594a93983dc --- /dev/null +++ b/servers/rendering/renderer_rd/meson.build @@ -0,0 +1,5 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) + +subdir('forward_clustered') +subdir('forward_mobile') +subdir('shaders') diff --git a/servers/rendering/renderer_rd/shaders/meson.build b/servers/rendering/renderer_rd/shaders/meson.build new file mode 100644 index 000000000000..946a8c7cb0a3 --- /dev/null +++ b/servers/rendering/renderer_rd/shaders/meson.build @@ -0,0 +1,15 @@ +# NOTE: do not use files() here +_rd_shaders = run_command(GLOB, '*.glsl').stdout().split('\n') + +foreach glsl_file : _rd_shaders + _rd_target = custom_target( + 'rd_target_' + glsl_file, + output: '@PLAINNAME@.gen.h', + input: files(glsl_file), + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'build_rd_headers', SCRIPT_GLSL_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: true + ) + + SOURCES += [_rd_target] +endforeach diff --git a/servers/xr/meson.build b/servers/xr/meson.build new file mode 100644 index 000000000000..8a9708c46449 --- /dev/null +++ b/servers/xr/meson.build @@ -0,0 +1 @@ +SOURCES += files(run_command(GLOB, '*.cpp').stdout().split('\n')) diff --git a/splash/meson.build b/splash/meson.build new file mode 100644 index 000000000000..443a89452518 --- /dev/null +++ b/splash/meson.build @@ -0,0 +1,30 @@ + +_splash_target = custom_target( + 'splash', + output: ['splash.gen.h'], + input: ['../main/splash.png'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_splash', SCRIPT_MAIN_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@', '-t', 'main'], + build_by_default: true +) +SOURCES += [_splash_target] + +_splash_editor_target = custom_target( + 'splash_editor', + output: ['splash_editor.gen.h'], + input: ['../main/splash_editor.png'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_splash_editor', SCRIPT_MAIN_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@', '-t', 'main'], + build_by_default: true +) +SOURCES += [_splash_editor_target] + +_app_icon_target = custom_target( + 'app_icon', + output: ['app_icon.gen.h'], + input: ['../main/app_icon.png'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'make_app_icon', SCRIPT_MAIN_BUILDERS, '-i', '@INPUT@', '-o', '@OUTPUT@', '-t', 'main'], + build_by_default: true +) +SOURCES += [_app_icon_target] diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 000000000000..8bb59768c6f3 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,19 @@ +if get_option('tests') + _tests_srcs = files(run_command(GLOB, '*.cpp').stdout().split('\n')) + + _tests_cpp_args = [] + if PLATFORM == 'windows' + _tests_cpp_args += '-DDOCTEST_THREAD_LOCAL' + endif + + #_tests_incdirs = include_directories('.') + + lib_tests = static_library('tests', _tests_srcs, builtin_fonts_gen, + cpp_args: _tests_cpp_args, + include_directories: INCDIRS, + dependencies: DEP_GODOT_ALL, + build_by_default: false) + # include_directories: _builtin_libogg_incdirs, + + DEP_TESTS = declare_dependency(link_with: lib_tests) +endif diff --git a/thirdparty/basis_universal/meson.build b/thirdparty/basis_universal/meson.build new file mode 100644 index 000000000000..3186b8370753 --- /dev/null +++ b/thirdparty/basis_universal/meson.build @@ -0,0 +1,48 @@ +_basis_universal_incdirs = include_directories('.') + +_basis_universal_srcs = files([ +'encoder/basisu_astc_decomp.cpp', +'encoder/basisu_backend.cpp', +'encoder/basisu_basis_file.cpp', +'encoder/basisu_bc7enc.cpp', +'encoder/basisu_comp.cpp', +'encoder/basisu_enc.cpp', +'encoder/basisu_etc.cpp', +'encoder/basisu_frontend.cpp', +'encoder/basisu_global_selector_palette_helpers.cpp', +'encoder/basisu_gpu_texture.cpp', +'encoder/basisu_kernels_sse.cpp', +'encoder/basisu_pvrtc1_4.cpp', +'encoder/basisu_resample_filters.cpp', +'encoder/basisu_resampler.cpp', +'encoder/basisu_ssim.cpp', +'encoder/basisu_uastc_enc.cpp', +'encoder/jpgd.cpp', +'encoder/lodepng.cpp', + + 'encoder/apg_bmp.c', + + # this was guarded by tools enabled, but it seems to be incorrect + 'transcoder/basisu_transcoder.cpp' +]) + +_basis_universal_cpp_args = [] + +if meson.get_compiler('cpp').get_id() == 'msvc' + _basis_universal_cpp_args += ['-DBASISU_NO_ITERATOR_DEBUG_LEVEL', '-DNOMINMAX'] +elif meson.get_compiler('cpp').get_id() == 'gcc' + _basis_universal_cpp_args += '-Wno-multichar' +endif + +if get_option('debug') + _basis_universal_cpp_args += ['-DBASISU_DEVEL_MESSAGES=1', '-DBASISD_ENABLE_DEBUG_FLAGS=1'] +endif + + +_lib_basis_universal = static_library('builtin_basis_universal', _basis_universal_srcs, + include_directories: _basis_universal_incdirs, + cpp_args: _basis_universal_cpp_args, + build_by_default: false +) + +DEP_BASIS_UNIVERSAL = declare_dependency(link_with: _lib_basis_universal, include_directories: _basis_universal_incdirs) diff --git a/thirdparty/bullet/meson.build b/thirdparty/bullet/meson.build new file mode 100644 index 000000000000..bd18d6976509 --- /dev/null +++ b/thirdparty/bullet/meson.build @@ -0,0 +1,196 @@ +if get_option('builtin_bullet') + _bullet_incdirs = include_directories('.') + + _bullet_srcs = files([ + # BulletCollision + 'BulletCollision/BroadphaseCollision/btAxisSweep3.cpp', + 'BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp', + 'BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp', + 'BulletCollision/BroadphaseCollision/btDbvt.cpp', + 'BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp', + 'BulletCollision/BroadphaseCollision/btDispatcher.cpp', + 'BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp', + 'BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp', + 'BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp', + 'BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp', + 'BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp', + 'BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp', + 'BulletCollision/CollisionDispatch/btCollisionObject.cpp', + 'BulletCollision/CollisionDispatch/btCollisionWorld.cpp', + 'BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp', + 'BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp', + 'BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btGhostObject.cpp', + 'BulletCollision/CollisionDispatch/btHashedSimplePairCache.cpp', + 'BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp', + 'BulletCollision/CollisionDispatch/btManifoldResult.cpp', + 'BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp', + 'BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp', + 'BulletCollision/CollisionDispatch/btUnionFind.cpp', + 'BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp', + 'BulletCollision/CollisionShapes/btBoxShape.cpp', + 'BulletCollision/CollisionShapes/btBox2dShape.cpp', + 'BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp', + 'BulletCollision/CollisionShapes/btCapsuleShape.cpp', + 'BulletCollision/CollisionShapes/btCollisionShape.cpp', + 'BulletCollision/CollisionShapes/btCompoundShape.cpp', + 'BulletCollision/CollisionShapes/btConcaveShape.cpp', + 'BulletCollision/CollisionShapes/btConeShape.cpp', + 'BulletCollision/CollisionShapes/btConvexHullShape.cpp', + 'BulletCollision/CollisionShapes/btConvexInternalShape.cpp', + 'BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp', + 'BulletCollision/CollisionShapes/btConvexPolyhedron.cpp', + 'BulletCollision/CollisionShapes/btConvexShape.cpp', + 'BulletCollision/CollisionShapes/btConvex2dShape.cpp', + 'BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp', + 'BulletCollision/CollisionShapes/btCylinderShape.cpp', + 'BulletCollision/CollisionShapes/btEmptyShape.cpp', + 'BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp', + 'BulletCollision/CollisionShapes/btMiniSDF.cpp', + 'BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp', + 'BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp', + 'BulletCollision/CollisionShapes/btMultiSphereShape.cpp', + 'BulletCollision/CollisionShapes/btOptimizedBvh.cpp', + 'BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp', + 'BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp', + 'BulletCollision/CollisionShapes/btSdfCollisionShape.cpp', + 'BulletCollision/CollisionShapes/btShapeHull.cpp', + 'BulletCollision/CollisionShapes/btSphereShape.cpp', + 'BulletCollision/CollisionShapes/btStaticPlaneShape.cpp', + 'BulletCollision/CollisionShapes/btStridingMeshInterface.cpp', + 'BulletCollision/CollisionShapes/btTetrahedronShape.cpp', + 'BulletCollision/CollisionShapes/btTriangleBuffer.cpp', + 'BulletCollision/CollisionShapes/btTriangleCallback.cpp', + 'BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp', + 'BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp', + 'BulletCollision/CollisionShapes/btTriangleMesh.cpp', + 'BulletCollision/CollisionShapes/btTriangleMeshShape.cpp', + 'BulletCollision/CollisionShapes/btUniformScalingShape.cpp', + 'BulletCollision/Gimpact/btContactProcessing.cpp', + 'BulletCollision/Gimpact/btGenericPoolAllocator.cpp', + 'BulletCollision/Gimpact/btGImpactBvh.cpp', + 'BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp', + 'BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp', + 'BulletCollision/Gimpact/btGImpactShape.cpp', + 'BulletCollision/Gimpact/btTriangleShapeEx.cpp', + 'BulletCollision/Gimpact/gim_box_set.cpp', + 'BulletCollision/Gimpact/gim_contact.cpp', + 'BulletCollision/Gimpact/gim_memory.cpp', + 'BulletCollision/Gimpact/gim_tri_collision.cpp', + 'BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp', + 'BulletCollision/NarrowPhaseCollision/btConvexCast.cpp', + 'BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp', + 'BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp', + 'BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp', + 'BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp', + 'BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp', + 'BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp', + 'BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp', + 'BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp', + 'BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp', + 'BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp', + # BulletDynamics + 'BulletDynamics/Character/btKinematicCharacterController.cpp', + 'BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btContactConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btFixedConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btGearConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp', + 'BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp', + 'BulletDynamics/ConstraintSolver/btHingeConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp', + 'BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolverMt.cpp', + 'BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp', + 'BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp', + 'BulletDynamics/ConstraintSolver/btSliderConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btTypedConstraint.cpp', + 'BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp', + 'BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp', + 'BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp', + 'BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp', + 'BulletDynamics/Dynamics/btRigidBody.cpp', + 'BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp', + # 'BulletDynamics/Dynamics/Bullet-C-API.cpp', + 'BulletDynamics/Vehicle/btRaycastVehicle.cpp', + 'BulletDynamics/Vehicle/btWheelInfo.cpp', + 'BulletDynamics/Featherstone/btMultiBody.cpp', + 'BulletDynamics/Featherstone/btMultiBodyConstraint.cpp', + 'BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp', + 'BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp', + 'BulletDynamics/Featherstone/btMultiBodyFixedConstraint.cpp', + 'BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp', + 'BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp', + 'BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp', + 'BulletDynamics/Featherstone/btMultiBodyMLCPConstraintSolver.cpp', + 'BulletDynamics/Featherstone/btMultiBodyPoint2Point.cpp', + 'BulletDynamics/Featherstone/btMultiBodySliderConstraint.cpp', + 'BulletDynamics/Featherstone/btMultiBodySphericalJointMotor.cpp', + 'BulletDynamics/MLCPSolvers/btDantzigLCP.cpp', + 'BulletDynamics/MLCPSolvers/btMLCPSolver.cpp', + 'BulletDynamics/MLCPSolvers/btLemkeAlgorithm.cpp', + # BulletInverseDynamics + 'BulletInverseDynamics/IDMath.cpp', + 'BulletInverseDynamics/MultiBodyTree.cpp', + 'BulletInverseDynamics/details/MultiBodyTreeInitCache.cpp', + 'BulletInverseDynamics/details/MultiBodyTreeImpl.cpp', + # BulletSoftBody + 'BulletSoftBody/btSoftBody.cpp', + 'BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp', + 'BulletSoftBody/btSoftBodyHelpers.cpp', + 'BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.cpp', + 'BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp', + 'BulletSoftBody/btSoftRigidDynamicsWorld.cpp', + 'BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp', + 'BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp', + 'BulletSoftBody/btDefaultSoftBodySolver.cpp', + 'BulletSoftBody/btDeformableBackwardEulerObjective.cpp', + 'BulletSoftBody/btDeformableBodySolver.cpp', + 'BulletSoftBody/btDeformableMultiBodyConstraintSolver.cpp', + 'BulletSoftBody/btDeformableContactProjection.cpp', + 'BulletSoftBody/btDeformableMultiBodyDynamicsWorld.cpp', + 'BulletSoftBody/btDeformableContactConstraint.cpp', + 'BulletSoftBody/poly34.cpp', + # clew + 'clew/clew.c', + # LinearMath + 'LinearMath/btAlignedAllocator.cpp', + 'LinearMath/btConvexHull.cpp', + 'LinearMath/btConvexHullComputer.cpp', + 'LinearMath/btGeometryUtil.cpp', + 'LinearMath/btPolarDecomposition.cpp', + 'LinearMath/btQuickprof.cpp', + 'LinearMath/btSerializer.cpp', + 'LinearMath/btSerializer64.cpp', + 'LinearMath/btThreads.cpp', + 'LinearMath/btVector3.cpp', + 'LinearMath/TaskScheduler/btTaskScheduler.cpp', + 'LinearMath/TaskScheduler/btThreadSupportPosix.cpp', + 'LinearMath/TaskScheduler/btThreadSupportWin32.cpp', + ]) + + _bullet_cpp_args = ['-DBT_USE_OLD_DAMPING_METHOD'] + if get_option('debug') + _bullet_cpp_args += ['-DDEBUG'] + endif + + _lib_bullet = static_library('builtin_bullet', _bullet_srcs, include_directories: _bullet_incdirs, cpp_args: _bullet_cpp_args, build_by_default: false) + + DEP_BULLET = declare_dependency(link_with: _lib_bullet, include_directories: _bullet_incdirs) +else + DEP_BULLET = dependency('bullet', version: '>=2.90') +endif \ No newline at end of file diff --git a/thirdparty/cvtt/meson.build b/thirdparty/cvtt/meson.build new file mode 100644 index 000000000000..e0dd492299a4 --- /dev/null +++ b/thirdparty/cvtt/meson.build @@ -0,0 +1,9 @@ +_cvtt_incdirs = include_directories('.') + +_cvtt_srcs = files([ + 'ConvectionKernels.cpp' +]) + +_lib_cvtt = static_library('builtin_cvtt', _cvtt_srcs, include_directories: _cvtt_incdirs, build_by_default: false) + +DEP_CVTT = declare_dependency(link_with: _lib_cvtt, include_directories: _cvtt_incdirs) diff --git a/thirdparty/enet/meson.build b/thirdparty/enet/meson.build new file mode 100644 index 000000000000..be7a4249eac7 --- /dev/null +++ b/thirdparty/enet/meson.build @@ -0,0 +1,37 @@ +if get_option('builtin_enet') + # builtin enet uses files directly from godot source.... and platform folder.... + _enet_incdirs = include_directories('.', '../..', '../..' / DIR_PLATFORM) + _enet_incdirs_pub = include_directories('.') + + _enet_srcs = files( + 'callbacks.c', + 'compress.c', + 'host.c', + 'list.c', + 'packet.c', + 'peer.c', + 'protocol.c', + ) + + _enet_compile_dep_defines = ['-DGODOT_ENET'] + + if PLATFORM == 'windows' + _enet_compile_dep_defines += '-DWINDOWS_ENABLED' + else + _enet_compile_dep_defines += '-DUNIX_ENABLED' + endif + + _lib_enet = static_library('builtin_enet', _enet_srcs, + include_directories: _enet_incdirs, + cpp_args: _enet_compile_dep_defines, + c_args: _enet_compile_dep_defines, + build_by_default: false + ) + + DEP_ENET = declare_dependency(link_with: _lib_enet, + sources: files('godot.cpp'), + compile_args: _enet_compile_dep_defines, + include_directories: _enet_incdirs_pub) +else + DEP_ENET = dependency('libenet') +endif diff --git a/thirdparty/etcpak/meson.build b/thirdparty/etcpak/meson.build new file mode 100644 index 000000000000..1ea05e85dd14 --- /dev/null +++ b/thirdparty/etcpak/meson.build @@ -0,0 +1,17 @@ +# the include directory +_etcpak_srcs = files( + 'Dither.cpp', + 'ProcessDxtc.cpp', + 'ProcessRGB.cpp', + 'Tables.cpp', +) + +_etcpak_cpp_args = [] +if PLATFORM == 'windows' + _etcpak_cpp_args += ['-DNOMINMAX'] +endif + +_lib_etcpak = static_library('etcpak', + _etcpak_srcs, + cpp_args: _etcpak_cpp_args) +DEP_ETCPAK = declare_dependency(link_with: _lib_etcpak) diff --git a/thirdparty/freetype/meson.build b/thirdparty/freetype/meson.build new file mode 100644 index 000000000000..ddd5111134e0 --- /dev/null +++ b/thirdparty/freetype/meson.build @@ -0,0 +1,66 @@ +if get_option('builtin_freetype') + _freetype_incdirs = include_directories('include') + + _freetype_srcs = files([ + 'src/autofit/autofit.c', + 'src/base/ftbase.c', + 'src/base/ftbbox.c', + 'src/base/ftbdf.c', + 'src/base/ftbitmap.c', + 'src/base/ftcid.c', + 'src/base/ftdebug.c', + 'src/base/ftfstype.c', + 'src/base/ftgasp.c', + 'src/base/ftglyph.c', + 'src/base/ftgxval.c', + 'src/base/ftinit.c', + 'src/base/ftmm.c', + 'src/base/ftotval.c', + 'src/base/ftpatent.c', + 'src/base/ftpfr.c', + 'src/base/ftstroke.c', + 'src/base/ftsynth.c', + 'src/base/ftsystem.c', + 'src/base/fttype1.c', + 'src/base/ftwinfnt.c', + 'src/bdf/bdf.c', + 'src/bzip2/ftbzip2.c', + 'src/cache/ftcache.c', + 'src/cff/cff.c', + 'src/cid/type1cid.c', + 'src/gxvalid/gxvalid.c', + 'src/gzip/ftgzip.c', + 'src/lzw/ftlzw.c', + 'src/otvalid/otvalid.c', + 'src/pcf/pcf.c', + 'src/pfr/pfr.c', + 'src/psaux/psaux.c', + 'src/pshinter/pshinter.c', + 'src/psnames/psnames.c', + 'src/raster/raster.c', + 'src/smooth/smooth.c', + 'src/truetype/truetype.c', + 'src/type1/type1.c', + 'src/type42/type42.c', + 'src/winfonts/winfnt.c', + 'src/sfnt/sfnt.c' + ]) + + _freetype_dep_defines = ['-DFT2_BUILD_LIBRARY', '-DFT_CONFIG_OPTION_USE_PNG'] + + _freetype_c_defines = [] + if PLATFORM == 'javascript' + _freetype_c_defines += ['-U__OPTIMIZE__'] + endif + + + if meson.get_compiler('c').get_id() == 'msvc' + _freetype_c_defines += ['/wd4312'] + endif + + _lib_freetype2 = static_library('freetype2', _freetype_srcs, include_directories: _freetype_incdirs, c_args: _freetype_dep_defines + _freetype_c_defines, dependencies: [DEP_ZLIB, DEP_LIBPNG], build_by_default: false) + + DEP_FREETYPE = declare_dependency(link_with: _lib_freetype2, include_directories: _freetype_incdirs, compile_args: _freetype_dep_defines) +else + DEP_FREETYPE = dependency('freetype2') +endif diff --git a/thirdparty/glslang/meson.build b/thirdparty/glslang/meson.build new file mode 100644 index 000000000000..88111fb59898 --- /dev/null +++ b/thirdparty/glslang/meson.build @@ -0,0 +1,72 @@ +if get_option('builtin_glslang') + _glslang_incdir = include_directories('.') + + _glslang_srcs = files([ + 'OGLCompilersDLL/InitializeDll.cpp', + 'SPIRV/CInterface/spirv_c_interface.cpp', + 'SPIRV/GlslangToSpv.cpp', + 'SPIRV/InReadableOrder.cpp', + 'SPIRV/Logger.cpp', + 'SPIRV/SPVRemapper.cpp', + 'SPIRV/SpvBuilder.cpp', + 'SPIRV/SpvPostProcess.cpp', + 'SPIRV/SpvTools.cpp', + 'SPIRV/disassemble.cpp', + 'SPIRV/doc.cpp', + 'StandAlone/ResourceLimits.cpp', + 'glslang/CInterface/glslang_c_interface.cpp', + 'glslang/GenericCodeGen/CodeGen.cpp', + 'glslang/GenericCodeGen/Link.cpp', + 'glslang/MachineIndependent/Constant.cpp', + 'glslang/MachineIndependent/InfoSink.cpp', + 'glslang/MachineIndependent/Initialize.cpp', + 'glslang/MachineIndependent/IntermTraverse.cpp', + 'glslang/MachineIndependent/Intermediate.cpp', + 'glslang/MachineIndependent/ParseContextBase.cpp', + 'glslang/MachineIndependent/ParseHelper.cpp', + 'glslang/MachineIndependent/PoolAlloc.cpp', + 'glslang/MachineIndependent/RemoveTree.cpp', + 'glslang/MachineIndependent/Scan.cpp', + 'glslang/MachineIndependent/ShaderLang.cpp', + 'glslang/MachineIndependent/SymbolTable.cpp', + 'glslang/MachineIndependent/SpirvIntrinsics.cpp', + 'glslang/MachineIndependent/Versions.cpp', + 'glslang/MachineIndependent/attribute.cpp', + 'glslang/MachineIndependent/glslang_tab.cpp', + 'glslang/MachineIndependent/intermOut.cpp', + 'glslang/MachineIndependent/iomapper.cpp', + 'glslang/MachineIndependent/limits.cpp', + 'glslang/MachineIndependent/linkValidate.cpp', + 'glslang/MachineIndependent/parseConst.cpp', + 'glslang/MachineIndependent/preprocessor/Pp.cpp', + 'glslang/MachineIndependent/preprocessor/PpAtom.cpp', + 'glslang/MachineIndependent/preprocessor/PpContext.cpp', + 'glslang/MachineIndependent/preprocessor/PpScanner.cpp', + 'glslang/MachineIndependent/preprocessor/PpTokens.cpp', + 'glslang/MachineIndependent/propagateNoContraction.cpp', + 'glslang/MachineIndependent/reflection.cpp', + ]) + + _glslang_cpp_flags = ['-DENABLE_OPT=0'] + + if PLATFORM == 'windows' + _glslang_srcs += files(['glslang/OSDependent/Windows/ossource.cpp']) + else + _glslang_srcs += files(['glslang/OSDependent/Unix/ossource.cpp']) + endif + + # TODO: investiage + # if meson.get_compiler('cpp').get_id() != 'msvc' + # _glslang_cpp_flags += ['-isystem'] + # endif + + _lib_glslang = static_library('glslang', _glslang_srcs, include_directories: _glslang_incdir, cpp_args: _glslang_cpp_flags, build_by_default: false) + + DEP_GLSLANG = declare_dependency(link_with: _lib_glslang, include_directories: _glslang_incdir) + +else + DEP_GLSLANG = [ + dependency('glslang'), + meson.get_compiler('cpp').find_library('SPIRV') + ] +endif diff --git a/thirdparty/graphite/meson.build b/thirdparty/graphite/meson.build new file mode 100644 index 000000000000..7ba6005ca99d --- /dev/null +++ b/thirdparty/graphite/meson.build @@ -0,0 +1,70 @@ +if get_option('builtin_graphite') + + _builtin_graphite_dep_incdirs = include_directories('include') + _builtin_graphite_incdirs = include_directories('include', 'src') + + _builtin_graphite_srcs = files([ + 'src/gr_char_info.cpp', + 'src/gr_face.cpp', + 'src/gr_features.cpp', + 'src/gr_font.cpp', + 'src/gr_logging.cpp', + 'src/gr_segment.cpp', + 'src/gr_slot.cpp', + 'src/CmapCache.cpp', + 'src/Code.cpp', + 'src/Collider.cpp', + 'src/Decompressor.cpp', + 'src/Face.cpp', + #'src/FileFace.cpp', + 'src/FeatureMap.cpp', + 'src/Font.cpp', + 'src/GlyphCache.cpp', + 'src/GlyphFace.cpp', + 'src/Intervals.cpp', + 'src/Justifier.cpp', + 'src/NameTable.cpp', + 'src/Pass.cpp', + 'src/Position.cpp', + 'src/Segment.cpp', + 'src/Silf.cpp', + 'src/Slot.cpp', + 'src/Sparse.cpp', + 'src/TtfUtil.cpp', + 'src/UtfCodec.cpp', + 'src/FileFace.cpp', + 'src/json.cpp', + ]) + + _builtin_graphite_compile_args = [ + '-DGRAPHITE2_STATIC', + '-DGRAPHITE2_NTRACING', + '-DGRAPHITE2_NFILEFACE', + ] + + if meson.get_compiler('cpp').get_id() == 'msvc' + _builtin_graphite_srcs += files(['src/call_machine.cpp']) + else + _builtin_graphite_srcs += files(['src/direct_machine.cpp']) + endif + + if meson.get_compiler('cpp').get_id() == 'msvc' + # disable std::iterator implementation warning + _builtin_graphite_compile_args += '/wd4996' + endif + + + lib_builtin_graphite = static_library('builtin_graphite', _builtin_graphite_srcs, + include_directories: _builtin_graphite_incdirs, + cpp_args: _builtin_graphite_compile_args, + build_by_default: false + ) + + DEP_GRAPHITE = declare_dependency( + link_with: lib_builtin_graphite, + include_directories: _builtin_graphite_dep_incdirs, + compile_args: _builtin_graphite_compile_args + ) +else + DEP_GRAPHITE = dependency('graphite2') +endif \ No newline at end of file diff --git a/thirdparty/harfbuzz/meson.build b/thirdparty/harfbuzz/meson.build new file mode 100644 index 000000000000..7142067a9be5 --- /dev/null +++ b/thirdparty/harfbuzz/meson.build @@ -0,0 +1,117 @@ +if get_option('builtin_harfbuzz') + _builtin_harfbuzz_srcs = files( + 'src/hb-aat-layout.cc', + 'src/hb-aat-map.cc', + 'src/hb-blob.cc', + 'src/hb-buffer.cc', + 'src/hb-buffer-serialize.cc', + 'src/hb-common.cc', + 'src/hb-coretext.cc', + 'src/hb-directwrite.cc', + 'src/hb-draw.cc', + 'src/hb-face.cc', + 'src/hb-fallback-shape.cc', + 'src/hb-font.cc', + 'src/hb-ft.cc', + 'src/hb-gdi.cc', + 'src/hb-glib.cc', + 'src/hb-gobject-structs.cc', + 'src/hb-graphite2.cc', + 'src/hb-icu.cc', + 'src/hb-map.cc', + 'src/hb-number.cc', + 'src/hb-ot-cff1-table.cc', + 'src/hb-ot-cff2-table.cc', + 'src/hb-ot-color.cc', + 'src/hb-ot-face.cc', + 'src/hb-ot-font.cc', + 'src/hb-ot-layout.cc', + 'src/hb-ot-map.cc', + 'src/hb-ot-math.cc', + 'src/hb-ot-meta.cc', + 'src/hb-ot-metrics.cc', + 'src/hb-ot-name.cc', + 'src/hb-ot-shape.cc', + 'src/hb-ot-shape-complex-arabic.cc', + 'src/hb-ot-shape-complex-default.cc', + 'src/hb-ot-shape-complex-hangul.cc', + 'src/hb-ot-shape-complex-hebrew.cc', + 'src/hb-ot-shape-complex-indic.cc', + 'src/hb-ot-shape-complex-indic-table.cc', + 'src/hb-ot-shape-complex-khmer.cc', + 'src/hb-ot-shape-complex-myanmar.cc', + 'src/hb-ot-shape-complex-syllabic.cc', + 'src/hb-ot-shape-complex-thai.cc', + 'src/hb-ot-shape-complex-use.cc', + 'src/hb-ot-shape-complex-vowel-constraints.cc', + 'src/hb-ot-shape-fallback.cc', + 'src/hb-ot-shape-normalize.cc', + 'src/hb-ot-tag.cc', + 'src/hb-ot-var.cc', + 'src/hb-set.cc', + 'src/hb-shape.cc', + 'src/hb-shape-plan.cc', + 'src/hb-shaper.cc', + 'src/hb-static.cc', + 'src/hb-style.cc', + 'src/hb-subset.cc', + 'src/hb-subset-cff1.cc', + 'src/hb-subset-cff2.cc', + 'src/hb-subset-cff-common.cc', + 'src/hb-subset-input.cc', + 'src/hb-subset-plan.cc', + 'src/hb-ucd.cc', + 'src/hb-unicode.cc', + #'src/hb-uniscribe.cc',', + ) + + _builtin_harfbuzz_incdirs = include_directories('src') + + _builtin_harfbuzz_dep_compile_flags = [] + _builtin_harfbuzz_compile_flags = [ + '-DHAVE_ICU_BUILTIN', + '-DHAVE_ICU', + '-DHAVE_FREETYPE', + '-DHAVE_GRAPHITE2', + '-DGRAPHITE2_STATIC', + ] + + if PLATFORM in ['android', 'linuxbsd', 'server'] + _builtin_harfbuzz_compile_flags += ['-DHAVE_PTHREAD'] + endif + + if PLATFORM == 'javascript' + if get_option('threads_enabled') + _builtin_harfbuzz_compile_flags += ['-DHAVE_PTHREAD'] + else + _builtin_harfbuzz_dep_compile_flags += ['-DHB_NO_MT'] + endif + endif + + # compiler warnings + if meson.get_compiler('cpp').get_id() == 'msvc' + _builtin_harfbuzz_compile_flags += '/wd4172' + elif meson.get_compiler('cpp').get_id() == 'gcc' + _builtin_harfbuzz_compile_flags += ['-DHB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING', '-Wno-deprecated-declarations'] + elif meson.get_compiler('cpp').get_id() == 'emscripten' + _builtin_harfbuzz_compile_flags += ['-w'] + endif + + lib_builtin_harfbuzz = static_library('builtin_harfbuzz', _builtin_harfbuzz_srcs, + include_directories: _builtin_harfbuzz_incdirs, + cpp_args: [_builtin_harfbuzz_dep_compile_flags, _builtin_harfbuzz_compile_flags], + dependencies: [DEP_GRAPHITE, DEP_FREETYPE, DEP_ICU], + build_by_default: false + ) + + DEP_HARFBUZZ = declare_dependency(link_with: lib_builtin_harfbuzz, + include_directories: _builtin_harfbuzz_incdirs, + compile_args: _builtin_harfbuzz_dep_compile_flags + ) + +else + DEP_HARFBUZZ = [ + dependency('harfbuzz'), + dependency('harfbuzz-icu') + ] +endif diff --git a/thirdparty/icu4c/meson.build b/thirdparty/icu4c/meson.build new file mode 100644 index 000000000000..b7e09c6f27e6 --- /dev/null +++ b/thirdparty/icu4c/meson.build @@ -0,0 +1,249 @@ +if get_option('builtin_icu') + _builtin_icu_incdirs = include_directories('common') + + _builtin_icu_srcs = files([ + 'common/appendable.cpp', + 'common/bmpset.cpp', + 'common/brkeng.cpp', + 'common/brkiter.cpp', + 'common/bytesinkutil.cpp', + 'common/bytestream.cpp', + 'common/bytestrie.cpp', + 'common/bytestriebuilder.cpp', + 'common/bytestrieiterator.cpp', + 'common/caniter.cpp', + 'common/characterproperties.cpp', + 'common/chariter.cpp', + 'common/charstr.cpp', + 'common/cmemory.cpp', + 'common/cstr.cpp', + 'common/cstring.cpp', + 'common/cwchar.cpp', + 'common/dictbe.cpp', + 'common/dictionarydata.cpp', + 'common/dtintrv.cpp', + 'common/edits.cpp', + 'common/errorcode.cpp', + 'common/filteredbrk.cpp', + 'common/filterednormalizer2.cpp', + 'common/icudataver.cpp', + 'common/icuplug.cpp', + 'common/loadednormalizer2impl.cpp', + 'common/localebuilder.cpp', + 'common/localematcher.cpp', + 'common/localeprioritylist.cpp', + 'common/locavailable.cpp', + 'common/locbased.cpp', + 'common/locdispnames.cpp', + 'common/locdistance.cpp', + 'common/locdspnm.cpp', + 'common/locid.cpp', + 'common/loclikely.cpp', + 'common/loclikelysubtags.cpp', + 'common/locmap.cpp', + 'common/locresdata.cpp', + 'common/locutil.cpp', + 'common/lsr.cpp', + 'common/messagepattern.cpp', + 'common/normalizer2.cpp', + 'common/normalizer2impl.cpp', + 'common/normlzr.cpp', + 'common/parsepos.cpp', + 'common/patternprops.cpp', + 'common/pluralmap.cpp', + 'common/propname.cpp', + 'common/propsvec.cpp', + 'common/punycode.cpp', + 'common/putil.cpp', + 'common/rbbi.cpp', + 'common/rbbi_cache.cpp', + 'common/rbbidata.cpp', + 'common/rbbinode.cpp', + 'common/rbbirb.cpp', + 'common/rbbiscan.cpp', + 'common/rbbisetb.cpp', + 'common/rbbistbl.cpp', + 'common/rbbitblb.cpp', + 'common/resbund.cpp', + 'common/resbund_cnv.cpp', + 'common/resource.cpp', + 'common/restrace.cpp', + 'common/ruleiter.cpp', + 'common/schriter.cpp', + 'common/serv.cpp', + 'common/servlk.cpp', + 'common/servlkf.cpp', + 'common/servls.cpp', + 'common/servnotf.cpp', + 'common/servrbf.cpp', + 'common/servslkf.cpp', + 'common/sharedobject.cpp', + 'common/simpleformatter.cpp', + 'common/static_unicode_sets.cpp', + 'common/stringpiece.cpp', + 'common/stringtriebuilder.cpp', + 'common/uarrsort.cpp', + 'common/ubidi.cpp', + 'common/ubidi_props.cpp', + 'common/ubidiln.cpp', + 'common/ubiditransform.cpp', + 'common/ubidiwrt.cpp', + 'common/ubrk.cpp', + 'common/ucase.cpp', + 'common/ucasemap.cpp', + 'common/ucasemap_titlecase_brkiter.cpp', + 'common/ucat.cpp', + 'common/uchar.cpp', + 'common/ucharstrie.cpp', + 'common/ucharstriebuilder.cpp', + 'common/ucharstrieiterator.cpp', + 'common/uchriter.cpp', + 'common/ucln_cmn.cpp', + 'common/ucmndata.cpp', + 'common/ucnv.cpp', + 'common/ucnv2022.cpp', + 'common/ucnv_bld.cpp', + 'common/ucnv_cb.cpp', + 'common/ucnv_cnv.cpp', + 'common/ucnv_ct.cpp', + 'common/ucnv_err.cpp', + 'common/ucnv_ext.cpp', + 'common/ucnv_io.cpp', + 'common/ucnv_lmb.cpp', + 'common/ucnv_set.cpp', + 'common/ucnv_u16.cpp', + 'common/ucnv_u32.cpp', + 'common/ucnv_u7.cpp', + 'common/ucnv_u8.cpp', + 'common/ucnvbocu.cpp', + 'common/ucnvdisp.cpp', + 'common/ucnvhz.cpp', + 'common/ucnvisci.cpp', + 'common/ucnvlat1.cpp', + 'common/ucnvmbcs.cpp', + 'common/ucnvscsu.cpp', + 'common/ucnvsel.cpp', + 'common/ucol_swp.cpp', + 'common/ucptrie.cpp', + 'common/ucurr.cpp', + 'common/udata.cpp', + 'common/udatamem.cpp', + 'common/udataswp.cpp', + 'common/uenum.cpp', + 'common/uhash.cpp', + 'common/uhash_us.cpp', + 'common/uidna.cpp', + 'common/uinit.cpp', + 'common/uinvchar.cpp', + 'common/uiter.cpp', + 'common/ulist.cpp', + 'common/uloc.cpp', + 'common/uloc_keytype.cpp', + 'common/uloc_tag.cpp', + 'common/umapfile.cpp', + 'common/umath.cpp', + 'common/umutablecptrie.cpp', + 'common/umutex.cpp', + 'common/unames.cpp', + 'common/unifiedcache.cpp', + 'common/unifilt.cpp', + 'common/unifunct.cpp', + 'common/uniset.cpp', + 'common/uniset_closure.cpp', + 'common/uniset_props.cpp', + 'common/unisetspan.cpp', + 'common/unistr.cpp', + 'common/unistr_case.cpp', + 'common/unistr_case_locale.cpp', + 'common/unistr_cnv.cpp', + 'common/unistr_props.cpp', + 'common/unistr_titlecase_brkiter.cpp', + 'common/unorm.cpp', + 'common/unormcmp.cpp', + 'common/uobject.cpp', + 'common/uprops.cpp', + 'common/ures_cnv.cpp', + 'common/uresbund.cpp', + 'common/uresdata.cpp', + 'common/usc_impl.cpp', + 'common/uscript.cpp', + 'common/uscript_props.cpp', + 'common/uset.cpp', + 'common/uset_props.cpp', + 'common/usetiter.cpp', + # 'common/ushape.cpp', + 'common/usprep.cpp', + 'common/ustack.cpp', + 'common/ustr_cnv.cpp', + 'common/ustr_titlecase_brkiter.cpp', + 'common/ustr_wcs.cpp', + 'common/ustrcase.cpp', + 'common/ustrcase_locale.cpp', + 'common/ustrenum.cpp', + 'common/ustrfmt.cpp', + 'common/ustring.cpp', + 'common/ustrtrns.cpp', + 'common/utext.cpp', + 'common/utf_impl.cpp', + 'common/util.cpp', + 'common/util_props.cpp', + 'common/utrace.cpp', + 'common/utrie.cpp', + 'common/utrie2.cpp', + 'common/utrie2_builder.cpp', + 'common/utrie_swap.cpp', + 'common/uts46.cpp', + 'common/utypes.cpp', + 'common/uvector.cpp', + 'common/uvectr32.cpp', + 'common/uvectr64.cpp', + 'common/wintz.cpp', + ]) + + _icu_data_name = 'icudt69l.dat' + + _builtin_icu_compile_dep_flags = [ + '-DU_STATIC_IMPLEMENTATION', + '-DU_COMMON_IMPLEMENTATION', + '-DUCONFIG_NO_COLLATION', + '-DUCONFIG_NO_CONVERSION', + '-DUCONFIG_NO_FORMATTING', + '-DUCONFIG_NO_SERVICE', + '-DUCONFIG_NO_IDNA', + '-DUCONFIG_NO_FILE_IO', + '-DUCONFIG_NO_TRANSLITERATION', + '-DPKGDATA_MODE=static', + '-DICU_DATA_NAME=' + _icu_data_name, + ] + + _builtin_icu_compile_flags = [] + + if meson.get_compiler('cpp').get_id() == 'gcc' + _builtin_icu_compile_flags += '-Wno-stringop-overflow' + endif + + lib_builtin_icu = static_library('builtin_icu4c', _builtin_icu_srcs, + include_directories: _builtin_icu_incdirs, + cpp_args: [_builtin_icu_compile_flags, _builtin_icu_compile_dep_flags], + build_by_default: false + ) + + _builtin_icu_dep_flags = [ + '-DICU_DATA_NAME=' + _icu_data_name, + ] + + if get_option('tools') + _builtin_icu_dep_flags += ['-DICU_STATIC_DATA'] + endif + + DEP_ICU = declare_dependency( + link_with: lib_builtin_icu, + include_directories: _builtin_icu_incdirs, + compile_args: ['-DICU_DATA_NAME=' + _icu_data_name], + variables: { + 'icu_data_name': _icu_data_name, + } + ) +else + DEP_ICU = dependency('icu-uc') +endif diff --git a/thirdparty/jpeg-compressor/meson.build b/thirdparty/jpeg-compressor/meson.build new file mode 100644 index 000000000000..f9eec84c450a --- /dev/null +++ b/thirdparty/jpeg-compressor/meson.build @@ -0,0 +1,9 @@ +_jpeg_compressor_srcs = files([ + 'jpgd.cpp' +]) + +_jpeg_compressor_incdirs = include_directories('.') + +_lib_jpeg_compressor = static_library('builtin_jpeg_compressor', _jpeg_compressor_srcs, include_directories: _jpeg_compressor_incdirs, build_by_default: false) + +DEP_JPEG_COMPRESSOR = declare_dependency(link_with: _lib_jpeg_compressor, include_directories: _jpeg_compressor_incdirs) \ No newline at end of file diff --git a/thirdparty/libogg/meson.build b/thirdparty/libogg/meson.build new file mode 100644 index 000000000000..1cba5d532e82 --- /dev/null +++ b/thirdparty/libogg/meson.build @@ -0,0 +1,16 @@ +if get_option('builtin_libogg') + + _builtin_libogg_srcs = files([ + 'bitwise.c', + 'framing.c' + ]) + + _builtin_libogg_incdirs = include_directories('.') + + lib_builtin_libogg = static_library('builtin_libogg', _builtin_libogg_srcs, include_directories: _builtin_libogg_incdirs, + build_by_default: false) + + DEP_LIBOGG = declare_dependency(link_with: lib_builtin_libogg, include_directories: _builtin_libogg_incdirs) +else + DEP_LIBOGG = dependency('ogg') +endif \ No newline at end of file diff --git a/thirdparty/libpng/meson.build b/thirdparty/libpng/meson.build new file mode 100644 index 000000000000..d44f3c867dfc --- /dev/null +++ b/thirdparty/libpng/meson.build @@ -0,0 +1,35 @@ +if get_option('builtin_libpng') + _libpng_incdirs = include_directories('.') + + _libpng_sources = files([ + 'png.c', + 'pngerror.c', + 'pngget.c', + 'pngmem.c', + 'pngpread.c', + 'pngread.c', + 'pngrio.c', + 'pngrtran.c', + 'pngrutil.c', + 'pngset.c', + 'pngtrans.c', + 'pngwio.c', + 'pngwrite.c', + 'pngwtran.c', + 'pngwutil.c', + ]) + + if host_machine.cpu_family() == 'aarch64' or host_machine.cpu_family() == 'arm' + _libpng_sources += files( + 'arm/arm_init.c', + 'arm/filter_neon_intrinsics.c', + 'arm/palette_neon_intrinsics.c', + ) + endif + + _lib_libpng = static_library('libpng', _libpng_sources, include_directories: _libpng_incdirs, dependencies: [DEP_ZLIB], build_by_default: false) + + DEP_LIBPNG = declare_dependency(link_with: _lib_libpng, include_directories: _libpng_incdirs) +else + DEP_LIBPNG = dependency('libpng') +endif diff --git a/thirdparty/libtheora/meson.build b/thirdparty/libtheora/meson.build new file mode 100644 index 000000000000..fd93c8042750 --- /dev/null +++ b/thirdparty/libtheora/meson.build @@ -0,0 +1,77 @@ +if get_option('builtin_libtheora') + + _builtin_libtheora_srcs = files([ + # 'analyze.c', + # 'apiwrapper.c', + 'bitpack.c', + 'cpu.c', + # 'decapiwrapper.c', + 'decinfo.c', + 'decode.c', + 'dequant.c', + # 'encapiwrapper.c', + # 'encfrag.c', + # 'encinfo.c', + # 'encode.c', + # 'encoder_disabled.c', + # 'enquant.c', + # 'fdct.c', + 'fragment.c', + 'huffdec.c', + # 'huffenc.c', + 'idct.c', + 'info.c', + 'internal.c', + # 'mathops.c', + # 'mcenc.c', + 'quant.c', + # 'rate.c', + 'state.c', + # 'tokenize.c', + ]) + + _builtin_libtheora_compile_args = [] + + _builtin_libtheora_incdirs = include_directories('.') + + if host_machine.cpu_family() in ['x86', 'x86_64'] + _builtin_libtheora_compile_args += '-DOC_X86_ASM' + + if PLATFORM == 'windows' + _builtin_libtheora_srcs += files([ + # 'x86_vc/mmxencfrag.c', + # 'x86_vc/mmxfdct.c', + 'x86_vc/mmxfrag.c', + 'x86_vc/mmxidct.c', + 'x86_vc/mmxstate.c', + # 'x86_vc/sse2fdct.c', + # 'x86_vc/x86enc.c', + 'x86_vc/x86state.c', + ]) + else + _builtin_libtheora_srcs += files([ + # 'x86/mmxencfrag.c', + # 'x86/mmxfdct.c', + 'x86/mmxfrag.c', + 'x86/mmxidct.c', + 'x86/mmxstate.c', + # 'x86/sse2fdct.c', + # 'x86/x86enc.c', + 'x86/x86state.c', + ]) + endif + endif + + lib_builtin_libtheora = static_library('builtin_libtheora', _builtin_libtheora_srcs, + include_directories: _builtin_libtheora_incdirs, + dependencies: [DEP_LIBOGG, DEP_LIBVORBIS], + build_by_default: false + ) + + DEP_LIBTHEORA = declare_dependency(link_with: lib_builtin_libtheora, include_directories: _builtin_libtheora_incdirs) +else + DEP_LIBTHEORA = [ + dependency('theora'), + dependency('theoradec') + ] +endif \ No newline at end of file diff --git a/thirdparty/libvorbis/meson.build b/thirdparty/libvorbis/meson.build new file mode 100644 index 000000000000..1562f48ee7c5 --- /dev/null +++ b/thirdparty/libvorbis/meson.build @@ -0,0 +1,52 @@ +if get_option('builtin_libvorbis') + _builtin_libvorbis_srcs = files([ + # 'analysis.c', + # 'barkmel.c', + 'bitrate.c', + 'block.c', + 'codebook.c', + 'envelope.c', + 'floor0.c', + 'floor1.c', + 'info.c', + 'lookup.c', + 'lpc.c', + 'lsp.c', + 'mapping0.c', + 'mdct.c', + 'psy.c', + # 'psytune.c', + 'registry.c', + 'res0.c', + 'sharedbook.c', + 'smallft.c', + 'synthesis.c', + # 'tone.c', + # 'vorbisenc.c', + 'vorbisfile.c', + 'window.c', + ]) + + _builtin_libvorbis_incdirs = include_directories('.') + + c_dep_args = [] + if PLATFORM != 'windows' + c_dep_args += '-DHAVE_ALLOCA_H' + endif + + lib_builtin_libvorbis = static_library('builtin_libvorbis', _builtin_libvorbis_srcs, + include_directories: _builtin_libvorbis_incdirs, + dependencies: [DEP_LIBOGG], + c_args: c_dep_args, + build_by_default: false + ) + + + DEP_LIBVORBIS = declare_dependency(link_with: lib_builtin_libvorbis, include_directories: _builtin_libvorbis_incdirs, compile_args: c_dep_args) + +else + DEP_LIBVORBIS = [ + dependency('vorbis'), + dependency('vorbisfile') + ] +endif diff --git a/thirdparty/libwebp/meson.build b/thirdparty/libwebp/meson.build new file mode 100644 index 000000000000..7b194170405b --- /dev/null +++ b/thirdparty/libwebp/meson.build @@ -0,0 +1,129 @@ +if get_option('builtin_libwebp') + _builtin_libwebp_srcs = files([ + 'src/dec/alpha_dec.c', + 'src/dec/buffer_dec.c', + 'src/dec/frame_dec.c', + 'src/dec/idec_dec.c', + 'src/dec/io_dec.c', + 'src/dec/quant_dec.c', + 'src/dec/tree_dec.c', + 'src/dec/vp8_dec.c', + 'src/dec/vp8l_dec.c', + 'src/dec/webp_dec.c', + 'src/demux/anim_decode.c', + 'src/demux/demux.c', + 'src/dsp/alpha_processing.c', + 'src/dsp/alpha_processing_mips_dsp_r2.c', + 'src/dsp/alpha_processing_neon.c', + 'src/dsp/alpha_processing_sse2.c', + 'src/dsp/alpha_processing_sse41.c', + 'src/dsp/cost.c', + 'src/dsp/cost_mips32.c', + 'src/dsp/cost_mips_dsp_r2.c', + 'src/dsp/cost_neon.c', + 'src/dsp/cost_sse2.c', + 'src/dsp/cpu.c', + 'src/dsp/dec.c', + 'src/dsp/dec_clip_tables.c', + 'src/dsp/dec_mips32.c', + 'src/dsp/dec_mips_dsp_r2.c', + 'src/dsp/dec_msa.c', + 'src/dsp/dec_neon.c', + 'src/dsp/dec_sse2.c', + 'src/dsp/dec_sse41.c', + 'src/dsp/enc.c', + 'src/dsp/enc_mips32.c', + 'src/dsp/enc_mips_dsp_r2.c', + 'src/dsp/enc_msa.c', + 'src/dsp/enc_neon.c', + 'src/dsp/enc_sse2.c', + 'src/dsp/enc_sse41.c', + 'src/dsp/filters.c', + 'src/dsp/filters_mips_dsp_r2.c', + 'src/dsp/filters_msa.c', + 'src/dsp/filters_neon.c', + 'src/dsp/filters_sse2.c', + 'src/dsp/lossless.c', + 'src/dsp/lossless_enc.c', + 'src/dsp/lossless_enc_mips32.c', + 'src/dsp/lossless_enc_mips_dsp_r2.c', + 'src/dsp/lossless_enc_msa.c', + 'src/dsp/lossless_enc_neon.c', + 'src/dsp/lossless_enc_sse2.c', + 'src/dsp/lossless_enc_sse41.c', + 'src/dsp/lossless_mips_dsp_r2.c', + 'src/dsp/lossless_msa.c', + 'src/dsp/lossless_neon.c', + 'src/dsp/lossless_sse2.c', + 'src/dsp/rescaler.c', + 'src/dsp/rescaler_mips32.c', + 'src/dsp/rescaler_mips_dsp_r2.c', + 'src/dsp/rescaler_msa.c', + 'src/dsp/rescaler_neon.c', + 'src/dsp/rescaler_sse2.c', + 'src/dsp/ssim.c', + 'src/dsp/ssim_sse2.c', + 'src/dsp/upsampling.c', + 'src/dsp/upsampling_mips_dsp_r2.c', + 'src/dsp/upsampling_msa.c', + 'src/dsp/upsampling_neon.c', + 'src/dsp/upsampling_sse2.c', + 'src/dsp/upsampling_sse41.c', + 'src/dsp/yuv.c', + 'src/dsp/yuv_mips32.c', + 'src/dsp/yuv_mips_dsp_r2.c', + 'src/dsp/yuv_neon.c', + 'src/dsp/yuv_sse2.c', + 'src/dsp/yuv_sse41.c', + 'src/enc/alpha_enc.c', + 'src/enc/analysis_enc.c', + 'src/enc/backward_references_cost_enc.c', + 'src/enc/backward_references_enc.c', + 'src/enc/config_enc.c', + 'src/enc/cost_enc.c', + 'src/enc/filter_enc.c', + 'src/enc/frame_enc.c', + 'src/enc/histogram_enc.c', + 'src/enc/iterator_enc.c', + 'src/enc/near_lossless_enc.c', + 'src/enc/picture_csp_enc.c', + 'src/enc/picture_enc.c', + 'src/enc/picture_psnr_enc.c', + 'src/enc/picture_rescale_enc.c', + 'src/enc/picture_tools_enc.c', + 'src/enc/predictor_enc.c', + 'src/enc/quant_enc.c', + 'src/enc/syntax_enc.c', + 'src/enc/token_enc.c', + 'src/enc/tree_enc.c', + 'src/enc/vp8l_enc.c', + 'src/enc/webp_enc.c', + 'src/mux/anim_encode.c', + 'src/mux/muxedit.c', + 'src/mux/muxinternal.c', + 'src/mux/muxread.c', + 'src/utils/bit_reader_utils.c', + 'src/utils/bit_writer_utils.c', + 'src/utils/color_cache_utils.c', + 'src/utils/filters_utils.c', + 'src/utils/huffman_encode_utils.c', + 'src/utils/huffman_utils.c', + 'src/utils/quant_levels_dec_utils.c', + 'src/utils/quant_levels_utils.c', + 'src/utils/random_utils.c', + 'src/utils/rescaler_utils.c', + 'src/utils/thread_utils.c', + 'src/utils/utils.c', + ]) + + _builtin_libwebp_incdirs = include_directories('src') + + lib_builtin_libwebp = static_library('builtin_libwebp', _builtin_libwebp_srcs, + include_directories: _builtin_libwebp_incdirs, + build_by_default: false + ) + + DEP_LIBWEBP = declare_dependency(link_with: lib_builtin_libwebp, include_directories: _builtin_libwebp_incdirs) +else + DEP_LIBWEBP = dependency('libwebp') +endif \ No newline at end of file diff --git a/thirdparty/mbedtls/meson.build b/thirdparty/mbedtls/meson.build new file mode 100644 index 000000000000..d2a3cd4f6bb5 --- /dev/null +++ b/thirdparty/mbedtls/meson.build @@ -0,0 +1,117 @@ +# the include directory +_mbedtls_incdirs = include_directories('include') + +_mbedtls_deps = [] +if host_machine.system() == 'windows' + _mbedtls_deps += meson.get_compiler('cpp').find_library('bcrypt') +endif + + +# builtin +if get_option('builtin_mbedtls') and 'mbedtls' in MODULES_DISABLED + _mbedtls_srcs = files([ + 'library/aes.c', + 'library/base64.c', + 'library/godot_core_mbedtls_platform.c', + 'library/md5.c', + 'library/sha1.c', + 'library/sha256.c', + 'library/platform_util.c' + ]) + + _lib_mbedtls = static_library('mbedtls', _mbedtls_srcs, include_directories: _mbedtls_incdirs, dependencies: _mbedtls_deps, build_by_default: false) + DEP_MBEDTLS = declare_dependency(link_with: _lib_mbedtls, include_directories: _mbedtls_incdirs) +elif get_option('builtin_mbedtls') + # The full src for the full dependency + _mbedtls_srcs = files([ + 'library/aes.c', + 'library/aesni.c', + 'library/arc4.c', + 'library/aria.c', + 'library/asn1parse.c', + 'library/asn1write.c', + 'library/base64.c', + 'library/bignum.c', + 'library/blowfish.c', + 'library/camellia.c', + 'library/ccm.c', + 'library/certs.c', + 'library/chacha20.c', + 'library/chachapoly.c', + 'library/cipher.c', + 'library/cipher_wrap.c', + 'library/cmac.c', + 'library/ctr_drbg.c', + 'library/debug.c', + 'library/des.c', + 'library/dhm.c', + 'library/ecdh.c', + 'library/ecdsa.c', + 'library/ecjpake.c', + 'library/ecp.c', + 'library/ecp_curves.c', + 'library/entropy.c', + 'library/entropy_poll.c', + 'library/error.c', + 'library/gcm.c', + 'library/godot_core_mbedtls_platform.c', + 'library/havege.c', + 'library/hkdf.c', + 'library/hmac_drbg.c', + 'library/md.c', + 'library/md2.c', + 'library/md4.c', + 'library/md5.c', + 'library/md_wrap.c', + 'library/memory_buffer_alloc.c', + 'library/net_sockets.c', + 'library/nist_kw.c', + 'library/oid.c', + 'library/padlock.c', + 'library/pem.c', + 'library/pk.c', + 'library/pk_wrap.c', + 'library/pkcs11.c', + 'library/pkcs12.c', + 'library/pkcs5.c', + 'library/pkparse.c', + 'library/pkwrite.c', + 'library/platform.c', + 'library/platform_util.c', + 'library/poly1305.c', + 'library/ripemd160.c', + 'library/rsa.c', + 'library/rsa_internal.c', + 'library/sha1.c', + 'library/sha256.c', + 'library/sha512.c', + 'library/ssl_cache.c', + 'library/ssl_ciphersuites.c', + 'library/ssl_cli.c', + 'library/ssl_cookie.c', + 'library/ssl_srv.c', + 'library/ssl_ticket.c', + 'library/ssl_tls.c', + 'library/threading.c', + 'library/timing.c', + 'library/version.c', + 'library/version_features.c', + 'library/x509.c', + 'library/x509_create.c', + 'library/x509_crl.c', + 'library/x509_crt.c', + 'library/x509_csr.c', + 'library/x509write_crt.c', + 'library/x509write_csr.c', + 'library/xtea.c' + ]) + + _lib_mbedtls = static_library('mbedtls', _mbedtls_srcs, include_directories: _mbedtls_incdirs, dependencies: _mbedtls_deps, build_by_default: false) + DEP_MBEDTLS = declare_dependency(link_with: _lib_mbedtls, include_directories: _mbedtls_incdirs) +else + DEP_MBEDTLS = [ + dependency('mbedtls'), + dependency('mbedcrypto'), + dependency('mbedx509') + ] +endif \ No newline at end of file diff --git a/thirdparty/meshoptimizer/meson.build b/thirdparty/meshoptimizer/meson.build new file mode 100644 index 000000000000..a7b8cdb67575 --- /dev/null +++ b/thirdparty/meshoptimizer/meson.build @@ -0,0 +1,26 @@ +_builtin_meshoptimizer_srcs = files([ + 'allocator.cpp', + 'clusterizer.cpp', + 'indexcodec.cpp', + 'indexgenerator.cpp', + 'overdrawanalyzer.cpp', + 'overdrawoptimizer.cpp', + 'simplifier.cpp', + 'spatialorder.cpp', + 'stripifier.cpp', + 'vcacheanalyzer.cpp', + 'vcacheoptimizer.cpp', + 'vertexcodec.cpp', + 'vertexfilter.cpp', + 'vfetchanalyzer.cpp', + 'vfetchoptimizer.cpp', +]) + +_builtin_meshoptimizer_incdirs = include_directories('.') + +lib_builtin_meshoptimizer = static_library('builtin_meshoptimizer', _builtin_meshoptimizer_srcs, + include_directories: _builtin_meshoptimizer_incdirs, + build_by_default: false +) + +DEP_MESHOPTIMIZER = declare_dependency(link_with: lib_builtin_meshoptimizer, include_directories: _builtin_meshoptimizer_incdirs) \ No newline at end of file diff --git a/thirdparty/meson.build b/thirdparty/meson.build new file mode 100644 index 000000000000..09be7fec70d1 --- /dev/null +++ b/thirdparty/meson.build @@ -0,0 +1,44 @@ +# order matters with these +subdir('zlib') +subdir('minizip') +subdir('libpng') +subdir('freetype') + +subdir('libogg') +subdir('libvorbis') +subdir('libtheora') +subdir('opus') + +subdir('graphite') +subdir('icu4c') +subdir('harfbuzz') +subdir('nanosvg') + +# the rest +subdir('basis_universal') +subdir('bullet') +subdir('cvtt') +subdir('enet') +subdir('etcpak') +subdir('glslang') +subdir('jpeg-compressor') +subdir('libwebp') +subdir('mbedtls') +subdir('meshoptimizer') +subdir('minimp3') +subdir('miniupnpc') +subdir('misc') +subdir('msdfgen') +subdir('oidn') +subdir('pcre2') +subdir('pvrtccompressor') +subdir('recastnavigation') +subdir('rvo2') +subdir('spirv-reflect') +subdir('squish') +subdir('tinyexr') +subdir('vhacd') +subdir('vulkan') +subdir('wslay') +subdir('xatlas') +subdir('zstd') diff --git a/thirdparty/minimp3/meson.build b/thirdparty/minimp3/meson.build new file mode 100644 index 000000000000..30d6bf648e8c --- /dev/null +++ b/thirdparty/minimp3/meson.build @@ -0,0 +1,3 @@ +_builtin_minimp3_incdirs = include_directories('.') + +DEP_MINIMP3 = declare_dependency(include_directories: _builtin_minimp3_incdirs) \ No newline at end of file diff --git a/thirdparty/miniupnpc/meson.build b/thirdparty/miniupnpc/meson.build new file mode 100644 index 000000000000..47071b3b60f1 --- /dev/null +++ b/thirdparty/miniupnpc/meson.build @@ -0,0 +1,51 @@ +if get_option('builtin_miniupnpc') + _builtin_miniupnpc_srcs = files( + 'miniupnpc/addr_is_reserved.c', + 'miniupnpc/miniupnpc.c', + 'miniupnpc/upnpcommands.c', + 'miniupnpc/miniwget.c', + 'miniupnpc/upnpdev.c', + 'miniupnpc/igd_desc_parse.c', + 'miniupnpc/minissdpc.c', + 'miniupnpc/minisoap.c', + 'miniupnpc/minixml.c', + 'miniupnpc/connecthostport.c', + 'miniupnpc/receivedata.c', + 'miniupnpc/portlistingparse.c', + 'miniupnpc/upnpreplyparse.c', + ) + + _builtin_miniupnpc_c_args = ['-DMINIUPNPC_SET_SOCKET_TIMEOUT'] + _builtin_miniupnpc_dep_compile_args = ['-DMINIUPNP_STATICLIB'] + + if meson.get_compiler('c').get_id() == 'msvc' + _builtin_miniupnpc_c_args += '/wd4133' + elif meson.get_compiler('c').get_id() == 'gcc' + _builtin_miniupnpc_c_args += '-std=gnu99' + elif meson.get_compiler('c').get_id() == 'emscripten' + _builtin_miniupnpc_c_args += '-std=gnu99' + endif + + lib_builtin_miniupnpc = static_library('builtin_miniupnpc', + _builtin_miniupnpc_srcs, +# _version_target, + c_args: [_builtin_miniupnpc_c_args, _builtin_miniupnpc_dep_compile_args], + include_directories: '../..', + build_by_default: false + ) + + DEP_MINIUPNPC = declare_dependency(link_with: lib_builtin_miniupnpc, + compile_args: _builtin_miniupnpc_dep_compile_args, + include_directories: include_directories('.') + ) +else + _dep_miniupnpc = dependency('miniupnpc', required: false) + if _dep_miniupnpc.found() + DEP_MINIUPNPC = _dep_miniupnpc + else + DEP_MINIUPNPC = declare_dependency( + link_with: meson.get_compiler('cpp').find_library('miniupnpc'), + include_directories: include_directories('/usr/include/miniupnpc') + ) + endif +endif diff --git a/thirdparty/minizip/meson.build b/thirdparty/minizip/meson.build new file mode 100644 index 000000000000..c297ddec12a4 --- /dev/null +++ b/thirdparty/minizip/meson.build @@ -0,0 +1,11 @@ +_minizip_incdirs = include_directories('.') + +_minizip_srcs = files([ + 'ioapi.c', + 'unzip.c', + 'zip.c' +]) + +_lib_minizip = static_library('minizip', _minizip_srcs, include_directories: _minizip_incdirs, dependencies: [DEP_ZLIB], build_by_default: false) + +DEP_MINIZIP = declare_dependency(link_with: _lib_minizip, include_directories: _minizip_incdirs) \ No newline at end of file diff --git a/thirdparty/misc/meson.build b/thirdparty/misc/meson.build new file mode 100644 index 000000000000..518dd743d6af --- /dev/null +++ b/thirdparty/misc/meson.build @@ -0,0 +1,24 @@ +_misc_incdirs = include_directories('.') + +_misc_srcs = files( +'clipper.cpp', +'pcg.cpp', +'polypartition.cpp', +'smolv.cpp', +'fastlz.c', +'mikktspace.c', +'open-simplex-noise.c', +'r128.c', +'smaz.c', +) + +if PLATFORM == 'android' + _misc_srcs += files('ifaddrs-android.cc') +endif + +_lib_misc = static_library('misc', _misc_srcs, + include_directories: [_misc_incdirs, '../../', '../../platform/linuxbsd'], + dependencies: [DEP_ZLIB], + ) + +DEP_MISC = declare_dependency(link_with: _lib_misc, include_directories: _misc_incdirs) diff --git a/thirdparty/msdfgen/meson.build b/thirdparty/msdfgen/meson.build new file mode 100644 index 000000000000..31c4b58d13a4 --- /dev/null +++ b/thirdparty/msdfgen/meson.build @@ -0,0 +1,36 @@ +_msdf_incdirs = include_directories('.') + +_msdf_srcs = files( + 'core/Contour.cpp', + 'core/EdgeHolder.cpp', + 'core/MSDFErrorCorrection.cpp', + 'core/Projection.cpp', + 'core/Scanline.cpp', + 'core/Shape.cpp', + 'core/SignedDistance.cpp', + 'core/Vector2.cpp', + 'core/contour-combiners.cpp', + 'core/edge-coloring.cpp', + 'core/edge-segments.cpp', + 'core/edge-selectors.cpp', + 'core/equation-solver.cpp', + 'core/msdf-error-correction.cpp', + 'core/msdfgen.cpp', + 'core/rasterization.cpp', + 'core/render-sdf.cpp', + 'core/sdf-error-estimation.cpp', + 'core/shape-description.cpp', +) + +_lib_msdf = static_library('msdf', + _msdf_srcs, + include_directories: _msdf_incdirs, + c_args: _freetype_dep_defines + _freetype_c_defines, + dependencies: [DEP_ZLIB, DEP_LIBPNG, DEP_NANOSVG], +) + +DEP_MSDF = declare_dependency(link_with: _lib_msdf, + include_directories: _msdf_incdirs, +) + +DEPENDENCIES += DEP_MSDF diff --git a/thirdparty/nanosvg/meson.build b/thirdparty/nanosvg/meson.build new file mode 100644 index 000000000000..b7ff1d241bcb --- /dev/null +++ b/thirdparty/nanosvg/meson.build @@ -0,0 +1,13 @@ +_nanosvg_incdirs = include_directories('.') + +_nanosvg_srcs = files([ + 'nanosvg.cc' +]) + +_lib_nanosvg = static_library('nanosvg', _nanosvg_srcs, + include_directories: _nanosvg_incdirs, + build_by_default: false +) + +DEP_NANOSVG = declare_dependency(link_with: _lib_nanosvg, include_directories: _nanosvg_incdirs) + diff --git a/thirdparty/oidn/meson.build b/thirdparty/oidn/meson.build new file mode 100644 index 000000000000..43929f1826b0 --- /dev/null +++ b/thirdparty/oidn/meson.build @@ -0,0 +1,107 @@ +# no _ on name, there is a subdir that needs this +oidn_srcs = files([ + 'core/api.cpp', + 'core/device.cpp', + 'core/filter.cpp', + 'core/network.cpp', + 'core/autoencoder.cpp', + 'core/transfer_function.cpp', + 'mkl-dnn/src/common/batch_normalization.cpp', + 'mkl-dnn/src/common/concat.cpp', + 'mkl-dnn/src/common/convolution.cpp', + 'mkl-dnn/src/common/convolution_pd.cpp', + 'mkl-dnn/src/common/deconvolution.cpp', + 'mkl-dnn/src/common/eltwise.cpp', + 'mkl-dnn/src/common/engine.cpp', + 'mkl-dnn/src/common/inner_product.cpp', + 'mkl-dnn/src/common/inner_product_pd.cpp', + 'mkl-dnn/src/common/lrn.cpp', + 'mkl-dnn/src/common/memory.cpp', + 'mkl-dnn/src/common/memory_desc_wrapper.cpp', + 'mkl-dnn/src/common/mkldnn_debug.cpp', + 'mkl-dnn/src/common/mkldnn_debug_autogenerated.cpp', + 'mkl-dnn/src/common/pooling.cpp', + 'mkl-dnn/src/common/primitive.cpp', + 'mkl-dnn/src/common/primitive_attr.cpp', + 'mkl-dnn/src/common/primitive_desc.cpp', + 'mkl-dnn/src/common/primitive_exec_types.cpp', + 'mkl-dnn/src/common/primitive_iterator.cpp', + 'mkl-dnn/src/common/query.cpp', + 'mkl-dnn/src/common/reorder.cpp', + 'mkl-dnn/src/common/rnn.cpp', + 'mkl-dnn/src/common/scratchpad.cpp', + 'mkl-dnn/src/common/shuffle.cpp', + 'mkl-dnn/src/common/softmax.cpp', + 'mkl-dnn/src/common/stream.cpp', + 'mkl-dnn/src/common/sum.cpp', + 'mkl-dnn/src/common/utils.cpp', + 'mkl-dnn/src/common/verbose.cpp', + 'mkl-dnn/src/cpu/cpu_barrier.cpp', + 'mkl-dnn/src/cpu/cpu_concat.cpp', + 'mkl-dnn/src/cpu/cpu_engine.cpp', + 'mkl-dnn/src/cpu/cpu_memory.cpp', + 'mkl-dnn/src/cpu/cpu_reducer.cpp', + 'mkl-dnn/src/cpu/cpu_reorder.cpp', + 'mkl-dnn/src/cpu/cpu_sum.cpp', + 'mkl-dnn/src/cpu/jit_avx2_conv_kernel_f32.cpp', + 'mkl-dnn/src/cpu/jit_avx2_convolution.cpp', + 'mkl-dnn/src/cpu/jit_avx512_common_conv_kernel.cpp', + 'mkl-dnn/src/cpu/jit_avx512_common_conv_winograd_kernel_f32.cpp', + 'mkl-dnn/src/cpu/jit_avx512_common_convolution.cpp', + 'mkl-dnn/src/cpu/jit_avx512_common_convolution_winograd.cpp', + 'mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_2x3.cpp', + 'mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_4x3.cpp', + 'mkl-dnn/src/cpu/jit_avx512_core_fp32_wino_conv_4x3_kernel.cpp', + 'mkl-dnn/src/cpu/jit_sse42_conv_kernel_f32.cpp', + 'mkl-dnn/src/cpu/jit_sse42_convolution.cpp', + 'mkl-dnn/src/cpu/jit_transpose_src_utils.cpp', + 'mkl-dnn/src/cpu/jit_uni_eltwise.cpp', + 'mkl-dnn/src/cpu/jit_uni_pool_kernel_f32.cpp', + 'mkl-dnn/src/cpu/jit_uni_pooling.cpp', + 'mkl-dnn/src/cpu/jit_uni_reorder.cpp', + 'mkl-dnn/src/cpu/jit_uni_reorder_utils.cpp', + 'mkl-dnn/src/cpu/jit_utils/jit_utils.cpp', + 'mkl-dnn/src/cpu/jit_utils/jitprofiling/jitprofiling.c', + 'common/platform.cpp', + 'common/thread.cpp', + 'common/tensor.cpp', +]) + +# generate the lightmapper cpp weights +subdir('weights') + +_oidn_cpp_args = [ + '-DOIDN_STATIC_LIB', + '-DMKLDNN_THR=MKLDNN_THR_SEQ', + '-D__STDC_CONSTANT_MACROS', + '-D__STDC_LIMIT_MACROS', + '-DDISABLE_VERBOSE', + '-DMKLDNN_ENABLE_CONCURRENT_EXEC', + # Do we always want to add this to oidn? + '-DNDEBUG', + '-DNOMINMAX' +] + +if meson.get_compiler('cpp').get_id() == 'msvc' + _oidn_cpp_args += ['/wd4068'] +endif + +_lib_oidn = static_library('builtin_oidn', oidn_srcs, + include_directories: include_directories( + '.', + 'include', + 'mkl-dnn/include', + 'mkl-dnn/src', + 'mkl-dnn/src/common', + 'mkl-dnn/src/cpu/xbyak', + 'mkl-dnn/src/cpu', + ), + cpp_args: _oidn_cpp_args, + build_by_default: false +) + +DEP_OIDN = declare_dependency(link_with: _lib_oidn, + include_directories: include_directories('include'), + compile_args: ['-DOIDN_STATIC_LIB'] +) + diff --git a/thirdparty/oidn/weights/meson.build b/thirdparty/oidn/weights/meson.build new file mode 100644 index 000000000000..469b8c9370b2 --- /dev/null +++ b/thirdparty/oidn/weights/meson.build @@ -0,0 +1,12 @@ +_oidn_resource_to_cpp = find_program(MESON_SOURCE_ROOT / 'modules' / 'denoise' / 'resource_to_cpp.py').full_path() + +_oidn_lightmap_target = custom_target( + 'oidn_lightmap', + output: ['rtlightmap_hdr.gen.cpp'], + input: ['rtlightmap_hdr.tza'], + env: SCRIPTS_ENV, + command: [SCRIPT_COMPAT, 'tza_to_cpp', _oidn_resource_to_cpp, '-i', '@INPUT@', '-o', '@OUTPUT@'], + build_by_default: false +) + +oidn_srcs += [_oidn_lightmap_target] diff --git a/thirdparty/opus/meson.build b/thirdparty/opus/meson.build new file mode 100644 index 000000000000..621868a89eb5 --- /dev/null +++ b/thirdparty/opus/meson.build @@ -0,0 +1,234 @@ +if get_option('builtin_opus') + _builtin_opus_incdirs_list = ['.', 'celt', 'opus', 'silk'] + + _builtin_opus_compile_args = ['-DHAVE_CONFIG_H'] + + _builtin_opus_srcs = files([ + # Sync with opus_sources.mk + 'opus.c', + 'opus_decoder.c', + 'opus_encoder.c', + 'opus_multistream.c', + 'opus_multistream_encoder.c', + 'opus_multistream_decoder.c', + 'repacketizer.c', + 'analysis.c', + 'mlp.c', + 'mlp_data.c', + # Sync with libopusfile Makefile.am + 'info.c', + 'internal.c', + 'opusfile.c', + 'stream.c', + # Sync with celt_sources.mk + 'celt/bands.c', + 'celt/celt.c', + 'celt/celt_encoder.c', + 'celt/celt_decoder.c', + 'celt/cwrs.c', + 'celt/entcode.c', + 'celt/entdec.c', + 'celt/entenc.c', + 'celt/kiss_fft.c', + 'celt/laplace.c', + 'celt/mathops.c', + 'celt/mdct.c', + 'celt/modes.c', + 'celt/pitch.c', + 'celt/celt_lpc.c', + 'celt/quant_bands.c', + 'celt/rate.c', + 'celt/vq.c', + # 'celt/arm/arm_celt_map.c', + # 'celt/arm/armcpu.c', + # 'celt/arm/celt_ne10_fft.c', + # 'celt/arm/celt_ne10_mdct.c', + # 'celt/arm/celt_neon_intr.c', + # Sync with silk_sources.mk + 'silk/CNG.c', + 'silk/code_signs.c', + 'silk/init_decoder.c', + 'silk/decode_core.c', + 'silk/decode_frame.c', + 'silk/decode_parameters.c', + 'silk/decode_indices.c', + 'silk/decode_pulses.c', + 'silk/decoder_set_fs.c', + 'silk/dec_API.c', + 'silk/enc_API.c', + 'silk/encode_indices.c', + 'silk/encode_pulses.c', + 'silk/gain_quant.c', + 'silk/interpolate.c', + 'silk/LP_variable_cutoff.c', + 'silk/NLSF_decode.c', + 'silk/NSQ.c', + 'silk/NSQ_del_dec.c', + 'silk/PLC.c', + 'silk/shell_coder.c', + 'silk/tables_gain.c', + 'silk/tables_LTP.c', + 'silk/tables_NLSF_CB_NB_MB.c', + 'silk/tables_NLSF_CB_WB.c', + 'silk/tables_other.c', + 'silk/tables_pitch_lag.c', + 'silk/tables_pulses_per_block.c', + 'silk/VAD.c', + 'silk/control_audio_bandwidth.c', + 'silk/quant_LTP_gains.c', + 'silk/VQ_WMat_EC.c', + 'silk/HP_variable_cutoff.c', + 'silk/NLSF_encode.c', + 'silk/NLSF_VQ.c', + 'silk/NLSF_unpack.c', + 'silk/NLSF_del_dec_quant.c', + 'silk/process_NLSFs.c', + 'silk/stereo_LR_to_MS.c', + 'silk/stereo_MS_to_LR.c', + 'silk/check_control_input.c', + 'silk/control_SNR.c', + 'silk/init_encoder.c', + 'silk/control_codec.c', + 'silk/A2NLSF.c', + 'silk/ana_filt_bank_1.c', + 'silk/biquad_alt.c', + 'silk/bwexpander_32.c', + 'silk/bwexpander.c', + 'silk/debug.c', + 'silk/decode_pitch.c', + 'silk/inner_prod_aligned.c', + 'silk/lin2log.c', + 'silk/log2lin.c', + 'silk/LPC_analysis_filter.c', + 'silk/LPC_inv_pred_gain.c', + 'silk/table_LSF_cos.c', + 'silk/NLSF2A.c', + 'silk/NLSF_stabilize.c', + 'silk/NLSF_VQ_weights_laroia.c', + 'silk/pitch_est_tables.c', + 'silk/resampler.c', + 'silk/resampler_down2_3.c', + 'silk/resampler_down2.c', + 'silk/resampler_private_AR2.c', + 'silk/resampler_private_down_FIR.c', + 'silk/resampler_private_IIR_FIR.c', + 'silk/resampler_private_up2_HQ.c', + 'silk/resampler_rom.c', + 'silk/sigm_Q15.c', + 'silk/sort.c', + 'silk/sum_sqr_shift.c', + 'silk/stereo_decode_pred.c', + 'silk/stereo_encode_pred.c', + 'silk/stereo_find_predictor.c', + 'silk/stereo_quant_pred.c', + ]) + + if PLATFORM in ['android', 'iphone', 'javascript'] + _builtin_opus_srcs += files([ + 'silk/fixed/LTP_analysis_filter_FIX.c', + 'silk/fixed/LTP_scale_ctrl_FIX.c', + 'silk/fixed/corrMatrix_FIX.c', + 'silk/fixed/encode_frame_FIX.c', + 'silk/fixed/find_LPC_FIX.c', + 'silk/fixed/find_LTP_FIX.c', + 'silk/fixed/find_pitch_lags_FIX.c', + 'silk/fixed/find_pred_coefs_FIX.c', + 'silk/fixed/noise_shape_analysis_FIX.c', + 'silk/fixed/prefilter_FIX.c', + 'silk/fixed/process_gains_FIX.c', + 'silk/fixed/regularize_correlations_FIX.c', + 'silk/fixed/residual_energy16_FIX.c', + 'silk/fixed/residual_energy_FIX.c', + 'silk/fixed/solve_LS_FIX.c', + 'silk/fixed/warped_autocorrelation_FIX.c', + 'silk/fixed/apply_sine_window_FIX.c', + 'silk/fixed/autocorr_FIX.c', + 'silk/fixed/burg_modified_FIX.c', + 'silk/fixed/k2a_FIX.c', + 'silk/fixed/k2a_Q16_FIX.c', + 'silk/fixed/pitch_analysis_core_FIX.c', + 'silk/fixed/vector_ops_FIX.c', + 'silk/fixed/schur64_FIX.c', + 'silk/fixed/schur_FIX.c', + ]) + + _builtin_opus_compile_args += '-DFIXED_POINT' + _builtin_opus_incdirs_list += ['silk/fixed'] + else + _builtin_opus_srcs += files([ + 'silk/float/apply_sine_window_FLP.c', + 'silk/float/corrMatrix_FLP.c', + 'silk/float/encode_frame_FLP.c', + 'silk/float/find_LPC_FLP.c', + 'silk/float/find_LTP_FLP.c', + 'silk/float/find_pitch_lags_FLP.c', + 'silk/float/find_pred_coefs_FLP.c', + 'silk/float/LPC_analysis_filter_FLP.c', + 'silk/float/LTP_analysis_filter_FLP.c', + 'silk/float/LTP_scale_ctrl_FLP.c', + 'silk/float/noise_shape_analysis_FLP.c', + 'silk/float/prefilter_FLP.c', + 'silk/float/process_gains_FLP.c', + 'silk/float/regularize_correlations_FLP.c', + 'silk/float/residual_energy_FLP.c', + 'silk/float/solve_LS_FLP.c', + 'silk/float/warped_autocorrelation_FLP.c', + 'silk/float/wrappers_FLP.c', + 'silk/float/autocorrelation_FLP.c', + 'silk/float/burg_modified_FLP.c', + 'silk/float/bwexpander_FLP.c', + 'silk/float/energy_FLP.c', + 'silk/float/inner_product_FLP.c', + 'silk/float/k2a_FLP.c', + 'silk/float/levinsondurbin_FLP.c', + 'silk/float/LPC_inv_pred_gain_FLP.c', + 'silk/float/pitch_analysis_core_FLP.c', + 'silk/float/scale_copy_vector_FLP.c', + 'silk/float/scale_vector_FLP.c', + 'silk/float/schur_FLP.c', + 'silk/float/sort_FLP.c', + ]) + + _builtin_opus_incdirs_list += ['silk/float'] + endif + + # platform flags + if PLATFORM == 'android' + if host_machine.cpu_family() == 'arm' + _builtin_opus_compile_args += '-DOPUS_ARM_OPT' + elif host_machine.cpu_family() == 'aarch64' + _builtin_opus_compile_args += '-DOPUS_ARM64_OPT' + endif + elif PLATFORM == 'iphone' + if host_machine.cpu_family() == 'aarch64' + _builtin_opus_compile_args += '-DOPUS_ARM_OPT' + elif host_machine.cpu_family() == 'arm' + _builtin_opus_compile_args += '-DOPUS_ARM64_OPT' + endif + elif PLATFORM == 'osx' + if host_machine.cpu_family() == 'aarch64' + _builtin_opus_compile_args += '-DOPUS_ARM64_OPT' + endif + endif + + if PLATFORM == 'windows' + _builtin_opus_compile_args += ['-DWIN32'] + endif + + _builtin_opus_incdirs = include_directories(_builtin_opus_incdirs_list) + + lib_builtin_opus = static_library('builtin_opus', _builtin_opus_srcs, + include_directories: _builtin_opus_incdirs, + c_args: _builtin_opus_compile_args, + dependencies: [DEP_LIBOGG], + build_by_default: false + ) + + DEP_OPUS = declare_dependency(link_with: lib_builtin_opus, + include_directories: _builtin_opus_incdirs) +else + DEP_OPUS = [ + dependency('opus'), + dependency('opusfile') + ] +endif \ No newline at end of file diff --git a/thirdparty/pcre2/meson.build b/thirdparty/pcre2/meson.build new file mode 100644 index 000000000000..e398fb6d2741 --- /dev/null +++ b/thirdparty/pcre2/meson.build @@ -0,0 +1,47 @@ +if get_option('builtin_pcre2') + _pcre2_incdirs = include_directories('src') + + _pcre2_srcs = files([ + 'src/pcre2_auto_possess.c', + 'src/pcre2_chartables.c', + 'src/pcre2_compile.c', + 'src/pcre2_config.c', + 'src/pcre2_context.c', + 'src/pcre2_convert.c', + 'src/pcre2_dfa_match.c', + 'src/pcre2_error.c', + 'src/pcre2_extuni.c', + 'src/pcre2_find_bracket.c', + 'src/pcre2_jit_compile.c', + # 'src/pcre2_jit_match.c', 'src/pcre2_jit_misc.c', # these files are included in src/pcre2_jit_compile.c. + 'src/pcre2_maketables.c', + 'src/pcre2_match.c', + 'src/pcre2_match_data.c', + 'src/pcre2_newline.c', + 'src/pcre2_ord2utf.c', + 'src/pcre2_pattern_info.c', + 'src/pcre2_script_run.c', + 'src/pcre2_serialize.c', + 'src/pcre2_string_utils.c', + 'src/pcre2_study.c', + 'src/pcre2_substitute.c', + 'src/pcre2_substring.c', + 'src/pcre2_tables.c', + 'src/pcre2_ucd.c', + 'src/pcre2_valid_utf.c', + 'src/pcre2_xclass.c', + ]) + + _pcre2_c_args = [ '-DHAVE_CONFIG_H', '-DSUPPORT_UNICODE'] + _pcre2_dep_args = ['-DPCRE2_STATIC','-DPCRE2_CODE_UNIT_WIDTH=32'] + + if get_option('builtin_pcre2_with_jit') + _pcre2_c_args += ['-DSUPPORT_JIT'] + endif + + _lib_pcre2 = static_library('libpcre2', _pcre2_srcs, include_directories: _pcre2_incdirs, c_args: _pcre2_c_args + _pcre2_dep_args, build_by_default: false) + + DEP_PCRE2 = declare_dependency(link_with: _lib_pcre2, include_directories: _pcre2_incdirs, compile_args: _pcre2_dep_args) +else + DEP_PCRE2 = dependency('libpcre2-32') +endif \ No newline at end of file diff --git a/thirdparty/pvrtccompressor/meson.build b/thirdparty/pvrtccompressor/meson.build new file mode 100644 index 000000000000..226679e7e39d --- /dev/null +++ b/thirdparty/pvrtccompressor/meson.build @@ -0,0 +1,20 @@ +_builtin_pvrtc_srcs = files([ + 'BitScale.cpp', + 'MortonTable.cpp', + 'PvrTcDecoder.cpp', + 'PvrTcEncoder.cpp', + 'PvrTcPacket.cpp', +]) + +# we use core/typedefs.h from godot, so inject that core folder in +_builtin_pvrtc_build_incdirs = include_directories('../../', '../../' / DIR_PLATFORM) + +_builtin_pvrtc_dep_incdirs = include_directories('.') + +lib_builtin_pvrtc = static_library('builtin_pvrtccompressor', _builtin_pvrtc_srcs, + include_directories: _builtin_pvrtc_build_incdirs, + build_by_default: false +) + +DEP_PVRTCCOMPRESSOR = declare_dependency(link_with: lib_builtin_pvrtc, + include_directories: _builtin_pvrtc_dep_incdirs) \ No newline at end of file diff --git a/thirdparty/recastnavigation/meson.build b/thirdparty/recastnavigation/meson.build new file mode 100644 index 000000000000..5ad07099c3b7 --- /dev/null +++ b/thirdparty/recastnavigation/meson.build @@ -0,0 +1,19 @@ +_recast_incdirs = include_directories('Recast/Include') + +_recast_srcs = files([ + 'Recast/Source/Recast.cpp', + 'Recast/Source/RecastAlloc.cpp', + 'Recast/Source/RecastArea.cpp', + 'Recast/Source/RecastAssert.cpp', + 'Recast/Source/RecastContour.cpp', + 'Recast/Source/RecastFilter.cpp', + 'Recast/Source/RecastLayers.cpp', + 'Recast/Source/RecastMesh.cpp', + 'Recast/Source/RecastMeshDetail.cpp', + 'Recast/Source/RecastRasterization.cpp', + 'Recast/Source/RecastRegion.cpp', +]) + +_lib_recast = static_library('bultin_recast', _recast_srcs, include_directories: _recast_incdirs, build_by_default: false) + +DEP_RECAST = declare_dependency(link_with: _lib_recast, include_directories: _recast_incdirs) \ No newline at end of file diff --git a/thirdparty/rvo2/meson.build b/thirdparty/rvo2/meson.build new file mode 100644 index 000000000000..c275bc176552 --- /dev/null +++ b/thirdparty/rvo2/meson.build @@ -0,0 +1,10 @@ +_rvo2_incdirs = include_directories('.') + +_rvo2_srcs = files([ + 'Agent.cpp', + 'KdTree.cpp' +]) + +_lib_rvo2 = static_library('builtin_rvo2', _rvo2_srcs, include_directories: _rvo2_incdirs, build_by_default: false) + +DEP_RVO2 = declare_dependency(link_with: _lib_rvo2, include_directories: _rvo2_incdirs) \ No newline at end of file diff --git a/thirdparty/spirv-reflect/meson.build b/thirdparty/spirv-reflect/meson.build new file mode 100644 index 000000000000..9b068661db06 --- /dev/null +++ b/thirdparty/spirv-reflect/meson.build @@ -0,0 +1,9 @@ +_spirv_reflect_incdirs = include_directories('include') + +_spirv_reflect_sources = files([ + 'spirv_reflect.c' +]) + +_lib_spirv_reflect = static_library('spirv-reflect', _spirv_reflect_sources, include_directories: _spirv_reflect_incdirs, build_by_default: false) + +DEP_SPIRV_REFLECT = declare_dependency(link_with: _lib_spirv_reflect, include_directories: _spirv_reflect_incdirs) diff --git a/thirdparty/squish/meson.build b/thirdparty/squish/meson.build new file mode 100644 index 000000000000..ba4ffcfd0e24 --- /dev/null +++ b/thirdparty/squish/meson.build @@ -0,0 +1,24 @@ +if get_option('builtin_squish') + _builtin_squish_srcs = files([ + 'alpha.cpp', + 'clusterfit.cpp', + 'colourblock.cpp', + 'colourfit.cpp', + 'colourset.cpp', + 'maths.cpp', + 'rangefit.cpp', + 'singlecolourfit.cpp', + 'squish.cpp', + ]) + + _builtin_squish_incdirs = include_directories('.') + + lib_builtin_squish = static_library('builtin_squish', _builtin_squish_srcs, + include_directories: _builtin_squish_incdirs, + build_by_default: false + ) + + DEP_SQUISH = declare_dependency(link_with: lib_builtin_squish, include_directories: _builtin_squish_incdirs) +else + DEP_SQUISH = dependency('libsquish') +endif \ No newline at end of file diff --git a/thirdparty/tinyexr/meson.build b/thirdparty/tinyexr/meson.build new file mode 100644 index 000000000000..3eac1f3a092b --- /dev/null +++ b/thirdparty/tinyexr/meson.build @@ -0,0 +1,19 @@ +_builtin_tinyexr_srcs = files([ + 'tinyexr.cc' +]) + +_builtin_tinyexr_incdirs = include_directories('.') + +_builtin_tinyexr_compile_args = ['-DTINYEXR_USE_THREAD'] + +lib_builtin_tinyexr = static_library('builtin_tinyexr', _builtin_tinyexr_srcs, + include_directories: _builtin_tinyexr_incdirs, + cpp_args: _builtin_tinyexr_compile_args, + build_by_default: false +) + +DEP_TINYEXR = declare_dependency( + link_with: lib_builtin_tinyexr, + include_directories: _builtin_tinyexr_incdirs, + compile_args: _builtin_tinyexr_compile_args +) \ No newline at end of file diff --git a/thirdparty/vhacd/meson.build b/thirdparty/vhacd/meson.build new file mode 100644 index 000000000000..fbe99fd92c53 --- /dev/null +++ b/thirdparty/vhacd/meson.build @@ -0,0 +1,18 @@ +_builtin_vhacd_srcs = files([ + 'src/vhacdManifoldMesh.cpp', + 'src/FloatMath.cpp', + 'src/vhacdMesh.cpp', + 'src/vhacdICHull.cpp', + 'src/vhacdVolume.cpp', + 'src/VHACD-ASYNC.cpp', + 'src/btAlignedAllocator.cpp', + 'src/vhacdRaycastMesh.cpp', + 'src/VHACD.cpp', + 'src/btConvexHullComputer.cpp', +]) + +_builtin_vhacd_incdirs = include_directories('inc') + +lib_builtin_vhacd = static_library('builtin_vhacd', _builtin_vhacd_srcs, include_directories: _builtin_vhacd_incdirs, build_by_default: false) + +DEP_VHACD = declare_dependency(link_with: lib_builtin_vhacd, include_directories: _builtin_vhacd_incdirs) \ No newline at end of file diff --git a/thirdparty/vulkan/meson.build b/thirdparty/vulkan/meson.build new file mode 100644 index 000000000000..c77985f111cd --- /dev/null +++ b/thirdparty/vulkan/meson.build @@ -0,0 +1,77 @@ +if get_option('builtin_vulkan') + _vulkan_lib_incdirs = [include_directories('.', 'include')] + + _vulkan_deps = [] + _vulkan_link_args = [] + # CPP flags that we need to link against in godot + _vulkan_cpp_dep_args = [] + # CPP flags for building the vulkan library + _vulkan_cpp_args = ['-DVULKAN_NON_CMAKE_BUILD'] + + _vulkan_srcs = files( + 'vk_mem_alloc.cpp', + ) + + if PLATFORM == 'windows' + _vulkan_deps += meson.get_compiler('cpp').find_library('cfgmgr32') + _vulkan_cpp_dep_args += ['-DVK_USE_PLATFORM_WIN32_KHR', '-DAPI_NAME="Vulkan"'] + _vulkan_cpp_args += ['-DWIN32_LEAN_AND_MEAN'] + + if _cpp_compiler_id != 'msvc' + _vulkan_cpp_args += ['-DCM_GETIDLIST_FILTER_CLASS=0x00000200', '-DCM_GETIDLIST_FILTER_PRESENT=0x00000100'] + endif + elif PLATFORM == 'osx' + _vulkan_cpp_dep_args += ['-DVK_USE_PLATFORM_MACOS_MVK'] + _vulkan_cpp_args += [ + '-DSYSCONFDIR="/etc"', + '-DFALLBACK_DATA_DIRS="/usr/local/share:/usr/share"', + '-DFALLBACK_CONFIG_DIRS="/etc/xdg"' + ] + elif PLATFORM == 'iphone' + _vulkan_cpp_dep_args += ['-DVK_USE_PLATFORM_IOS_MVK'] + _vulkan_cpp_args += [ + '-DSYSCONFDIR="/etc"', + '-DFALLBACK_DATA_DIRS="/usr/local/share:/usr/share"', + '-DFALLBACK_CONFIG_DIRS="/etc/xdg"' + ] + elif PLATFORM == 'linuxbsd' + _vulkan_cpp_dep_args += ['-DVK_USE_PLATFORM_XLIB_KHR'] + _vulkan_cpp_args += [ + '-DSYSCONFDIR="/etc"', + '-DFALLBACK_DATA_DIRS="/usr/local/share:/usr/share"', + '-DFALLBACK_CONFIG_DIRS="/etc/xdg"', + '-DHAVE_SECURE_GETENV', + '-D_DEFAULT_SOURCE', + ] + elif PLATFORM == 'android' + _vulkan_cpp_dep_args += ['-DVK_USE_PLATFORM_ANDROID_KHR'] + endif + + if _cpp_compiler_id == 'gcc' + _vulkan_cpp_args += '-Wno-stringop-overflow' + endif + + _vulkan_incdirs = [include_directories('include', '.')] + + if get_option('use_volk') + _vulkan_cpp_dep_args += ['-DUSE_VOLK'] + _vulkan_lib_incdirs += include_directories('../volk') + _vulkan_incdirs += include_directories('../volk') + elif PLATFORM == 'android' + # Our current NDK version only provides old Vulkan headers, + # so we have to limit VMA. + _vulkan_cpp_dep_args += ['VMA_VULKAN_VERSION=1000000'] + endif + + # force cpp language, even though its c files (for pragma once) + _vulkan_lib = static_library('vulkan', _vulkan_srcs, + include_directories: _vulkan_lib_incdirs, dependencies: _vulkan_deps, + link_args: _vulkan_link_args, + cpp_args: [_vulkan_cpp_args, _vulkan_cpp_dep_args], + c_args: [_vulkan_cpp_args, _vulkan_cpp_dep_args], + build_by_default: false) + + DEP_VULKAN = declare_dependency(link_with: _vulkan_lib, include_directories: _vulkan_incdirs, compile_args: _vulkan_cpp_dep_args) +else + DEP_VULKAN = dependency('vulkan') +endif diff --git a/thirdparty/wslay/meson.build b/thirdparty/wslay/meson.build new file mode 100644 index 000000000000..505f1e6faf50 --- /dev/null +++ b/thirdparty/wslay/meson.build @@ -0,0 +1,32 @@ +if get_option('builtin_wslay') + _builtin_wslay_srcs = files([ + 'wslay_event.c', + 'wslay_frame.c', + 'wslay_net.c', + 'wslay_queue.c', + 'wslay_stack.c', + ]) + + _builtin_wslay_incdirs = include_directories('includes') + + _builtin_wslay_compile_args = ['-DHAVE_CONFIG_H'] + + if PLATFORM == 'windows' or PLATFORM == 'uwp' + _builtin_wslay_compile_args += '-DHAVE_WINSOCK2_H' + else + _builtin_wslay_compile_args += '-DHAVE_NETINET_IN_H' + endif + + lib_builtin_wslay = static_library('builtin_wslay', _builtin_wslay_srcs, + include_directories: _builtin_wslay_incdirs, + c_args: _builtin_wslay_compile_args, + build_by_default: false + ) + + DEP_WSLAY = declare_dependency(link_with: lib_builtin_wslay, + include_directories: _builtin_wslay_incdirs, + compile_args: _builtin_wslay_compile_args + ) +else + DEP_WSLAY = dependency('libwslay') +endif \ No newline at end of file diff --git a/thirdparty/xatlas/meson.build b/thirdparty/xatlas/meson.build new file mode 100644 index 000000000000..a7996a55750e --- /dev/null +++ b/thirdparty/xatlas/meson.build @@ -0,0 +1,12 @@ +_builtin_xatlas_srcs = files([ + 'xatlas.cpp' +]) + +_builtin_xatlas_incdirs = include_directories('.') + +lib_bultin_xatlas = static_library('bultin_xatlas', _builtin_xatlas_srcs, + include_directories: _builtin_xatlas_incdirs, + build_by_default: false +) + +DEP_XATLAS = declare_dependency(link_with: lib_bultin_xatlas, include_directories: _builtin_xatlas_incdirs) \ No newline at end of file diff --git a/thirdparty/zlib/meson.build b/thirdparty/zlib/meson.build new file mode 100644 index 000000000000..0cbd9e5adab1 --- /dev/null +++ b/thirdparty/zlib/meson.build @@ -0,0 +1,42 @@ + + +if get_option('builtin_zlib') + _zlib_incdirs = include_directories('.') + _zlib_srcs = files([ + 'adler32.c', + 'compress.c', + 'crc32.c', + 'deflate.c', + 'infback.c', + 'inffast.c', + 'inflate.c', + 'inftrees.c', + 'trees.c', + 'uncompr.c', + 'zutil.c' + ]) + + _zlib_link_args = [] + _zlib_c_args = [] + + if get_option('debug') + _zlib_c_args += '-DZLIB_DEBUG' + endif + + _c_compiler = meson.get_compiler('c').get_id() + + if _c_compiler == 'clang' + _zlib_link_args += ['-Wdeprecated-declarations'] + endif + + _lib_zlib = static_library('zlib', _zlib_srcs, include_directories: _zlib_incdirs, link_args: _zlib_link_args, c_args: _zlib_c_args, build_by_default: false) + + _zlib_dep_flags = [] + if get_option('debug') + _zlib_dep_flags += ['-DZLIB_DEBUG'] + endif + + DEP_ZLIB = declare_dependency(link_with: _lib_zlib, include_directories: _zlib_incdirs, compile_args: _zlib_dep_flags) +else + DEP_ZLIB = dependency('zlib', required=false) +endif \ No newline at end of file diff --git a/thirdparty/zstd/meson.build b/thirdparty/zstd/meson.build new file mode 100644 index 000000000000..53fc1f1f0c47 --- /dev/null +++ b/thirdparty/zstd/meson.build @@ -0,0 +1,39 @@ +if get_option('builtin_zstd') + _zstd_srcs = files([ + 'common/debug.c', + 'common/entropy_common.c', + 'common/error_private.c', + 'common/fse_decompress.c', + 'common/pool.c', + 'common/threading.c', + 'common/xxhash.c', + 'common/zstd_common.c', + 'compress/fse_compress.c', + 'compress/hist.c', + 'compress/huf_compress.c', + 'compress/zstd_compress.c', + 'compress/zstd_double_fast.c', + 'compress/zstd_fast.c', + 'compress/zstd_lazy.c', + 'compress/zstd_ldm.c', + 'compress/zstd_opt.c', + 'compress/zstdmt_compress.c', + 'compress/zstd_compress_literals.c', + 'compress/zstd_compress_sequences.c', + 'compress/zstd_compress_superblock.c', + 'decompress/huf_decompress.c', + 'decompress/zstd_ddict.c', + 'decompress/zstd_decompress_block.c', + 'decompress/zstd_decompress.c', + ]) + + _zstd_incdirs = include_directories('.') + + #_zstd_c_args = ['-DZSTD_STATIC_LINKING_ONLY'] + + _lib_zstd = static_library('zstd', _zstd_srcs, include_directories: _zstd_incdirs, build_by_default: false) + + DEP_ZSTD = declare_dependency(link_with: _lib_zstd, include_directories: _zstd_incdirs) +else + DEP_ZSTD = dependency('libzstd') +endif \ No newline at end of file diff --git a/version.json b/version.json new file mode 100644 index 000000000000..c099362ffb1f --- /dev/null +++ b/version.json @@ -0,0 +1,11 @@ +{ + "short_name": "godot", + "name": "Godot Engine", + "major": 4, + "minor": 0, + "patch": 0, + "status": "dev", + "module_config": "", + "year": 2020, + "website": "https://godotengine.org" +}