Skip to content

Commit

Permalink
Add Meson Build System to CMaNGOS Classic
Browse files Browse the repository at this point in the history
  • Loading branch information
insunaa committed Aug 13, 2023
1 parent d2d6631 commit 2b26694
Show file tree
Hide file tree
Showing 29 changed files with 1,191 additions and 0 deletions.
18 changes: 18 additions & 0 deletions contrib/extractor/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ad_sources = [
'loadlib/loadlib.cpp',
'loadlib/adt.cpp',
'loadlib/wdt.cpp',
'dbcfile.cpp',
'mpq_libmpq.cpp',
'System.cpp',
]

executable('ad',
ad_sources,
link_with: [lib_libmpq],
include_directories: global_includes,
dependencies: [boost_dep, zlib_dep],
link_args: _linker_args,
install_dir: 'bin/tools',
install: true
)
3 changes: 3 additions & 0 deletions contrib/git_id/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
executable('git_id',
'git_id.cpp',
)
58 changes: 58 additions & 0 deletions contrib/mmap/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
movemapgen_args = ''
movemapgen_args = [movemapgen_args, '-DMMAP_GENERATOR', '-DNO_CORE_FUNCS', '-DNO_vsnprintf', '-DDT_POLYREF64']
movemapgen_sources = [
'src/generator.cpp',
'src/IntermediateValues.cpp',
'src/MapBuilder.cpp',
'src/TerrainBuilder.cpp',
'src/VMapExtensions.cpp'
]

if build_machine.system() == 'linux'
movemapgen_args = [movemapgen_args, '-ggdb']
endif

vmaplib = static_library('vmaplib',
[
'../../src/game/vmap/BIH.cpp',
'../../src/game/vmap/VMapManager2.cpp',
'../../src/game/vmap/MapTree.cpp',
'../../src/game/vmap/TileAssembler.cpp',
'../../src/game/vmap/WorldModel.cpp',
'../../src/game/vmap/ModelInstance.cpp'
],
include_directories: global_includes,
dependencies: [zlib_dep, boost_dep],
cpp_args: movemapgen_args,
link_with: [g3dlib, detourlib, recastlib, frameworklib, sharedlib],
install : false
)

mmaplib = static_library('mmaplib',
['src/generator.cpp', 'src/IntermediateValues.cpp', 'src/MapBuilder.cpp', 'src/TerrainBuilder.cpp', 'src/VMapExtensions.cpp'],
include_directories: global_includes,
dependencies: [zlib_dep, boost_dep],
cpp_args: movemapgen_args,
link_with: [vmaplib, detourlib, recastlib, g3dlib, frameworklib],
install: false
)

if get_option('BUILD_EXTRACTORS')
if build_machine.system() == 'linux'
local_linker = [_linker_args, '-rdynamic']
endif
executable('MoveMapGen',
movemapgen_sources,
link_with: [vmaplib, detourlib, recastlib, mmaplib],
include_directories: global_includes,
dependencies: [boost_dep, zlib_dep],
cpp_args: movemapgen_args,
link_args: _linker_args,
install_dir: 'bin/tools',
install: true
)
install_data(movemapgen_script_file, install_dir: 'bin/tools')
install_data(offmesh_file, install_dir: 'bin/tools')
install_data(config_json_file, install_dir: 'bin/tools')
endif

31 changes: 31 additions & 0 deletions contrib/vmap_assembler/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
assembler_args = ''
if get_option('DEBUG')
assembler_args = [assembler_args, '-DIOMAP_DEBUG']
endif

assembler_args = [assembler_args, '-DNO_CORE_FUNCS']

if build_machine.system() == 'linux'
assembler_args = [assembler_args, '-ggdb']
endif

vmap_assembler_sources = [
'../../src/game/vmap/BIH.cpp',
'../../src/game/vmap/VMapManager2.cpp',
'../../src/game/vmap/MapTree.cpp',
'../../src/game/vmap/TileAssembler.cpp',
'../../src/game/vmap/WorldModel.cpp',
'../../src/game/vmap/ModelInstance.cpp',
'vmap_assembler.cpp'
]

