mirror of
https://github.com/celisej567/mcpe.git
synced 2025-12-31 17:49:17 +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
|
||||
run: |
|
||||
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
|
||||
run: |
|
||||
cd platforms/sdl
|
||||
|
||||
@@ -3,7 +3,7 @@ project(reminecraftpe-sdl)
|
||||
|
||||
# SDL Build
|
||||
add_compile_definitions(USE_SDL USE_OPENAL HANDLE_CHARS_SEPARATELY)
|
||||
set(USE_SDL 1)
|
||||
set(USE_SDL TRUE)
|
||||
|
||||
# WASM
|
||||
if(EMSCRIPTEN)
|
||||
@@ -64,7 +64,7 @@ endif()
|
||||
# LibPNG (If Needed)
|
||||
if(NOT EMSCRIPTEN)
|
||||
if(ANDROID)
|
||||
# Vendor LibPNG
|
||||
# Vendor LibPNG (Android Only)
|
||||
add_subdirectory(../../thirdparty/LibPNG-src libpng EXCLUDE_FROM_ALL)
|
||||
target_include_directories(png_static INTERFACE
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/LibPNG-src>"
|
||||
@@ -72,6 +72,7 @@ if(NOT EMSCRIPTEN)
|
||||
)
|
||||
target_link_libraries(reminecraftpe png_static)
|
||||
else()
|
||||
# System LibPNG
|
||||
find_package(PNG REQUIRED)
|
||||
target_link_libraries(reminecraftpe PNG::PNG)
|
||||
endif()
|
||||
|
||||
@@ -269,27 +269,40 @@ add_library(reminecraftpe-core STATIC
|
||||
renderer/GL/GL.cpp
|
||||
)
|
||||
|
||||
target_include_directories(reminecraftpe-core PUBLIC . .. ../thirdparty/zlib)
|
||||
target_include_directories(reminecraftpe-core PUBLIC . ..)
|
||||
|
||||
# RakNet
|
||||
add_subdirectory(../thirdparty/raknet raknet)
|
||||
target_link_libraries(reminecraftpe-core PUBLIC raknet)
|
||||
|
||||
# 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)
|
||||
|
||||
# SDL
|
||||
if(USE_SDL)
|
||||
add_library(SDL INTERFACE)
|
||||
if(ANDROID)
|
||||
# Use Vendored SDL2 (Only For Android)
|
||||
add_subdirectory(../thirdparty/SDL-src SDL EXCLUDE_FROM_ALL)
|
||||
target_link_libraries(SDL INTERFACE SDL2::SDL2)
|
||||
elseif(EMSCRIPTEN)
|
||||
# Use Emscripten's SDL2
|
||||
set(SDL_FLAG -sUSE_SDL=2)
|
||||
target_compile_options(SDL INTERFACE "${SDL_FLAG}")
|
||||
target_link_options(SDL INTERFACE "${SDL_FLAG}")
|
||||
else()
|
||||
# Use System SDL2
|
||||
find_package(SDL2 REQUIRED)
|
||||
target_link_libraries(SDL INTERFACE SDL2::SDL2)
|
||||
endif()
|
||||
@@ -310,9 +323,6 @@ if(USE_SDL)
|
||||
if(EMSCRIPTEN)
|
||||
target_link_options(reminecraftpe-core PUBLIC -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2)
|
||||
endif()
|
||||
else()
|
||||
find_package(OpenGL REQUIRED)
|
||||
target_link_libraries(reminecraftpe-core PUBLIC OpenGL::OpenGL OpenGL::GLU)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user