mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-05 18:10:09 +03:00
Use Host ZLib In CMake Builds
The vendored ZLib is still in the repo for VS builds.
This commit is contained in:
committed by
iProgramInCpp
parent
fdf3106d7e
commit
e9ddb5ab61
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install --no-install-recommends -y build-essential cmake ninja-build libopenal-dev libsdl2-dev
|
sudo apt-get install --no-install-recommends -y build-essential cmake ninja-build libopenal-dev libsdl2-dev libpng-dev zlib1g-dev
|
||||||
- name: Build Desktop
|
- name: Build Desktop
|
||||||
run: |
|
run: |
|
||||||
cd platforms/sdl
|
cd platforms/sdl
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ project(reminecraftpe-sdl)
|
|||||||
|
|
||||||
# SDL Build
|
# SDL Build
|
||||||
add_compile_definitions(USE_SDL USE_OPENAL HANDLE_CHARS_SEPARATELY)
|
add_compile_definitions(USE_SDL USE_OPENAL HANDLE_CHARS_SEPARATELY)
|
||||||
set(USE_SDL 1)
|
set(USE_SDL TRUE)
|
||||||
|
|
||||||
# WASM
|
# WASM
|
||||||
if(EMSCRIPTEN)
|
if(EMSCRIPTEN)
|
||||||
@@ -64,7 +64,7 @@ endif()
|
|||||||
# LibPNG (If Needed)
|
# LibPNG (If Needed)
|
||||||
if(NOT EMSCRIPTEN)
|
if(NOT EMSCRIPTEN)
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
# Vendor LibPNG
|
# Vendor LibPNG (Android Only)
|
||||||
add_subdirectory(../../thirdparty/LibPNG-src libpng EXCLUDE_FROM_ALL)
|
add_subdirectory(../../thirdparty/LibPNG-src libpng EXCLUDE_FROM_ALL)
|
||||||
target_include_directories(png_static INTERFACE
|
target_include_directories(png_static INTERFACE
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/LibPNG-src>"
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/LibPNG-src>"
|
||||||
@@ -72,6 +72,7 @@ if(NOT EMSCRIPTEN)
|
|||||||
)
|
)
|
||||||
target_link_libraries(reminecraftpe png_static)
|
target_link_libraries(reminecraftpe png_static)
|
||||||
else()
|
else()
|
||||||
|
# System LibPNG
|
||||||
find_package(PNG REQUIRED)
|
find_package(PNG REQUIRED)
|
||||||
target_link_libraries(reminecraftpe PNG::PNG)
|
target_link_libraries(reminecraftpe PNG::PNG)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -269,27 +269,40 @@ add_library(reminecraftpe-core STATIC
|
|||||||
renderer/GL/GL.cpp
|
renderer/GL/GL.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(reminecraftpe-core PUBLIC . .. ../thirdparty/zlib)
|
target_include_directories(reminecraftpe-core PUBLIC . ..)
|
||||||
|
|
||||||
# RakNet
|
# RakNet
|
||||||
add_subdirectory(../thirdparty/raknet raknet)
|
add_subdirectory(../thirdparty/raknet raknet)
|
||||||
target_link_libraries(reminecraftpe-core PUBLIC raknet)
|
target_link_libraries(reminecraftpe-core PUBLIC raknet)
|
||||||
|
|
||||||
# zlib
|
# zlib
|
||||||
add_subdirectory(../thirdparty/zlib zlib)
|
add_library(zlib INTERFACE)
|
||||||
|
if(EMSCRIPTEN)
|
||||||
|
# Use Emscripten's ZLib
|
||||||
|
set(ZLIB_FLAG -sUSE_ZLIB=1)
|
||||||
|
target_compile_options(zlib INTERFACE "${ZLIB_FLAG}")
|
||||||
|
target_link_options(zlib INTERFACE "${ZLIB_FLAG}")
|
||||||
|
else()
|
||||||
|
# Use System ZLib
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
target_link_libraries(zlib INTERFACE ZLIB::ZLIB)
|
||||||
|
endif()
|
||||||
target_link_libraries(reminecraftpe-core PUBLIC zlib)
|
target_link_libraries(reminecraftpe-core PUBLIC zlib)
|
||||||
|
|
||||||
# SDL
|
# SDL
|
||||||
if(USE_SDL)
|
if(USE_SDL)
|
||||||
add_library(SDL INTERFACE)
|
add_library(SDL INTERFACE)
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
|
# Use Vendored SDL2 (Only For Android)
|
||||||
add_subdirectory(../thirdparty/SDL-src SDL EXCLUDE_FROM_ALL)
|
add_subdirectory(../thirdparty/SDL-src SDL EXCLUDE_FROM_ALL)
|
||||||
target_link_libraries(SDL INTERFACE SDL2::SDL2)
|
target_link_libraries(SDL INTERFACE SDL2::SDL2)
|
||||||
elseif(EMSCRIPTEN)
|
elseif(EMSCRIPTEN)
|
||||||
|
# Use Emscripten's SDL2
|
||||||
set(SDL_FLAG -sUSE_SDL=2)
|
set(SDL_FLAG -sUSE_SDL=2)
|
||||||
target_compile_options(SDL INTERFACE "${SDL_FLAG}")
|
target_compile_options(SDL INTERFACE "${SDL_FLAG}")
|
||||||
target_link_options(SDL INTERFACE "${SDL_FLAG}")
|
target_link_options(SDL INTERFACE "${SDL_FLAG}")
|
||||||
else()
|
else()
|
||||||
|
# Use System SDL2
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
target_link_libraries(SDL INTERFACE SDL2::SDL2)
|
target_link_libraries(SDL INTERFACE SDL2::SDL2)
|
||||||
endif()
|
endif()
|
||||||
@@ -310,9 +323,6 @@ if(USE_SDL)
|
|||||||
if(EMSCRIPTEN)
|
if(EMSCRIPTEN)
|
||||||
target_link_options(reminecraftpe-core PUBLIC -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2)
|
target_link_options(reminecraftpe-core PUBLIC -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2)
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
target_link_libraries(reminecraftpe-core PUBLIC OpenGL::OpenGL OpenGL::GLU)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user