From 6ba3973c058d3831258c0cb1b223261af264e60a Mon Sep 17 00:00:00 2001 From: Jammyjamjamman Date: Wed, 17 Aug 2022 20:48:01 +0100 Subject: [PATCH 01/48] wip --- meson.build | 35 ++++++ source/meson.build | 1 + source/shared_lib/meson.build | 34 +++++ .../shared_lib/sources/streflop/meson.build | 117 ++++++++++++++++++ 4 files changed, 187 insertions(+) create mode 100644 meson.build create mode 100644 source/meson.build create mode 100644 source/shared_lib/meson.build create mode 100644 source/shared_lib/sources/streflop/meson.build diff --git a/meson.build b/meson.build new file mode 100644 index 000000000..0f6b06a6a --- /dev/null +++ b/meson.build @@ -0,0 +1,35 @@ +project( + 'MegaGlest', + 'cpp', + version: '3.13.0.999', + meson_version : '>= 0.56.0', + default_options: ['warning_level=0'] + ) + +# Setup compiler. +compiler = meson.get_compiler('cpp') + +add_global_arguments( + [ + # '-DUSE_STREFLOP', + '-DSTREFLOP_SOFT', + # '-DSTREFLOP_RANDOM_GEN_SIZE=32', + '-DLIBM_COMPILING_FLT32', + '-DN_SPECIALIZED=32', + '-frounding-math', + '-fsignaling-nans', + # '-Wno-switch', + # '-Wuninitialized', + # '-Wsign-compare', + # '-Wunused-function', + # '-Wunused-variable', + # '-Wreturn-type', + '-fno-strict-aliasing', + '-DHAVE_SYS_IOCTL_H', + '-DUNICODE', + # '-O3', + # '-w', + ], + language: 'cpp') + +subdir('source') diff --git a/source/meson.build b/source/meson.build new file mode 100644 index 000000000..3106a579b --- /dev/null +++ b/source/meson.build @@ -0,0 +1 @@ +subdir('shared_lib') diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build new file mode 100644 index 000000000..d502f01af --- /dev/null +++ b/source/shared_lib/meson.build @@ -0,0 +1,34 @@ +subdir('sources/streflop') + +src_basename = [ + 'base_thread.cpp', + 'byte_order.cpp', + 'cache_manager.cpp', + 'platform_common.cpp', + 'simple_threads.cpp', +] + +src = [] +foreach file : src_basename + src += [join_paths('sources/platform/common/', file)] +endforeach + +dep_curl = dependency('libcurl') +dep_sdl = dependency('sdl2') + +# lib_megaglest = static_library( +# 'megaglest', +# src, +# include_directories : [ +# 'include/streflop', +# 'include/platform/common', +# 'include/platform/posix', +# 'include/platform/sdl', +# 'include/util', +# 'include/graphics', +# ], +# dependencies: [dep_curl, dep_sdl, dep_streflop] +# # dependencies: [dep_curl, dep_sdl, dep_streflop] +# ) + +# dep_rmw = declare_dependency(link_with: lib_rmw, include_directories : '..') diff --git a/source/shared_lib/sources/streflop/meson.build b/source/shared_lib/sources/streflop/meson.build new file mode 100644 index 000000000..6cec5d6ec --- /dev/null +++ b/source/shared_lib/sources/streflop/meson.build @@ -0,0 +1,117 @@ +src = [ + 'SMath.cpp', + 'Random.cpp', + 'streflopC.cpp', + 'SoftFloatWrapper.cpp', + 'softfloat/softfloat.cpp', +] + +# src_basename = [ +# 'e_expf.c', +# 'w_expf.c', +# ] + +# foreach file : src_basename +# src += [join_paths('libm/', file)] +# endforeach + +# src_basename = [ +# 'e_acosf.cpp', +# 'e_acoshf.cpp', +# 'e_asinf.cpp', +# 'e_atan2f.cpp', +# 'e_atanhf.cpp', +# 'e_coshf.cpp', +# 'e_exp2f.cpp', +# 'e_expf.cpp', +# 'e_fmodf.cpp', +# 'e_gammaf_r.cpp', +# 'e_hypotf.cpp', +# 'e_j0f.cpp', +# 'e_j1f.cpp', +# 'e_jnf.cpp', +# 'e_lgammaf_r.cpp', +# 'e_log10f.cpp', +# 'e_log2f.cpp', +# 'e_logf.cpp', +# 'e_powf.cpp', +# 'e_remainderf.cpp', +# 'e_rem_pio2f.cpp', +# 'e_sinhf.cpp', +# 'e_sqrtf.cpp', +# 'k_cosf.cpp', +# 'k_rem_pio2f.cpp', +# 'k_sinf.cpp', +# 'k_tanf.cpp', +# 's_asinhf.cpp', +# 's_atanf.cpp', +# 's_cbrtf.cpp', +# 's_ceilf.cpp', +# 's_copysignf.cpp', +# 's_cosf.cpp', +# 's_erff.cpp', +# 's_expm1f.cpp', +# 's_fabsf.cpp', +# 's_finitef.cpp', +# 's_floorf.cpp', +# 's_fpclassifyf.cpp', +# 's_frexpf.cpp', +# 's_ilogbf.cpp', +# 's_isinff.cpp', +# 's_isnanf.cpp', +# 's_ldexpf.cpp', +# 's_llrintf.cpp', +# 's_llroundf.cpp', +# 's_log1pf.cpp', +# 's_logbf.cpp', +# 's_lrintf.cpp', +# 's_lroundf.cpp', +# 's_modff.cpp', +# 's_nearbyintf.cpp', +# 's_nextafterf.cpp', +# 's_remquof.cpp', +# 's_rintf.cpp', +# 's_roundf.cpp', +# 's_scalblnf.cpp', +# 's_scalbnf.cpp', +# 's_signbitf.cpp', +# 's_sincosf.cpp', +# 's_sinf.cpp', +# 's_tanf.cpp', +# 's_tanhf.cpp', +# 's_truncf.cpp', +# 'w_expf.cpp', +# ] + +# foreach file : src_basename +# src += [join_paths('libm/flt-32', file)] +# endforeach + +includes = [ + '../../include/streflop/libm/flt-32', + # '../../include/streflop/libm/headers', + '../../include/streflop/libm', + '../../include/streflop/softfloat', + '../../include/streflop', + '../../include/platform/common', + # '../../include/streflop/libm_flt32_source', +] + +# add_project_arguments( +# [ +# '-DSTREFLOP_SOFT', +# '-DLIBM_COMPILING_FLT32', +# '-DN_SPECIALIZED=32', +# ], +# language: 'cpp' +# ) + +lib_streflop = static_library( + 'streflop', + src, + # c_args : ['-DSTREFLOP_SOFT'], + include_directories : includes, +# dependencies: [dep_curl, dep_sdl] + ) + +dep_streflop = declare_dependency(link_with: lib_streflop, include_directories : includes) From da6402ae6f09f87fe6676ee1b9994d61a69bd200 Mon Sep 17 00:00:00 2001 From: Jammyjamjamman Date: Mon, 22 Aug 2022 22:34:22 +0100 Subject: [PATCH 02/48] More meson progress --- meson.build | 52 ++++--- source/glest_game/meson.build | 143 ++++++++++++++++++ source/shared_lib/meson.build | 107 ++++++++++--- .../sources/feathery_ftp/meson.build | 33 ++++ 4 files changed, 293 insertions(+), 42 deletions(-) create mode 100644 source/glest_game/meson.build create mode 100644 source/shared_lib/sources/feathery_ftp/meson.build diff --git a/meson.build b/meson.build index 0f6b06a6a..2eedb3d3f 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project( 'MegaGlest', - 'cpp', + ['c', 'cpp'], version: '3.13.0.999', meson_version : '>= 0.56.0', default_options: ['warning_level=0'] @@ -9,27 +9,31 @@ project( # Setup compiler. compiler = meson.get_compiler('cpp') -add_global_arguments( - [ - # '-DUSE_STREFLOP', - '-DSTREFLOP_SOFT', - # '-DSTREFLOP_RANDOM_GEN_SIZE=32', - '-DLIBM_COMPILING_FLT32', - '-DN_SPECIALIZED=32', - '-frounding-math', - '-fsignaling-nans', - # '-Wno-switch', - # '-Wuninitialized', - # '-Wsign-compare', - # '-Wunused-function', - # '-Wunused-variable', - # '-Wreturn-type', - '-fno-strict-aliasing', - '-DHAVE_SYS_IOCTL_H', - '-DUNICODE', - # '-O3', - # '-w', - ], - language: 'cpp') +#add_global_arguments( +# [ +# # '-DUSE_STREFLOP', +# '-DSTREFLOP_SOFT', +# # '-DSTREFLOP_RANDOM_GEN_SIZE=32', +# '-DLIBM_COMPILING_FLT32', +# '-DN_SPECIALIZED=32', +# '-frounding-math', +# '-fsignaling-nans', +# # '-Wno-switch', +# # '-Wuninitialized', +# # '-Wsign-compare', +# # '-Wunused-function', +# # '-Wunused-variable', +# # '-Wreturn-type', +# '-fno-strict-aliasing', +# '-DHAVE_SYS_IOCTL_H', +# '-DUNICODE', +# # '-O3', +# # '-w', +# ], +# language: 'cpp') -subdir('source') +subdir('source/shared_lib') +#subdir('source/glest_game') + + +#subdir('source') diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build new file mode 100644 index 000000000..61815078a --- /dev/null +++ b/source/glest_game/meson.build @@ -0,0 +1,143 @@ +src_game = [ + 'ai/ai.cpp', + 'ai/ai_interface.cpp', + 'ai/ai_rule.cpp', + 'ai/path_finder.cpp', + 'facilities/auto_test.cpp', + 'facilities/components.cpp', + 'facilities/game_util.cpp', + 'facilities/logger.cpp', + 'game/achievement.cpp', + 'game/chat_manager.cpp', + 'game/commander.cpp', + 'game/console.cpp', + 'game/game_camera.cpp', + 'game/game.cpp', + 'game/script_manager.cpp', + 'game/stats.cpp', + 'global/config.cpp', + 'global/core_data.cpp', + 'global/lang.cpp', + 'global/metrics.cpp', + 'graphics/particle_type.cpp', + 'graphics/renderer.cpp', + 'graphics/unit_particle_type.cpp', + 'gui/display.cpp', + 'gui/gui.cpp', + 'gui/selection.cpp', + 'main/battle_end.cpp', + 'main/intro.cpp', + 'main/main.cpp', + 'main/program.cpp', + 'menu/main_menu.cpp', + 'menu/menu_background.cpp', + 'menu/menu_state_about.cpp', + 'menu/menu_state_connected_game.cpp', + 'menu/menu_state_custom_game.cpp', + 'menu/menu_state_graphic_info.cpp', + 'menu/menu_state_join_game.cpp', + 'menu/menu_state_keysetup.cpp', + 'menu/menu_state_load_game.cpp', + 'menu/menu_state_masterserver.cpp', + 'menu/menu_state_mods.cpp', + 'menu/menu_state_new_game.cpp', + 'menu/menu_state_options.cpp', + 'menu/menu_state_options_graphics.cpp', + 'menu/menu_state_options_network.cpp', + 'menu/menu_state_options_sound.cpp', + 'menu/menu_state_root.cpp', + 'menu/menu_state_scenario.cpp', + 'menu/server_line.cpp', + 'network/client_interface.cpp', + 'network/connection_slot.cpp', + 'network/network_interface.cpp', + 'network/network_manager.cpp', + 'network/network_message.cpp', + 'network/network_protocol.cpp', + 'network/network_types.cpp', + 'network/server_interface.cpp', + 'sound/sound_container.cpp', + 'sound/sound_renderer.cpp', + 'steam/steam.cpp', + 'type_instances/command.cpp', + 'type_instances/faction.cpp', + 'type_instances/object.cpp', + 'type_instances/resource.cpp', + 'type_instances/unit.cpp', + 'type_instances/upgrade.cpp', + 'types/command_type.cpp', + 'types/damage_multiplier.cpp', + 'types/element_type.cpp', + 'types/faction_type.cpp', + 'types/object_type.cpp', + 'types/projectile_type.cpp', + 'types/resource_type.cpp', + 'types/skill_type.cpp', + 'types/tech_tree.cpp', + 'types/tileset_model_type.cpp', + 'types/unit_type.cpp', + 'types/upgrade_type.cpp', + 'world/map.cpp', + 'world/minimap.cpp', + 'world/scenario.cpp', + 'world/surface_atlas.cpp', + 'world/tileset.cpp', + 'world/time_flow.cpp', + 'world/unit_updater.cpp', + 'world/water_effects.cpp', + 'world/world.cpp', + ] + + +inc_game = [ + 'types', + 'ai', + 'menu', + 'steam', + 'facilities', + 'main', + 'steamshim', + 'network', + 'world', + 'global', + 'type_instances', + 'gui', + 'sound', + 'graphics', + 'game', +] + +inc_common = [ + '../shared_lib/include/platform', + '../shared_lib/include/platform/posix', + '../shared_lib/include/platform/common', + '../shared_lib/include/platform/win32', + '../shared_lib/include/platform/miniupnpc', + '../shared_lib/include/platform/sdl', + '../shared_lib/include/util', + '../shared_lib/include/util/utf8', + '../shared_lib/include/map', + '../shared_lib/include/compression', + '../shared_lib/include/feathery_ftp', + '../shared_lib/include/libircclient', + '../shared_lib/include/libircclient/include', + '../shared_lib/include/streflop', + '../shared_lib/include/streflop/softfloat', + '../shared_lib/include/streflop/libm', + '../shared_lib/include/streflop/libm/headers', + '../shared_lib/include/streflop/libm/flt-32', + '../shared_lib/include/lua', + '../shared_lib/include/xml', + '../shared_lib/include/xml/rapidxml', + '../shared_lib/include/sound', + '../shared_lib/include/sound/openal', + '../shared_lib/include/graphics', + '../shared_lib/include/graphics/gl', + ] + +executable('megaglest', + src_game, + include_directories: [inc_game, inc_common], + dependencies: [dep_sdl, dep_lua, dep_feathery_ftp], + link_with: [lib_megaglest] + ) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index d502f01af..5397b53d5 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -1,4 +1,27 @@ -subdir('sources/streflop') +# subdir('sources/streflop') +subdir('sources/feathery_ftp') +# subdir('sources/util') + +src = [] + +src_basename = [ + 'string_utils.cpp', + 'util.cpp', + 'properties.cpp', + 'profiler.cpp', + 'leak_dumper.cpp', + 'checksum.cpp', + 'conversion.cpp', + 'randomgen.cpp', +] + +foreach file : src_basename + src += [join_paths('sources/util/', file)] +endforeach + +inc_util = [ + +] src_basename = [ 'base_thread.cpp', @@ -8,27 +31,75 @@ src_basename = [ 'simple_threads.cpp', ] -src = [] foreach file : src_basename src += [join_paths('sources/platform/common/', file)] endforeach dep_curl = dependency('libcurl') dep_sdl = dependency('sdl2') +dep_x11 = dependency('x11') +dep_openal = dependency('openal') +dep_lua = dependency('lua') +dep_cppunit = dependency('cppunit') +dep_fribidi = dependency('fribidi') +dep_glib = dependency('glib-2.0') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') +#dep_ = dependency('') + +#-lcppunit +#-lfribidi +#-lglib-2.0 +#-lGL +#-lGLU +#-lSM +#-lICE +#-lXext +#-lopenal +#-llua5.3 +#-lm #£ math lib +#-ldl +#-ljpeg +#-lpng +#-lfontconfig +#-lftgl +#-lfreetype +#-lGLEW +#-lminiupnpc +#-lircclient +#-lSDL2main +#-lfribidi +#-lglib-2.0 + +lib_megaglest = static_library( + 'megaglest', + src, + include_directories : [ + 'include/streflop', + 'include/platform/common', + 'include/platform/posix', + 'include/platform/sdl', + 'include/graphics', + 'include/util/', + 'include/util/utf8', + ], + dependencies: [ + dep_curl, + dep_sdl, dep_x11, dep_openal, dep_lua, + dep_cppunit, + dep_fribidi, + dep_glib + ] + ) -# lib_megaglest = static_library( -# 'megaglest', -# src, -# include_directories : [ -# 'include/streflop', -# 'include/platform/common', -# 'include/platform/posix', -# 'include/platform/sdl', -# 'include/util', -# 'include/graphics', -# ], -# dependencies: [dep_curl, dep_sdl, dep_streflop] -# # dependencies: [dep_curl, dep_sdl, dep_streflop] -# ) - -# dep_rmw = declare_dependency(link_with: lib_rmw, include_directories : '..') +# dep_libmegaglest = declare_dependency(link_with: lib_megaglest, include_directories : '..') diff --git a/source/shared_lib/sources/feathery_ftp/meson.build b/source/shared_lib/sources/feathery_ftp/meson.build new file mode 100644 index 000000000..c3ca418a7 --- /dev/null +++ b/source/shared_lib/sources/feathery_ftp/meson.build @@ -0,0 +1,33 @@ +src_feathery_ftp = [ + 'ftpTargetWin32.c', + 'ftpServer.c', + 'ftpTargetPosix.c', + 'ftpLib.c', + 'ftpRuntime.c', + 'ftpCmds.c', + 'ftpSession.c', + 'ftpAccount.c', + 'ftpMessages.c', +] + +inc_feathery_ftp = [ + '../../include/feathery_ftp/', +] + +lib_featheryftp = static_library( + 'feathery_ftp', + src_feathery_ftp, + include_directories : inc_feathery_ftp, +# dependencies: [ +# dep_curl, +# dep_sdl, dep_x11, dep_openal, dep_lua, +# dep_cppunit, +# dep_fribidi, +# dep_glib +# ] + ) + +dep_feathery_ftp = declare_dependency( + link_with: lib_featheryftp, + include_directories: inc_feathery_ftp + ) From 639326820dfbbdb9ec8f0096a83f759327c36c83 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Tue, 23 Aug 2022 14:43:29 -0500 Subject: [PATCH 03/48] add meson build to the CI --- .github/workflows/cmake.yml | 393 ++++++++++++++++++---------------- meson.build | 4 +- source/shared_lib/meson.build | 16 +- 3 files changed, 222 insertions(+), 191 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c1b1a4b7d..60f2da0e9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -15,198 +15,217 @@ on: - '**/appimage.yml' jobs: - freebsd: - runs-on: ubuntu-latest - name: FreeBSD - steps: - - uses: actions/checkout@v4 - - name: Test in FreeBSD - id: test - uses: vmactions/freebsd-vm@v1 - with: - usesh: true - prepare: | - pkg install -y \ - bash \ - cmake \ - cppunit \ - curl \ - freetype2 \ - fribidi \ - ftgl \ - git \ - glew \ - jpeg-turbo \ - libGLU \ - libircclient \ - libogg \ - libvorbis \ - libX11 \ - libxml2 \ - lua53 \ - mesa-libs \ - miniupnpc \ - openal-soft \ - pkgconf \ - png \ - sdl2 \ - wx30-gtk3 - - run: | - git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source - cd mk/linux - ./build-mg.sh -f -d - - build-linux: + #freebsd: + #runs-on: ubuntu-latest + #name: FreeBSD + #steps: + #- uses: actions/checkout@v4 + #- name: Test in FreeBSD + #id: test + #uses: vmactions/freebsd-vm@v1 + #with: + #usesh: true + #prepare: | + #pkg install -y \ + #bash \ + #cmake \ + #cppunit \ + #curl \ + #freetype2 \ + #fribidi \ + #ftgl \ + #git \ + #glew \ + #jpeg-turbo \ + #libGLU \ + #libircclient \ + #libogg \ + #libvorbis \ + #libX11 \ + #libxml2 \ + #lua53 \ + #mesa-libs \ + #miniupnpc \ + #openal-soft \ + #pkgconf \ + #png \ + #sdl2 \ + #wx30-gtk3 + + #run: | + #git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source + #cd mk/linux + #./build-mg.sh -f -d + + #build-linux: + #strategy: + #fail-fast: false + #matrix: + #arch: [x64] + #os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] + #compiler: [gcc, clang] + #runs-on: ${{ matrix.os }} + #env: + #MATRIX_COMPILER: ${{matrix.compiler}} + #MATRIX_OS: ${{matrix.os}} + #steps: + #- uses: actions/checkout@v4 + #- name: Get dependencies + #run: | + #echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates + #sudo apt update + #sudo apt remove -y firefox # save some time during upgrade + #sudo apt upgrade -y + #sudo mk/linux/setupBuildDeps.sh + #- name: Build + #run: | + #if [ "${MATRIX_COMPILER}" = "clang" ]; then + #EXTRA_OPTS="-f" + #else + #ADD_FLAGS="-flto=auto" + #export CFLAGS=$ADD_FLAGS CXXFLAGS=$ADD_FLAGS + #fi + #mk/linux/build-mg.sh -m -d ${EXTRA_OPTS} + #make -C mk/linux/build -j$(nproc) VERBOSE=1 + + #build-win64-deps: + ## The CMake configure and build commands are platform agnostic and should work equally + ## well on Windows or Mac. You can convert this to a matrix build if you need + ## cross-platform coverage. + ## See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + #strategy: + #fail-fast: false + #matrix: + #arch: [x64] + #build_type: [Release] + #include: + #- build_type: Release + #release: 'ON' + #runs-on: windows-latest + + #steps: + #- uses: actions/checkout@v4 + + #- name: Cache Vcpkg Libs + #uses: actions/cache@v4 + #env: + #cache-name: cache-vcpkg-deps + #with: + #path: c:/vcpkg/installed + #key: vcpkg-deps + + #- name: Install Windows Deps + #run: | + #cd mk\windoze + #$scriptDir = Get-Location + #cd c:\vcpkg + #& "$(Join-Path $scriptDir install-deps-vcpkg.ps1)" + + #build-win64: + #needs: build-win64-deps + #strategy: + #fail-fast: false + #matrix: + #arch: [x64] + #build_type: [Release] + #include: + #- build_type: Release + #release: 'ON' + #runs-on: windows-latest + + #steps: + #- uses: actions/checkout@v4 + + #- name: Get Vcpkg Libs Cache + #uses: actions/cache@v4 + #env: + #cache-name: cache-vcpkg-deps + #with: + #path: c:/vcpkg/installed + #key: vcpkg-deps + + #- name: Build MegaGlest + #run: | + #cd mk/windoze + #./build-mg-vs-cmake.ps1 -vcpkg-location c:/vcpkg/ + + #- name: Git Hash + #if: ${{ github.ref == 'refs/heads/develop' }} + #run: echo "VERSION=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV + + #- name: Prepare Snapshot + #if: ${{ github.ref == 'refs/heads/develop' }} + #run: | + #cd mk\windoze + #Get-ChildItem *.exe | Rename-Item -NewName {$_.BaseName + "-$env:VERSION" + $_.Extension} + #cp ..\shared\*.ini . + #$7zPath = $(Get-Command 7z).Source + #cp $7zPath . + #Remove-Item glest-dev.ini + #Compress-Archive -Path *.exe,*.ini -DestinationPath megaglest-x64-windows.zip + #cd ../.. + + #- name: Create MegaGlest Snapshot + #if: ${{ github.ref == 'refs/heads/develop' }} + #uses: actions/upload-artifact@v4 + #with: + #name: megaglest-x64-windows-archive + #retention-days: 1 + #path: mk/windoze/*.zip + + #build-macos: + #strategy: + #fail-fast: false + #runs-on: macos-latest + #steps: + #- uses: actions/checkout@v4 + + #- name: Get dependencies + #run: | + #mk/macos/setupBuildDeps.sh + + #- name: Build MegaGlest With Clang Compiler + #run: | + #mk/macos/build-mg.sh -m + #make -C mk/macos/build -j$(sysctl -n hw.ncpu) VERBOSE=1 + + #- name: Git Hash + #if: ${{ github.ref == 'refs/heads/develop' }} + #run: | + #echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + #- name: Prepare Snapshot + #if: ${{ github.ref == 'refs/heads/develop' }} + #run: | + #cd mk/macos + #./make-binary-archive.sh + #cd - + #mv release/mg-binary-macos*.tar.bz2 release/megaglest-x64-macos.tar.bz2 + + #- name: Create MegaGlest Snapshot + #if: ${{ github.ref == 'refs/heads/develop' }} + #uses: actions/upload-artifact@v4 + #with: + #name: megaglest-x64-macos + #retention-days: 1 + #path: release/*.tar.bz2 + + meson: strategy: fail-fast: false - matrix: - arch: [x64] - os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] - compiler: [gcc, clang] - runs-on: ${{ matrix.os }} - env: - MATRIX_COMPILER: ${{matrix.compiler}} - MATRIX_OS: ${{matrix.os}} + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - name: Get dependencies run: | - echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates - sudo apt update - sudo apt remove -y firefox # save some time during upgrade - sudo apt upgrade -y + sudo apt-get -y update && sudo apt-get -y upgrade sudo mk/linux/setupBuildDeps.sh + sudo apt-get install -y meson + # Using pip is only required if a newer version of meson is required + # sudo apt-get install -y python3-pip python3-setuptools # required for pip + # sudo -H python3 -m pip install meson ninja # version included w - name: Build run: | - if [ "${MATRIX_COMPILER}" = "clang" ]; then - EXTRA_OPTS="-f" - else - ADD_FLAGS="-flto=auto" - export CFLAGS=$ADD_FLAGS CXXFLAGS=$ADD_FLAGS - fi - mk/linux/build-mg.sh -m -d ${EXTRA_OPTS} - make -C mk/linux/build -j$(nproc) VERBOSE=1 - - build-win64-deps: - # The CMake configure and build commands are platform agnostic and should work equally - # well on Windows or Mac. You can convert this to a matrix build if you need - # cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - strategy: - fail-fast: false - matrix: - arch: [x64] - build_type: [Release] - include: - - build_type: Release - release: 'ON' - runs-on: windows-latest - - steps: - - uses: actions/checkout@v4 - - - name: Cache Vcpkg Libs - uses: actions/cache@v4 - env: - cache-name: cache-vcpkg-deps - with: - path: c:/vcpkg/installed - key: vcpkg-deps - - - name: Install Windows Deps - run: | - cd mk\windoze - $scriptDir = Get-Location - cd c:\vcpkg - & "$(Join-Path $scriptDir install-deps-vcpkg.ps1)" - - build-win64: - needs: build-win64-deps - strategy: - fail-fast: false - matrix: - arch: [x64] - build_type: [Release] - include: - - build_type: Release - release: 'ON' - runs-on: windows-latest - - steps: - - uses: actions/checkout@v4 - - - name: Get Vcpkg Libs Cache - uses: actions/cache@v4 - env: - cache-name: cache-vcpkg-deps - with: - path: c:/vcpkg/installed - key: vcpkg-deps - - - name: Build MegaGlest - run: | - cd mk/windoze - ./build-mg-vs-cmake.ps1 -vcpkg-location c:/vcpkg/ - - - name: Git Hash - if: ${{ github.ref == 'refs/heads/develop' }} - run: echo "VERSION=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV - - - name: Prepare Snapshot - if: ${{ github.ref == 'refs/heads/develop' }} - run: | - cd mk\windoze - Get-ChildItem *.exe | Rename-Item -NewName {$_.BaseName + "-$env:VERSION" + $_.Extension} - cp ..\shared\*.ini . - $7zPath = $(Get-Command 7z).Source - cp $7zPath . - Remove-Item glest-dev.ini - Compress-Archive -Path *.exe,*.ini -DestinationPath megaglest-x64-windows.zip - cd ../.. - - - name: Create MegaGlest Snapshot - if: ${{ github.ref == 'refs/heads/develop' }} - uses: actions/upload-artifact@v4 - with: - name: megaglest-x64-windows-archive - retention-days: 1 - path: mk/windoze/*.zip - - build-macos: - strategy: - fail-fast: false - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - - name: Get dependencies - run: | - mk/macos/setupBuildDeps.sh - - - name: Build MegaGlest With Clang Compiler - run: | - mk/macos/build-mg.sh -m - make -C mk/macos/build -j$(sysctl -n hw.ncpu) VERBOSE=1 - - - name: Git Hash - if: ${{ github.ref == 'refs/heads/develop' }} - run: | - echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - - name: Prepare Snapshot - if: ${{ github.ref == 'refs/heads/develop' }} - run: | - cd mk/macos - ./make-binary-archive.sh - cd - - mv release/mg-binary-macos*.tar.bz2 release/megaglest-x64-macos.tar.bz2 - - - name: Create MegaGlest Snapshot - if: ${{ github.ref == 'refs/heads/develop' }} - uses: actions/upload-artifact@v4 - with: - name: megaglest-x64-macos - retention-days: 1 - path: release/*.tar.bz2 - + meson setup builddir + cd builddir + meson compile -v diff --git a/meson.build b/meson.build index 2eedb3d3f..506d2b39c 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'MegaGlest', ['c', 'cpp'], version: '3.13.0.999', - meson_version : '>= 0.56.0', + meson_version : '>= 0.53.2', default_options: ['warning_level=0'] ) @@ -32,7 +32,7 @@ compiler = meson.get_compiler('cpp') # ], # language: 'cpp') -subdir('source/shared_lib') +subdir('source/shared_lib') #subdir('source/glest_game') diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 5397b53d5..8bbc77cff 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -39,7 +39,19 @@ dep_curl = dependency('libcurl') dep_sdl = dependency('sdl2') dep_x11 = dependency('x11') dep_openal = dependency('openal') -dep_lua = dependency('lua') + +# Using simply 'lua' doesn't work on all Linux distributions +# See https://github.com/mesonbuild/meson/issues/4553 for more info +foreach name : ['lua', 'lua5.3', 'lua-5.3', 'lua53'] + dep_lua = dependency(name, version: '>=5.3', required: false) + if dep_lua.found() + break + endif +endforeach +if not dep_lua.found() + error('Lua could not be found!') +endif + dep_cppunit = dependency('cppunit') dep_fribidi = dependency('fribidi') dep_glib = dependency('glib-2.0') @@ -77,7 +89,7 @@ dep_glib = dependency('glib-2.0') #-lGLEW #-lminiupnpc #-lircclient -#-lSDL2main +#-lSDL2main #-lfribidi #-lglib-2.0 From 211a376657b5e57bda6488a6e5299ffd50874e0c Mon Sep 17 00:00:00 2001 From: Jammyjamjamman Date: Wed, 24 Aug 2022 23:24:56 +0100 Subject: [PATCH 04/48] Meson: Added most stuff to shared_lib --- meson.build | 3 +- source/glest_game/meson.build | 2 +- source/shared_lib/meson.build | 67 +++++++++++++++++++++++++++++------ 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/meson.build b/meson.build index 506d2b39c..2d0ad9ce3 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,8 @@ project( ) # Setup compiler. -compiler = meson.get_compiler('cpp') +cxx = meson.get_compiler('cpp') +cc = meson.get_compiler('c') #add_global_arguments( # [ diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 61815078a..899d548a0 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -138,6 +138,6 @@ inc_common = [ executable('megaglest', src_game, include_directories: [inc_game, inc_common], - dependencies: [dep_sdl, dep_lua, dep_feathery_ftp], + dependencies: [dep_sdl, dep_lua], link_with: [lib_megaglest] ) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 8bbc77cff..ae54c9763 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -1,6 +1,6 @@ # subdir('sources/streflop') -subdir('sources/feathery_ftp') # subdir('sources/util') +subdir('sources/feathery_ftp') src = [] @@ -19,10 +19,6 @@ foreach file : src_basename src += [join_paths('sources/util/', file)] endforeach -inc_util = [ - -] - src_basename = [ 'base_thread.cpp', 'byte_order.cpp', @@ -35,6 +31,30 @@ foreach file : src_basename src += [join_paths('sources/platform/common/', file)] endforeach +src_basename = [ + 'ircclient.cpp', + 'miniftpclient.cpp', + 'miniftpserver.cpp', + 'socket.cpp', +] + +foreach file : src_basename + src += [join_paths('sources/platform/posix/', file)] +endforeach + +src_basename = [ + 'factory_repository.cpp', + 'gl_wrap.cpp', + 'platform_util.cpp', + 'thread.cpp', + 'window.cpp', + 'window_gl.cpp', +] + +foreach file : src_basename + src += [join_paths('sources/platform/sdl/', file)] +endforeach + dep_curl = dependency('libcurl') dep_sdl = dependency('sdl2') dep_x11 = dependency('x11') @@ -55,8 +75,22 @@ endif dep_cppunit = dependency('cppunit') dep_fribidi = dependency('fribidi') dep_glib = dependency('glib-2.0') -#dep_ = dependency('') -#dep_ = dependency('') +# TODO: needs condition for OSes which can/ can't find libircclient. +# dep_ircclient = dependency('libircclient') +inc_ircclient = '/usr/include/libircclient' +dep_ircclient = cxx.find_library( + 'libircclient', + has_headers: 'libircclient.h', + header_include_directories: include_directories(inc_ircclient), + ) + +inc_miniupnpc = ['/usr/include/miniupnpc', 'include/platform/miniupnpc'] +dep_ircclient = cxx.find_library( + 'miniupnpc', + has_headers: 'miniupnpc.h', + header_include_directories: include_directories(inc_miniupnpc), + ) +dep_miniupnpc = dependency('miniupnpc') #dep_ = dependency('') #dep_ = dependency('') #dep_ = dependency('') @@ -97,20 +131,33 @@ lib_megaglest = static_library( 'megaglest', src, include_directories : [ - 'include/streflop', + 'include/graphics', + 'include/map', + 'include/xml', + 'include/sound', + 'include/sound/openal', 'include/platform/common', 'include/platform/posix', 'include/platform/sdl', 'include/graphics', + 'include/graphics/gl', 'include/util/', 'include/util/utf8', + inc_ircclient, + inc_miniupnpc, ], dependencies: [ dep_curl, - dep_sdl, dep_x11, dep_openal, dep_lua, + dep_sdl, + dep_x11, + dep_openal, + dep_lua, dep_cppunit, dep_fribidi, - dep_glib + dep_glib, + dep_feathery_ftp, + dep_ircclient, + dep_miniupnpc, ] ) From 5a2cd602229a590319a3b84c6594fc3c36c0af01 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 25 Aug 2022 09:59:46 -0500 Subject: [PATCH 05/48] improve conditions for finding miniupnpc and libircclient Was failing on Ubuntu --- source/shared_lib/meson.build | 48 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index ae54c9763..3f0a0b650 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -75,22 +75,30 @@ endif dep_cppunit = dependency('cppunit') dep_fribidi = dependency('fribidi') dep_glib = dependency('glib-2.0') -# TODO: needs condition for OSes which can/ can't find libircclient. -# dep_ircclient = dependency('libircclient') -inc_ircclient = '/usr/include/libircclient' -dep_ircclient = cxx.find_library( - 'libircclient', - has_headers: 'libircclient.h', - header_include_directories: include_directories(inc_ircclient), - ) -inc_miniupnpc = ['/usr/include/miniupnpc', 'include/platform/miniupnpc'] -dep_ircclient = cxx.find_library( - 'miniupnpc', - has_headers: 'miniupnpc.h', - header_include_directories: include_directories(inc_miniupnpc), - ) +inc_ircclient = [] +dep_irclient = [] +dep_ircclient = dependency('libircclient', required: false) +if not dep_ircclient.found() + dep_ircclient = cc.find_library('libircclient', has_headers: 'libircclient.h', required: false) + if not dep_ircclient.found() + inc_ircclient = '/usr/include/libircclient' + dep_ircclient = cc.find_library( + 'libircclient', + has_headers: 'libircclient.h', + header_include_directories: include_directories(inc_ircclient) + ) + endif +endif + +inc_miniupnpc = ['include/platform/miniupnpc'] +dep_miniupnpc = [] dep_miniupnpc = dependency('miniupnpc') +if not dep_miniupnpc.found() + dep_miniupnpc = cxx.find_library('miniupnpc', required: false) + inc_miniupnpc += '/usr/include/miniupnpc' +endif + #dep_ = dependency('') #dep_ = dependency('') #dep_ = dependency('') @@ -147,18 +155,14 @@ lib_megaglest = static_library( inc_miniupnpc, ], dependencies: [ - dep_curl, - dep_sdl, - dep_x11, + dep_curl, + dep_sdl, dep_openal, dep_lua, - dep_cppunit, - dep_fribidi, - dep_glib, dep_feathery_ftp, dep_ircclient, dep_miniupnpc, - ] + ] ) -# dep_libmegaglest = declare_dependency(link_with: lib_megaglest, include_directories : '..') +dep_libmegaglest = declare_dependency(link_with: lib_megaglest) From 159ea0f033fae6d4c3533004395764d6e64436c0 Mon Sep 17 00:00:00 2001 From: Jammyjamjamman Date: Fri, 26 Aug 2022 22:45:54 +0100 Subject: [PATCH 06/48] More progress game builds and runs --- meson.build | 6 +- source/glest_game/meson.build | 77 ++++++++++++--- source/shared_lib/meson.build | 177 ++++++++++++++++++++++------------ 3 files changed, 180 insertions(+), 80 deletions(-) diff --git a/meson.build b/meson.build index 2d0ad9ce3..d27ca311e 100644 --- a/meson.build +++ b/meson.build @@ -3,13 +3,15 @@ project( ['c', 'cpp'], version: '3.13.0.999', meson_version : '>= 0.53.2', - default_options: ['warning_level=0'] + default_options: ['warning_level=1'] ) # Setup compiler. cxx = meson.get_compiler('cpp') cc = meson.get_compiler('c') +add_global_arguments(['-DNDEBUG', '-DUSE_FTGL'], language: 'cpp') + #add_global_arguments( # [ # # '-DUSE_STREFLOP', @@ -34,7 +36,7 @@ cc = meson.get_compiler('c') # language: 'cpp') subdir('source/shared_lib') -#subdir('source/glest_game') +subdir('source/glest_game') #subdir('source') diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 899d548a0..713dd651f 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -3,10 +3,6 @@ src_game = [ 'ai/ai_interface.cpp', 'ai/ai_rule.cpp', 'ai/path_finder.cpp', - 'facilities/auto_test.cpp', - 'facilities/components.cpp', - 'facilities/game_util.cpp', - 'facilities/logger.cpp', 'game/achievement.cpp', 'game/chat_manager.cpp', 'game/commander.cpp', @@ -59,6 +55,7 @@ src_game = [ 'sound/sound_container.cpp', 'sound/sound_renderer.cpp', 'steam/steam.cpp', + 'steamshim/steamshim_child.c', 'type_instances/command.cpp', 'type_instances/faction.cpp', 'type_instances/object.cpp', @@ -86,6 +83,10 @@ src_game = [ 'world/unit_updater.cpp', 'world/water_effects.cpp', 'world/world.cpp', + 'facilities/auto_test.cpp', + 'facilities/components.cpp', + 'facilities/game_util.cpp', + 'facilities/logger.cpp', ] @@ -112,20 +113,20 @@ inc_common = [ '../shared_lib/include/platform/posix', '../shared_lib/include/platform/common', '../shared_lib/include/platform/win32', - '../shared_lib/include/platform/miniupnpc', +# '../shared_lib/include/platform/miniupnpc', '../shared_lib/include/platform/sdl', '../shared_lib/include/util', '../shared_lib/include/util/utf8', '../shared_lib/include/map', '../shared_lib/include/compression', '../shared_lib/include/feathery_ftp', - '../shared_lib/include/libircclient', - '../shared_lib/include/libircclient/include', - '../shared_lib/include/streflop', - '../shared_lib/include/streflop/softfloat', - '../shared_lib/include/streflop/libm', - '../shared_lib/include/streflop/libm/headers', - '../shared_lib/include/streflop/libm/flt-32', +# '../shared_lib/include/libircclient', +# '../shared_lib/include/libircclient/include', +# '../shared_lib/include/streflop', +# '../shared_lib/include/streflop/softfloat', +# '../shared_lib/include/streflop/libm', +# '../shared_lib/include/streflop/libm/headers', +# '../shared_lib/include/streflop/libm/flt-32', '../shared_lib/include/lua', '../shared_lib/include/xml', '../shared_lib/include/xml/rapidxml', @@ -135,9 +136,57 @@ inc_common = [ '../shared_lib/include/graphics/gl', ] +dep_cppunit = dependency('cppunit') +dep_fribidi = dependency('fribidi') +dep_glib = dependency('glib-2.0') +dep_pthread = dependency('threads') +dep_gl = dependency('gl') +dep_openal = dependency('openal') +dep_x11 = dependency('x11') +# dep_ogg = dependency('ogg') +dep_vorbis = dependency('vorbisfile') +dep_glew = dependency('glew') +dep_png = dependency('libpng') +dep_jpeg = dependency('libjpeg') +dep_fontconfig = dependency('fontconfig') +dep_ftgl = dependency('ftgl') +dep_freetype = dependency('freetype2') +# dep_math = dependency('libm') + executable('megaglest', src_game, include_directories: [inc_game, inc_common], - dependencies: [dep_sdl, dep_lua], - link_with: [lib_megaglest] + dependencies: [dep_libmegaglest, + dep_sdl, + dep_lua, + dep_cppunit, + dep_fribidi, + dep_glib, + dep_pthread, + # dep_gl, + dep_openal, + dep_x11, + # dep_ogg, + dep_vorbis, + dep_curl, + dep_glew, + dep_png, + dep_jpeg, + # dep_fontconfig, + dep_ftgl, + dep_freetype, + # dep_math, + ], + cpp_args: [ '-DGITVERSION="HELPME"'], + link_args: ['-lm', +# '-lSM', +# '-lICE', + '-lGLU', + '-ldl', + '-lXext', + '-Wl,-Bstatic', + '-lSDL2main', + '-Wl,-Bdynamic', + ] + ) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 3f0a0b650..e7ccc55f1 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -16,7 +16,7 @@ src_basename = [ ] foreach file : src_basename - src += [join_paths('sources/util/', file)] + src += [join_paths('sources/util', file)] endforeach src_basename = [ @@ -28,7 +28,7 @@ src_basename = [ ] foreach file : src_basename - src += [join_paths('sources/platform/common/', file)] + src += [join_paths('sources/platform/common', file)] endforeach src_basename = [ @@ -39,7 +39,7 @@ src_basename = [ ] foreach file : src_basename - src += [join_paths('sources/platform/posix/', file)] + src += [join_paths('sources/platform/posix', file)] endforeach src_basename = [ @@ -52,13 +52,87 @@ src_basename = [ ] foreach file : src_basename - src += [join_paths('sources/platform/sdl/', file)] + src += [join_paths('sources/platform/sdl', file)] +endforeach + +src_basename = [ + 'BMPReader.cpp', + 'graphics_interface.cpp', + 'quaternion.cpp', + 'buffer.cpp', + 'ImageReaders.cpp', + 'shader.cpp', + 'camera.cpp', + 'interpolation.cpp', + 'shader_manager.cpp', + 'context.cpp', + 'JPGReader.cpp', + 'texture.cpp', + 'FileReader.cpp', + 'model.cpp', + 'texture_manager.cpp', + 'font.cpp', + 'model_manager.cpp', + 'TGAReader.cpp', + 'font_manager.cpp', + 'particle.cpp', + 'video_player.cpp', + 'font_text.cpp', + 'pixmap.cpp', + 'PNGReader.cpp', +] + +foreach file : src_basename + src += [join_paths('sources/graphics', file)] +endforeach + +src_basename = [ + 'base_renderer.cpp', + 'opengl.cpp', + 'context_gl.cpp', + 'particle_renderer_gl.cpp', + 'font_gl.cpp', + 'shader_gl.cpp', + 'font_textFTGL.cpp', + 'text_renderer_gl.cpp', + 'model_gl.cpp', + 'texture_gl.cpp', + 'model_renderer_gl.cpp', +] + +foreach file : src_basename + src += [join_paths('sources/graphics/gl', file)] +endforeach + +src_basename = [ + 'sound_file_loader.cpp', + 'sound_player.cpp', + 'sound.cpp', + 'sound_interface.cpp', +] + +foreach file : src_basename + src += [join_paths('sources/sound', file)] +endforeach + +src_shared_lib_misc = [ + 'sound/openal/sound_player_openal.cpp', + 'platform/unix/gl_wrap.cpp', + 'compression/compression_utils.cpp', + 'lua/lua_script.cpp', + 'miniz/miniz.c', + 'map/map_preview.cpp', + 'xml/xml_parser.cpp' +] + +foreach file : src_shared_lib_misc + src += [join_paths('sources', file)] endforeach dep_curl = dependency('libcurl') dep_sdl = dependency('sdl2') -dep_x11 = dependency('x11') dep_openal = dependency('openal') +dep_ftgl = dependency('ftgl') # Using simply 'lua' doesn't work on all Linux distributions # See https://github.com/mesonbuild/meson/issues/4553 for more info @@ -68,14 +142,11 @@ foreach name : ['lua', 'lua5.3', 'lua-5.3', 'lua53'] break endif endforeach + if not dep_lua.found() error('Lua could not be found!') endif -dep_cppunit = dependency('cppunit') -dep_fribidi = dependency('fribidi') -dep_glib = dependency('glib-2.0') - inc_ircclient = [] dep_irclient = [] dep_ircclient = dependency('libircclient', required: false) @@ -94,74 +165,52 @@ endif inc_miniupnpc = ['include/platform/miniupnpc'] dep_miniupnpc = [] dep_miniupnpc = dependency('miniupnpc') -if not dep_miniupnpc.found() +if not dep_miniupnpc.found() # TODO: review/test for if the library isn't installed. dep_miniupnpc = cxx.find_library('miniupnpc', required: false) inc_miniupnpc += '/usr/include/miniupnpc' endif -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') -#dep_ = dependency('') - -#-lcppunit -#-lfribidi -#-lglib-2.0 -#-lGL -#-lGLU -#-lSM -#-lICE -#-lXext -#-lopenal -#-llua5.3 -#-lm #£ math lib -#-ldl -#-ljpeg -#-lpng -#-lfontconfig -#-lftgl -#-lfreetype -#-lGLEW -#-lminiupnpc -#-lircclient -#-lSDL2main -#-lfribidi -#-lglib-2.0 +inc_shared_lib_misc_basename = [ + 'graphics', + 'map', + 'xml', + 'sound', + 'sound/openal', + 'platform/common', + 'platform/posix', + 'platform/sdl', + 'graphics', + 'graphics/gl', + 'util/', + 'util/utf8', + 'compression', + 'lua', +] + +inc_shared_lib_misc = [] + +foreach file : inc_shared_lib_misc_basename + inc_shared_lib_misc += [join_paths('include', file)] +endforeach lib_megaglest = static_library( 'megaglest', src, include_directories : [ - 'include/graphics', - 'include/map', - 'include/xml', - 'include/sound', - 'include/sound/openal', - 'include/platform/common', - 'include/platform/posix', - 'include/platform/sdl', - 'include/graphics', - 'include/graphics/gl', - 'include/util/', - 'include/util/utf8', + inc_shared_lib_misc, + 'sources', # for miniz inc_ircclient, inc_miniupnpc, ], dependencies: [ - dep_curl, - dep_sdl, - dep_openal, - dep_lua, - dep_feathery_ftp, - dep_ircclient, - dep_miniupnpc, + dep_curl, + dep_sdl, + dep_openal, + dep_lua, + dep_feathery_ftp, + dep_ircclient, + dep_miniupnpc, + dep_ftgl, ] ) From 2eba0f2e1c0e815ffb6e62fe707c5525dc745eac Mon Sep 17 00:00:00 2001 From: Jammyjamjamman Date: Sat, 27 Aug 2022 02:28:47 +0100 Subject: [PATCH 07/48] mapeditor build --- meson.build | 4 ++-- source/glest_game/meson.build | 20 ++++++++--------- source/glest_map_editor/meson.build | 35 +++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 source/glest_map_editor/meson.build diff --git a/meson.build b/meson.build index d27ca311e..67b0be411 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,7 @@ project( cxx = meson.get_compiler('cpp') cc = meson.get_compiler('c') -add_global_arguments(['-DNDEBUG', '-DUSE_FTGL'], language: 'cpp') +add_global_arguments(['-DUSE_FTGL'], language: 'cpp') #add_global_arguments( # [ @@ -37,6 +37,6 @@ add_global_arguments(['-DNDEBUG', '-DUSE_FTGL'], language: 'cpp') subdir('source/shared_lib') subdir('source/glest_game') - +subdir('source/glest_map_editor') #subdir('source') diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 713dd651f..55a92a5f9 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -151,7 +151,7 @@ dep_jpeg = dependency('libjpeg') dep_fontconfig = dependency('fontconfig') dep_ftgl = dependency('ftgl') dep_freetype = dependency('freetype2') -# dep_math = dependency('libm') +dep_math = cxx.find_library('m') executable('megaglest', src_game, @@ -175,18 +175,18 @@ executable('megaglest', # dep_fontconfig, dep_ftgl, dep_freetype, - # dep_math, + dep_math, ], cpp_args: [ '-DGITVERSION="HELPME"'], - link_args: ['-lm', + # link_args: ['-lm', # '-lSM', # '-lICE', - '-lGLU', - '-ldl', - '-lXext', - '-Wl,-Bstatic', - '-lSDL2main', - '-Wl,-Bdynamic', - ] + # '-lGLU', + # '-ldl', + # '-lXext', + # '-Wl,-Bstatic', + # '-lSDL2main', + # '-Wl,-Bdynamic', + # ] ) diff --git a/source/glest_map_editor/meson.build b/source/glest_map_editor/meson.build new file mode 100644 index 000000000..52888958b --- /dev/null +++ b/source/glest_map_editor/meson.build @@ -0,0 +1,35 @@ +src_map_editor = [ + 'program.cpp', + 'main.cpp', + '../glest_game/global/config.cpp' +] + +inc_common = [ + '../shared_lib/include/map', + '../shared_lib/include/util', + '../shared_lib/include/graphics', + '../shared_lib/include/graphics/gl', + '../shared_lib/include/platform/sdl', + '../shared_lib/include/platform/common', + '../glest_game/global', + '../glest_game/game', + '../glest_game/facilities', + '.', +] + +dep_wx = dependency('wxwidgets', version : '>=3.0.0', modules : ['gl', 'core', 'base']) +dep_glu = dependency('glu') + +executable('megaglest_map_editor', + src_map_editor, + include_directories: inc_common, + dependencies: [ + dep_libmegaglest, + dep_wx, + dep_sdl, + dep_gl, + dep_glu, + ], + cpp_args: [ + '-DNDEBUG', + ]) From 6c2ee8cf963b8cf7d838930a7254c63858918adc Mon Sep 17 00:00:00 2001 From: Jammyjamjamman Date: Sun, 28 Aug 2022 02:07:09 +0100 Subject: [PATCH 08/48] Everything builds! --- meson.build | 29 ++----------------- source/g3d_viewer/meson.build | 45 +++++++++++++++++++++++++++++ source/glest_map_editor/meson.build | 1 - source/meson.build | 1 - source/tools/glexemel/meson.build | 8 +++++ 5 files changed, 56 insertions(+), 28 deletions(-) create mode 100644 source/g3d_viewer/meson.build delete mode 100644 source/meson.build create mode 100644 source/tools/glexemel/meson.build diff --git a/meson.build b/meson.build index 67b0be411..b4d5dc0d6 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ project( ['c', 'cpp'], version: '3.13.0.999', meson_version : '>= 0.53.2', - default_options: ['warning_level=1'] + default_options: ['warning_level=1', 'buildtype=release'] ) # Setup compiler. @@ -12,31 +12,8 @@ cc = meson.get_compiler('c') add_global_arguments(['-DUSE_FTGL'], language: 'cpp') -#add_global_arguments( -# [ -# # '-DUSE_STREFLOP', -# '-DSTREFLOP_SOFT', -# # '-DSTREFLOP_RANDOM_GEN_SIZE=32', -# '-DLIBM_COMPILING_FLT32', -# '-DN_SPECIALIZED=32', -# '-frounding-math', -# '-fsignaling-nans', -# # '-Wno-switch', -# # '-Wuninitialized', -# # '-Wsign-compare', -# # '-Wunused-function', -# # '-Wunused-variable', -# # '-Wreturn-type', -# '-fno-strict-aliasing', -# '-DHAVE_SYS_IOCTL_H', -# '-DUNICODE', -# # '-O3', -# # '-w', -# ], -# language: 'cpp') - subdir('source/shared_lib') subdir('source/glest_game') subdir('source/glest_map_editor') - -#subdir('source') +subdir('source/g3d_viewer') +subdir('source/tools/glexemel') diff --git a/source/g3d_viewer/meson.build b/source/g3d_viewer/meson.build new file mode 100644 index 000000000..ebcf61fc8 --- /dev/null +++ b/source/g3d_viewer/meson.build @@ -0,0 +1,45 @@ +src_g3d_viewer = [ + 'main.cpp', + 'renderer.cpp', + '../glest_game/global/config.cpp', + '../glest_game/graphics/unit_particle_type.cpp', + '../glest_game/graphics/particle_type.cpp', + +] + +inc_common = [ + '../shared_lib/include/graphics', + '../shared_lib/include/platform/sdl', + '../shared_lib/include/platform/common', + '../shared_lib/include/util', + '../shared_lib/include/xml', + '../shared_lib/include/map', + '../shared_lib/include/graphics/gl', + '../shared_lib/include/sound', + '../glest_game/global', + '../glest_game/game', + '../glest_game/graphics', + '../glest_game/facilities', + '../glest_game/sound', +] + +dep_xercesc = dependency('XercesC') + +executable('megaglest_g3d_viewer', + src_g3d_viewer, + include_directories: inc_common, + dependencies: [ + dep_libmegaglest, + dep_wx, + dep_sdl, + dep_gl, + dep_x11, + dep_jpeg, + dep_png, + dep_glew, + dep_xercesc + ], +# cpp_args: [ +# '-DNDEBUG', +# ] +) diff --git a/source/glest_map_editor/meson.build b/source/glest_map_editor/meson.build index 52888958b..6c44ce142 100644 --- a/source/glest_map_editor/meson.build +++ b/source/glest_map_editor/meson.build @@ -14,7 +14,6 @@ inc_common = [ '../glest_game/global', '../glest_game/game', '../glest_game/facilities', - '.', ] dep_wx = dependency('wxwidgets', version : '>=3.0.0', modules : ['gl', 'core', 'base']) diff --git a/source/meson.build b/source/meson.build deleted file mode 100644 index 3106a579b..000000000 --- a/source/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir('shared_lib') diff --git a/source/tools/glexemel/meson.build b/source/tools/glexemel/meson.build new file mode 100644 index 000000000..f0e5dd515 --- /dev/null +++ b/source/tools/glexemel/meson.build @@ -0,0 +1,8 @@ +executable('g2xml', + 'g2xml.c' +) + +executable('xml2g', + 'xml2g.c', + dependencies: dependency('libxml2') +) From ee0ba6ddfc1dfe3293d35527e8b3385d76c26298 Mon Sep 17 00:00:00 2001 From: Jammyjamjamman Date: Sun, 28 Aug 2022 02:16:22 +0100 Subject: [PATCH 09/48] Fix ubuntu build --- source/g3d_viewer/meson.build | 4 ---- source/tools/glexemel/meson.build | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/source/g3d_viewer/meson.build b/source/g3d_viewer/meson.build index ebcf61fc8..f310d042e 100644 --- a/source/g3d_viewer/meson.build +++ b/source/g3d_viewer/meson.build @@ -4,7 +4,6 @@ src_g3d_viewer = [ '../glest_game/global/config.cpp', '../glest_game/graphics/unit_particle_type.cpp', '../glest_game/graphics/particle_type.cpp', - ] inc_common = [ @@ -23,8 +22,6 @@ inc_common = [ '../glest_game/sound', ] -dep_xercesc = dependency('XercesC') - executable('megaglest_g3d_viewer', src_g3d_viewer, include_directories: inc_common, @@ -37,7 +34,6 @@ executable('megaglest_g3d_viewer', dep_jpeg, dep_png, dep_glew, - dep_xercesc ], # cpp_args: [ # '-DNDEBUG', diff --git a/source/tools/glexemel/meson.build b/source/tools/glexemel/meson.build index f0e5dd515..2191dec70 100644 --- a/source/tools/glexemel/meson.build +++ b/source/tools/glexemel/meson.build @@ -4,5 +4,5 @@ executable('g2xml', executable('xml2g', 'xml2g.c', - dependencies: dependency('libxml2') + dependencies: dependency('libxml-2.0') ) From 4ef15e4be8b320bc4cb2fa05847860e029f1ac9d Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 10 Oct 2024 09:18:15 -0500 Subject: [PATCH 10/48] Create meson.yml --- .github/workflows/meson.yml | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/meson.yml diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml new file mode 100644 index 000000000..f01b1ee48 --- /dev/null +++ b/.github/workflows/meson.yml @@ -0,0 +1,39 @@ +name: Meson +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +on: + push: + branches: [ develop ] + paths: + - 'source/**/**' + - '**meson.build' + - '**/meson.yml' + pull_request: + branches: [ develop ] + paths: + - 'source/**/**' + - '**meson.build' + - '**/meson.yml' + +jobs: + meson: + strategy: + fail-fast: false + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - name: Get dependencies + run: | + sudo apt-get -y update && sudo apt-get -y upgrade + sudo mk/linux/setupBuildDeps.sh + sudo apt-get install -y meson + # Using pip is only required if a newer version of meson is required + # sudo apt-get install -y python3-pip python3-setuptools # required for pip + # sudo -H python3 -m pip install meson ninja # version included w + - name: Build + run: | + meson setup builddir + cd builddir + meson compile -v From 104e59d7fe35d8218b4b5f9ec2c8ec9f2434f46d Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 10 Oct 2024 09:20:05 -0500 Subject: [PATCH 11/48] meson.yml: Update --- .github/workflows/meson.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index f01b1ee48..7a60195a6 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -19,19 +19,16 @@ on: jobs: meson: - strategy: - fail-fast: false - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get dependencies run: | - sudo apt-get -y update && sudo apt-get -y upgrade sudo mk/linux/setupBuildDeps.sh - sudo apt-get install -y meson + sudo apt install -y meson # Using pip is only required if a newer version of meson is required # sudo apt-get install -y python3-pip python3-setuptools # required for pip - # sudo -H python3 -m pip install meson ninja # version included w + # sudo -H python3 -m pip install meson ninja - name: Build run: | meson setup builddir From e40ab054255e996c96f98620dbc738feb771ac21 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Fri, 11 Oct 2024 06:49:54 -0500 Subject: [PATCH 12/48] Build and add streflop --- source/shared_lib/meson.build | 3 ++- source/shared_lib/sources/streflop/meson.build | 17 ++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index e7ccc55f1..554029c4e 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -1,4 +1,4 @@ -# subdir('sources/streflop') +subdir('sources/streflop') # subdir('sources/util') subdir('sources/feathery_ftp') @@ -211,6 +211,7 @@ lib_megaglest = static_library( dep_ircclient, dep_miniupnpc, dep_ftgl, + dep_streflop ] ) diff --git a/source/shared_lib/sources/streflop/meson.build b/source/shared_lib/sources/streflop/meson.build index 6cec5d6ec..6a1c2c249 100644 --- a/source/shared_lib/sources/streflop/meson.build +++ b/source/shared_lib/sources/streflop/meson.build @@ -97,19 +97,18 @@ includes = [ # '../../include/streflop/libm_flt32_source', ] -# add_project_arguments( -# [ -# '-DSTREFLOP_SOFT', -# '-DLIBM_COMPILING_FLT32', -# '-DN_SPECIALIZED=32', -# ], -# language: 'cpp' -# ) +add_cpp_args = [ + '-DUSE_STREFLOP', + '-DSTREFLOP_SSE', + '-DSTREFLOP_RANDOM_GEN_SIZE=32', + '-DLIBM_COMPILING_FLT32', + '-DN_SPECIALIZED=32', +] lib_streflop = static_library( 'streflop', src, - # c_args : ['-DSTREFLOP_SOFT'], + cpp_args : add_cpp_args, include_directories : includes, # dependencies: [dep_curl, dep_sdl] ) From 931cc7b89edbe1b3d9442ae93aeab3b851d1eb11 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Wed, 5 Feb 2025 20:46:41 -0600 Subject: [PATCH 13/48] Use only meson.yml --- .github/workflows/cmake.yml | 20 -------------------- .github/workflows/meson.yml | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 60f2da0e9..38e4b133f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -209,23 +209,3 @@ jobs: #name: megaglest-x64-macos #retention-days: 1 #path: release/*.tar.bz2 - - meson: - strategy: - fail-fast: false - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: Get dependencies - run: | - sudo apt-get -y update && sudo apt-get -y upgrade - sudo mk/linux/setupBuildDeps.sh - sudo apt-get install -y meson - # Using pip is only required if a newer version of meson is required - # sudo apt-get install -y python3-pip python3-setuptools # required for pip - # sudo -H python3 -m pip install meson ninja # version included w - - name: Build - run: | - meson setup builddir - cd builddir - meson compile -v diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 7a60195a6..e8cf80970 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -19,7 +19,7 @@ on: jobs: meson: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Get dependencies From 45bba651a1370f24dd2139308d6334d94bd84881 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Wed, 5 Feb 2025 21:17:32 -0600 Subject: [PATCH 14/48] Use loops to prepend directory names --- meson.build | 56 +++++++++++++++++++++++++++++++ source/glest_game/meson.build | 63 +++++++++++++++++++---------------- 2 files changed, 90 insertions(+), 29 deletions(-) diff --git a/meson.build b/meson.build index b4d5dc0d6..118098f64 100644 --- a/meson.build +++ b/meson.build @@ -12,6 +12,62 @@ cc = meson.get_compiler('c') add_global_arguments(['-DUSE_FTGL'], language: 'cpp') +inc_common = [ + 'platform', + 'platform/posix', + 'platform/common', + 'platform/win32', +# ' platform/miniupnpc', + 'platform/sdl', + 'util', + 'util/utf8', + 'map', + 'compression', + 'feathery_ftp', +# ' libircclient', +# ' libircclient/include', +# ' streflop', +# ' streflop/softfloat', +# ' streflop/libm', +# ' streflop/libm/headers', +# ' streflop/libm/flt-32', + 'lua', + 'xml', + 'xml/rapidxml', + 'sound', + 'sound/openal', + 'graphics', + 'graphics/gl', + ] + +inc_shared_lib = [] +foreach dir : inc_common + inc_shared_lib += [join_paths('../../source/shared_lib/include', dir)] +endforeach + +inc_game = [ + 'types', + 'ai', + 'menu', + 'steam', + 'facilities', + 'main', + 'steamshim', + 'network', + 'world', + 'global', + 'type_instances', + 'gui', + 'sound', + 'graphics', + 'game', +] + +game_includes = [] +foreach dir : inc_game + game_includes += [join_paths('../../source/glest_game', dir)] +endforeach + subdir('source/shared_lib') subdir('source/glest_game') subdir('source/glest_map_editor') diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 55a92a5f9..4263a30c2 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -88,8 +88,8 @@ src_game = [ 'facilities/game_util.cpp', 'facilities/logger.cpp', ] - - + + inc_game = [ 'types', 'ai', @@ -109,33 +109,38 @@ inc_game = [ ] inc_common = [ - '../shared_lib/include/platform', - '../shared_lib/include/platform/posix', - '../shared_lib/include/platform/common', - '../shared_lib/include/platform/win32', -# '../shared_lib/include/platform/miniupnpc', - '../shared_lib/include/platform/sdl', - '../shared_lib/include/util', - '../shared_lib/include/util/utf8', - '../shared_lib/include/map', - '../shared_lib/include/compression', - '../shared_lib/include/feathery_ftp', -# '../shared_lib/include/libircclient', -# '../shared_lib/include/libircclient/include', -# '../shared_lib/include/streflop', -# '../shared_lib/include/streflop/softfloat', -# '../shared_lib/include/streflop/libm', -# '../shared_lib/include/streflop/libm/headers', -# '../shared_lib/include/streflop/libm/flt-32', - '../shared_lib/include/lua', - '../shared_lib/include/xml', - '../shared_lib/include/xml/rapidxml', - '../shared_lib/include/sound', - '../shared_lib/include/sound/openal', - '../shared_lib/include/graphics', - '../shared_lib/include/graphics/gl', + 'platform', + 'platform/posix', + 'platform/common', + 'platform/win32', +# 'platform/miniupnpc', + 'platform/sdl', + 'util', + 'util/utf8', + 'map', + 'compression', + 'feathery_ftp', +# 'libircclient', +# 'libircclient/include', +# 'streflop', +# 'streflop/softfloat', +# 'streflop/libm', +# 'streflop/libm/headers', +# 'streflop/libm/flt-32', + 'lua', + 'xml', + 'xml/rapidxml', + 'sound', + 'sound/openal', + 'graphics', + 'graphics/gl', ] +inc_shared_lib = [] +foreach dir : inc_common + inc_shared_lib += [join_paths('..', 'shared_lib', 'include', dir)] +endforeach + dep_cppunit = dependency('cppunit') dep_fribidi = dependency('fribidi') dep_glib = dependency('glib-2.0') @@ -155,7 +160,7 @@ dep_math = cxx.find_library('m') executable('megaglest', src_game, - include_directories: [inc_game, inc_common], + include_directories: [inc_game, inc_shared_lib], dependencies: [dep_libmegaglest, dep_sdl, dep_lua, @@ -188,5 +193,5 @@ executable('megaglest', # '-lSDL2main', # '-Wl,-Bdynamic', # ] - + ) From 65072e2acbf14124342a6a565d4d7ee815be4f10 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 15:30:02 -0600 Subject: [PATCH 15/48] Add build script --- mk/linux/test-meson-build.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 mk/linux/test-meson-build.sh diff --git a/mk/linux/test-meson-build.sh b/mk/linux/test-meson-build.sh new file mode 100755 index 000000000..573ad83eb --- /dev/null +++ b/mk/linux/test-meson-build.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +HERE="$(readlink -f "$(dirname "$0")")" +SOURCE_ROOT="$HERE/../.." +BUILD_DIR="${BUILD_DIR:-$HERE/_build}" + +if [ ! -d "$BUILD_DIR" ]; then + cd "$SOURCE_ROOT" + meson setup "$BUILD_DIR" "$@" +fi + +cd "$HERE" + +meson compile -C "$BUILD_DIR" + +GAME_BIN="$BUILD_DIR/source/glest_game/megaglest" +EDITOR_BIN="$BUILD_DIR/source/glest_map_editor/megaglest_map_editor" +VIEWER_BIN="$BUILD_DIR/source/g3d_viewer/megaglest_g3d_viewer" + +for bin in "$GAME_BIN" "$EDITOR_BIN" "$VIEWER_BIN"; do + mv -vf "$bin" "$HERE" +done From 912f90f94269ba003ff28637741be5a04ed88455 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 15:30:19 -0600 Subject: [PATCH 16/48] Change buildtype to debugoptimized --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 118098f64..e259c35ce 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ project( ['c', 'cpp'], version: '3.13.0.999', meson_version : '>= 0.53.2', - default_options: ['warning_level=1', 'buildtype=release'] + default_options: ['warning_level=1', 'buildtype=debugoptimized'] ) # Setup compiler. From b08e5626d526fb6db9d29c369b6a39622547a1d3 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 15:30:55 -0600 Subject: [PATCH 17/48] meson.yml: Add FreeBSD job --- .github/workflows/cmake.yml | 388 ++++++++++++++++++------------------ .github/workflows/meson.yml | 46 ++++- 2 files changed, 237 insertions(+), 197 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 38e4b133f..7ad1f08f6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -15,197 +15,197 @@ on: - '**/appimage.yml' jobs: - #freebsd: - #runs-on: ubuntu-latest - #name: FreeBSD - #steps: - #- uses: actions/checkout@v4 - #- name: Test in FreeBSD - #id: test - #uses: vmactions/freebsd-vm@v1 - #with: - #usesh: true - #prepare: | - #pkg install -y \ - #bash \ - #cmake \ - #cppunit \ - #curl \ - #freetype2 \ - #fribidi \ - #ftgl \ - #git \ - #glew \ - #jpeg-turbo \ - #libGLU \ - #libircclient \ - #libogg \ - #libvorbis \ - #libX11 \ - #libxml2 \ - #lua53 \ - #mesa-libs \ - #miniupnpc \ - #openal-soft \ - #pkgconf \ - #png \ - #sdl2 \ - #wx30-gtk3 - - #run: | - #git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source - #cd mk/linux - #./build-mg.sh -f -d - - #build-linux: - #strategy: - #fail-fast: false - #matrix: - #arch: [x64] - #os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] - #compiler: [gcc, clang] - #runs-on: ${{ matrix.os }} - #env: - #MATRIX_COMPILER: ${{matrix.compiler}} - #MATRIX_OS: ${{matrix.os}} - #steps: - #- uses: actions/checkout@v4 - #- name: Get dependencies - #run: | - #echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates - #sudo apt update - #sudo apt remove -y firefox # save some time during upgrade - #sudo apt upgrade -y - #sudo mk/linux/setupBuildDeps.sh - #- name: Build - #run: | - #if [ "${MATRIX_COMPILER}" = "clang" ]; then - #EXTRA_OPTS="-f" - #else - #ADD_FLAGS="-flto=auto" - #export CFLAGS=$ADD_FLAGS CXXFLAGS=$ADD_FLAGS - #fi - #mk/linux/build-mg.sh -m -d ${EXTRA_OPTS} - #make -C mk/linux/build -j$(nproc) VERBOSE=1 - - #build-win64-deps: - ## The CMake configure and build commands are platform agnostic and should work equally - ## well on Windows or Mac. You can convert this to a matrix build if you need - ## cross-platform coverage. - ## See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - #strategy: - #fail-fast: false - #matrix: - #arch: [x64] - #build_type: [Release] - #include: - #- build_type: Release - #release: 'ON' - #runs-on: windows-latest - - #steps: - #- uses: actions/checkout@v4 - - #- name: Cache Vcpkg Libs - #uses: actions/cache@v4 - #env: - #cache-name: cache-vcpkg-deps - #with: - #path: c:/vcpkg/installed - #key: vcpkg-deps - - #- name: Install Windows Deps - #run: | - #cd mk\windoze - #$scriptDir = Get-Location - #cd c:\vcpkg - #& "$(Join-Path $scriptDir install-deps-vcpkg.ps1)" - - #build-win64: - #needs: build-win64-deps - #strategy: - #fail-fast: false - #matrix: - #arch: [x64] - #build_type: [Release] - #include: - #- build_type: Release - #release: 'ON' - #runs-on: windows-latest - - #steps: - #- uses: actions/checkout@v4 - - #- name: Get Vcpkg Libs Cache - #uses: actions/cache@v4 - #env: - #cache-name: cache-vcpkg-deps - #with: - #path: c:/vcpkg/installed - #key: vcpkg-deps - - #- name: Build MegaGlest - #run: | - #cd mk/windoze - #./build-mg-vs-cmake.ps1 -vcpkg-location c:/vcpkg/ - - #- name: Git Hash - #if: ${{ github.ref == 'refs/heads/develop' }} - #run: echo "VERSION=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV - - #- name: Prepare Snapshot - #if: ${{ github.ref == 'refs/heads/develop' }} - #run: | - #cd mk\windoze - #Get-ChildItem *.exe | Rename-Item -NewName {$_.BaseName + "-$env:VERSION" + $_.Extension} - #cp ..\shared\*.ini . - #$7zPath = $(Get-Command 7z).Source - #cp $7zPath . - #Remove-Item glest-dev.ini - #Compress-Archive -Path *.exe,*.ini -DestinationPath megaglest-x64-windows.zip - #cd ../.. - - #- name: Create MegaGlest Snapshot - #if: ${{ github.ref == 'refs/heads/develop' }} - #uses: actions/upload-artifact@v4 - #with: - #name: megaglest-x64-windows-archive - #retention-days: 1 - #path: mk/windoze/*.zip - - #build-macos: - #strategy: - #fail-fast: false - #runs-on: macos-latest - #steps: - #- uses: actions/checkout@v4 - - #- name: Get dependencies - #run: | - #mk/macos/setupBuildDeps.sh - - #- name: Build MegaGlest With Clang Compiler - #run: | - #mk/macos/build-mg.sh -m - #make -C mk/macos/build -j$(sysctl -n hw.ncpu) VERBOSE=1 - - #- name: Git Hash - #if: ${{ github.ref == 'refs/heads/develop' }} - #run: | - #echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - #- name: Prepare Snapshot - #if: ${{ github.ref == 'refs/heads/develop' }} - #run: | - #cd mk/macos - #./make-binary-archive.sh - #cd - - #mv release/mg-binary-macos*.tar.bz2 release/megaglest-x64-macos.tar.bz2 - - #- name: Create MegaGlest Snapshot - #if: ${{ github.ref == 'refs/heads/develop' }} - #uses: actions/upload-artifact@v4 - #with: - #name: megaglest-x64-macos - #retention-days: 1 - #path: release/*.tar.bz2 + freebsd: + runs-on: ubuntu-latest + name: FreeBSD + steps: + - uses: actions/checkout@v4 + - name: Test in FreeBSD + id: test + uses: vmactions/freebsd-vm@v1 + with: + usesh: true + prepare: | + pkg install -y \ + bash \ + cmake \ + cppunit \ + curl \ + freetype2 \ + fribidi \ + ftgl \ + git \ + glew \ + jpeg-turbo \ + libGLU \ + libircclient \ + libogg \ + libvorbis \ + libX11 \ + libxml2 \ + lua53 \ + mesa-libs \ + miniupnpc \ + openal-soft \ + pkgconf \ + png \ + sdl2 \ + wx30-gtk3 + + run: | + git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source + cd mk/linux + ./build-mg.sh -f -d + + build-linux: + strategy: + fail-fast: false + matrix: + arch: [x64] + os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] + compiler: [gcc, clang] + runs-on: ${{ matrix.os }} + env: + MATRIX_COMPILER: ${{matrix.compiler}} + MATRIX_OS: ${{matrix.os}} + steps: + - uses: actions/checkout@v4 + - name: Get dependencies + run: | + echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates + sudo apt update + sudo apt remove -y firefox # save some time during upgrade + sudo apt upgrade -y + sudo mk/linux/setupBuildDeps.sh + - name: Build + run: | + if [ "${MATRIX_COMPILER}" = "clang" ]; then + EXTRA_OPTS="-f" + else + ADD_FLAGS="-flto=auto" + export CFLAGS=$ADD_FLAGS CXXFLAGS=$ADD_FLAGS + fi + mk/linux/build-mg.sh -m -d ${EXTRA_OPTS} + make -C mk/linux/build -j$(nproc) VERBOSE=1 + + build-win64-deps: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + strategy: + fail-fast: false + matrix: + arch: [x64] + build_type: [Release] + include: + - build_type: Release + release: 'ON' + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Cache Vcpkg Libs + uses: actions/cache@v4 + env: + cache-name: cache-vcpkg-deps + with: + path: c:/vcpkg/installed + key: vcpkg-deps + + - name: Install Windows Deps + run: | + cd mk\windoze + $scriptDir = Get-Location + cd c:\vcpkg + & "$(Join-Path $scriptDir install-deps-vcpkg.ps1)" + + build-win64: + needs: build-win64-deps + strategy: + fail-fast: false + matrix: + arch: [x64] + build_type: [Release] + include: + - build_type: Release + release: 'ON' + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Get Vcpkg Libs Cache + uses: actions/cache@v4 + env: + cache-name: cache-vcpkg-deps + with: + path: c:/vcpkg/installed + key: vcpkg-deps + + - name: Build MegaGlest + run: | + cd mk/windoze + ./build-mg-vs-cmake.ps1 -vcpkg-location c:/vcpkg/ + + - name: Git Hash + if: ${{ github.ref == 'refs/heads/develop' }} + run: echo "VERSION=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV + + - name: Prepare Snapshot + if: ${{ github.ref == 'refs/heads/develop' }} + run: | + cd mk\windoze + Get-ChildItem *.exe | Rename-Item -NewName {$_.BaseName + "-$env:VERSION" + $_.Extension} + cp ..\shared\*.ini . + $7zPath = $(Get-Command 7z).Source + cp $7zPath . + Remove-Item glest-dev.ini + Compress-Archive -Path *.exe,*.ini -DestinationPath megaglest-x64-windows.zip + cd ../.. + + - name: Create MegaGlest Snapshot + if: ${{ github.ref == 'refs/heads/develop' }} + uses: actions/upload-artifact@v4 + with: + name: megaglest-x64-windows-archive + retention-days: 1 + path: mk/windoze/*.zip + + build-macos: + strategy: + fail-fast: false + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Get dependencies + run: | + mk/macos/setupBuildDeps.sh + + - name: Build MegaGlest With Clang Compiler + run: | + mk/macos/build-mg.sh -m + make -C mk/macos/build -j$(sysctl -n hw.ncpu) VERBOSE=1 + + - name: Git Hash + if: ${{ github.ref == 'refs/heads/develop' }} + run: | + echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Prepare Snapshot + if: ${{ github.ref == 'refs/heads/develop' }} + run: | + cd mk/macos + ./make-binary-archive.sh + cd - + mv release/mg-binary-macos*.tar.bz2 release/megaglest-x64-macos.tar.bz2 + + - name: Create MegaGlest Snapshot + if: ${{ github.ref == 'refs/heads/develop' }} + uses: actions/upload-artifact@v4 + with: + name: megaglest-x64-macos + retention-days: 1 + path: release/*.tar.bz2 diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index e8cf80970..a63aa9cc5 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -31,6 +31,46 @@ jobs: # sudo -H python3 -m pip install meson ninja - name: Build run: | - meson setup builddir - cd builddir - meson compile -v + mk/linux/test-meson-build.sh + + freebsd: + runs-on: ubuntu-latest + name: FreeBSD + steps: + - uses: actions/checkout@v4 + - name: Test in FreeBSD + id: test + uses: vmactions/freebsd-vm@v1 + with: + usesh: true + prepare: | + pkg install -y \ + bash \ + meson \ + cmake \ + cppunit \ + curl \ + freetype2 \ + fribidi \ + ftgl \ + git \ + glew \ + jpeg-turbo \ + libGLU \ + libircclient \ + libogg \ + libvorbis \ + libX11 \ + libxml2 \ + lua53 \ + mesa-libs \ + miniupnpc \ + openal-soft \ + pkgconf \ + png \ + sdl2 \ + wx30-gtk3 + + run: | + git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source + mk/linux/test-meson-build.sh From 953aca658b904144a4824f7c008a629d8030d9e4 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 15:40:00 -0600 Subject: [PATCH 18/48] Adjust lookup for libircclient --- source/shared_lib/meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 554029c4e..94a712340 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -149,13 +149,13 @@ endif inc_ircclient = [] dep_irclient = [] -dep_ircclient = dependency('libircclient', required: false) +dep_ircclient = dependency('ircclient', required: false) if not dep_ircclient.found() - dep_ircclient = cc.find_library('libircclient', has_headers: 'libircclient.h', required: false) + dep_ircclient = cc.find_library('ircclient', has_headers: 'libircclient.h', required: false) if not dep_ircclient.found() inc_ircclient = '/usr/include/libircclient' dep_ircclient = cc.find_library( - 'libircclient', + 'ircclient', has_headers: 'libircclient.h', header_include_directories: include_directories(inc_ircclient) ) From c6c41f53a3403f0067bbc5f47a8f625b33fb5e37 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 15:48:24 -0600 Subject: [PATCH 19/48] Add fontconfig wrap --- .github/workflows/meson.yml | 5 +++-- source/glest_game/meson.build | 17 ++++++++++++++++- subprojects/fontconfig.wrap | 10 ++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 subprojects/fontconfig.wrap diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index a63aa9cc5..b910f96fc 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -19,13 +19,14 @@ on: jobs: meson: - runs-on: ubuntu-24.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Get dependencies run: | + sudo apt update && sudo apt upgrade -y sudo mk/linux/setupBuildDeps.sh - sudo apt install -y meson + sudo apt install -y --no-install-recommends meson # Using pip is only required if a newer version of meson is required # sudo apt-get install -y python3-pip python3-setuptools # required for pip # sudo -H python3 -m pip install meson ninja diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 4263a30c2..6a7dcdcc1 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -153,7 +153,22 @@ dep_vorbis = dependency('vorbisfile') dep_glew = dependency('glew') dep_png = dependency('libpng') dep_jpeg = dependency('libjpeg') -dep_fontconfig = dependency('fontconfig') + +dep_fontconfig = dependency('fontconfig', required: false) +if not dep_fontconfig.found() + phyfs_dep = cc.find_library('fontconfig', has_headers: 'fontconfig.h', required: false) + if not dep_fontconfig.found() + # This will use the fallback + dep_fontconfig = dependency( + 'fontconfig', + required: true, + fallback: 'fontconfig', + default_options: ['default_library=static'] + ) + endif +endif +#deps += dep_fontconfig + dep_ftgl = dependency('ftgl') dep_freetype = dependency('freetype2') dep_math = cxx.find_library('m') diff --git a/subprojects/fontconfig.wrap b/subprojects/fontconfig.wrap new file mode 100644 index 000000000..2a72b98a8 --- /dev/null +++ b/subprojects/fontconfig.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = fontconfig-2.16.0 +source_url = https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.16.0.tar.xz +source_filename = fontconfig-2.16.0.tar.xz +source_hash = 6a33dc555cc9ba8b10caf7695878ef134eeb36d0af366041f639b1da9b6ed220 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fontconfig_2.16.0-1/fontconfig-2.16.0.tar.xz +wrapdb_version = 2.16.0-1 + +[provide] +fontconfig = fontconfig_dep From c464ba40fa4b63c7815ad4d33297786d31fb9fa4 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 16:17:39 -0600 Subject: [PATCH 20/48] Add lua wrap --- meson.build | 2 +- mk/linux/test-meson-build.sh | 2 +- source/glest_game/meson.build | 7 +- source/glest_map_editor/meson.build | 2 +- source/shared_lib/meson.build | 35 +++-- subprojects/lua.wrap | 11 ++ subprojects/packagefiles/lua/meson.build | 131 ++++++++++++++++++ .../packagefiles/lua/meson_options.txt | 12 ++ 8 files changed, 181 insertions(+), 21 deletions(-) create mode 100644 subprojects/lua.wrap create mode 100644 subprojects/packagefiles/lua/meson.build create mode 100644 subprojects/packagefiles/lua/meson_options.txt diff --git a/meson.build b/meson.build index e259c35ce..7275f50b3 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'MegaGlest', ['c', 'cpp'], version: '3.13.0.999', - meson_version : '>= 0.53.2', + meson_version : '>= 0.55.0', default_options: ['warning_level=1', 'buildtype=debugoptimized'] ) diff --git a/mk/linux/test-meson-build.sh b/mk/linux/test-meson-build.sh index 573ad83eb..c781aa609 100755 --- a/mk/linux/test-meson-build.sh +++ b/mk/linux/test-meson-build.sh @@ -16,7 +16,7 @@ cd "$HERE" meson compile -C "$BUILD_DIR" GAME_BIN="$BUILD_DIR/source/glest_game/megaglest" -EDITOR_BIN="$BUILD_DIR/source/glest_map_editor/megaglest_map_editor" +EDITOR_BIN="$BUILD_DIR/source/glest_map_editor/megaglest_editor" VIEWER_BIN="$BUILD_DIR/source/g3d_viewer/megaglest_g3d_viewer" for bin in "$GAME_BIN" "$EDITOR_BIN" "$VIEWER_BIN"; do diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 6a7dcdcc1..bfac1b429 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -141,6 +141,8 @@ foreach dir : inc_common inc_shared_lib += [join_paths('..', 'shared_lib', 'include', dir)] endforeach +deps = [] + dep_cppunit = dependency('cppunit') dep_fribidi = dependency('fribidi') dep_glib = dependency('glib-2.0') @@ -167,7 +169,7 @@ if not dep_fontconfig.found() ) endif endif -#deps += dep_fontconfig +deps += dep_fontconfig dep_ftgl = dependency('ftgl') dep_freetype = dependency('freetype2') @@ -177,8 +179,8 @@ executable('megaglest', src_game, include_directories: [inc_game, inc_shared_lib], dependencies: [dep_libmegaglest, + deps, dep_sdl, - dep_lua, dep_cppunit, dep_fribidi, dep_glib, @@ -192,7 +194,6 @@ executable('megaglest', dep_glew, dep_png, dep_jpeg, - # dep_fontconfig, dep_ftgl, dep_freetype, dep_math, diff --git a/source/glest_map_editor/meson.build b/source/glest_map_editor/meson.build index 6c44ce142..49947c714 100644 --- a/source/glest_map_editor/meson.build +++ b/source/glest_map_editor/meson.build @@ -19,7 +19,7 @@ inc_common = [ dep_wx = dependency('wxwidgets', version : '>=3.0.0', modules : ['gl', 'core', 'base']) dep_glu = dependency('glu') -executable('megaglest_map_editor', +executable('megaglest_editor', src_map_editor, include_directories: inc_common, dependencies: [ diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 94a712340..384819ccf 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -129,23 +129,28 @@ foreach file : src_shared_lib_misc src += [join_paths('sources', file)] endforeach +deps_shared_lib = [] + dep_curl = dependency('libcurl') dep_sdl = dependency('sdl2') dep_openal = dependency('openal') dep_ftgl = dependency('ftgl') -# Using simply 'lua' doesn't work on all Linux distributions -# See https://github.com/mesonbuild/meson/issues/4553 for more info -foreach name : ['lua', 'lua5.3', 'lua-5.3', 'lua53'] - dep_lua = dependency(name, version: '>=5.3', required: false) - if dep_lua.found() - break - endif -endforeach - -if not dep_lua.found() - error('Lua could not be found!') +# This will get changed to 5.3 +lua_dep = dependency('lua-5.3', required: false) +if not lua_dep.found() + lua_dep = cc.find_library('lua', has_headers: 'lua.h', required: false) + if not lua_dep.found() + # This will use the fallback + lua_dep = dependency( + 'lua-5.3', + required: true, + fallback: 'lua', + default_options: ['default_library=static'] + ) + endif endif +deps_shared_lib += lua_dep inc_ircclient = [] dep_irclient = [] @@ -153,14 +158,15 @@ dep_ircclient = dependency('ircclient', required: false) if not dep_ircclient.found() dep_ircclient = cc.find_library('ircclient', has_headers: 'libircclient.h', required: false) if not dep_ircclient.found() - inc_ircclient = '/usr/include/libircclient' + inc_ircclient = ['/usr/include', '/usr/include/libircclient'] dep_ircclient = cc.find_library( 'ircclient', has_headers: 'libircclient.h', - header_include_directories: include_directories(inc_ircclient) + header_include_directories: inc_ircclient ) endif endif +deps_shared_lib += dep_ircclient inc_miniupnpc = ['include/platform/miniupnpc'] dep_miniupnpc = [] @@ -203,12 +209,11 @@ lib_megaglest = static_library( inc_miniupnpc, ], dependencies: [ + deps_shared_lib, dep_curl, dep_sdl, dep_openal, - dep_lua, dep_feathery_ftp, - dep_ircclient, dep_miniupnpc, dep_ftgl, dep_streflop diff --git a/subprojects/lua.wrap b/subprojects/lua.wrap new file mode 100644 index 000000000..8d13d5656 --- /dev/null +++ b/subprojects/lua.wrap @@ -0,0 +1,11 @@ +[wrap-file] +directory = lua-5.1.5 +source_url = https://www.lua.org/ftp/lua-5.1.5.tar.gz +source_filename = lua-5.1.5.tar.gz +source_hash = 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333 +patch_directory = lua +method = meson + +[provide] +lua-5.1 = lua_dep + diff --git a/subprojects/packagefiles/lua/meson.build b/subprojects/packagefiles/lua/meson.build new file mode 100644 index 000000000..2e2d58443 --- /dev/null +++ b/subprojects/packagefiles/lua/meson.build @@ -0,0 +1,131 @@ +project( + 'lua-5.1', 'c', + license: 'MIT', + meson_version: '>=0.49.2', + version: '5.1.5', +) + +lua_versions = meson.project_version().split('.') +# Override the c_std and warning_level of any superproject. +project_options = ['c_std=c99', 'warning_level=2'] +cc = meson.get_compiler('c') + +# Skip bogus warning. +if cc.get_id() == 'clang' + add_project_arguments('-Wno-string-plus-int', language: 'c') +elif cc.get_id() == 'gcc' + add_project_arguments('-Wno-stringop-overflow', language: 'c') +endif + +add_project_arguments('-D_XOPEN_SOURCE=600', language: 'c') + +# Platform-specific defines. +is_posix = host_machine.system() not in ['windows', 'emscripten', 'android'] +if is_posix + add_project_arguments('-DLUA_USE_POSIX', language: 'c') +endif + +# Library dependencies. +lua_lib_deps = [cc.find_library('m', required: false)] + +if get_option('loadlib') + dl_dep = cc.find_library('dl', required: false) + lua_lib_deps += [dl_dep] + add_project_arguments('-DLUA_USE_DLOPEN', language: 'c') +endif + +# Interpreter dependencies. +lua_exe_deps = [] +lua_exe_args = [] + +if get_option('line_editing') + readline_dep = dependency('readline', required: false) + if not readline_dep.found() + readline_dep = dependency('libedit', required: false) + if not readline_dep.found() + error('''Didn't find readline or libedit, can't enable line editing.''') + endif + endif + lua_exe_deps += [readline_dep] + lua_exe_args += ['-DLUA_USE_READLINE'] +endif + +# Targets. +lua_static = static_library('_lua', + 'src/print.c', + 'src/lstring.c', + 'src/ltablib.c', + 'src/loadlib.c', + 'src/lmathlib.c', + 'src/lstate.c', + 'src/ldump.c', + 'src/loslib.c', + 'src/liolib.c', + 'src/ldblib.c', + 'src/lbaselib.c', + 'src/lapi.c', + 'src/llex.c', + 'src/lopcodes.c', + 'src/lvm.c', + 'src/ltable.c', + 'src/linit.c', + 'src/lobject.c', + 'src/lstrlib.c', + 'src/lcode.c', + 'src/ldebug.c', + 'src/lauxlib.c', + 'src/ldo.c', + 'src/lfunc.c', + 'src/lzio.c', + 'src/ltm.c', + 'src/lgc.c', + 'src/lmem.c', + 'src/lparser.c', + 'src/lundump.c', + + dependencies: lua_lib_deps, + override_options: project_options, + implicit_include_directories: false, +) + +lua_lib = library('lua', + link_whole: lua_static, + dependencies: lua_lib_deps, + version: meson.project_version(), + soversion: lua_versions[0] + '.' + lua_versions[1], + override_options: project_options, + implicit_include_directories: false, +) + +if cc.get_id() == 'msvc' + # Lua does not export symbols + # so we have to compile executables + # statically + lua_link = lua_static +else + lua_link = lua_lib +endif + +if get_option('interpreter') + lua_exe = executable('lua', + 'src/lua.c', + c_args: lua_exe_args, + link_with: lua_link, + dependencies: lua_exe_deps, + export_dynamic: get_option('loadlib'), + override_options: project_options, + implicit_include_directories: false, + ) + + if get_option('default_library') == 'static' + luac_exe = executable('luac', + 'src/luac.c', + link_with: lua_link, + override_options: project_options, + implicit_include_directories: false, + ) + endif +endif + +inc = include_directories('src') +lua_dep = declare_dependency(link_with: lua_lib, include_directories: inc) diff --git a/subprojects/packagefiles/lua/meson_options.txt b/subprojects/packagefiles/lua/meson_options.txt new file mode 100644 index 000000000..8c549e45b --- /dev/null +++ b/subprojects/packagefiles/lua/meson_options.txt @@ -0,0 +1,12 @@ +option( + 'loadlib', type: 'boolean', value: false, + description: 'Allow Lua to "require" C extension modules' +) +option( + 'line_editing', type: 'boolean', value: false, + description: 'Link with GNU readline (or libedit) to add history to the Lua interpreter.' +) +option( + 'interpreter', type: 'boolean', value: true, + description: 'Build the Lua interpreter.' +) From 86a4ab29d41b186d8e8140be0a9474a3dc5ab58d Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 17:17:27 -0600 Subject: [PATCH 21/48] remove fontconfig requirement --- .github/workflows/meson.yml | 50 +++++++++++++++++------------------ source/glest_game/meson.build | 17 +----------- source/shared_lib/meson.build | 26 +++++++++--------- subprojects/fontconfig.wrap | 10 ------- 4 files changed, 39 insertions(+), 64 deletions(-) delete mode 100644 subprojects/fontconfig.wrap diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index b910f96fc..c72709892 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -46,31 +46,31 @@ jobs: usesh: true prepare: | pkg install -y \ - bash \ - meson \ - cmake \ - cppunit \ - curl \ - freetype2 \ - fribidi \ - ftgl \ - git \ - glew \ - jpeg-turbo \ - libGLU \ - libircclient \ - libogg \ - libvorbis \ - libX11 \ - libxml2 \ - lua53 \ - mesa-libs \ - miniupnpc \ - openal-soft \ - pkgconf \ - png \ - sdl2 \ - wx30-gtk3 + bash \ + meson \ + cmake \ + cppunit \ + curl \ + freetype2 \ + fribidi \ + ftgl \ + git \ + glew \ + jpeg-turbo \ + libGLU \ + libircclient \ + libogg \ + libvorbis \ + libX11 \ + libxml2 \ + lua53 \ + mesa-libs \ + miniupnpc \ + openal-soft \ + pkgconf \ + png \ + sdl2 \ + wx30-gtk3 run: | git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index bfac1b429..dfddca0a2 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -155,22 +155,6 @@ dep_vorbis = dependency('vorbisfile') dep_glew = dependency('glew') dep_png = dependency('libpng') dep_jpeg = dependency('libjpeg') - -dep_fontconfig = dependency('fontconfig', required: false) -if not dep_fontconfig.found() - phyfs_dep = cc.find_library('fontconfig', has_headers: 'fontconfig.h', required: false) - if not dep_fontconfig.found() - # This will use the fallback - dep_fontconfig = dependency( - 'fontconfig', - required: true, - fallback: 'fontconfig', - default_options: ['default_library=static'] - ) - endif -endif -deps += dep_fontconfig - dep_ftgl = dependency('ftgl') dep_freetype = dependency('freetype2') dep_math = cxx.find_library('m') @@ -180,6 +164,7 @@ executable('megaglest', include_directories: [inc_game, inc_shared_lib], dependencies: [dep_libmegaglest, deps, + lua_dep, dep_sdl, dep_cppunit, dep_fribidi, diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 384819ccf..ced2927b3 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -137,20 +137,19 @@ dep_openal = dependency('openal') dep_ftgl = dependency('ftgl') # This will get changed to 5.3 -lua_dep = dependency('lua-5.3', required: false) +lua_dep = dependency('lua-5.3', required: true) if not lua_dep.found() - lua_dep = cc.find_library('lua', has_headers: 'lua.h', required: false) - if not lua_dep.found() - # This will use the fallback - lua_dep = dependency( - 'lua-5.3', - required: true, - fallback: 'lua', - default_options: ['default_library=static'] - ) - endif + lua_dep = cc.find_library('lua', has_headers: 'lua.hpp', required: true) +# if not lua_dep.found() +# # This will use the fallback +# lua_dep = dependency( +# 'lua-5.3', +# required: true, +# fallback: 'lua', +# default_options: ['default_library=static'] +# ) +# endif endif -deps_shared_lib += lua_dep inc_ircclient = [] dep_irclient = [] @@ -162,7 +161,7 @@ if not dep_ircclient.found() dep_ircclient = cc.find_library( 'ircclient', has_headers: 'libircclient.h', - header_include_directories: inc_ircclient + header_include_directories: include_directories(inc_ircclient) ) endif endif @@ -210,6 +209,7 @@ lib_megaglest = static_library( ], dependencies: [ deps_shared_lib, + lua_dep, dep_curl, dep_sdl, dep_openal, diff --git a/subprojects/fontconfig.wrap b/subprojects/fontconfig.wrap deleted file mode 100644 index 2a72b98a8..000000000 --- a/subprojects/fontconfig.wrap +++ /dev/null @@ -1,10 +0,0 @@ -[wrap-file] -directory = fontconfig-2.16.0 -source_url = https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.16.0.tar.xz -source_filename = fontconfig-2.16.0.tar.xz -source_hash = 6a33dc555cc9ba8b10caf7695878ef134eeb36d0af366041f639b1da9b6ed220 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fontconfig_2.16.0-1/fontconfig-2.16.0.tar.xz -wrapdb_version = 2.16.0-1 - -[provide] -fontconfig = fontconfig_dep From b0181597b2006e4a9aca4a22fd5441d6db33742d Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 17:53:04 -0600 Subject: [PATCH 22/48] conditionally check /usr/include/libircclient The header is in this directory on Manjaro. On FreeBSD, looking in this directory fails with the error that the directory doesn't exist. https://github.com/mesonbuild/meson/issues/10738 --- source/shared_lib/meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index ced2927b3..9c0cb99a4 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -157,7 +157,12 @@ dep_ircclient = dependency('ircclient', required: false) if not dep_ircclient.found() dep_ircclient = cc.find_library('ircclient', has_headers: 'libircclient.h', required: false) if not dep_ircclient.found() - inc_ircclient = ['/usr/include', '/usr/include/libircclient'] + inc_ircclient = ['/usr/include/libircclient'] + path = '/usr/include/libircclient' + result = run_command('test', '-d', path, check: false) + if result.returncode() == 0 + inc_ircclient += path + endif dep_ircclient = cc.find_library( 'ircclient', has_headers: 'libircclient.h', From 3e7eb9b1e22a9885fc297b3e8f94caafa6079fee Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 18:03:36 -0600 Subject: [PATCH 23/48] Fix default include path for libircclient --- source/shared_lib/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 9c0cb99a4..8dc6035ee 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -157,7 +157,7 @@ dep_ircclient = dependency('ircclient', required: false) if not dep_ircclient.found() dep_ircclient = cc.find_library('ircclient', has_headers: 'libircclient.h', required: false) if not dep_ircclient.found() - inc_ircclient = ['/usr/include/libircclient'] + inc_ircclient = ['/usr/include'] path = '/usr/include/libircclient' result = run_command('test', '-d', path, check: false) if result.returncode() == 0 From ce63b719266c2cb41b3747a38a693d5fdd6c5973 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 18:03:49 -0600 Subject: [PATCH 24/48] cmake.yml: Don't run unless meson workflow completes --- .github/workflows/cmake.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 7ad1f08f6..1fd8012d6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -4,15 +4,18 @@ concurrency: cancel-in-progress: true on: - push: - branches: [ develop ] - paths-ignore: - - '**/appimage.yml' - - pull_request: - branches: [ develop ] - paths-ignore: - - '**/appimage.yml' + workflow_run: + workflows: [Meson] + types: [completed] + #push: + #branches: [ develop ] + #paths-ignore: + #- '**/appimage.yml' + + #pull_request: + #branches: [ develop ] + #paths-ignore: + #- '**/appimage.yml' jobs: freebsd: From 59b9f9e19598c33723f4323476e56e9ef7d88986 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 18:11:09 -0600 Subject: [PATCH 25/48] Also look in /usr/local/include for libircclient.h --- source/shared_lib/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 8dc6035ee..4e0621e31 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -157,7 +157,7 @@ dep_ircclient = dependency('ircclient', required: false) if not dep_ircclient.found() dep_ircclient = cc.find_library('ircclient', has_headers: 'libircclient.h', required: false) if not dep_ircclient.found() - inc_ircclient = ['/usr/include'] + inc_ircclient = ['/usr/include', '/usr/local/include'] path = '/usr/include/libircclient' result = run_command('test', '-d', path, check: false) if result.returncode() == 0 From 5847ca38f826187a5c19aae4abc0a781f7f6e420 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 18:19:28 -0600 Subject: [PATCH 26/48] Search in /usr/local/lib for libircclient Header now found, but linking fails on FreeBSD --- source/shared_lib/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 4e0621e31..14b86a0cf 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -165,6 +165,7 @@ if not dep_ircclient.found() endif dep_ircclient = cc.find_library( 'ircclient', + dirs: '/usr/local/lib', has_headers: 'libircclient.h', header_include_directories: include_directories(inc_ircclient) ) From 5dc07cc0c8e104f2fa0f759b9602161d99ba93da Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 18:32:21 -0600 Subject: [PATCH 27/48] Add macos --- .github/workflows/meson.yml | 13 +++++++++++++ mk/macos/setupBuildDeps.sh | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index c72709892..09d12fe86 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -75,3 +75,16 @@ jobs: run: | git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source mk/linux/test-meson-build.sh + + build-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Get dependencies + run: | + mk/macos/setupBuildDeps.sh + + - name: Build MegaGlest With Clang Compiler + run: | + mk/linux/test-meson-build.sh diff --git a/mk/macos/setupBuildDeps.sh b/mk/macos/setupBuildDeps.sh index 40aab3619..181a02193 100755 --- a/mk/macos/setupBuildDeps.sh +++ b/mk/macos/setupBuildDeps.sh @@ -13,7 +13,8 @@ brew install cmake \ libogg \ libpng \ libvorbis \ - lua \ + lua@5.3 \ + meson \ miniupnpc \ pkg-config \ sdl2 \ From ffb7ac7acfbbf0bfef1b6583461d4500e64c80bb Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 6 Feb 2025 19:20:24 -0600 Subject: [PATCH 28/48] Add extra flags --- meson.build | 65 +++++++++-------------------------------------------- 1 file changed, 10 insertions(+), 55 deletions(-) diff --git a/meson.build b/meson.build index 7275f50b3..07af40c14 100644 --- a/meson.build +++ b/meson.build @@ -10,63 +10,18 @@ project( cxx = meson.get_compiler('cpp') cc = meson.get_compiler('c') -add_global_arguments(['-DUSE_FTGL'], language: 'cpp') - -inc_common = [ - 'platform', - 'platform/posix', - 'platform/common', - 'platform/win32', -# ' platform/miniupnpc', - 'platform/sdl', - 'util', - 'util/utf8', - 'map', - 'compression', - 'feathery_ftp', -# ' libircclient', -# ' libircclient/include', -# ' streflop', -# ' streflop/softfloat', -# ' streflop/libm', -# ' streflop/libm/headers', -# ' streflop/libm/flt-32', - 'lua', - 'xml', - 'xml/rapidxml', - 'sound', - 'sound/openal', - 'graphics', - 'graphics/gl', - ] - -inc_shared_lib = [] -foreach dir : inc_common - inc_shared_lib += [join_paths('../../source/shared_lib/include', dir)] -endforeach - -inc_game = [ - 'types', - 'ai', - 'menu', - 'steam', - 'facilities', - 'main', - 'steamshim', - 'network', - 'world', - 'global', - 'type_instances', - 'gui', - 'sound', - 'graphics', - 'game', +extra_flags = [ + '-fno-common', + '-Werror=odr', + '-Werror=lto-type-mismatch', +# '-Werror=strict-aliasing', + '-frounding-math', + '-fsignaling-nans', + '-DUSE_FTGL' ] -game_includes = [] -foreach dir : inc_game - game_includes += [join_paths('../../source/glest_game', dir)] -endforeach +add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') +add_project_arguments(cxx.get_supported_arguments(extra_flags), language: 'cpp') subdir('source/shared_lib') subdir('source/glest_game') From ce16f3e133e17de525aedea62854e6d136b69d40 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Fri, 7 Feb 2025 13:51:01 -0600 Subject: [PATCH 29/48] mv irclient from shared_lib to game --- .github/workflows/meson.yml | 6 +++--- meson.build | 6 +----- mk/{linux => }/test-meson-build.sh | 18 ++++++++++++++-- source/glest_game/meson.build | 33 ++++++++++++++++++++++-------- source/meson.build | 15 ++++++++++++++ source/shared_lib/meson.build | 32 ++--------------------------- 6 files changed, 62 insertions(+), 48 deletions(-) rename mk/{linux => }/test-meson-build.sh (52%) create mode 100644 source/meson.build diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 09d12fe86..ab385e58b 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -32,7 +32,7 @@ jobs: # sudo -H python3 -m pip install meson ninja - name: Build run: | - mk/linux/test-meson-build.sh + mk/test-meson-build.sh freebsd: runs-on: ubuntu-latest @@ -74,7 +74,7 @@ jobs: run: | git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source - mk/linux/test-meson-build.sh + mk/test-meson-build.sh build-macos: runs-on: macos-latest @@ -87,4 +87,4 @@ jobs: - name: Build MegaGlest With Clang Compiler run: | - mk/linux/test-meson-build.sh + mk/test-meson-build.sh diff --git a/meson.build b/meson.build index 07af40c14..ef1443117 100644 --- a/meson.build +++ b/meson.build @@ -23,8 +23,4 @@ extra_flags = [ add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') add_project_arguments(cxx.get_supported_arguments(extra_flags), language: 'cpp') -subdir('source/shared_lib') -subdir('source/glest_game') -subdir('source/glest_map_editor') -subdir('source/g3d_viewer') -subdir('source/tools/glexemel') +subdir('source') diff --git a/mk/linux/test-meson-build.sh b/mk/test-meson-build.sh similarity index 52% rename from mk/linux/test-meson-build.sh rename to mk/test-meson-build.sh index c781aa609..840c7d810 100755 --- a/mk/linux/test-meson-build.sh +++ b/mk/test-meson-build.sh @@ -3,9 +3,15 @@ set -e HERE="$(readlink -f "$(dirname "$0")")" -SOURCE_ROOT="$HERE/../.." +SOURCE_ROOT="$HERE/.." BUILD_DIR="${BUILD_DIR:-$HERE/_build}" +# Ensure BUILD_DIR is an absolute path +[ "${BUILD_DIR#/}" != "$BUILD_DIR" ] || { echo "Error: BUILD_DIR must be an absolute path!"; exit 1; } + +# Detect OS type +OS_TYPE="$(uname -s)" + if [ ! -d "$BUILD_DIR" ]; then cd "$SOURCE_ROOT" meson setup "$BUILD_DIR" "$@" @@ -19,6 +25,14 @@ GAME_BIN="$BUILD_DIR/source/glest_game/megaglest" EDITOR_BIN="$BUILD_DIR/source/glest_map_editor/megaglest_editor" VIEWER_BIN="$BUILD_DIR/source/g3d_viewer/megaglest_g3d_viewer" +# Determine the correct directory based on OS +if [ "$OS_TYPE" = "Darwin" ]; then + TARGET_DIR="$HERE/macos" +else + TARGET_DIR="$HERE/linux" +fi + +# Move binaries to the correct directory for bin in "$GAME_BIN" "$EDITOR_BIN" "$VIEWER_BIN"; do - mv -vf "$bin" "$HERE" + mv -vf "$bin" "$TARGET_DIR" done diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index dfddca0a2..26648a829 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -120,8 +120,6 @@ inc_common = [ 'map', 'compression', 'feathery_ftp', -# 'libircclient', -# 'libircclient/include', # 'streflop', # 'streflop/softfloat', # 'streflop/libm', @@ -136,13 +134,32 @@ inc_common = [ 'graphics/gl', ] +inc_ircclient = [] +irclient_dep = [] +ircclient_dep = dependency('ircclient', required: false) +if not ircclient_dep.found() + ircclient_dep = cc.find_library('ircclient', has_headers: 'libircclient.h', required: false) + if not ircclient_dep.found() + inc_ircclient = ['/usr/include', '/usr/local/include'] + path = '/usr/include/libircclient' + result = run_command('test', '-d', path, check: false) + if result.returncode() == 0 + inc_ircclient += path + endif + ircclient_dep = cc.find_library( + 'ircclient', + dirs: '/usr/local/lib', + has_headers: 'libircclient.h', + header_include_directories: include_directories(inc_ircclient) + ) + endif +endif + inc_shared_lib = [] foreach dir : inc_common inc_shared_lib += [join_paths('..', 'shared_lib', 'include', dir)] endforeach -deps = [] - dep_cppunit = dependency('cppunit') dep_fribidi = dependency('fribidi') dep_glib = dependency('glib-2.0') @@ -160,10 +177,11 @@ dep_freetype = dependency('freetype2') dep_math = cxx.find_library('m') executable('megaglest', - src_game, - include_directories: [inc_game, inc_shared_lib], + [src_game, '../shared_lib/sources/platform/posix/ircclient.cpp'], + include_directories: [inc_ircclient, inc_game, inc_shared_lib], dependencies: [dep_libmegaglest, - deps, + shared_lib_game_deps, + ircclient_dep, lua_dep, dep_sdl, dep_cppunit, @@ -175,7 +193,6 @@ executable('megaglest', dep_x11, # dep_ogg, dep_vorbis, - dep_curl, dep_glew, dep_png, dep_jpeg, diff --git a/source/meson.build b/source/meson.build new file mode 100644 index 000000000..ca73de7b2 --- /dev/null +++ b/source/meson.build @@ -0,0 +1,15 @@ +shared_lib_game_deps = [] + +shared_lib_game_common = [ + 'libcurl' + ] + +foreach dep : shared_lib_game_common + shared_lib_game_deps += dependency(dep) +endforeach + +subdir('shared_lib') +subdir('glest_game') +subdir('glest_map_editor') +subdir('g3d_viewer') +subdir('tools/glexemel') diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 14b86a0cf..bc8f0c511 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -32,7 +32,6 @@ foreach file : src_basename endforeach src_basename = [ - 'ircclient.cpp', 'miniftpclient.cpp', 'miniftpserver.cpp', 'socket.cpp', @@ -129,9 +128,6 @@ foreach file : src_shared_lib_misc src += [join_paths('sources', file)] endforeach -deps_shared_lib = [] - -dep_curl = dependency('libcurl') dep_sdl = dependency('sdl2') dep_openal = dependency('openal') dep_ftgl = dependency('ftgl') @@ -139,7 +135,7 @@ dep_ftgl = dependency('ftgl') # This will get changed to 5.3 lua_dep = dependency('lua-5.3', required: true) if not lua_dep.found() - lua_dep = cc.find_library('lua', has_headers: 'lua.hpp', required: true) + lua_dep = cc.find_library('lua', has_headers: 'lua.h', required: true) # if not lua_dep.found() # # This will use the fallback # lua_dep = dependency( @@ -151,28 +147,6 @@ if not lua_dep.found() # endif endif -inc_ircclient = [] -dep_irclient = [] -dep_ircclient = dependency('ircclient', required: false) -if not dep_ircclient.found() - dep_ircclient = cc.find_library('ircclient', has_headers: 'libircclient.h', required: false) - if not dep_ircclient.found() - inc_ircclient = ['/usr/include', '/usr/local/include'] - path = '/usr/include/libircclient' - result = run_command('test', '-d', path, check: false) - if result.returncode() == 0 - inc_ircclient += path - endif - dep_ircclient = cc.find_library( - 'ircclient', - dirs: '/usr/local/lib', - has_headers: 'libircclient.h', - header_include_directories: include_directories(inc_ircclient) - ) - endif -endif -deps_shared_lib += dep_ircclient - inc_miniupnpc = ['include/platform/miniupnpc'] dep_miniupnpc = [] dep_miniupnpc = dependency('miniupnpc') @@ -210,13 +184,11 @@ lib_megaglest = static_library( include_directories : [ inc_shared_lib_misc, 'sources', # for miniz - inc_ircclient, inc_miniupnpc, ], dependencies: [ - deps_shared_lib, + shared_lib_game_deps, lua_dep, - dep_curl, dep_sdl, dep_openal, dep_feathery_ftp, From a71e627945f1655abf4de5449a7805d8d508e63e Mon Sep 17 00:00:00 2001 From: andy5995 Date: Fri, 7 Feb 2025 14:45:43 -0600 Subject: [PATCH 30/48] Add xinit to macos install (fix error?) --- mk/macos/setupBuildDeps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/mk/macos/setupBuildDeps.sh b/mk/macos/setupBuildDeps.sh index 181a02193..2db345038 100755 --- a/mk/macos/setupBuildDeps.sh +++ b/mk/macos/setupBuildDeps.sh @@ -19,5 +19,6 @@ brew install cmake \ pkg-config \ sdl2 \ wxwidgets \ + xinit \ xorg-server \ zstd From 2819bab653ac951a48a53f72d6e29a0631198bf2 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Fri, 7 Feb 2025 14:46:35 -0600 Subject: [PATCH 31/48] Create symlink to wx-config on FreeBSD Fix 2025-02-07T19:54:26.1249387Z wx-config found: NO need ['>=3.0.0'] 2025-02-07T19:54:26.1249865Z Run-time dependency WxWidgets found: NO (tried config-tool) --- .github/workflows/meson.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index ab385e58b..276253034 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -74,6 +74,9 @@ jobs: run: | git config --global --add safe.directory /home/runner/work/megaglest-source/megaglest-source + cd /usr/local/bin + ln -s wxgtk3u-3.0-config wx-config + cd - mk/test-meson-build.sh build-macos: From 7bc328200fefe1d697d1ba7d45a869eaa62ecb4a Mon Sep 17 00:00:00 2001 From: andy5995 Date: Fri, 7 Feb 2025 15:11:20 -0600 Subject: [PATCH 32/48] Define streflop unconditionally --- meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ef1443117..c253c2388 100644 --- a/meson.build +++ b/meson.build @@ -17,7 +17,9 @@ extra_flags = [ # '-Werror=strict-aliasing', '-frounding-math', '-fsignaling-nans', - '-DUSE_FTGL' + '-DUSE_FTGL', + '-DUSE_STREFLOP', + '-DSTREFLOP_SSE', ] add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') From 254da38d446fe303d61872675b40731cdfd15bbf Mon Sep 17 00:00:00 2001 From: andy5995 Date: Fri, 7 Feb 2025 15:16:56 -0600 Subject: [PATCH 33/48] Add streflop dep to game --- source/glest_game/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 26648a829..b144a41d0 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -181,6 +181,7 @@ executable('megaglest', include_directories: [inc_ircclient, inc_game, inc_shared_lib], dependencies: [dep_libmegaglest, shared_lib_game_deps, + dep_streflop, ircclient_dep, lua_dep, dep_sdl, From dbc00f463cbb41ce33f173676df71c443c78b176 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Sat, 8 Feb 2025 00:51:29 -0600 Subject: [PATCH 34/48] Try to fix streflop and fail --- meson.build | 5 + source/shared_lib/meson.build | 2 +- .../shared_lib/sources/streflop/meson.build | 207 +++++++++--------- 3 files changed, 113 insertions(+), 101 deletions(-) diff --git a/meson.build b/meson.build index c253c2388..3029b0460 100644 --- a/meson.build +++ b/meson.build @@ -20,6 +20,11 @@ extra_flags = [ '-DUSE_FTGL', '-DUSE_STREFLOP', '-DSTREFLOP_SSE', + '-DSTREFLOP_RANDOM_GEN_SIZE=32', + '-DLIBM_COMPILING_FLT32', + '-DN_SPECIALIZED=32', + '-mfpmath=sse', + '-msse' ] add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index bc8f0c511..fbd361d74 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -187,6 +187,7 @@ lib_megaglest = static_library( inc_miniupnpc, ], dependencies: [ + dep_streflop, shared_lib_game_deps, lua_dep, dep_sdl, @@ -194,7 +195,6 @@ lib_megaglest = static_library( dep_feathery_ftp, dep_miniupnpc, dep_ftgl, - dep_streflop ] ) diff --git a/source/shared_lib/sources/streflop/meson.build b/source/shared_lib/sources/streflop/meson.build index 6a1c2c249..b8cd4877e 100644 --- a/source/shared_lib/sources/streflop/meson.build +++ b/source/shared_lib/sources/streflop/meson.build @@ -1,11 +1,26 @@ -src = [ - 'SMath.cpp', - 'Random.cpp', - 'streflopC.cpp', - 'SoftFloatWrapper.cpp', - 'softfloat/softfloat.cpp', +includes = [ + '../../include/streflop', + '../../include/streflop/libm/flt-32', + '../../include/streflop/libm/headers', +] + +add_cpp_args = [ + '-DSTREFLOP_SSE', + '-fno-strict-aliasing', + '-mieee-fp', + '-mfpmath=sse', + '-msse', + '-msse2', + '-fPIC', ] +#Random_lib = static_library('Random', 'Random.cpp', cpp_args: add_cpp_args, include_directories : includes) + +#src = [ +# 'SMath.cpp', +# 'streflopC.cpp', +#] + # src_basename = [ # 'e_expf.c', # 'w_expf.c', @@ -15,102 +30,94 @@ src = [ # src += [join_paths('libm/', file)] # endforeach -# src_basename = [ -# 'e_acosf.cpp', -# 'e_acoshf.cpp', -# 'e_asinf.cpp', -# 'e_atan2f.cpp', -# 'e_atanhf.cpp', -# 'e_coshf.cpp', -# 'e_exp2f.cpp', -# 'e_expf.cpp', -# 'e_fmodf.cpp', -# 'e_gammaf_r.cpp', -# 'e_hypotf.cpp', -# 'e_j0f.cpp', -# 'e_j1f.cpp', -# 'e_jnf.cpp', -# 'e_lgammaf_r.cpp', -# 'e_log10f.cpp', -# 'e_log2f.cpp', -# 'e_logf.cpp', -# 'e_powf.cpp', -# 'e_remainderf.cpp', -# 'e_rem_pio2f.cpp', -# 'e_sinhf.cpp', -# 'e_sqrtf.cpp', -# 'k_cosf.cpp', -# 'k_rem_pio2f.cpp', -# 'k_sinf.cpp', -# 'k_tanf.cpp', -# 's_asinhf.cpp', -# 's_atanf.cpp', -# 's_cbrtf.cpp', -# 's_ceilf.cpp', -# 's_copysignf.cpp', -# 's_cosf.cpp', -# 's_erff.cpp', -# 's_expm1f.cpp', -# 's_fabsf.cpp', -# 's_finitef.cpp', -# 's_floorf.cpp', -# 's_fpclassifyf.cpp', -# 's_frexpf.cpp', -# 's_ilogbf.cpp', -# 's_isinff.cpp', -# 's_isnanf.cpp', -# 's_ldexpf.cpp', -# 's_llrintf.cpp', -# 's_llroundf.cpp', -# 's_log1pf.cpp', -# 's_logbf.cpp', -# 's_lrintf.cpp', -# 's_lroundf.cpp', -# 's_modff.cpp', -# 's_nearbyintf.cpp', -# 's_nextafterf.cpp', -# 's_remquof.cpp', -# 's_rintf.cpp', -# 's_roundf.cpp', -# 's_scalblnf.cpp', -# 's_scalbnf.cpp', -# 's_signbitf.cpp', -# 's_sincosf.cpp', -# 's_sinf.cpp', -# 's_tanf.cpp', -# 's_tanhf.cpp', -# 's_truncf.cpp', -# 'w_expf.cpp', -# ] - -# foreach file : src_basename -# src += [join_paths('libm/flt-32', file)] -# endforeach - -includes = [ - '../../include/streflop/libm/flt-32', - # '../../include/streflop/libm/headers', - '../../include/streflop/libm', - '../../include/streflop/softfloat', - '../../include/streflop', - '../../include/platform/common', - # '../../include/streflop/libm_flt32_source', +src_basename = [ + 'e_acosf.cpp', + 'e_acoshf.cpp', + 'e_asinf.cpp', + 'e_atan2f.cpp', + 'e_atanhf.cpp', + 'e_coshf.cpp', + 'e_exp2f.cpp', + 'e_expf.cpp', + 'e_fmodf.cpp', + 'e_gammaf_r.cpp', + 'e_hypotf.cpp', + 'e_j0f.cpp', + 'e_j1f.cpp', + 'e_jnf.cpp', + 'e_lgammaf_r.cpp', + 'e_log10f.cpp', + 'e_log2f.cpp', + 'e_logf.cpp', + 'e_powf.cpp', + 'e_remainderf.cpp', + 'e_rem_pio2f.cpp', + 'e_sinhf.cpp', + 'e_sqrtf.cpp', + 'k_cosf.cpp', + 'k_rem_pio2f.cpp', + 'k_sinf.cpp', + 'k_tanf.cpp', + 's_asinhf.cpp', + 's_atanf.cpp', + 's_cbrtf.cpp', + 's_ceilf.cpp', + 's_copysignf.cpp', + 's_cosf.cpp', + 's_erff.cpp', + 's_expm1f.cpp', + 's_fabsf.cpp', + 's_finitef.cpp', + 's_floorf.cpp', + 's_fpclassifyf.cpp', + 's_frexpf.cpp', + 's_ilogbf.cpp', + 's_isinff.cpp', + 's_isnanf.cpp', + 's_ldexpf.cpp', + 's_llrintf.cpp', + 's_llroundf.cpp', + 's_log1pf.cpp', + 's_logbf.cpp', + 's_lrintf.cpp', + 's_lroundf.cpp', + 's_modff.cpp', + 's_nearbyintf.cpp', + 's_nextafterf.cpp', + 's_remquof.cpp', + 's_rintf.cpp', + 's_roundf.cpp', + 's_scalblnf.cpp', + 's_scalbnf.cpp', + 's_signbitf.cpp', + 's_sincosf.cpp', + 's_sinf.cpp', + 's_tanf.cpp', + 's_tanhf.cpp', + 's_truncf.cpp', + 'w_expf.cpp', ] -add_cpp_args = [ - '-DUSE_STREFLOP', - '-DSTREFLOP_SSE', - '-DSTREFLOP_RANDOM_GEN_SIZE=32', - '-DLIBM_COMPILING_FLT32', - '-DN_SPECIALIZED=32', -] +libm32_lib_src = [] +foreach file : src_basename + libm32_lib_src += [join_paths('libm/flt-32', file)] +endforeach + +libm32_lib = static_library( + 'libm32', + libm32_lib_src, + include_directories: includes, +) lib_streflop = static_library( - 'streflop', - src, - cpp_args : add_cpp_args, - include_directories : includes, -# dependencies: [dep_curl, dep_sdl] - ) + 'streflop', + cpp_args: add_cpp_args, + include_directories: includes, + link_with: [libm32_lib], + # dependencies: [dep_curl, dep_sdl] +) -dep_streflop = declare_dependency(link_with: lib_streflop, include_directories : includes) +dep_streflop = declare_dependency( + link_with: lib_streflop, + include_directories: includes, +) From 059e09c27953648df7bdf154b7b9351b06030abc Mon Sep 17 00:00:00 2001 From: andy5995 Date: Sat, 8 Feb 2025 15:04:17 -0600 Subject: [PATCH 35/48] Add streflop as meson subproject --- .gitignore | 4 + source/glest_game/meson.build | 1 - source/shared_lib/meson.build | 15 ++- .../shared_lib/sources/streflop/meson.build | 123 ------------------ subprojects/streflop.wrap | 13 ++ 5 files changed, 29 insertions(+), 127 deletions(-) delete mode 100644 source/shared_lib/sources/streflop/meson.build create mode 100644 subprojects/streflop.wrap diff --git a/.gitignore b/.gitignore index 0a4e799f0..61aed0cdf 100644 --- a/.gitignore +++ b/.gitignore @@ -100,3 +100,7 @@ $RECYCLE.BIN/ *.msi *.pdb # + +# meson +subprojects/* +!subprojects/*.wrap diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index b144a41d0..26648a829 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -181,7 +181,6 @@ executable('megaglest', include_directories: [inc_ircclient, inc_game, inc_shared_lib], dependencies: [dep_libmegaglest, shared_lib_game_deps, - dep_streflop, ircclient_dep, lua_dep, dep_sdl, diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index fbd361d74..0827b353c 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -1,4 +1,3 @@ -subdir('sources/streflop') # subdir('sources/util') subdir('sources/feathery_ftp') @@ -147,6 +146,13 @@ if not lua_dep.found() # endif endif +streflop_dep = dependency( + 'streflop', + required: true, + fallback: 'streflop', + default_options: ['default_library=static'] + ) + inc_miniupnpc = ['include/platform/miniupnpc'] dep_miniupnpc = [] dep_miniupnpc = dependency('miniupnpc') @@ -187,7 +193,7 @@ lib_megaglest = static_library( inc_miniupnpc, ], dependencies: [ - dep_streflop, + streflop_dep, shared_lib_game_deps, lua_dep, dep_sdl, @@ -198,4 +204,7 @@ lib_megaglest = static_library( ] ) -dep_libmegaglest = declare_dependency(link_with: lib_megaglest) +dep_libmegaglest = declare_dependency( + link_with: lib_megaglest, + include_directories: 'include/streflop' + ) diff --git a/source/shared_lib/sources/streflop/meson.build b/source/shared_lib/sources/streflop/meson.build deleted file mode 100644 index b8cd4877e..000000000 --- a/source/shared_lib/sources/streflop/meson.build +++ /dev/null @@ -1,123 +0,0 @@ -includes = [ - '../../include/streflop', - '../../include/streflop/libm/flt-32', - '../../include/streflop/libm/headers', -] - -add_cpp_args = [ - '-DSTREFLOP_SSE', - '-fno-strict-aliasing', - '-mieee-fp', - '-mfpmath=sse', - '-msse', - '-msse2', - '-fPIC', -] - -#Random_lib = static_library('Random', 'Random.cpp', cpp_args: add_cpp_args, include_directories : includes) - -#src = [ -# 'SMath.cpp', -# 'streflopC.cpp', -#] - -# src_basename = [ -# 'e_expf.c', -# 'w_expf.c', -# ] - -# foreach file : src_basename -# src += [join_paths('libm/', file)] -# endforeach - -src_basename = [ - 'e_acosf.cpp', - 'e_acoshf.cpp', - 'e_asinf.cpp', - 'e_atan2f.cpp', - 'e_atanhf.cpp', - 'e_coshf.cpp', - 'e_exp2f.cpp', - 'e_expf.cpp', - 'e_fmodf.cpp', - 'e_gammaf_r.cpp', - 'e_hypotf.cpp', - 'e_j0f.cpp', - 'e_j1f.cpp', - 'e_jnf.cpp', - 'e_lgammaf_r.cpp', - 'e_log10f.cpp', - 'e_log2f.cpp', - 'e_logf.cpp', - 'e_powf.cpp', - 'e_remainderf.cpp', - 'e_rem_pio2f.cpp', - 'e_sinhf.cpp', - 'e_sqrtf.cpp', - 'k_cosf.cpp', - 'k_rem_pio2f.cpp', - 'k_sinf.cpp', - 'k_tanf.cpp', - 's_asinhf.cpp', - 's_atanf.cpp', - 's_cbrtf.cpp', - 's_ceilf.cpp', - 's_copysignf.cpp', - 's_cosf.cpp', - 's_erff.cpp', - 's_expm1f.cpp', - 's_fabsf.cpp', - 's_finitef.cpp', - 's_floorf.cpp', - 's_fpclassifyf.cpp', - 's_frexpf.cpp', - 's_ilogbf.cpp', - 's_isinff.cpp', - 's_isnanf.cpp', - 's_ldexpf.cpp', - 's_llrintf.cpp', - 's_llroundf.cpp', - 's_log1pf.cpp', - 's_logbf.cpp', - 's_lrintf.cpp', - 's_lroundf.cpp', - 's_modff.cpp', - 's_nearbyintf.cpp', - 's_nextafterf.cpp', - 's_remquof.cpp', - 's_rintf.cpp', - 's_roundf.cpp', - 's_scalblnf.cpp', - 's_scalbnf.cpp', - 's_signbitf.cpp', - 's_sincosf.cpp', - 's_sinf.cpp', - 's_tanf.cpp', - 's_tanhf.cpp', - 's_truncf.cpp', - 'w_expf.cpp', -] - -libm32_lib_src = [] -foreach file : src_basename - libm32_lib_src += [join_paths('libm/flt-32', file)] -endforeach - -libm32_lib = static_library( - 'libm32', - libm32_lib_src, - include_directories: includes, -) - -lib_streflop = static_library( - 'streflop', - cpp_args: add_cpp_args, - include_directories: includes, - link_with: [libm32_lib], - # dependencies: [dep_curl, dep_sdl] -) - -dep_streflop = declare_dependency( - link_with: lib_streflop, - include_directories: includes, -) diff --git a/subprojects/streflop.wrap b/subprojects/streflop.wrap new file mode 100644 index 000000000..d3e6ef0f2 --- /dev/null +++ b/subprojects/streflop.wrap @@ -0,0 +1,13 @@ +[wrap-git] +directory = streflop-0.3 +url = https://github.com/andy5995/streflop +revision = add-meson +#source_url = https://nicolas.brodu.net/common/programmation/streflop/streflop-0.3.tar.bz2 +#source_filename = streflop-0.3.tar.bz2 +#source_hash = 53642f71be5df5d8d2b766a77cd48d537e02fb366f09f902473818e9f8cd3817 +#patch_directory = streflop-ng +#method = meson + +[provide] +streflop = streflop_dep + From 1891faa72d11e5f866ff55ee03aba0b023f36e4a Mon Sep 17 00:00:00 2001 From: andy5995 Date: Sat, 8 Feb 2025 15:45:34 -0600 Subject: [PATCH 36/48] add cstd=c++11 (maybe fix freebsd build) --- meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 3029b0460..cad5b07b7 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,11 @@ project( ['c', 'cpp'], version: '3.13.0.999', meson_version : '>= 0.55.0', - default_options: ['warning_level=1', 'buildtype=debugoptimized'] + default_options: [ + 'warning_level=1', + 'buildtype=debugoptimized', + 'cpp_std=c++11' + ] ) # Setup compiler. From 257afed3133950589acc3393abd1a486597bb239 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Sat, 8 Feb 2025 15:46:50 -0600 Subject: [PATCH 37/48] meson format recursive --- meson.build | 48 +-- source/g3d_viewer/meson.build | 33 +- source/glest_game/meson.build | 333 +++++++++--------- source/glest_map_editor/meson.build | 50 ++- source/meson.build | 6 +- source/shared_lib/meson.build | 242 +++++++------ .../sources/feathery_ftp/meson.build | 50 ++- source/tools/glexemel/meson.build | 9 +- 8 files changed, 379 insertions(+), 392 deletions(-) diff --git a/meson.build b/meson.build index cad5b07b7..eadf937d3 100644 --- a/meson.build +++ b/meson.build @@ -1,34 +1,34 @@ project( - 'MegaGlest', - ['c', 'cpp'], - version: '3.13.0.999', - meson_version : '>= 0.55.0', - default_options: [ - 'warning_level=1', - 'buildtype=debugoptimized', - 'cpp_std=c++11' - ] - ) + 'MegaGlest', + ['c', 'cpp'], + version: '3.13.0.999', + meson_version: '>= 0.55.0', + default_options: [ + 'warning_level=1', + 'buildtype=debugoptimized', + 'cpp_std=c++11', + ], +) # Setup compiler. cxx = meson.get_compiler('cpp') cc = meson.get_compiler('c') extra_flags = [ - '-fno-common', - '-Werror=odr', - '-Werror=lto-type-mismatch', -# '-Werror=strict-aliasing', - '-frounding-math', - '-fsignaling-nans', - '-DUSE_FTGL', - '-DUSE_STREFLOP', - '-DSTREFLOP_SSE', - '-DSTREFLOP_RANDOM_GEN_SIZE=32', - '-DLIBM_COMPILING_FLT32', - '-DN_SPECIALIZED=32', - '-mfpmath=sse', - '-msse' + '-fno-common', + '-Werror=odr', + '-Werror=lto-type-mismatch', + # '-Werror=strict-aliasing', + '-frounding-math', + '-fsignaling-nans', + '-DUSE_FTGL', + '-DUSE_STREFLOP', + '-DSTREFLOP_SSE', + '-DSTREFLOP_RANDOM_GEN_SIZE=32', + '-DLIBM_COMPILING_FLT32', + '-DN_SPECIALIZED=32', + '-mfpmath=sse', + '-msse', ] add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') diff --git a/source/g3d_viewer/meson.build b/source/g3d_viewer/meson.build index f310d042e..8ca1323bc 100644 --- a/source/g3d_viewer/meson.build +++ b/source/g3d_viewer/meson.build @@ -22,20 +22,21 @@ inc_common = [ '../glest_game/sound', ] -executable('megaglest_g3d_viewer', - src_g3d_viewer, - include_directories: inc_common, - dependencies: [ - dep_libmegaglest, - dep_wx, - dep_sdl, - dep_gl, - dep_x11, - dep_jpeg, - dep_png, - dep_glew, - ], -# cpp_args: [ -# '-DNDEBUG', -# ] +executable( + 'megaglest_g3d_viewer', + src_g3d_viewer, + include_directories: inc_common, + dependencies: [ + dep_libmegaglest, + dep_wx, + dep_sdl, + dep_gl, + dep_x11, + dep_jpeg, + dep_png, + dep_glew, + ], + # cpp_args: [ + # '-DNDEBUG', + # ] ) diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 26648a829..a5804d9ac 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -1,93 +1,93 @@ src_game = [ - 'ai/ai.cpp', - 'ai/ai_interface.cpp', - 'ai/ai_rule.cpp', - 'ai/path_finder.cpp', - 'game/achievement.cpp', - 'game/chat_manager.cpp', - 'game/commander.cpp', - 'game/console.cpp', - 'game/game_camera.cpp', - 'game/game.cpp', - 'game/script_manager.cpp', - 'game/stats.cpp', - 'global/config.cpp', - 'global/core_data.cpp', - 'global/lang.cpp', - 'global/metrics.cpp', - 'graphics/particle_type.cpp', - 'graphics/renderer.cpp', - 'graphics/unit_particle_type.cpp', - 'gui/display.cpp', - 'gui/gui.cpp', - 'gui/selection.cpp', - 'main/battle_end.cpp', - 'main/intro.cpp', - 'main/main.cpp', - 'main/program.cpp', - 'menu/main_menu.cpp', - 'menu/menu_background.cpp', - 'menu/menu_state_about.cpp', - 'menu/menu_state_connected_game.cpp', - 'menu/menu_state_custom_game.cpp', - 'menu/menu_state_graphic_info.cpp', - 'menu/menu_state_join_game.cpp', - 'menu/menu_state_keysetup.cpp', - 'menu/menu_state_load_game.cpp', - 'menu/menu_state_masterserver.cpp', - 'menu/menu_state_mods.cpp', - 'menu/menu_state_new_game.cpp', - 'menu/menu_state_options.cpp', - 'menu/menu_state_options_graphics.cpp', - 'menu/menu_state_options_network.cpp', - 'menu/menu_state_options_sound.cpp', - 'menu/menu_state_root.cpp', - 'menu/menu_state_scenario.cpp', - 'menu/server_line.cpp', - 'network/client_interface.cpp', - 'network/connection_slot.cpp', - 'network/network_interface.cpp', - 'network/network_manager.cpp', - 'network/network_message.cpp', - 'network/network_protocol.cpp', - 'network/network_types.cpp', - 'network/server_interface.cpp', - 'sound/sound_container.cpp', - 'sound/sound_renderer.cpp', - 'steam/steam.cpp', - 'steamshim/steamshim_child.c', - 'type_instances/command.cpp', - 'type_instances/faction.cpp', - 'type_instances/object.cpp', - 'type_instances/resource.cpp', - 'type_instances/unit.cpp', - 'type_instances/upgrade.cpp', - 'types/command_type.cpp', - 'types/damage_multiplier.cpp', - 'types/element_type.cpp', - 'types/faction_type.cpp', - 'types/object_type.cpp', - 'types/projectile_type.cpp', - 'types/resource_type.cpp', - 'types/skill_type.cpp', - 'types/tech_tree.cpp', - 'types/tileset_model_type.cpp', - 'types/unit_type.cpp', - 'types/upgrade_type.cpp', - 'world/map.cpp', - 'world/minimap.cpp', - 'world/scenario.cpp', - 'world/surface_atlas.cpp', - 'world/tileset.cpp', - 'world/time_flow.cpp', - 'world/unit_updater.cpp', - 'world/water_effects.cpp', - 'world/world.cpp', - 'facilities/auto_test.cpp', - 'facilities/components.cpp', - 'facilities/game_util.cpp', - 'facilities/logger.cpp', - ] + 'ai/ai.cpp', + 'ai/ai_interface.cpp', + 'ai/ai_rule.cpp', + 'ai/path_finder.cpp', + 'game/achievement.cpp', + 'game/chat_manager.cpp', + 'game/commander.cpp', + 'game/console.cpp', + 'game/game_camera.cpp', + 'game/game.cpp', + 'game/script_manager.cpp', + 'game/stats.cpp', + 'global/config.cpp', + 'global/core_data.cpp', + 'global/lang.cpp', + 'global/metrics.cpp', + 'graphics/particle_type.cpp', + 'graphics/renderer.cpp', + 'graphics/unit_particle_type.cpp', + 'gui/display.cpp', + 'gui/gui.cpp', + 'gui/selection.cpp', + 'main/battle_end.cpp', + 'main/intro.cpp', + 'main/main.cpp', + 'main/program.cpp', + 'menu/main_menu.cpp', + 'menu/menu_background.cpp', + 'menu/menu_state_about.cpp', + 'menu/menu_state_connected_game.cpp', + 'menu/menu_state_custom_game.cpp', + 'menu/menu_state_graphic_info.cpp', + 'menu/menu_state_join_game.cpp', + 'menu/menu_state_keysetup.cpp', + 'menu/menu_state_load_game.cpp', + 'menu/menu_state_masterserver.cpp', + 'menu/menu_state_mods.cpp', + 'menu/menu_state_new_game.cpp', + 'menu/menu_state_options.cpp', + 'menu/menu_state_options_graphics.cpp', + 'menu/menu_state_options_network.cpp', + 'menu/menu_state_options_sound.cpp', + 'menu/menu_state_root.cpp', + 'menu/menu_state_scenario.cpp', + 'menu/server_line.cpp', + 'network/client_interface.cpp', + 'network/connection_slot.cpp', + 'network/network_interface.cpp', + 'network/network_manager.cpp', + 'network/network_message.cpp', + 'network/network_protocol.cpp', + 'network/network_types.cpp', + 'network/server_interface.cpp', + 'sound/sound_container.cpp', + 'sound/sound_renderer.cpp', + 'steam/steam.cpp', + 'steamshim/steamshim_child.c', + 'type_instances/command.cpp', + 'type_instances/faction.cpp', + 'type_instances/object.cpp', + 'type_instances/resource.cpp', + 'type_instances/unit.cpp', + 'type_instances/upgrade.cpp', + 'types/command_type.cpp', + 'types/damage_multiplier.cpp', + 'types/element_type.cpp', + 'types/faction_type.cpp', + 'types/object_type.cpp', + 'types/projectile_type.cpp', + 'types/resource_type.cpp', + 'types/skill_type.cpp', + 'types/tech_tree.cpp', + 'types/tileset_model_type.cpp', + 'types/unit_type.cpp', + 'types/upgrade_type.cpp', + 'world/map.cpp', + 'world/minimap.cpp', + 'world/scenario.cpp', + 'world/surface_atlas.cpp', + 'world/tileset.cpp', + 'world/time_flow.cpp', + 'world/unit_updater.cpp', + 'world/water_effects.cpp', + 'world/world.cpp', + 'facilities/auto_test.cpp', + 'facilities/components.cpp', + 'facilities/game_util.cpp', + 'facilities/logger.cpp', +] inc_game = [ @@ -109,55 +109,59 @@ inc_game = [ ] inc_common = [ - 'platform', - 'platform/posix', - 'platform/common', - 'platform/win32', -# 'platform/miniupnpc', - 'platform/sdl', - 'util', - 'util/utf8', - 'map', - 'compression', - 'feathery_ftp', -# 'streflop', -# 'streflop/softfloat', -# 'streflop/libm', -# 'streflop/libm/headers', -# 'streflop/libm/flt-32', - 'lua', - 'xml', - 'xml/rapidxml', - 'sound', - 'sound/openal', - 'graphics', - 'graphics/gl', - ] + 'platform', + 'platform/posix', + 'platform/common', + 'platform/win32', + # 'platform/miniupnpc', + 'platform/sdl', + 'util', + 'util/utf8', + 'map', + 'compression', + 'feathery_ftp', + # 'streflop', + # 'streflop/softfloat', + # 'streflop/libm', + # 'streflop/libm/headers', + # 'streflop/libm/flt-32', + 'lua', + 'xml', + 'xml/rapidxml', + 'sound', + 'sound/openal', + 'graphics', + 'graphics/gl', +] inc_ircclient = [] irclient_dep = [] ircclient_dep = dependency('ircclient', required: false) if not ircclient_dep.found() - ircclient_dep = cc.find_library('ircclient', has_headers: 'libircclient.h', required: false) - if not ircclient_dep.found() - inc_ircclient = ['/usr/include', '/usr/local/include'] - path = '/usr/include/libircclient' - result = run_command('test', '-d', path, check: false) - if result.returncode() == 0 - inc_ircclient += path - endif ircclient_dep = cc.find_library( - 'ircclient', - dirs: '/usr/local/lib', - has_headers: 'libircclient.h', - header_include_directories: include_directories(inc_ircclient) + 'ircclient', + has_headers: 'libircclient.h', + required: false, ) - endif + if not ircclient_dep.found() + inc_ircclient = ['/usr/include', '/usr/local/include'] + path = '/usr/include/libircclient' + result = run_command('test', '-d', path, check: false) + if result.returncode() == 0 + inc_ircclient += path + endif + ircclient_dep = cc.find_library( + 'ircclient', + dirs: '/usr/local/lib', + has_headers: 'libircclient.h', + header_include_directories: include_directories(inc_ircclient), + ) + endif endif inc_shared_lib = [] foreach dir : inc_common - inc_shared_lib += [join_paths('..', 'shared_lib', 'include', dir)] + inc_shared_lib += [join_paths('..', 'shared_lib', 'include', dir)] endforeach dep_cppunit = dependency('cppunit') @@ -176,40 +180,41 @@ dep_ftgl = dependency('ftgl') dep_freetype = dependency('freetype2') dep_math = cxx.find_library('m') -executable('megaglest', - [src_game, '../shared_lib/sources/platform/posix/ircclient.cpp'], - include_directories: [inc_ircclient, inc_game, inc_shared_lib], - dependencies: [dep_libmegaglest, - shared_lib_game_deps, - ircclient_dep, - lua_dep, - dep_sdl, - dep_cppunit, - dep_fribidi, - dep_glib, - dep_pthread, - # dep_gl, - dep_openal, - dep_x11, - # dep_ogg, - dep_vorbis, - dep_glew, - dep_png, - dep_jpeg, - dep_ftgl, - dep_freetype, - dep_math, - ], - cpp_args: [ '-DGITVERSION="HELPME"'], - # link_args: ['-lm', -# '-lSM', -# '-lICE', - # '-lGLU', - # '-ldl', - # '-lXext', - # '-Wl,-Bstatic', - # '-lSDL2main', - # '-Wl,-Bdynamic', - # ] - - ) +executable( + 'megaglest', + [src_game, '../shared_lib/sources/platform/posix/ircclient.cpp'], + include_directories: [inc_ircclient, inc_game, inc_shared_lib], + dependencies: [ + dep_libmegaglest, + shared_lib_game_deps, + ircclient_dep, + lua_dep, + dep_sdl, + dep_cppunit, + dep_fribidi, + dep_glib, + dep_pthread, + # dep_gl, + dep_openal, + dep_x11, + # dep_ogg, + dep_vorbis, + dep_glew, + dep_png, + dep_jpeg, + dep_ftgl, + dep_freetype, + dep_math, + ], + cpp_args: ['-DGITVERSION="HELPME"'], + # link_args: ['-lm', + # '-lSM', + # '-lICE', + # '-lGLU', + # '-ldl', + # '-lXext', + # '-Wl,-Bstatic', + # '-lSDL2main', + # '-Wl,-Bdynamic', + # ] +) diff --git a/source/glest_map_editor/meson.build b/source/glest_map_editor/meson.build index 49947c714..4e3842ab9 100644 --- a/source/glest_map_editor/meson.build +++ b/source/glest_map_editor/meson.build @@ -1,34 +1,28 @@ -src_map_editor = [ - 'program.cpp', - 'main.cpp', - '../glest_game/global/config.cpp' -] +src_map_editor = ['program.cpp', 'main.cpp', '../glest_game/global/config.cpp'] inc_common = [ - '../shared_lib/include/map', - '../shared_lib/include/util', - '../shared_lib/include/graphics', - '../shared_lib/include/graphics/gl', - '../shared_lib/include/platform/sdl', - '../shared_lib/include/platform/common', - '../glest_game/global', - '../glest_game/game', - '../glest_game/facilities', + '../shared_lib/include/map', + '../shared_lib/include/util', + '../shared_lib/include/graphics', + '../shared_lib/include/graphics/gl', + '../shared_lib/include/platform/sdl', + '../shared_lib/include/platform/common', + '../glest_game/global', + '../glest_game/game', + '../glest_game/facilities', ] -dep_wx = dependency('wxwidgets', version : '>=3.0.0', modules : ['gl', 'core', 'base']) +dep_wx = dependency( + 'wxwidgets', + version: '>=3.0.0', + modules: ['gl', 'core', 'base'], +) dep_glu = dependency('glu') -executable('megaglest_editor', - src_map_editor, - include_directories: inc_common, - dependencies: [ - dep_libmegaglest, - dep_wx, - dep_sdl, - dep_gl, - dep_glu, - ], - cpp_args: [ - '-DNDEBUG', - ]) +executable( + 'megaglest_editor', + src_map_editor, + include_directories: inc_common, + dependencies: [dep_libmegaglest, dep_wx, dep_sdl, dep_gl, dep_glu], + cpp_args: ['-DNDEBUG'], +) diff --git a/source/meson.build b/source/meson.build index ca73de7b2..3ea665348 100644 --- a/source/meson.build +++ b/source/meson.build @@ -1,11 +1,9 @@ shared_lib_game_deps = [] -shared_lib_game_common = [ - 'libcurl' - ] +shared_lib_game_common = ['libcurl'] foreach dep : shared_lib_game_common - shared_lib_game_deps += dependency(dep) + shared_lib_game_deps += dependency(dep) endforeach subdir('shared_lib') diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 0827b353c..d1b3e25d7 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -4,14 +4,14 @@ subdir('sources/feathery_ftp') src = [] src_basename = [ - 'string_utils.cpp', - 'util.cpp', - 'properties.cpp', - 'profiler.cpp', - 'leak_dumper.cpp', - 'checksum.cpp', - 'conversion.cpp', - 'randomgen.cpp', + 'string_utils.cpp', + 'util.cpp', + 'properties.cpp', + 'profiler.cpp', + 'leak_dumper.cpp', + 'checksum.cpp', + 'conversion.cpp', + 'randomgen.cpp', ] foreach file : src_basename @@ -19,34 +19,30 @@ foreach file : src_basename endforeach src_basename = [ - 'base_thread.cpp', - 'byte_order.cpp', - 'cache_manager.cpp', - 'platform_common.cpp', - 'simple_threads.cpp', + 'base_thread.cpp', + 'byte_order.cpp', + 'cache_manager.cpp', + 'platform_common.cpp', + 'simple_threads.cpp', ] foreach file : src_basename src += [join_paths('sources/platform/common', file)] endforeach -src_basename = [ - 'miniftpclient.cpp', - 'miniftpserver.cpp', - 'socket.cpp', -] +src_basename = ['miniftpclient.cpp', 'miniftpserver.cpp', 'socket.cpp'] foreach file : src_basename src += [join_paths('sources/platform/posix', file)] endforeach src_basename = [ - 'factory_repository.cpp', - 'gl_wrap.cpp', - 'platform_util.cpp', - 'thread.cpp', - 'window.cpp', - 'window_gl.cpp', + 'factory_repository.cpp', + 'gl_wrap.cpp', + 'platform_util.cpp', + 'thread.cpp', + 'window.cpp', + 'window_gl.cpp', ] foreach file : src_basename @@ -54,30 +50,30 @@ foreach file : src_basename endforeach src_basename = [ - 'BMPReader.cpp', - 'graphics_interface.cpp', - 'quaternion.cpp', - 'buffer.cpp', - 'ImageReaders.cpp', - 'shader.cpp', - 'camera.cpp', - 'interpolation.cpp', - 'shader_manager.cpp', - 'context.cpp', - 'JPGReader.cpp', - 'texture.cpp', - 'FileReader.cpp', - 'model.cpp', - 'texture_manager.cpp', - 'font.cpp', - 'model_manager.cpp', - 'TGAReader.cpp', - 'font_manager.cpp', - 'particle.cpp', - 'video_player.cpp', - 'font_text.cpp', - 'pixmap.cpp', - 'PNGReader.cpp', + 'BMPReader.cpp', + 'graphics_interface.cpp', + 'quaternion.cpp', + 'buffer.cpp', + 'ImageReaders.cpp', + 'shader.cpp', + 'camera.cpp', + 'interpolation.cpp', + 'shader_manager.cpp', + 'context.cpp', + 'JPGReader.cpp', + 'texture.cpp', + 'FileReader.cpp', + 'model.cpp', + 'texture_manager.cpp', + 'font.cpp', + 'model_manager.cpp', + 'TGAReader.cpp', + 'font_manager.cpp', + 'particle.cpp', + 'video_player.cpp', + 'font_text.cpp', + 'pixmap.cpp', + 'PNGReader.cpp', ] foreach file : src_basename @@ -85,17 +81,17 @@ foreach file : src_basename endforeach src_basename = [ - 'base_renderer.cpp', - 'opengl.cpp', - 'context_gl.cpp', - 'particle_renderer_gl.cpp', - 'font_gl.cpp', - 'shader_gl.cpp', - 'font_textFTGL.cpp', - 'text_renderer_gl.cpp', - 'model_gl.cpp', - 'texture_gl.cpp', - 'model_renderer_gl.cpp', + 'base_renderer.cpp', + 'opengl.cpp', + 'context_gl.cpp', + 'particle_renderer_gl.cpp', + 'font_gl.cpp', + 'shader_gl.cpp', + 'font_textFTGL.cpp', + 'text_renderer_gl.cpp', + 'model_gl.cpp', + 'texture_gl.cpp', + 'model_renderer_gl.cpp', ] foreach file : src_basename @@ -103,10 +99,10 @@ foreach file : src_basename endforeach src_basename = [ - 'sound_file_loader.cpp', - 'sound_player.cpp', - 'sound.cpp', - 'sound_interface.cpp', + 'sound_file_loader.cpp', + 'sound_player.cpp', + 'sound.cpp', + 'sound_interface.cpp', ] foreach file : src_basename @@ -114,13 +110,13 @@ foreach file : src_basename endforeach src_shared_lib_misc = [ - 'sound/openal/sound_player_openal.cpp', - 'platform/unix/gl_wrap.cpp', - 'compression/compression_utils.cpp', - 'lua/lua_script.cpp', - 'miniz/miniz.c', - 'map/map_preview.cpp', - 'xml/xml_parser.cpp' + 'sound/openal/sound_player_openal.cpp', + 'platform/unix/gl_wrap.cpp', + 'compression/compression_utils.cpp', + 'lua/lua_script.cpp', + 'miniz/miniz.c', + 'map/map_preview.cpp', + 'xml/xml_parser.cpp', ] foreach file : src_shared_lib_misc @@ -134,48 +130,48 @@ dep_ftgl = dependency('ftgl') # This will get changed to 5.3 lua_dep = dependency('lua-5.3', required: true) if not lua_dep.found() - lua_dep = cc.find_library('lua', has_headers: 'lua.h', required: true) -# if not lua_dep.found() -# # This will use the fallback -# lua_dep = dependency( -# 'lua-5.3', -# required: true, -# fallback: 'lua', -# default_options: ['default_library=static'] -# ) -# endif + lua_dep = cc.find_library('lua', has_headers: 'lua.h', required: true) + # if not lua_dep.found() + # # This will use the fallback + # lua_dep = dependency( + # 'lua-5.3', + # required: true, + # fallback: 'lua', + # default_options: ['default_library=static'] + # ) + # endif endif streflop_dep = dependency( - 'streflop', - required: true, - fallback: 'streflop', - default_options: ['default_library=static'] - ) + 'streflop', + required: true, + fallback: 'streflop', + default_options: ['default_library=static'], +) inc_miniupnpc = ['include/platform/miniupnpc'] dep_miniupnpc = [] dep_miniupnpc = dependency('miniupnpc') -if not dep_miniupnpc.found() # TODO: review/test for if the library isn't installed. - dep_miniupnpc = cxx.find_library('miniupnpc', required: false) - inc_miniupnpc += '/usr/include/miniupnpc' +if not dep_miniupnpc.found() # TODO: review/test for if the library isn't installed. + dep_miniupnpc = cxx.find_library('miniupnpc', required: false) + inc_miniupnpc += '/usr/include/miniupnpc' endif inc_shared_lib_misc_basename = [ - 'graphics', - 'map', - 'xml', - 'sound', - 'sound/openal', - 'platform/common', - 'platform/posix', - 'platform/sdl', - 'graphics', - 'graphics/gl', - 'util/', - 'util/utf8', - 'compression', - 'lua', + 'graphics', + 'map', + 'xml', + 'sound', + 'sound/openal', + 'platform/common', + 'platform/posix', + 'platform/sdl', + 'graphics', + 'graphics/gl', + 'util/', + 'util/utf8', + 'compression', + 'lua', ] inc_shared_lib_misc = [] @@ -185,26 +181,26 @@ foreach file : inc_shared_lib_misc_basename endforeach lib_megaglest = static_library( - 'megaglest', - src, - include_directories : [ - inc_shared_lib_misc, - 'sources', # for miniz - inc_miniupnpc, - ], - dependencies: [ - streflop_dep, - shared_lib_game_deps, - lua_dep, - dep_sdl, - dep_openal, - dep_feathery_ftp, - dep_miniupnpc, - dep_ftgl, - ] - ) + 'megaglest', + src, + include_directories: [ + inc_shared_lib_misc, + 'sources', # for miniz + inc_miniupnpc, + ], + dependencies: [ + streflop_dep, + shared_lib_game_deps, + lua_dep, + dep_sdl, + dep_openal, + dep_feathery_ftp, + dep_miniupnpc, + dep_ftgl, + ], +) dep_libmegaglest = declare_dependency( - link_with: lib_megaglest, - include_directories: 'include/streflop' - ) + link_with: lib_megaglest, + include_directories: 'include/streflop', +) diff --git a/source/shared_lib/sources/feathery_ftp/meson.build b/source/shared_lib/sources/feathery_ftp/meson.build index c3ca418a7..119eb5dea 100644 --- a/source/shared_lib/sources/feathery_ftp/meson.build +++ b/source/shared_lib/sources/feathery_ftp/meson.build @@ -1,33 +1,31 @@ src_feathery_ftp = [ - 'ftpTargetWin32.c', - 'ftpServer.c', - 'ftpTargetPosix.c', - 'ftpLib.c', - 'ftpRuntime.c', - 'ftpCmds.c', - 'ftpSession.c', - 'ftpAccount.c', - 'ftpMessages.c', + 'ftpTargetWin32.c', + 'ftpServer.c', + 'ftpTargetPosix.c', + 'ftpLib.c', + 'ftpRuntime.c', + 'ftpCmds.c', + 'ftpSession.c', + 'ftpAccount.c', + 'ftpMessages.c', ] -inc_feathery_ftp = [ - '../../include/feathery_ftp/', -] +inc_feathery_ftp = ['../../include/feathery_ftp/'] lib_featheryftp = static_library( - 'feathery_ftp', - src_feathery_ftp, - include_directories : inc_feathery_ftp, -# dependencies: [ -# dep_curl, -# dep_sdl, dep_x11, dep_openal, dep_lua, -# dep_cppunit, -# dep_fribidi, -# dep_glib -# ] - ) + 'feathery_ftp', + src_feathery_ftp, + include_directories: inc_feathery_ftp, + # dependencies: [ + # dep_curl, + # dep_sdl, dep_x11, dep_openal, dep_lua, + # dep_cppunit, + # dep_fribidi, + # dep_glib + # ] +) dep_feathery_ftp = declare_dependency( - link_with: lib_featheryftp, - include_directories: inc_feathery_ftp - ) + link_with: lib_featheryftp, + include_directories: inc_feathery_ftp, +) diff --git a/source/tools/glexemel/meson.build b/source/tools/glexemel/meson.build index 2191dec70..d5ccf4754 100644 --- a/source/tools/glexemel/meson.build +++ b/source/tools/glexemel/meson.build @@ -1,8 +1,3 @@ -executable('g2xml', - 'g2xml.c' -) +executable('g2xml', 'g2xml.c') -executable('xml2g', - 'xml2g.c', - dependencies: dependency('libxml-2.0') -) +executable('xml2g', 'xml2g.c', dependencies: dependency('libxml-2.0')) From 4c46497b99816d260d913b6b3611e9c121dca09e Mon Sep 17 00:00:00 2001 From: andy5995 Date: Sun, 9 Feb 2025 00:32:51 -0600 Subject: [PATCH 38/48] add undef=false to default meson opts --- meson.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/meson.build b/meson.build index eadf937d3..b25d4e0b3 100644 --- a/meson.build +++ b/meson.build @@ -18,15 +18,12 @@ extra_flags = [ '-fno-common', '-Werror=odr', '-Werror=lto-type-mismatch', - # '-Werror=strict-aliasing', + # '-Werror=strict-aliasing', '-frounding-math', '-fsignaling-nans', '-DUSE_FTGL', '-DUSE_STREFLOP', '-DSTREFLOP_SSE', - '-DSTREFLOP_RANDOM_GEN_SIZE=32', - '-DLIBM_COMPILING_FLT32', - '-DN_SPECIALIZED=32', '-mfpmath=sse', '-msse', ] From 3396bd24b0bfdb4f78ff306300dac0f09789aebe Mon Sep 17 00:00:00 2001 From: andy5995 Date: Sun, 9 Feb 2025 23:37:09 -0600 Subject: [PATCH 39/48] Specify streflop fpu in subproject call --- meson.build | 6 +---- source/glest_game/meson.build | 3 --- .../include/platform/common/math_wrapper.h | 2 +- .../include/platform/common/streflop_cond.h | 4 ++-- source/shared_lib/meson.build | 23 +++++++++++++++---- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index b25d4e0b3..54cbdfe49 100644 --- a/meson.build +++ b/meson.build @@ -18,14 +18,10 @@ extra_flags = [ '-fno-common', '-Werror=odr', '-Werror=lto-type-mismatch', - # '-Werror=strict-aliasing', - '-frounding-math', - '-fsignaling-nans', + # '-Werror=strict-aliasing', '-DUSE_FTGL', '-DUSE_STREFLOP', '-DSTREFLOP_SSE', - '-mfpmath=sse', - '-msse', ] add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index a5804d9ac..ccd2ae954 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -113,7 +113,6 @@ inc_common = [ 'platform/posix', 'platform/common', 'platform/win32', - # 'platform/miniupnpc', 'platform/sdl', 'util', 'util/utf8', @@ -178,7 +177,6 @@ dep_png = dependency('libpng') dep_jpeg = dependency('libjpeg') dep_ftgl = dependency('ftgl') dep_freetype = dependency('freetype2') -dep_math = cxx.find_library('m') executable( 'megaglest', @@ -204,7 +202,6 @@ executable( dep_jpeg, dep_ftgl, dep_freetype, - dep_math, ], cpp_args: ['-DGITVERSION="HELPME"'], # link_args: ['-lm', diff --git a/source/shared_lib/include/platform/common/math_wrapper.h b/source/shared_lib/include/platform/common/math_wrapper.h index e90550b83..d2bade288 100644 --- a/source/shared_lib/include/platform/common/math_wrapper.h +++ b/source/shared_lib/include/platform/common/math_wrapper.h @@ -14,7 +14,7 @@ #ifdef USE_STREFLOP -#include +// #include #include #else diff --git a/source/shared_lib/include/platform/common/streflop_cond.h b/source/shared_lib/include/platform/common/streflop_cond.h index 1ec17a788..3c7a1f473 100644 --- a/source/shared_lib/include/platform/common/streflop_cond.h +++ b/source/shared_lib/include/platform/common/streflop_cond.h @@ -14,8 +14,8 @@ When faced with ambiguous call errors with e.g. fabs, use math::function. Add it to math namespace if it doesn't exist there yet. */ -#ifndef STREFLOP_COND_H -#define STREFLOP_COND_H +#ifndef _STREFLOP_COND_H +#define _STREFLOP_COND_H #if defined(STREFLOP_X87) || defined(STREFLOP_SSE) || defined(STREFLOP_SOFT) #include diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index d1b3e25d7..e449bc236 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -142,12 +142,20 @@ if not lua_dep.found() # endif endif -streflop_dep = dependency( +# By default, meson will look in the repo roots 'subproject' directory # Note +# changing a default options might not be enough to trigger meson to rerun +# setup. In the build directory, you can change the option manually +# Example: meson configure -Dstreflop:fpu=soft (where the value preceding the +# colon is the subproject name) and then rebuild. +streflop_subproj = subproject( 'streflop', - required: true, - fallback: 'streflop', - default_options: ['default_library=static'], + default_options: ['default_library=static', 'fpu=sse', 'no_denormals=true'], ) +# TODO: The binaries don't need the dep object, but they do need the includes. +# Get them from the dep object instead of hard-coding them in the three +# binary meson builds. +streflop_dep = streflop_subproj.get_variable('streflop_dep') +streflop_includes = streflop_dep.partial_dependency(includes: true) inc_miniupnpc = ['include/platform/miniupnpc'] dep_miniupnpc = [] @@ -156,6 +164,10 @@ if not dep_miniupnpc.found() # TODO: review/test for if the library isn't insta dep_miniupnpc = cxx.find_library('miniupnpc', required: false) inc_miniupnpc += '/usr/include/miniupnpc' endif +# if miniupnpc isn't installed, add these flags. Check existing cmake in +# shared_lib to see about other platforms +#c_args: ['-DMINIUPNPC_SET_SOCKET_TIMEOUT', '-D_BSD_SOURCE'], +# cpp_args: ['-DMINIUPNPC_SET_SOCKET_TIMEOUT', '-D_BSD_SOURCE'], inc_shared_lib_misc_basename = [ 'graphics', @@ -198,9 +210,10 @@ lib_megaglest = static_library( dep_miniupnpc, dep_ftgl, ], + pic: true, ) dep_libmegaglest = declare_dependency( link_with: lib_megaglest, - include_directories: 'include/streflop', + dependencies: streflop_includes, ) From 2bfb72fa2d2a5602d99b8124198aed18d6a10c14 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Wed, 12 Feb 2025 22:43:16 -0600 Subject: [PATCH 40/48] some organizing and streflop work --- meson.build | 4 +-- mk/test-meson-build.sh | 4 ++- source/g3d_viewer/meson.build | 4 +-- source/glest_game/meson.build | 10 ++---- source/glest_map_editor/meson.build | 7 +--- source/meson.build | 56 ++++++++++++++++++++++++++++- source/shared_lib/meson.build | 42 ++-------------------- 7 files changed, 67 insertions(+), 60 deletions(-) diff --git a/meson.build b/meson.build index 54cbdfe49..78db3993f 100644 --- a/meson.build +++ b/meson.build @@ -4,7 +4,7 @@ project( version: '3.13.0.999', meson_version: '>= 0.55.0', default_options: [ - 'warning_level=1', + 'warning_level=0', 'buildtype=debugoptimized', 'cpp_std=c++11', ], @@ -20,8 +20,6 @@ extra_flags = [ '-Werror=lto-type-mismatch', # '-Werror=strict-aliasing', '-DUSE_FTGL', - '-DUSE_STREFLOP', - '-DSTREFLOP_SSE', ] add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') diff --git a/mk/test-meson-build.sh b/mk/test-meson-build.sh index 840c7d810..534d60ce9 100755 --- a/mk/test-meson-build.sh +++ b/mk/test-meson-build.sh @@ -12,9 +12,11 @@ BUILD_DIR="${BUILD_DIR:-$HERE/_build}" # Detect OS type OS_TYPE="$(uname -s)" +cd "$SOURCE_ROOT" if [ ! -d "$BUILD_DIR" ]; then - cd "$SOURCE_ROOT" meson setup "$BUILD_DIR" "$@" +else + meson setup --reconfigure "$BUILD_DIR" "$@" fi cd "$HERE" diff --git a/source/g3d_viewer/meson.build b/source/g3d_viewer/meson.build index 8ca1323bc..d562da70c 100644 --- a/source/g3d_viewer/meson.build +++ b/source/g3d_viewer/meson.build @@ -28,13 +28,13 @@ executable( include_directories: inc_common, dependencies: [ dep_libmegaglest, - dep_wx, - dep_sdl, + wx_dep, dep_gl, dep_x11, dep_jpeg, dep_png, dep_glew, + sdl_dep, ], # cpp_args: [ # '-DNDEBUG', diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index ccd2ae954..8610897e9 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -168,14 +168,12 @@ dep_fribidi = dependency('fribidi') dep_glib = dependency('glib-2.0') dep_pthread = dependency('threads') dep_gl = dependency('gl') -dep_openal = dependency('openal') dep_x11 = dependency('x11') # dep_ogg = dependency('ogg') dep_vorbis = dependency('vorbisfile') dep_glew = dependency('glew') dep_png = dependency('libpng') dep_jpeg = dependency('libjpeg') -dep_ftgl = dependency('ftgl') dep_freetype = dependency('freetype2') executable( @@ -184,23 +182,19 @@ executable( include_directories: [inc_ircclient, inc_game, inc_shared_lib], dependencies: [ dep_libmegaglest, + lua_dep.partial_dependency(compile_args: true), shared_lib_game_deps, ircclient_dep, - lua_dep, - dep_sdl, dep_cppunit, dep_fribidi, dep_glib, dep_pthread, - # dep_gl, - dep_openal, + sdl_dep, dep_x11, - # dep_ogg, dep_vorbis, dep_glew, dep_png, dep_jpeg, - dep_ftgl, dep_freetype, ], cpp_args: ['-DGITVERSION="HELPME"'], diff --git a/source/glest_map_editor/meson.build b/source/glest_map_editor/meson.build index 4e3842ab9..6f2b583db 100644 --- a/source/glest_map_editor/meson.build +++ b/source/glest_map_editor/meson.build @@ -12,17 +12,12 @@ inc_common = [ '../glest_game/facilities', ] -dep_wx = dependency( - 'wxwidgets', - version: '>=3.0.0', - modules: ['gl', 'core', 'base'], -) dep_glu = dependency('glu') executable( 'megaglest_editor', src_map_editor, include_directories: inc_common, - dependencies: [dep_libmegaglest, dep_wx, dep_sdl, dep_gl, dep_glu], + dependencies: [dep_libmegaglest, wx_dep, dep_gl, dep_glu, sdl_dep], cpp_args: ['-DNDEBUG'], ) diff --git a/source/meson.build b/source/meson.build index 3ea665348..0a1f0f51d 100644 --- a/source/meson.build +++ b/source/meson.build @@ -1,11 +1,65 @@ +# required to build both the game and the shared library, but not +# the editor or viewer shared_lib_game_deps = [] -shared_lib_game_common = ['libcurl'] +shared_lib_game_common = [ + 'libcurl', + 'ftgl', + 'lua', + 'openal', +] foreach dep : shared_lib_game_common shared_lib_game_deps += dependency(dep) endforeach +# This will get changed to 5.3 +lua_dep = dependency('lua-5.3', required: true) +if not lua_dep.found() + lua_dep = cc.find_library('lua', has_headers: 'lua.h', required: true) + # if not lua_dep.found() + # # This will use the fallback + # lua_dep = dependency( + # 'lua-5.3', + # required: true, + # fallback: 'lua', + # default_options: ['default_library=static'] + # ) + # endif +endif + +shared_lib_game_deps += lua_dep + +# required by all +sdl_dep = dependency('sdl2') + +# required by map editor and viewer +wx_dep = dependency( + 'wxwidgets', + version: '>=3.0.0', + modules: ['gl', 'core', 'base'], +) + +# streflop +# +# By default, meson will look in the repo roots 'subproject' directory # Note +# changing a default options might not be enough to trigger meson to rerun +# setup. In the build directory, you can change the option manually +# Example: meson configure -Dstreflop:fpu=soft (where the value preceding the +# colon is the subproject name) and then rebuild. +streflop_subproj = subproject( + 'streflop', + default_options: ['default_library=static', 'fpu=sse', 'denormals=false'], +) +# TODO: The binaries don't need the dep object, but they do need the includes. +# Get them from the dep object instead of hard-coding them in the three +# binary meson builds. +streflop_dep = streflop_subproj.get_variable('streflop_dep') + +# Only the include paths, not the whole dep object is required to +# build the game +streflop_includes = streflop_dep[0].partial_dependency(includes: true) + subdir('shared_lib') subdir('glest_game') subdir('glest_map_editor') diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index e449bc236..7fbf06bb4 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -123,40 +123,6 @@ foreach file : src_shared_lib_misc src += [join_paths('sources', file)] endforeach -dep_sdl = dependency('sdl2') -dep_openal = dependency('openal') -dep_ftgl = dependency('ftgl') - -# This will get changed to 5.3 -lua_dep = dependency('lua-5.3', required: true) -if not lua_dep.found() - lua_dep = cc.find_library('lua', has_headers: 'lua.h', required: true) - # if not lua_dep.found() - # # This will use the fallback - # lua_dep = dependency( - # 'lua-5.3', - # required: true, - # fallback: 'lua', - # default_options: ['default_library=static'] - # ) - # endif -endif - -# By default, meson will look in the repo roots 'subproject' directory # Note -# changing a default options might not be enough to trigger meson to rerun -# setup. In the build directory, you can change the option manually -# Example: meson configure -Dstreflop:fpu=soft (where the value preceding the -# colon is the subproject name) and then rebuild. -streflop_subproj = subproject( - 'streflop', - default_options: ['default_library=static', 'fpu=sse', 'no_denormals=true'], -) -# TODO: The binaries don't need the dep object, but they do need the includes. -# Get them from the dep object instead of hard-coding them in the three -# binary meson builds. -streflop_dep = streflop_subproj.get_variable('streflop_dep') -streflop_includes = streflop_dep.partial_dependency(includes: true) - inc_miniupnpc = ['include/platform/miniupnpc'] dep_miniupnpc = [] dep_miniupnpc = dependency('miniupnpc') @@ -203,17 +169,15 @@ lib_megaglest = static_library( dependencies: [ streflop_dep, shared_lib_game_deps, - lua_dep, - dep_sdl, - dep_openal, dep_feathery_ftp, dep_miniupnpc, - dep_ftgl, + sdl_dep, ], pic: true, + cpp_args: ['-DUSE_STREFLOP','-DSTREFLOP_SSE'], ) dep_libmegaglest = declare_dependency( link_with: lib_megaglest, - dependencies: streflop_includes, + dependencies: [streflop_includes], ) From 9b97dd9a0e332e22a267ed2f5c61fc886a416697 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 13 Feb 2025 00:58:39 -0600 Subject: [PATCH 41/48] Fix freeze and crash when starting network game Although probably better to find what's causing the problem, rather than undefining the macro https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html _GLIBCXX_ASSERTIONS Defined by default when compiling with no optimization, undefined by default when compiling with optimization. When defined, enables extra error checking in the form of precondition assertions, such as bounds checking in strings and null pointer checks when dereferencing smart pointers. --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 78db3993f..dc8f6c5b6 100644 --- a/meson.build +++ b/meson.build @@ -20,6 +20,7 @@ extra_flags = [ '-Werror=lto-type-mismatch', # '-Werror=strict-aliasing', '-DUSE_FTGL', + '-U_GLIBCXX_ASSERTIONS', ] add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') From 2594fc3dcd75968929373b103a4be60467b38c1d Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 13 Feb 2025 00:58:57 -0600 Subject: [PATCH 42/48] Various unremarkable changes --- meson.build | 14 +++++++++++++- source/glest_game/meson.build | 4 +--- source/meson.build | 3 ++- .../sources/feathery_ftp/meson.build | 1 - subprojects/lua.wrap | 19 +++++++++++-------- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/meson.build b/meson.build index dc8f6c5b6..ef9eddae7 100644 --- a/meson.build +++ b/meson.build @@ -4,7 +4,7 @@ project( version: '3.13.0.999', meson_version: '>= 0.55.0', default_options: [ - 'warning_level=0', + 'warning_level=1', 'buildtype=debugoptimized', 'cpp_std=c++11', ], @@ -18,8 +18,20 @@ extra_flags = [ '-fno-common', '-Werror=odr', '-Werror=lto-type-mismatch', + '-fno-strict-aliasing', # '-Werror=strict-aliasing', '-DUSE_FTGL', + '-DX11_AVAILABLE', + '-DHAVE_SYS_IOCTL_H', + '-DHAVE_FRIBIDI', + # '-DHAVE_FONTCONFIG' This didn't fix the freezing issue + '-DUSE_STREFLOP', + '-DSTREFLOP_SSE', + '-DSTREFLOP_RANDOM_GEN_SIZE=32', + '-DNDEBUG', + '-DHAS_GCC_BACKTRACE', + '-msse', + '-mfpmath=sse', '-U_GLIBCXX_ASSERTIONS', ] diff --git a/source/glest_game/meson.build b/source/glest_game/meson.build index 8610897e9..e039390c2 100644 --- a/source/glest_game/meson.build +++ b/source/glest_game/meson.build @@ -164,7 +164,6 @@ foreach dir : inc_common endforeach dep_cppunit = dependency('cppunit') -dep_fribidi = dependency('fribidi') dep_glib = dependency('glib-2.0') dep_pthread = dependency('threads') dep_gl = dependency('gl') @@ -182,11 +181,10 @@ executable( include_directories: [inc_ircclient, inc_game, inc_shared_lib], dependencies: [ dep_libmegaglest, - lua_dep.partial_dependency(compile_args: true), + lua_dep, shared_lib_game_deps, ircclient_dep, dep_cppunit, - dep_fribidi, dep_glib, dep_pthread, sdl_dep, diff --git a/source/meson.build b/source/meson.build index 0a1f0f51d..fbaee483c 100644 --- a/source/meson.build +++ b/source/meson.build @@ -7,6 +7,7 @@ shared_lib_game_common = [ 'ftgl', 'lua', 'openal', + 'fribidi', ] foreach dep : shared_lib_game_common @@ -14,7 +15,7 @@ foreach dep : shared_lib_game_common endforeach # This will get changed to 5.3 -lua_dep = dependency('lua-5.3', required: true) +lua_dep = dependency('lua', required: false) if not lua_dep.found() lua_dep = cc.find_library('lua', has_headers: 'lua.h', required: true) # if not lua_dep.found() diff --git a/source/shared_lib/sources/feathery_ftp/meson.build b/source/shared_lib/sources/feathery_ftp/meson.build index 119eb5dea..8dcc6b228 100644 --- a/source/shared_lib/sources/feathery_ftp/meson.build +++ b/source/shared_lib/sources/feathery_ftp/meson.build @@ -20,7 +20,6 @@ lib_featheryftp = static_library( # dep_curl, # dep_sdl, dep_x11, dep_openal, dep_lua, # dep_cppunit, - # dep_fribidi, # dep_glib # ] ) diff --git a/subprojects/lua.wrap b/subprojects/lua.wrap index 8d13d5656..97495984b 100644 --- a/subprojects/lua.wrap +++ b/subprojects/lua.wrap @@ -1,11 +1,14 @@ [wrap-file] -directory = lua-5.1.5 -source_url = https://www.lua.org/ftp/lua-5.1.5.tar.gz -source_filename = lua-5.1.5.tar.gz -source_hash = 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333 -patch_directory = lua -method = meson +directory = lua-5.4.6 +source_url = https://www.lua.org/ftp/lua-5.4.6.tar.gz +source_filename = lua-5.4.6.tar.gz +source_hash = 7d5ea1b9cb6aa0b59ca3dde1c6adcb57ef83a1ba8e5432c0ecd06bf439b3ad88 +patch_filename = lua_5.4.6-5_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/lua_5.4.6-5/get_patch +patch_hash = 755ec591b6b4739650ba6bb11b4feca2d221ab7f80f024dd625f50c8932ad76f +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/lua_5.4.6-5/lua-5.4.6.tar.gz +wrapdb_version = 5.4.6-5 [provide] -lua-5.1 = lua_dep - +lua-5.4 = lua_dep +lua = lua_dep From 5da28538aa42e1a9338ffdb6fb09483aa4d7a569 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 13 Feb 2025 01:24:55 -0600 Subject: [PATCH 43/48] For macos lua dep, don't specify 5.3 (which has been disabled) --- mk/macos/setupBuildDeps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/macos/setupBuildDeps.sh b/mk/macos/setupBuildDeps.sh index 2db345038..825cd6545 100755 --- a/mk/macos/setupBuildDeps.sh +++ b/mk/macos/setupBuildDeps.sh @@ -13,7 +13,7 @@ brew install cmake \ libogg \ libpng \ libvorbis \ - lua@5.3 \ + lua \ meson \ miniupnpc \ pkg-config \ From 51b3be6b05a1632892791275f9b7ec34831753df Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 13 Feb 2025 01:37:18 -0600 Subject: [PATCH 44/48] Use newer Ubuntu --- .github/workflows/meson.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 276253034..c54249b10 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -19,7 +19,7 @@ on: jobs: meson: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Get dependencies From 7ea9ba5d6eab50ec62a5fc4177634608228ff0ed Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 13 Feb 2025 01:41:30 -0600 Subject: [PATCH 45/48] undefine a couple macros --- meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/meson.build b/meson.build index ef9eddae7..50b5e7d36 100644 --- a/meson.build +++ b/meson.build @@ -28,8 +28,6 @@ extra_flags = [ '-DUSE_STREFLOP', '-DSTREFLOP_SSE', '-DSTREFLOP_RANDOM_GEN_SIZE=32', - '-DNDEBUG', - '-DHAS_GCC_BACKTRACE', '-msse', '-mfpmath=sse', '-U_GLIBCXX_ASSERTIONS', From a9c57e6c6ce6efe1bcdadfa3e593ebec399c890e Mon Sep 17 00:00:00 2001 From: andy5995 Date: Thu, 13 Feb 2025 13:43:29 -0600 Subject: [PATCH 46/48] Add '-ng' to streflop stuff --- source/meson.build | 4 ++-- subprojects/streflop-ng.wrap | 9 +++++++++ subprojects/streflop.wrap | 13 ------------- 3 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 subprojects/streflop-ng.wrap delete mode 100644 subprojects/streflop.wrap diff --git a/source/meson.build b/source/meson.build index fbaee483c..769aa2cfe 100644 --- a/source/meson.build +++ b/source/meson.build @@ -49,7 +49,7 @@ wx_dep = dependency( # Example: meson configure -Dstreflop:fpu=soft (where the value preceding the # colon is the subproject name) and then rebuild. streflop_subproj = subproject( - 'streflop', + 'streflop-ng', default_options: ['default_library=static', 'fpu=sse', 'denormals=false'], ) # TODO: The binaries don't need the dep object, but they do need the includes. @@ -59,7 +59,7 @@ streflop_dep = streflop_subproj.get_variable('streflop_dep') # Only the include paths, not the whole dep object is required to # build the game -streflop_includes = streflop_dep[0].partial_dependency(includes: true) +streflop_includes = streflop_dep.partial_dependency(includes: true) subdir('shared_lib') subdir('glest_game') diff --git a/subprojects/streflop-ng.wrap b/subprojects/streflop-ng.wrap new file mode 100644 index 000000000..7a4e26327 --- /dev/null +++ b/subprojects/streflop-ng.wrap @@ -0,0 +1,9 @@ +[wrap-git] +directory = streflop-ng +url = https://github.com/andy5995/streflop-ng +revision = add-meson + +[provide] +streflop-ng = streflop_dep +streflop = streflop_dep + diff --git a/subprojects/streflop.wrap b/subprojects/streflop.wrap deleted file mode 100644 index d3e6ef0f2..000000000 --- a/subprojects/streflop.wrap +++ /dev/null @@ -1,13 +0,0 @@ -[wrap-git] -directory = streflop-0.3 -url = https://github.com/andy5995/streflop -revision = add-meson -#source_url = https://nicolas.brodu.net/common/programmation/streflop/streflop-0.3.tar.bz2 -#source_filename = streflop-0.3.tar.bz2 -#source_hash = 53642f71be5df5d8d2b766a77cd48d537e02fb366f09f902473818e9f8cd3817 -#patch_directory = streflop-ng -#method = meson - -[provide] -streflop = streflop_dep - From ccc0dbf3ac058bfe6eb6247bc9f054f80ba0d8cf Mon Sep 17 00:00:00 2001 From: andy5995 Date: Fri, 14 Feb 2025 00:22:50 -0600 Subject: [PATCH 47/48] Add b_ndebug to default build This is related to 9b97dd9a0e332e22a267ed2f5c61fc886a416697 --- meson.build | 1 - mk/test-meson-build.sh | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 50b5e7d36..26d7ca363 100644 --- a/meson.build +++ b/meson.build @@ -30,7 +30,6 @@ extra_flags = [ '-DSTREFLOP_RANDOM_GEN_SIZE=32', '-msse', '-mfpmath=sse', - '-U_GLIBCXX_ASSERTIONS', ] add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') diff --git a/mk/test-meson-build.sh b/mk/test-meson-build.sh index 534d60ce9..e861d493e 100755 --- a/mk/test-meson-build.sh +++ b/mk/test-meson-build.sh @@ -12,11 +12,16 @@ BUILD_DIR="${BUILD_DIR:-$HERE/_build}" # Detect OS type OS_TYPE="$(uname -s)" +SETUP_OPTS="${BUILD_DIR} -Db_ndebug=true ${@}" +# -Db_ndebug=true | Disable assertions. +# Normally meson will add _GLIBCXX_ASSERTIONS to the build flags. When that's +# added, multiplayer network games will crash after starting. + cd "$SOURCE_ROOT" if [ ! -d "$BUILD_DIR" ]; then - meson setup "$BUILD_DIR" "$@" + meson setup ${SETUP_OPTS} else - meson setup --reconfigure "$BUILD_DIR" "$@" + meson setup --reconfigure "$SETUP_OPTS" fi cd "$HERE" From dc6059041906002ab5456ff79c3278b3a05877f5 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Fri, 14 Feb 2025 00:29:24 -0600 Subject: [PATCH 48/48] Initial implementation of config_whole for macros --- meson.build | 16 +++++++++----- source/meson.build | 5 +++++ source/shared_lib/include/graphics/font.h | 1 + .../include/graphics/gl/font_textFTGL.h | 2 ++ .../include/platform/common/math_wrapper.h | 2 ++ .../include/platform/sdl/platform_main.h | 2 ++ source/shared_lib/meson.build | 22 ++++++++++++++++++- .../sources/graphics/gl/font_textFTGL.cpp | 2 ++ .../sources/platform/posix/socket.cpp | 3 ++- 9 files changed, 48 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 26d7ca363..0039a609f 100644 --- a/meson.build +++ b/meson.build @@ -20,19 +20,25 @@ extra_flags = [ '-Werror=lto-type-mismatch', '-fno-strict-aliasing', # '-Werror=strict-aliasing', - '-DUSE_FTGL', - '-DX11_AVAILABLE', '-DHAVE_SYS_IOCTL_H', - '-DHAVE_FRIBIDI', - # '-DHAVE_FONTCONFIG' This didn't fix the freezing issue - '-DUSE_STREFLOP', '-DSTREFLOP_SSE', '-DSTREFLOP_RANDOM_GEN_SIZE=32', '-msse', '-mfpmath=sse', ] +# Defined in cmake but I didn't find references in the source code +# '-DX11_AVAILABLE' +# -DHAVE_FONTCONFIG' + add_project_arguments(cc.get_supported_arguments(extra_flags), language: 'c') add_project_arguments(cxx.get_supported_arguments(extra_flags), language: 'cpp') +# Macros can be written to config.h (see below) using conf.set() +conf = configuration_data() + subdir('source') + +# The config.h file finally is output here, all the data assigned by +# conf.set() will be written to it. +config_h = configure_file(output : 'config_whole.h', configuration : conf) diff --git a/source/meson.build b/source/meson.build index 769aa2cfe..ac7417116 100644 --- a/source/meson.build +++ b/source/meson.build @@ -14,6 +14,10 @@ foreach dep : shared_lib_game_common shared_lib_game_deps += dependency(dep) endforeach +conf.set('USE_FTGL', 1) +# will output '#define USE_FTGL 1' to config.h +conf.set('HAVE_FRIBIDI', 1) + # This will get changed to 5.3 lua_dep = dependency('lua', required: false) if not lua_dep.found() @@ -60,6 +64,7 @@ streflop_dep = streflop_subproj.get_variable('streflop_dep') # Only the include paths, not the whole dep object is required to # build the game streflop_includes = streflop_dep.partial_dependency(includes: true) +conf.set('USE_STREFLOP', 1) subdir('shared_lib') subdir('glest_game') diff --git a/source/shared_lib/include/graphics/font.h b/source/shared_lib/include/graphics/font.h index c76a9896f..6f32b3ab3 100644 --- a/source/shared_lib/include/graphics/font.h +++ b/source/shared_lib/include/graphics/font.h @@ -14,6 +14,7 @@ #include #include +#include "config_whole.h" #include "font_text.h" #include "leak_dumper.h" diff --git a/source/shared_lib/include/graphics/gl/font_textFTGL.h b/source/shared_lib/include/graphics/gl/font_textFTGL.h index 99a265d16..5973a203a 100644 --- a/source/shared_lib/include/graphics/gl/font_textFTGL.h +++ b/source/shared_lib/include/graphics/gl/font_textFTGL.h @@ -12,6 +12,8 @@ #ifndef TextFTGL_h #define TextFTGL_h +#include "config_whole.h" + #ifdef USE_FTGL #include diff --git a/source/shared_lib/include/platform/common/math_wrapper.h b/source/shared_lib/include/platform/common/math_wrapper.h index d2bade288..babbcc364 100644 --- a/source/shared_lib/include/platform/common/math_wrapper.h +++ b/source/shared_lib/include/platform/common/math_wrapper.h @@ -12,6 +12,8 @@ #ifndef _SHARED_PLATFORMCOMMON_MATHWRAPPER_H_ #define _SHARED_PLATFORMCOMMON_MATHWRAPPER_H_ +#include "config_whole.h" + #ifdef USE_STREFLOP // #include diff --git a/source/shared_lib/include/platform/sdl/platform_main.h b/source/shared_lib/include/platform/sdl/platform_main.h index 5125bdb0d..396df7a9e 100644 --- a/source/shared_lib/include/platform/sdl/platform_main.h +++ b/source/shared_lib/include/platform/sdl/platform_main.h @@ -14,6 +14,8 @@ #include #include #include + +#include "config_whole.h" #include "leak_dumper.h" #ifndef WIN32 diff --git a/source/shared_lib/meson.build b/source/shared_lib/meson.build index 7fbf06bb4..7687f7cb4 100644 --- a/source/shared_lib/meson.build +++ b/source/shared_lib/meson.build @@ -158,10 +158,29 @@ foreach file : inc_shared_lib_misc_basename inc_shared_lib_misc += [join_paths('include', file)] endforeach +# Note on includes +# +# You should not do that but use relative paths instead, for +# directories that are part of your project. +# +# To get include path to any directory relative to the current dir do +# +# incdir = include_directories(dirname) +# +# After this incdir will contain both the current source dir as well as the +# corresponding build dir. It can then be used in any subdirectory and +# Meson will take care of all the busywork to make paths work. +# +# Dirname can even be '.' to mark the current directory. Though you should +# remember that the current source and build directories are always +# put in the include directories by default so you only need to do +# include_directories('.') if you intend to use the result in a +# different subdirectory. lib_megaglest = static_library( 'megaglest', src, include_directories: [ + include_directories('../..'), # for config.h inc_shared_lib_misc, 'sources', # for miniz inc_miniupnpc, @@ -174,10 +193,11 @@ lib_megaglest = static_library( sdl_dep, ], pic: true, - cpp_args: ['-DUSE_STREFLOP','-DSTREFLOP_SSE'], + cpp_args: ['-DSTREFLOP_SSE'], ) dep_libmegaglest = declare_dependency( link_with: lib_megaglest, dependencies: [streflop_includes], + include_directories: include_directories('../..'), # for config.h ) diff --git a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp index df2d8f4ee..2afefc2ea 100644 --- a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp +++ b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp @@ -9,6 +9,8 @@ // License, or (at your option) any later version // ============================================================== +#include "config_whole.h" + #ifdef USE_FTGL //#include "gettext.h" diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index bcb3b358c..711ebf815 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -6,6 +6,7 @@ //Foundation; either version 2 of the License, or (at your option) any later //version. +#include "config_whole.h" #include "socket.h" #include @@ -1385,7 +1386,7 @@ int Socket::send(const void *data, int dataSize) { int totalBytesSent = bytesSent; int attemptCount = 0; - + time_t tStartTimer = time(NULL); while(((bytesSent > 0 && totalBytesSent < dataSize) || (bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN)) &&