Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
@@ -6,7 +6,6 @@ include(cmake/CPM.cmake)
|
|||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.10)
|
set(CMAKE_POLICY_VERSION_MINIMUM 3.10)
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
set(CMAKE_CXX_FLAGS "-Wno-c++11-narrowing -Wno-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal")
|
set(CMAKE_CXX_FLAGS "-Wno-c++11-narrowing -Wno-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal")
|
||||||
endif()
|
endif()
|
||||||
@@ -23,26 +22,15 @@ enum_option(PLATFORM "Desktop;Web" "Platform to build for.")
|
|||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
find_package(OpenSSL)
|
find_package(OpenSSL)
|
||||||
|
|
||||||
if (${PLATFORM} STREQUAL "Desktop")
|
if(EMSCRIPTEN)
|
||||||
set(PLATFORM_CPP "PLATFORM_DESKTOP")
|
set(AL_LIBTYPE "STATIC")
|
||||||
|
else()
|
||||||
if (WIN32)
|
set(AL_LIBTYPE "SHARED")
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
||||||
set(EXTRA_LIBS ws2_32)
|
|
||||||
elseif(UNIX)
|
|
||||||
find_library(pthread NAMES pthread)
|
|
||||||
set(EXTRA_LIBS pthread m)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
elseif (${PLATFORM} STREQUAL "Web")
|
|
||||||
set(PLATFORM_CPP "PLATFORM_WEB")
|
|
||||||
set(EXTRA_LIBS "idbfs.js")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# I totally shocked
|
# I totally shocked
|
||||||
if(${PLATFORM} MATCHES "Web")
|
if(EMSCRIPTEN)
|
||||||
set(PNG_LIB png)
|
set(PNG_LIB png)
|
||||||
set(AL_LIBTYPE "STATIC")
|
|
||||||
|
|
||||||
add_library(zlib INTERFACE IMPORTED)
|
add_library(zlib INTERFACE IMPORTED)
|
||||||
set_target_properties(zlib PROPERTIES
|
set_target_properties(zlib PROPERTIES
|
||||||
@@ -60,7 +48,6 @@ if(${PLATFORM} MATCHES "Web")
|
|||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
set(PNG_LIB png_shared)
|
set(PNG_LIB png_shared)
|
||||||
set(AL_LIBTYPE "SHARED")
|
|
||||||
|
|
||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
NAME "zlib"
|
NAME "zlib"
|
||||||
@@ -281,13 +268,23 @@ file(GLOB CLIENT_SOURCES
|
|||||||
"src/SharedConstants.cpp"
|
"src/SharedConstants.cpp"
|
||||||
"src/main.cpp"
|
"src/main.cpp"
|
||||||
"src/NinecraftApp.cpp"
|
"src/NinecraftApp.cpp"
|
||||||
|
|
||||||
"src/AppPlatform_glfw.cpp"
|
|
||||||
"src/main.cpp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (${PLATFORM} STREQUAL "Desktop")
|
if(NOT DEFINED PLATFORM)
|
||||||
list(APPEND CLIENT_SOURCES glad/src/glad.c)
|
set(PLATFORM "PLATFORM_GLFW")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(PLATFORM STREQUAL "PLATFORM_WIN32")
|
||||||
|
list(APPEND CLIENT_SOURCES "src/AppPlatform_win32.cpp" "glad/src/glad.c")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PLATFORM STREQUAL "PLATFORM_GLFW")
|
||||||
|
list(APPEND CLIENT_SOURCES "src/AppPlatform_glfw.cpp" "glad/src/glad.c")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EMSCRIPTEN)
|
||||||
|
list(APPEND CLIENT_SOURCES "glad/src/glad.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Server
|
# Server
|
||||||
@@ -306,7 +303,14 @@ endif()
|
|||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${CLIENT_SOURCES})
|
add_executable(${PROJECT_NAME} ${CLIENT_SOURCES})
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PLATFORM_CPP})
|
if(WIN32)
|
||||||
|
set(EXTRA_LIBS "ws2_32")
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PUBLIC "_CRT_SECURE_NO_WARNINGS")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PLATFORM STREQUAL "PLATFORM_WIN32" OR PLATFORM STREQUAL "PLATFORM_GLFW")
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLATFORM_DESKTOP")
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
"${CMAKE_SOURCE_DIR}/glad/include/"
|
"${CMAKE_SOURCE_DIR}/glad/include/"
|
||||||
@@ -316,7 +320,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
|
|||||||
"lib/include"
|
"lib/include"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${PLATFORM} MATCHES "Web")
|
if(EMSCRIPTEN)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
# uuuh i hate it
|
# uuuh i hate it
|
||||||
set(EM_FLAGS "-pthread -sUSE_PTHREADS=1 -sSHARED_MEMORY=1")
|
set(EM_FLAGS "-pthread -sUSE_PTHREADS=1 -sSHARED_MEMORY=1")
|
||||||
@@ -357,6 +361,7 @@ if(${PLATFORM} MATCHES "Web")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC "__EMSCRIPTEN__" "NO_SOUND" "NO_NETWORK")
|
target_compile_definitions(${PROJECT_NAME} PUBLIC "__EMSCRIPTEN__" "NO_SOUND" "NO_NETWORK")
|
||||||
|
set(EXTRA_LIBS "idbfs.js")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Client
|
# Client
|
||||||
@@ -377,7 +382,7 @@ if (NOT UNIX)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT ${PLATFORM} MATCHES "Web")
|
if(NOT EMSCRIPTEN)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${PROJECT_NAME}
|
TARGET ${PROJECT_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
@@ -390,6 +395,3 @@ else()
|
|||||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/misc/web/index.html" $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/misc/web/index.html" $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Compiling with the flags:")
|
|
||||||
message(STATUS " PLATFORM=" ${PLATFORM_CPP})
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<!-- This is the platform API where NativeActivity was introduced. -->
|
<!-- This is the platform API where NativeActivity was introduced. -->
|
||||||
<uses-sdk android:minSdkVersion="19"
|
<uses-sdk android:minSdkVersion="19"
|
||||||
android:targetSdkVersion="36" />
|
android:targetSdkVersion="30" />
|
||||||
|
|
||||||
<!-- uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="true"/ -->
|
<!-- uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="true"/ -->
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="19"
|
android:minSdkVersion="19"
|
||||||
android:targetSdkVersion="36"/>
|
android:targetSdkVersion="30"/>
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.touchscreen.multitouch"
|
android:name="android.hardware.touchscreen.multitouch"
|
||||||
|
|||||||
Reference in New Issue
Block a user