executable('vmap_assembler',
vmap_assembler_sources,
link_with: [sharedlib, g3dlib, frameworklib],
include_directories: global_includes,
dependencies: [boost_dep, zlib_dep],
cpp_args: assembler_args,
link_args: _linker_args,
install_dir: 'bin/tools',
install: true
)
7 changes: 7 additions & 0 deletions contrib/vmap_extractor/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
vmap_extractor_args = ['-DIOMAP_DEBUG', '-DUSE_LIBMPQ04']

if build_machine.system() == 'linux'
vmap_extractor_args = [vmap_extractor_args, '-ggdb']
endif

subdir('vmapextract')
20 changes: 20 additions & 0 deletions contrib/vmap_extractor/vmapextract/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
vmap_extractor_sources = [
'adtfile.cpp',
'dbcfile.cpp',
'gameobject_extract.cpp',
'model.cpp',
'mpq_libmpq.cpp',
'vmapexport.cpp',
'wdtfile.cpp',
'wmo.cpp'
]

executable('vmap_extractor',
vmap_extractor_sources,
include_directories: global_includes,
link_with: [g3dlib, lib_libmpq, detourlib, recastlib],
link_args: _linker_args,
install_dir: 'bin/tools',
install: true
)
install_data(extractor_script_file, install_dir: 'bin/tools')
52 changes: 52 additions & 0 deletions dep/g3dlite/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
g3d_sources = [
'AABox.cpp',
'Any.cpp',
'BinaryFormat.cpp',
'BinaryInput.cpp',
'BinaryOutput.cpp',
'Box.cpp',
'Capsule.cpp',
'CollisionDetection.cpp',
'CoordinateFrame.cpp',
'Crypto.cpp',
'Cylinder.cpp',
'FileSystem.cpp',
'Line.cpp',
'LineSegment.cpp',
'Log.cpp',
'Matrix3.cpp',
'Matrix4.cpp',
'MemoryManager.cpp',
'PhysicsFrame.cpp',
'Plane.cpp',
'Quat.cpp',
'Random.cpp',
'Ray.cpp',
'ReferenceCount.cpp',
'RegistryUtil.cpp',
'Sphere.cpp',
'System.cpp',
'TextInput.cpp',
'TextOutput.cpp',
'Triangle.cpp',
'UprightFrame.cpp',
'Vector2.cpp',
'Vector3.cpp',
'Vector4.cpp',
'debugAssert.cpp',
'fileutils.cpp',
'format.cpp',
'g3dfnmatch.cpp',
'g3dmath.cpp',
'prompt.cpp',
'stringutils.cpp',
'uint128.cpp'
]

g3d_inc = include_directories('G3D', '../include')

g3dlib = static_library('g3dlite',
g3d_sources,
include_directories: g3d_inc,
dependencies: zlib_dep,
install : false)
34 changes: 34 additions & 0 deletions dep/libmpq/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
libmpq_sources = [
'config.h',
'libmpq/common.c',
'libmpq/common.h',
'libmpq/crypt_buf.h',
'libmpq/explode.c',
'libmpq/explode.h',
'libmpq/extract.c',
'libmpq/huffman.c',
'libmpq/huffman.h',
'libmpq/mpq-internal.h',
'libmpq/mpq.c',
'libmpq/mpq.h',
'libmpq/pack_begin.h',
'libmpq/pack_end.h',
'libmpq/platform.h',
'libmpq/wave.c',
'libmpq/wave.h'
]

libmpq_inc_dir = ['.']

if meson.get_compiler('cpp').get_id() == 'msvc'
libmpq_inc_dir = [libmpq_inc_dir, 'win']
endif

libmpq_inc = include_directories(libmpq_inc_dir)

