From 8ac6ddfde26afb50b137d055f9c452b490848f54 Mon Sep 17 00:00:00 2001 From: DankParrot Date: Sat, 1 Aug 2020 20:47:53 -0700 Subject: [PATCH] Add zlib subproject --- .gitmodules | 6 ++++++ meson.build | 45 ++++++++++++++++++++++++++++++++++++++++++++- src/meson.build | 6 +++++- subprojects/zlib | 1 + 4 files changed, 56 insertions(+), 2 deletions(-) create mode 160000 subprojects/zlib diff --git a/.gitmodules b/.gitmodules index 39b7913..832f53a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,9 @@ [submodule "subprojects/rapidjson"] path = subprojects/rapidjson url = https://github.com/Tencent/rapidjson/ +[submodule "subprojects/cNBT"] + path = subprojects/cNBT + url = https://github.com/nickelpro/cNBT +[submodule "subprojects/zlib"] + path = subprojects/zlib + url = https://github.com/madler/zlib.git diff --git a/meson.build b/meson.build index 8c2850c..2b0446a 100644 --- a/meson.build +++ b/meson.build @@ -16,6 +16,24 @@ threads_dep = dependency('threads') cmake = import('cmake') +######################################## +# zlib +######################################## + +zlib_vars = cmake.subproject_options() +zlib_vars.add_cmake_defines({ + 'BUILD_SHARED_LIBS' : false +}) +zlib_vars.set_install(false) + +zlib_proj = cmake.subproject('zlib', options : zlib_vars) +zlib_dep = zlib_proj.dependency('zlibstatic') + + +######################################## +# libevent +######################################## + libevent_vars = cmake.subproject_options() libevent_vars.add_cmake_defines({ 'EVENT__DISABLE_OPENSSL' : true, @@ -33,7 +51,32 @@ libevent_proj = cmake.subproject('libevent', options : libevent_vars) libevent_core_dep = libevent_proj.dependency('event_core_static') libevent_extra_dep = libevent_proj.dependency('event_extra_static') -feather_deps = [ threads_dep, libevent_core_dep, libevent_extra_dep ] +######################################## +# cNBT +######################################## + +# TODO: cNBT + +#cnbt_vars = cmake.subproject_options() +#cnbt_vars.add_cmake_defines({ +# 'CNBT_BUILD_EXAMPLES' : false, +# 'BUILD_SHARED_LIBS' : false, +#}) + +#cnbt_vars.set_install(false) + +#cnbt_proj = cmake.subproject('cNBT', options : cnbt_vars) +#cnbt_dep = cnbt_proj.dependency('nbt') + +######################################## + +feather_deps = [ + threads_dep, + zlib_dep, + libevent_core_dep, + libevent_extra_dep, +# cnbt_dep +] if feather_platform == 'windows' ws2_32_dep = feather_compiler.find_library('ws2_32') diff --git a/src/meson.build b/src/meson.build index d18f819..c5328c7 100644 --- a/src/meson.build +++ b/src/meson.build @@ -22,7 +22,11 @@ subdir('protocol') executable('FeatherMC', feather_src, protocol_headers, dependencies : feather_deps, - include_directories : include_directories('.', '../subprojects/rapidjson/include'), + include_directories : include_directories( + '.', + '../subprojects/rapidjson/include', + '../subprojects' # for zlib and cNBT, which have no include dir + ), install : true, install_dir : meson.source_root() + '/bin', override_options : [ 'cpp_std=' + feather_cpp_std ]) diff --git a/subprojects/zlib b/subprojects/zlib new file mode 160000 index 0000000..cacf7f1 --- /dev/null +++ b/subprojects/zlib @@ -0,0 +1 @@ +Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f