lib_libmpq = static_library('libmpq',
libmpq_sources,
include_directories: libmpq_inc,
dependencies: [zlib_dep, bzip2_dep],
install : false
)
8 changes: 8 additions & 0 deletions dep/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if get_option('BUILD_GAME_SERVER') or get_option('BUILD_LOGIN_SERVER') or get_option('BUILD_EXTRACTORS')
subdir('recastnavigation')
subdir('src')
subdir('g3dlite')
if get_option('BUILD_EXTRACTORS')
subdir('libmpq')
endif
endif
26 changes: 26 additions & 0 deletions dep/recastnavigation/Detour/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
detour_sources = [
'Source/DetourAlloc.cpp',
'Source/DetourAssert.cpp',
'Source/DetourCommon.cpp',
'Source/DetourNavMesh.cpp',
'Source/DetourNavMeshBuilder.cpp',
'Source/DetourNavMeshQuery.cpp',
'Source/DetourNode.cpp',
'Include/DetourAlloc.h',
'Include/DetourAssert.h',
'Include/DetourCommon.h',
'Include/DetourMath.h',
'Include/DetourNavMesh.h',
'Include/DetourNavMeshBuilder.h',
'Include/DetourNavMeshQuery.h',
'Include/DetourNode.h',
'Include/DetourStatus.h'
]

detour_inc = include_directories('Include')

detourlib = static_library('Detour',
detour_sources,
include_directories: detour_inc,
cpp_args: recastnav_args,
install : false)
23 changes: 23 additions & 0 deletions dep/recastnavigation/Recast/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
recast_sources = [
'Source/Recast.cpp',
'Source/RecastAlloc.cpp',
'Source/RecastArea.cpp',
'Source/RecastAssert.cpp',
'Source/RecastContour.cpp',
'Source/RecastFilter.cpp',
'Source/RecastLayers.cpp',
'Source/RecastMesh.cpp',
'Source/RecastMeshDetail.cpp',
'Source/RecastRasterization.cpp',
'Source/RecastRegion.cpp',
'Include/Recast.h',
'Include/RecastAlloc.h',
'Include/RecastAssert.h'
]

recastlib = static_library('recast',
recast_sources,
include_directories: include_directories('Include'),
cpp_args: recastnav_args,
install : false
)
14 changes: 14 additions & 0 deletions dep/recastnavigation/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
if get_option('BUILD_GAME_SERVER') or get_option('BUILD_EXTRACTORS') or get_option('BUILD_RECASTDEMOMOD')
recastnav_args = '-DDT_POLYREF64'
subdir('Detour')
endif

if get_option('BUILD_EXTRACTORS') or get_option('BUILD_RECASTDEMOMOD')
subdir('Recast')
endif

if get_option('BUILD_RECASTDEMOMOD')
subdir('DetourCrowd')
subdir('DetourTileCache')
subdir('DebugUtils')
endif
21 changes: 21 additions & 0 deletions dep/src/bzip2/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
bzip2_sources = [
'compress.c',
'crctable.c',
'decompress.c',
'huffman.c',
'randtable.c',
'blocksort.c',
'bzlib.c'
]

bz2_inc = include_directories('.')

bz2lib = static_library('bzip2',
bzip2_sources,
include_directories: [global_includes, bz2_inc],
install : false)

bzip2_dep = declare_dependency(
include_directories: bz2_inc,
link_with: bz2lib
)
6 changes: 6 additions & 0 deletions dep/src/gsoap/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gsoap_sources = ['stdsoap2.cpp']

gsoaplib = static_library('gsoap',
gsoap_sources,
include_directories: global_includes,
install : false)
7 changes: 7 additions & 0 deletions dep/src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
subdir('gsoap')
if get_option('BUILD_EXTRACTORS')
bzip2_dep = dependency('bzip2', required: false)
if not bzip2_dep.found()
subdir('bzip2')
endif
endif
12 changes: 12 additions & 0 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
doxygen = find_program('doxygen', required : false)
if doxygen.found()
doxy_file = configure_file(
configuration: {'PACKAGE': meson.project_name(), 'VERSION': meson.project_version(), 'TOPSRCDIR': meson.source_root(), 'DESTDIR': meson.build_root() + '/doc/docs'},
input: 'Doxyfile.dist',
output: 'Doxyfile'
)
run_command([doxygen, meson.build_root() + '/doc/Doxyfile'], check: false)
install_subdir(meson.build_root() + '/doc/docs/html', install_dir: 'docs')
else
warning('Documentation disabled without doxygen')
endif
Loading

0 comments on commit 2b26694

Please sign in to comment.