mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #1034
1034: Try to find external GLEW, pnglite and Wavpack r=Learath2 a=heinrich5991 Allow for newer versions of Wavpack, fixes #1023. Fixes #1016.
This commit is contained in:
commit
c0fa444f3a
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -35,7 +35,7 @@ pack_*/
|
||||||
rules.ninja
|
rules.ninja
|
||||||
testrunner\[1\]_include.cmake
|
testrunner\[1\]_include.cmake
|
||||||
|
|
||||||
src/game/generated
|
generated
|
||||||
|
|
||||||
.cproject
|
.cproject
|
||||||
.project
|
.project
|
||||||
|
|
311
CMakeLists.txt
311
CMakeLists.txt
|
@ -36,7 +36,11 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
|
set(ORIGINAL_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||||
|
set(ORIGINAL_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
|
||||||
|
set(ORIGINAL_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||||
|
set(OWN_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
|
||||||
|
set(CMAKE_MODULE_PATH ${OWN_CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
set(TARGET_BITS "64")
|
set(TARGET_BITS "64")
|
||||||
|
@ -149,8 +153,62 @@ if(NOT MSVC)
|
||||||
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-unused-parameter)
|
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-unused-parameter)
|
||||||
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-missing-field-initializers)
|
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wno-missing-field-initializers)
|
||||||
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wformat=2) # Warn about format strings.
|
add_c_compiler_flag_if_supported(OUR_FLAGS_OWN -Wformat=2) # Warn about format strings.
|
||||||
|
add_c_compiler_flag_if_supported(OUR_FLAGS_DEP -Wno-implicit-function-declaration)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
check_c_compiler_flag("-O2;-Wp,-Werror;-D_FORTIFY_SOURCE=2" DEFINE_FORTIFY_SOURCE) # Some distributions define _FORTIFY_SOURCE by themselves.
|
||||||
|
endif()
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# COMMON FUNCTIONS
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
function(set_glob VAR GLOBBING DIRECTORY) # ...
|
||||||
|
file(${GLOBBING} GLOB_RESULT "${DIRECTORY}/*.c" "${DIRECTORY}/*.cpp" "${DIRECTORY}/*.h")
|
||||||
|
list(SORT GLOB_RESULT)
|
||||||
|
set(FILES)
|
||||||
|
foreach(file ${ARGN})
|
||||||
|
list(APPEND FILES "${PROJECT_SOURCE_DIR}/${DIRECTORY}/${file}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(NOT FILES STREQUAL GLOB_RESULT)
|
||||||
|
message(AUTHOR_WARNING "${VAR} does not contain every file from directory ${DIRECTORY}")
|
||||||
|
set(LIST_BUT_NOT_GLOB)
|
||||||
|
if(POLICY CMP0057)
|
||||||
|
cmake_policy(SET CMP0057 NEW)
|
||||||
|
foreach(file ${FILES})
|
||||||
|
if(NOT file IN_LIST GLOB_RESULT)
|
||||||
|
list(APPEND LIST_BUT_NOT_GLOB ${file})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(LIST_BUT_NOT_GLOB)
|
||||||
|
message(AUTHOR_WARNING "Entries only present in ${VAR}: ${LIST_BUT_NOT_GLOB}")
|
||||||
|
endif()
|
||||||
|
set(GLOB_BUT_NOT_LIST)
|
||||||
|
foreach(file ${GLOB_RESULT})
|
||||||
|
if(NOT file IN_LIST FILES)
|
||||||
|
list(APPEND GLOB_BUT_NOT_LIST ${file})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(GLOB_BUT_NOT_LIST)
|
||||||
|
message(AUTHOR_WARNING "Entries only present in ${DIRECTORY}: ${GLOB_BUT_NOT_LIST}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${VAR} ${FILES} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# INITALIZE TARGET LISTS
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
set(TARGETS_OWN)
|
||||||
|
set(TARGETS_DEP)
|
||||||
|
|
||||||
|
set(TARGETS_LINK) # Targets with a linking stage.
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# DEPENDENCIES
|
# DEPENDENCIES
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -203,11 +261,13 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||||
# quietly.
|
# quietly.
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
endif()
|
endif()
|
||||||
|
find_package(ZLIB)
|
||||||
find_package(Curl)
|
find_package(Curl)
|
||||||
find_package(Freetype)
|
find_package(Freetype)
|
||||||
if(DOWNLOAD_GTEST)
|
if(DOWNLOAD_GTEST)
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
endif()
|
endif()
|
||||||
|
find_package(GLEW)
|
||||||
find_package(GTest)
|
find_package(GTest)
|
||||||
if(MYSQL)
|
if(MYSQL)
|
||||||
find_package(MySQL)
|
find_package(MySQL)
|
||||||
|
@ -217,14 +277,11 @@ endif()
|
||||||
find_package(Ogg)
|
find_package(Ogg)
|
||||||
find_package(Opus)
|
find_package(Opus)
|
||||||
find_package(Opusfile)
|
find_package(Opusfile)
|
||||||
|
find_package(Pnglite)
|
||||||
find_package(PythonInterp)
|
find_package(PythonInterp)
|
||||||
find_package(SDL2)
|
find_package(SDL2)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
if(NOT PREFER_BUNDLED_LIBS)
|
find_package(Wavpack)
|
||||||
find_package(ZLIB)
|
|
||||||
else()
|
|
||||||
set(ZLIB_FOUND NO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET_OS AND TARGET_OS STREQUAL "mac")
|
if(TARGET_OS AND TARGET_OS STREQUAL "mac")
|
||||||
find_program(DMG dmg)
|
find_program(DMG dmg)
|
||||||
|
@ -245,44 +302,42 @@ message(STATUS "Compiler: ${CMAKE_CXX_COMPILER}")
|
||||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
message(STATUS "Dependencies:")
|
message(STATUS "Dependencies:")
|
||||||
function(show_dependency_status NAME FOUND PATH)
|
function(show_dependency_status OUTPUT_NAME NAME)
|
||||||
if(FOUND)
|
if(${NAME}_FOUND)
|
||||||
is_bundled(IS_BUNDLED "${PATH}")
|
if(${NAME}_BUNDLED)
|
||||||
if(IS_BUNDLED)
|
message(STATUS " * ${OUTPUT_NAME} not found (using bundled version)")
|
||||||
message(STATUS " * ${NAME} not found (using bundled version)")
|
|
||||||
else()
|
else()
|
||||||
message(STATUS " * ${NAME} found")
|
message(STATUS " * ${OUTPUT_NAME} found")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS " * ${NAME} not found")
|
message(STATUS " * ${OUTPUT_NAME} not found")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
show_dependency_status("Curl" ${CURL_FOUND} "${CURL_LIBRARY}")
|
show_dependency_status("Curl" CURL)
|
||||||
if(TARGET_OS AND TARGET_OS STREQUAL "mac")
|
if(TARGET_OS AND TARGET_OS STREQUAL "mac")
|
||||||
show_dependency_status("Dmg tools" ${DMGTOOLS_FOUND} "")
|
show_dependency_status("Dmg tools" DMGTOOLS)
|
||||||
endif()
|
endif()
|
||||||
show_dependency_status("Freetype" ${FREETYPE_FOUND} "${FREETYPE_LIBRARY}")
|
show_dependency_status("Freetype" FREETYPE)
|
||||||
if(DOWNLOAD_GTEST)
|
if(DOWNLOAD_GTEST)
|
||||||
show_dependency_status("Git" ${GIT_FOUND} "${GIT_EXECUTABLE}")
|
show_dependency_status("Git" GIT)
|
||||||
endif()
|
endif()
|
||||||
show_dependency_status("GTest" ${GTEST_FOUND} "${GTEST_LIBRARY}")
|
show_dependency_status("Glew" GLEW)
|
||||||
|
show_dependency_status("GTest" GTEST)
|
||||||
if(TARGET_OS AND TARGET_OS STREQUAL "mac")
|
if(TARGET_OS AND TARGET_OS STREQUAL "mac")
|
||||||
show_dependency_status("Hdiutil" ${HDIUTIL} "")
|
show_dependency_status("Hdiutil" HDIUTIL)
|
||||||
endif()
|
endif()
|
||||||
if(MYSQL)
|
if(MYSQL)
|
||||||
show_dependency_status("MySQL" ${MYSQL_FOUND} "${MYSQL_LIBRARY}")
|
show_dependency_status("MySQL" MYSQL)
|
||||||
endif()
|
|
||||||
show_dependency_status("Ogg" ${OGG_FOUND} "${OGG_INCLUDEDIR}")
|
|
||||||
show_dependency_status("Opus" ${OPUS_FOUND} "${OPUS_INCLUDEDIR}")
|
|
||||||
show_dependency_status("Opusfile" ${OPUSFILE_FOUND} "${OPUSFILE_LIBRARY}")
|
|
||||||
show_dependency_status("PythonInterp" ${PYTHONINTERP_FOUND} "")
|
|
||||||
show_dependency_status("SDL2" ${SDL2_FOUND} "${SDL2_LIBRARY}")
|
|
||||||
if(ZLIB_FOUND)
|
|
||||||
message(STATUS " * Zlib found")
|
|
||||||
else()
|
|
||||||
message(STATUS " * Zlib not found (using bundled version)")
|
|
||||||
endif()
|
endif()
|
||||||
|
show_dependency_status("Ogg" OGG)
|
||||||
|
show_dependency_status("Opus" OPUS)
|
||||||
|
show_dependency_status("Opusfile" OPUSFILE)
|
||||||
|
show_dependency_status("Pnglite" PNGLITE)
|
||||||
|
show_dependency_status("PythonInterp" PYTHONINTERP)
|
||||||
|
show_dependency_status("SDL2" SDL2)
|
||||||
|
show_dependency_status("Wavpack" WAVPACK)
|
||||||
|
show_dependency_status("Zlib" ZLIB)
|
||||||
|
|
||||||
if(NOT(PYTHONINTERP_FOUND))
|
if(NOT(PYTHONINTERP_FOUND))
|
||||||
message(SEND_ERROR "You must install Python to compile DDNet")
|
message(SEND_ERROR "You must install Python to compile DDNet")
|
||||||
|
@ -350,10 +405,6 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
check_c_compiler_flag("-O2;-Wp,-Werror;-D_FORTIFY_SOURCE=2" DEFINE_FORTIFY_SOURCE) # Some distributions define _FORTIFY_SOURCE by themselves.
|
|
||||||
endif()
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# DOWNLOAD GTEST
|
# DOWNLOAD GTEST
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -364,7 +415,7 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
|
||||||
configure_file(cmake/Download_GTest_CMakeLists.txt.in googletest-download/CMakeLists.txt)
|
configure_file(cmake/Download_GTest_CMakeLists.txt.in googletest-download/CMakeLists.txt)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||||
RESULT_VARIABLE result
|
RESULT_VARIABLE result
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/googletest-download
|
||||||
)
|
)
|
||||||
if(result)
|
if(result)
|
||||||
message(WARNING "CMake step for googletest failed: ${result}")
|
message(WARNING "CMake step for googletest failed: ${result}")
|
||||||
|
@ -372,7 +423,7 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
|
||||||
else()
|
else()
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||||
RESULT_VARIABLE result
|
RESULT_VARIABLE result
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/googletest-download
|
||||||
)
|
)
|
||||||
if(result)
|
if(result)
|
||||||
message(WARNING "Build step for googletest failed: ${result}")
|
message(WARNING "Build step for googletest failed: ${result}")
|
||||||
|
@ -383,8 +434,8 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
|
||||||
|
|
||||||
# Add googletest directly to our build. This defines the gtest target.
|
# Add googletest directly to our build. This defines the gtest target.
|
||||||
add_subdirectory(
|
add_subdirectory(
|
||||||
${CMAKE_BINARY_DIR}/googletest-src
|
${PROJECT_BINARY_DIR}/googletest-src
|
||||||
${CMAKE_BINARY_DIR}/googletest-build
|
${PROJECT_BINARY_DIR}/googletest-build
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -406,132 +457,17 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# INITALIZE TARGET LISTS
|
|
||||||
########################################################################
|
|
||||||
|
|
||||||
set(TARGETS_OWN)
|
|
||||||
set(TARGETS_DEP)
|
|
||||||
|
|
||||||
set(TARGETS_LINK) # Targets with a linking stage.
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# COMMON FUNCTIONS
|
|
||||||
########################################################################
|
|
||||||
|
|
||||||
function(set_glob VAR GLOBBING DIRECTORY) # ...
|
|
||||||
file(${GLOBBING} GLOB_RESULT "${DIRECTORY}/*.c" "${DIRECTORY}/*.cpp" "${DIRECTORY}/*.h")
|
|
||||||
list(SORT GLOB_RESULT)
|
|
||||||
set(FILES)
|
|
||||||
foreach(file ${ARGN})
|
|
||||||
list(APPEND FILES "${PROJECT_SOURCE_DIR}/${DIRECTORY}/${file}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
if(NOT FILES STREQUAL GLOB_RESULT)
|
|
||||||
message(AUTHOR_WARNING "${VAR} does not contain every file from directory ${DIRECTORY}")
|
|
||||||
set(LIST_BUT_NOT_GLOB)
|
|
||||||
if(POLICY CMP0057)
|
|
||||||
cmake_policy(SET CMP0057 NEW)
|
|
||||||
foreach(file ${FILES})
|
|
||||||
if(NOT file IN_LIST GLOB_RESULT)
|
|
||||||
list(APPEND LIST_BUT_NOT_GLOB ${file})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if(LIST_BUT_NOT_GLOB)
|
|
||||||
message(AUTHOR_WARNING "Entries only present in ${VAR}: ${LIST_BUT_NOT_GLOB}")
|
|
||||||
endif()
|
|
||||||
set(GLOB_BUT_NOT_LIST)
|
|
||||||
foreach(file ${GLOB_RESULT})
|
|
||||||
if(NOT file IN_LIST FILES)
|
|
||||||
list(APPEND GLOB_BUT_NOT_LIST ${file})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
if(GLOB_BUT_NOT_LIST)
|
|
||||||
message(AUTHOR_WARNING "Entries only present in ${DIRECTORY}: ${GLOB_BUT_NOT_LIST}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(${VAR} ${FILES} PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# DEPENDENCY COMPILATION
|
# DEPENDENCY COMPILATION
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
if(NOT(ZLIB_FOUND))
|
|
||||||
set(ZLIB_LIBRARIES)
|
|
||||||
set_glob(ZLIB_SRC GLOB src/engine/external/zlib
|
|
||||||
adler32.c
|
|
||||||
compress.c
|
|
||||||
crc32.c
|
|
||||||
crc32.h
|
|
||||||
deflate.c
|
|
||||||
deflate.h
|
|
||||||
gzclose.c
|
|
||||||
gzguts.h
|
|
||||||
gzlib.c
|
|
||||||
gzread.c
|
|
||||||
gzwrite.c
|
|
||||||
infback.c
|
|
||||||
inffast.c
|
|
||||||
inffast.h
|
|
||||||
inffixed.h
|
|
||||||
inflate.c
|
|
||||||
inflate.h
|
|
||||||
inftrees.c
|
|
||||||
inftrees.h
|
|
||||||
trees.c
|
|
||||||
trees.h
|
|
||||||
uncompr.c
|
|
||||||
zconf.h
|
|
||||||
zlib.h
|
|
||||||
zutil.c
|
|
||||||
zutil.h
|
|
||||||
)
|
|
||||||
add_library(zlib EXCLUDE_FROM_ALL OBJECT ${ZLIB_SRC})
|
|
||||||
|
|
||||||
list(APPEND TARGETS_DEP zlib)
|
|
||||||
set(ZLIB_INCLUDEDIR src/engine/external/zlib/)
|
|
||||||
set(DEP_ZLIB $<TARGET_OBJECTS:zlib>)
|
|
||||||
else()
|
|
||||||
set(ZLIB_INCLUDEDIR)
|
|
||||||
set(DEP_ZLIB)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_glob(DEP_PNG_SRC GLOB src/engine/external/pnglite pnglite.c pnglite.h)
|
|
||||||
add_library(png OBJECT EXCLUDE_FROM_ALL ${DEP_PNG_SRC})
|
|
||||||
target_include_directories(png PRIVATE ${ZLIB_INCLUDEDIR})
|
|
||||||
|
|
||||||
set(DEP_PNG $<TARGET_OBJECTS:png>)
|
|
||||||
list(APPEND TARGETS_DEP png)
|
|
||||||
|
|
||||||
set_glob(DEP_GLEW_SRC GLOB src/engine/external/glew glew.c)
|
|
||||||
set_glob(DEP_GLEW_INCLUDES GLOB src/engine/external/glew/GL eglew.h glew.h glxew.h wglew.h)
|
|
||||||
add_library(glew OBJECT EXCLUDE_FROM_ALL ${DEP_GLEW_SRC} ${DEP_GLEW_INCLUDES})
|
|
||||||
target_include_directories(glew PRIVATE src/engine/external/glew)
|
|
||||||
|
|
||||||
set(DEP_GLEW $<TARGET_OBJECTS:glew>)
|
|
||||||
list(APPEND TARGETS_DEP glew)
|
|
||||||
|
|
||||||
if(CLIENT)
|
if(CLIENT)
|
||||||
# Static dependencies
|
# Static dependencies
|
||||||
set_glob(DEP_JSON_SRC GLOB src/engine/external/json-parser json.c json.h)
|
set_glob(JSON_SRC GLOB src/engine/external/json-parser json.c json.h)
|
||||||
set_glob(DEP_WAV_SRC GLOB src/engine/external/wavpack
|
add_library(json EXCLUDE_FROM_ALL OBJECT ${JSON_SRC})
|
||||||
bits.c
|
|
||||||
float.c
|
|
||||||
metadata.c
|
|
||||||
unpack.c
|
|
||||||
wavpack.h
|
|
||||||
words.c
|
|
||||||
wputils.c
|
|
||||||
)
|
|
||||||
add_library(json EXCLUDE_FROM_ALL OBJECT ${DEP_JSON_SRC})
|
|
||||||
add_library(wav EXCLUDE_FROM_ALL OBJECT ${DEP_WAV_SRC})
|
|
||||||
|
|
||||||
list(APPEND TARGETS_DEP json wav)
|
list(APPEND TARGETS_DEP json)
|
||||||
set(DEP_JSON $<TARGET_OBJECTS:json>)
|
set(JSON_DEP $<TARGET_OBJECTS:json>)
|
||||||
set(DEP_WAV $<TARGET_OBJECTS:wav>)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -552,16 +488,18 @@ file(COPY ${COPY_FILES} DESTINATION .)
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
function(chash output_file)
|
function(chash output_file)
|
||||||
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/${output_file}
|
add_custom_command(OUTPUT ${output_file}
|
||||||
COMMAND ${PYTHON_EXECUTABLE} scripts/cmd5.py ${ARGN} > ${output_file}
|
COMMAND ${PYTHON_EXECUTABLE} scripts/cmd5.py ${ARGN}
|
||||||
|
> "${PROJECT_BINARY_DIR}/${output_file}"
|
||||||
DEPENDS scripts/cmd5.py ${ARGN}
|
DEPENDS scripts/cmd5.py ${ARGN}
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(generate_source output_file script_parameter)
|
function(generate_source output_file script_parameter)
|
||||||
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/${output_file}
|
add_custom_command(OUTPUT ${output_file}
|
||||||
COMMAND ${PYTHON_EXECUTABLE} datasrc/compile.py ${script_parameter} > ${output_file}
|
COMMAND ${PYTHON_EXECUTABLE} datasrc/compile.py ${script_parameter}
|
||||||
|
> "${PROJECT_BINARY_DIR}/${output_file}"
|
||||||
DEPENDS
|
DEPENDS
|
||||||
datasrc/compile.py
|
datasrc/compile.py
|
||||||
datasrc/content.py
|
datasrc/content.py
|
||||||
|
@ -571,10 +509,10 @@ function(generate_source output_file script_parameter)
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
file(MAKE_DIRECTORY "${PROJECT_SOURCE_DIR}/src/game/generated/")
|
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src/game/generated/")
|
||||||
chash("src/game/generated/nethash.cpp"
|
chash("src/game/generated/nethash.cpp"
|
||||||
"src/engine/shared/protocol.h"
|
"src/engine/shared/protocol.h"
|
||||||
"src/game/generated/protocol.h"
|
"${PROJECT_BINARY_DIR}/src/game/generated/protocol.h"
|
||||||
"src/game/tuning.h"
|
"src/game/tuning.h"
|
||||||
"src/game/gamecore.cpp"
|
"src/game/gamecore.cpp"
|
||||||
)
|
)
|
||||||
|
@ -761,7 +699,7 @@ else()
|
||||||
set(DEP_WEBSOCKETS)
|
set(DEP_WEBSOCKETS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(DEPS ${DEP_MD5} ${DEP_WEBSOCKETS} ${DEP_ZLIB})
|
set(DEPS ${DEP_MD5} ${DEP_WEBSOCKETS} ${ZLIB_DEP})
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
set(LIBS ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES} ${PLATFORM_LIBS})
|
set(LIBS ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES} ${PLATFORM_LIBS})
|
||||||
|
@ -906,14 +844,17 @@ if(CLIENT)
|
||||||
)
|
)
|
||||||
set(CLIENT_SRC ${ENGINE_CLIENT} ${PLATFORM_CLIENT} ${GAME_CLIENT} ${GAME_EDITOR} ${GAME_GENERATED_CLIENT})
|
set(CLIENT_SRC ${ENGINE_CLIENT} ${PLATFORM_CLIENT} ${GAME_CLIENT} ${GAME_EDITOR} ${GAME_GENERATED_CLIENT})
|
||||||
|
|
||||||
set(DEPS_CLIENT ${DEPS} ${DEP_JSON} ${DEP_PNG} ${DEP_WAV} ${DEP_GLEW})
|
set(DEPS_CLIENT ${DEPS} ${GLEW_DEP} ${JSON_DEP} ${PNGLITE_DEP} ${WAVPACK_DEP})
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
set(LIBS_CLIENT
|
set(LIBS_CLIENT
|
||||||
${LIBS}
|
${LIBS}
|
||||||
${CURL_LIBRARIES}
|
${CURL_LIBRARIES}
|
||||||
${FREETYPE_LIBRARIES}
|
${FREETYPE_LIBRARIES}
|
||||||
|
${GLEW_LIBRARIES}
|
||||||
|
${PNGLITE_LIBRARIES}
|
||||||
${SDL2_LIBRARIES}
|
${SDL2_LIBRARIES}
|
||||||
|
${WAVPACK_LIBRARIES}
|
||||||
|
|
||||||
# Order of these three is important.
|
# Order of these three is important.
|
||||||
${OPUSFILE_LIBRARIES}
|
${OPUSFILE_LIBRARIES}
|
||||||
|
@ -950,11 +891,25 @@ if(CLIENT)
|
||||||
target_include_directories(${TARGET_CLIENT} PRIVATE
|
target_include_directories(${TARGET_CLIENT} PRIVATE
|
||||||
${CURL_INCLUDE_DIRS}
|
${CURL_INCLUDE_DIRS}
|
||||||
${FREETYPE_INCLUDE_DIRS}
|
${FREETYPE_INCLUDE_DIRS}
|
||||||
|
${GLEW_INCLUDE_DIRS}
|
||||||
${OGG_INCLUDE_DIRS}
|
${OGG_INCLUDE_DIRS}
|
||||||
${OPUSFILE_INCLUDE_DIRS}
|
${OPUSFILE_INCLUDE_DIRS}
|
||||||
${OPUS_INCLUDE_DIRS}
|
${OPUS_INCLUDE_DIRS}
|
||||||
|
${PNGLITE_INCLUDE_DIRS}
|
||||||
${SDL2_INCLUDE_DIRS}
|
${SDL2_INCLUDE_DIRS}
|
||||||
|
${WAVPACK_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${ORIGINAL_CMAKE_REQUIRED_INCLUDES} ${WAVPACK_INCLUDE_DIRS})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${ORIGINAL_CMAKE_REQUIRED_LIBRARIES} ${WAVPACK_LIBRARIES})
|
||||||
|
check_symbol_exists(WavpackOpenFileInputEx64 wavpack.h WAVPACK_OPEN_FILE_INPUT_EX64)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${ORIGINAL_CMAKE_REQUIRED_INCLUDES})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${ORIGINAL_CMAKE_REQUIRED_LIBRARIES})
|
||||||
|
|
||||||
|
if(WAVPACK_OPEN_FILE_INPUT_EX64)
|
||||||
|
target_compile_definitions(${TARGET_CLIENT} PRIVATE CONF_WAVPACK_OPEN_FILE_INPUT_EX64)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND TARGETS_OWN ${TARGET_CLIENT})
|
list(APPEND TARGETS_OWN ${TARGET_CLIENT})
|
||||||
list(APPEND TARGETS_LINK ${TARGET_CLIENT})
|
list(APPEND TARGETS_LINK ${TARGET_CLIENT})
|
||||||
endif()
|
endif()
|
||||||
|
@ -1113,10 +1068,13 @@ foreach(ABS_T ${TOOLS})
|
||||||
file(RELATIVE_PATH T "${PROJECT_SOURCE_DIR}/src/tools/" ${ABS_T})
|
file(RELATIVE_PATH T "${PROJECT_SOURCE_DIR}/src/tools/" ${ABS_T})
|
||||||
if(T MATCHES "\\.cpp$")
|
if(T MATCHES "\\.cpp$")
|
||||||
string(REGEX REPLACE "\\.cpp$" "" TOOL "${T}")
|
string(REGEX REPLACE "\\.cpp$" "" TOOL "${T}")
|
||||||
set(EXTRA_TOOL_SRC)
|
set(TOOL_DEPS ${DEPS})
|
||||||
|
set(TOOL_LIBS ${LIBS})
|
||||||
set(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
|
set(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL)
|
||||||
if(TOOL MATCHES "^(tileset_.*|dilate|map_extract|map_replace_image)$")
|
if(TOOL MATCHES "^(tileset_.*|dilate|map_extract|map_replace_image)$")
|
||||||
list(APPEND EXTRA_TOOL_SRC ${DEP_PNG})
|
list(APPEND TOOL_DEPS ${PNGLITE_DEP})
|
||||||
|
list(APPEND TOOL_LIBS ${PNGLITE_LIBRARIES})
|
||||||
|
list(APPEND TOOL_INCLUDE_DIRS ${PNGLITE_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
if(TOOL MATCHES "^config_")
|
if(TOOL MATCHES "^config_")
|
||||||
list(APPEND EXTRA_TOOL_SRC "src/tools/config_common.h")
|
list(APPEND EXTRA_TOOL_SRC "src/tools/config_common.h")
|
||||||
|
@ -1125,12 +1083,13 @@ foreach(ABS_T ${TOOLS})
|
||||||
set(EXCLUDE_FROM_ALL)
|
set(EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
add_executable(${TOOL} ${EXCLUDE_FROM_ALL}
|
add_executable(${TOOL} ${EXCLUDE_FROM_ALL}
|
||||||
${DEPS}
|
${TOOL_DEPS}
|
||||||
src/tools/${TOOL}.cpp
|
src/tools/${TOOL}.cpp
|
||||||
${EXTRA_TOOL_SRC}
|
${EXTRA_TOOL_SRC}
|
||||||
$<TARGET_OBJECTS:engine-shared>
|
$<TARGET_OBJECTS:engine-shared>
|
||||||
)
|
)
|
||||||
target_link_libraries(${TOOL} ${LIBS})
|
target_include_directories(${TOOL} PRIVATE ${TOOL_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(${TOOL} ${TOOL_LIBS})
|
||||||
list(APPEND TARGETS_TOOLS ${TOOL})
|
list(APPEND TARGETS_TOOLS ${TOOL})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -1348,8 +1307,8 @@ endif()
|
||||||
set(PACKAGE_TARGETS)
|
set(PACKAGE_TARGETS)
|
||||||
|
|
||||||
if(DMGTOOLS_FOUND OR HDIUTIL)
|
if(DMGTOOLS_FOUND OR HDIUTIL)
|
||||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/bundle/client/")
|
file(MAKE_DIRECTORY bundle/client/)
|
||||||
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/bundle/server/")
|
file(MAKE_DIRECTORY bundle/server/)
|
||||||
configure_file(other/bundle/client/Info.plist.in bundle/client/Info.plist)
|
configure_file(other/bundle/client/Info.plist.in bundle/client/Info.plist)
|
||||||
configure_file(other/bundle/server/Info.plist.in bundle/server/Info.plist)
|
configure_file(other/bundle/server/Info.plist.in bundle/server/Info.plist)
|
||||||
|
|
||||||
|
@ -1403,8 +1362,8 @@ if(DMGTOOLS_FOUND OR HDIUTIL)
|
||||||
${TARGET_CLIENT}
|
${TARGET_CLIENT}
|
||||||
${TARGET_SERVER_LAUNCHER}
|
${TARGET_SERVER_LAUNCHER}
|
||||||
${TARGET_SERVER}
|
${TARGET_SERVER}
|
||||||
${CMAKE_BINARY_DIR}/bundle/client/Info.plist
|
${PROJECT_BINARY_DIR}/bundle/client/Info.plist
|
||||||
${CMAKE_BINARY_DIR}/bundle/server/Info.plist
|
${PROJECT_BINARY_DIR}/bundle/server/Info.plist
|
||||||
data
|
data
|
||||||
other/bundle/client/PkgInfo
|
other/bundle/client/PkgInfo
|
||||||
other/bundle/server/PkgInfo
|
other/bundle/server/PkgInfo
|
||||||
|
@ -1546,8 +1505,9 @@ foreach(target ${TARGETS_OWN})
|
||||||
target_compile_options(${target} PRIVATE ${OUR_FLAGS_OWN})
|
target_compile_options(${target} PRIVATE ${OUR_FLAGS_OWN})
|
||||||
endif()
|
endif()
|
||||||
target_include_directories(${target} PRIVATE src)
|
target_include_directories(${target} PRIVATE src)
|
||||||
|
target_include_directories(${target} PRIVATE ${PROJECT_BINARY_DIR}/src)
|
||||||
target_compile_definitions(${target} PRIVATE $<$<CONFIG:Debug>:CONF_DEBUG>)
|
target_compile_definitions(${target} PRIVATE $<$<CONFIG:Debug>:CONF_DEBUG>)
|
||||||
target_include_directories(${target} PRIVATE ${ZLIB_INCLUDEDIR})
|
target_include_directories(${target} PRIVATE ${ZLIB_INCLUDE_DIRS})
|
||||||
target_compile_definitions(${target} PRIVATE GLEW_STATIC)
|
target_compile_definitions(${target} PRIVATE GLEW_STATIC)
|
||||||
if(WEBSOCKETS)
|
if(WEBSOCKETS)
|
||||||
target_compile_definitions(${target} PRIVATE CONF_WEBSOCKETS)
|
target_compile_definitions(${target} PRIVATE CONF_WEBSOCKETS)
|
||||||
|
@ -1562,4 +1522,7 @@ foreach(target ${TARGETS_DEP})
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(${target} PRIVATE /W0)
|
target_compile_options(${target} PRIVATE /W0)
|
||||||
endif()
|
endif()
|
||||||
|
if(OUR_FLAGS_DEP)
|
||||||
|
target_compile_options(${target} PRIVATE ${OUR_FLAGS_DEP})
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
@ -22,11 +22,11 @@ find_package_handle_standard_args(Curl DEFAULT_MSG CURL_LIBRARY CURL_INCLUDEDIR)
|
||||||
|
|
||||||
mark_as_advanced(CURL_LIBRARY CURL_INCLUDEDIR)
|
mark_as_advanced(CURL_LIBRARY CURL_INCLUDEDIR)
|
||||||
|
|
||||||
is_bundled(IS_BUNDLED "${CURL_LIBRARY}")
|
if(CURL_FOUND)
|
||||||
|
is_bundled(CURL_BUNDLED "${CURL_LIBRARY}")
|
||||||
set(CURL_LIBRARIES ${CURL_LIBRARY})
|
set(CURL_LIBRARIES ${CURL_LIBRARY})
|
||||||
set(CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR})
|
set(CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR})
|
||||||
if(IS_BUNDLED AND TARGET_OS STREQUAL "linux")
|
if(CURL_BUNDLED AND TARGET_OS STREQUAL "linux")
|
||||||
find_library(CURL_LIBRARY_SSL
|
find_library(CURL_LIBRARY_SSL
|
||||||
NAMES ssl
|
NAMES ssl
|
||||||
HINTS ${EXTRA_CURL_LIBDIR}
|
HINTS ${EXTRA_CURL_LIBDIR}
|
||||||
|
@ -43,12 +43,13 @@ if(IS_BUNDLED AND TARGET_OS STREQUAL "linux")
|
||||||
# Order matters, SSL needs to be linked before CRYPTO, otherwise we also get
|
# Order matters, SSL needs to be linked before CRYPTO, otherwise we also get
|
||||||
# undefined symbols.
|
# undefined symbols.
|
||||||
list(APPEND CURL_LIBRARIES ${CURL_LIBRARY_SSL} ${CURL_LIBRARY_CRYPTO} dl)
|
list(APPEND CURL_LIBRARIES ${CURL_LIBRARY_SSL} ${CURL_LIBRARY_CRYPTO} dl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(IS_BUNDLED AND TARGET_OS STREQUAL "windows")
|
if(CURL_BUNDLED AND TARGET_OS STREQUAL "windows")
|
||||||
set(CURL_COPY_FILES
|
set(CURL_COPY_FILES
|
||||||
"${EXTRA_CURL_LIBDIR}/libcurl.dll"
|
"${EXTRA_CURL_LIBDIR}/libcurl.dll"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
set(CURL_COPY_FILES)
|
set(CURL_COPY_FILES)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -24,12 +24,14 @@ find_package_handle_standard_args(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE
|
||||||
|
|
||||||
mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDEDIR)
|
mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDEDIR)
|
||||||
|
|
||||||
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
|
if(FREETYPE_FOUND)
|
||||||
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDEDIR})
|
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
|
||||||
|
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDEDIR})
|
||||||
|
|
||||||
is_bundled(IS_BUNDLED "${FREETYPE_LIBRARY}")
|
is_bundled(FREETYPE_BUNDLED "${FREETYPE_LIBRARY}")
|
||||||
if(IS_BUNDLED AND TARGET_OS STREQUAL "windows")
|
if(FREETYPE_BUNDLED AND TARGET_OS STREQUAL "windows")
|
||||||
set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/libfreetype.dll")
|
set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/libfreetype.dll")
|
||||||
else()
|
else()
|
||||||
set(FREETYPE_COPY_FILES)
|
set(FREETYPE_COPY_FILES)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,33 +1,29 @@
|
||||||
if(NOT CMAKE_CROSSCOMPILING)
|
if(NOT PREFER_BUNDLED_LIBS)
|
||||||
find_package(PkgConfig QUIET)
|
set(CMAKE_MODULE_PATH ${ORIGINAL_CMAKE_MODULE_PATH})
|
||||||
pkg_check_modules(PC_GLEW libglew)
|
find_package(GLEW)
|
||||||
|
set(CMAKE_MODULE_PATH ${OWN_CMAKE_MODULE_PATH})
|
||||||
|
if(GLEW_FOUND)
|
||||||
|
set(GLEW_BUNDLED OFF)
|
||||||
|
set(GLEW_DEP)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_extra_dirs_lib(GLEW glew)
|
if(NOT GLEW_FOUND)
|
||||||
find_library(GLEW_LIBRARY
|
set(GLEW_FOUND ON)
|
||||||
NAMES GLEW glew32
|
set(GLEW_BUNDLED ON)
|
||||||
HINTS ${HINTS_GLEW_LIBDIR} ${PC_GLEW_LIBDIR} ${PC_GLEW_LIBRARY_DIRS}
|
set(GLEW_SRC_DIR src/engine/external/glew)
|
||||||
PATHS ${PATHS_GLEW_LIBDIR}
|
set_glob(GLEW_SRC GLOB ${GLEW_SRC_DIR} glew.c)
|
||||||
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
set_glob(GLEW_INCLUDES GLOB ${GLEW_SRC_DIR}/GL eglew.h glew.h glxew.h wglew.h)
|
||||||
)
|
add_library(glew EXCLUDE_FROM_ALL OBJECT ${GLEW_SRC} ${GLEW_INCLUDES})
|
||||||
set_extra_dirs_include(GLEW glew "${GLEW_LIBRARY}")
|
set(GLEW_INCLUDEDIR ${GLEW_SRC_DIR})
|
||||||
find_path(GLEW_INCLUDEDIR GL
|
target_include_directories(glew PRIVATE ${GLEW_INCLUDEDIR})
|
||||||
HINTS ${HINTS_GLEW_INCLUDEDIR} ${PC_GLEW_INCLUDEDIR} ${PC_GLEW_INCLUDE_DIRS}
|
|
||||||
PATHS ${PATHS_GLEW_INCLUDEDIR}
|
|
||||||
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
|
||||||
)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
set(GLEW_DEP $<TARGET_OBJECTS:glew>)
|
||||||
find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDEDIR)
|
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDEDIR})
|
||||||
|
set(GLEW_LIBRARIES)
|
||||||
|
|
||||||
mark_as_advanced(GLEW_LIBRARY GLEW_INCLUDEDIR)
|
list(APPEND TARGETS_DEP glew)
|
||||||
|
|
||||||
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
|
include(FindPackageHandleStandardArgs)
|
||||||
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDEDIR})
|
find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_INCLUDEDIR)
|
||||||
|
|
||||||
is_bundled(IS_BUNDLED "${GLEW_LIBRARY}")
|
|
||||||
if(IS_BUNDLED AND TARGET_OS STREQUAL "windows")
|
|
||||||
set(GLEW_COPY_FILES "${EXTRA_GLEW_LIBDIR}/glew32.dll")
|
|
||||||
else()
|
|
||||||
set(GLEW_COPY_FILES)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -69,7 +69,11 @@ find_path(MYSQL_CPPCONN_INCLUDEDIR
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(MySQL DEFAULT_MSG MYSQL_LIBRARY MYSQL_INCLUDEDIR)
|
find_package_handle_standard_args(MySQL DEFAULT_MSG MYSQL_LIBRARY MYSQL_INCLUDEDIR)
|
||||||
|
|
||||||
set(MYSQL_LIBRARIES ${MYSQL_LIBRARY} ${MYSQL_CPPCONN_LIBRARY})
|
if(MYSQL_FOUND)
|
||||||
set(MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDEDIR} ${MYSQL_CPPCONN_INCLUDEDIR})
|
is_bundled(MYSQL_BUNDLED "${MYSQL_LIBRARY}")
|
||||||
|
|
||||||
mark_as_advanced(MYSQL_INCLUDEDIR MYSQL_LIBRARY)
|
set(MYSQL_LIBRARIES ${MYSQL_LIBRARY} ${MYSQL_CPPCONN_LIBRARY})
|
||||||
|
set(MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDEDIR} ${MYSQL_CPPCONN_INCLUDEDIR})
|
||||||
|
|
||||||
|
mark_as_advanced(MYSQL_INCLUDEDIR MYSQL_LIBRARY)
|
||||||
|
endif()
|
||||||
|
|
|
@ -23,9 +23,11 @@ find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_INCLUDEDIR)
|
||||||
|
|
||||||
mark_as_advanced(OGG_INCLUDEDIR OGG_LIBRARY)
|
mark_as_advanced(OGG_INCLUDEDIR OGG_LIBRARY)
|
||||||
|
|
||||||
set(OGG_INCLUDE_DIRS ${OGG_INCLUDEDIR})
|
if(OGG_FOUND)
|
||||||
if(OGG_LIBRARY)
|
set(OGG_INCLUDE_DIRS ${OGG_INCLUDEDIR})
|
||||||
|
if(OGG_LIBRARY)
|
||||||
set(OGG_LIBRARIES ${OGG_LIBRARY})
|
set(OGG_LIBRARIES ${OGG_LIBRARY})
|
||||||
else()
|
else()
|
||||||
set(OGG_LIBRARIES)
|
set(OGG_LIBRARIES)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -23,9 +23,11 @@ find_package_handle_standard_args(Opus DEFAULT_MSG OPUS_INCLUDEDIR)
|
||||||
|
|
||||||
mark_as_advanced(OPUS_INCLUDEDIR OPUS_LIBRARY)
|
mark_as_advanced(OPUS_INCLUDEDIR OPUS_LIBRARY)
|
||||||
|
|
||||||
set(OPUS_INCLUDE_DIRS ${OPUS_INCLUDEDIR})
|
if(OPUS_FOUND)
|
||||||
if(OPUS_LIBRARY)
|
set(OPUS_INCLUDE_DIRS ${OPUS_INCLUDEDIR})
|
||||||
|
if(OPUS_LIBRARY)
|
||||||
set(OPUS_LIBRARIES ${OPUS_LIBRARY})
|
set(OPUS_LIBRARIES ${OPUS_LIBRARY})
|
||||||
else()
|
else()
|
||||||
set(OPUS_LIBRARIES)
|
set(OPUS_LIBRARIES)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -26,8 +26,9 @@ mark_as_advanced(OPUSFILE_LIBRARY OPUSFILE_INCLUDEDIR)
|
||||||
set(OPUSFILE_LIBRARIES ${OPUSFILE_LIBRARY})
|
set(OPUSFILE_LIBRARIES ${OPUSFILE_LIBRARY})
|
||||||
set(OPUSFILE_INCLUDE_DIRS ${OPUSFILE_INCLUDEDIR})
|
set(OPUSFILE_INCLUDE_DIRS ${OPUSFILE_INCLUDEDIR})
|
||||||
|
|
||||||
is_bundled(IS_BUNDLED "${OPUSFILE_LIBRARY}")
|
if(OPUSFILE_FOUND)
|
||||||
if(IS_BUNDLED AND TARGET_OS STREQUAL "windows")
|
is_bundled(OPUSFILE_BUNDLED "${OPUSFILE_LIBRARY}")
|
||||||
|
if(OPUSFILE_BUNDLED AND TARGET_OS STREQUAL "windows")
|
||||||
set(OPUSFILE_COPY_FILES
|
set(OPUSFILE_COPY_FILES
|
||||||
"${EXTRA_OPUSFILE_LIBDIR}/libogg.dll"
|
"${EXTRA_OPUSFILE_LIBDIR}/libogg.dll"
|
||||||
"${EXTRA_OPUSFILE_LIBDIR}/libopus.dll"
|
"${EXTRA_OPUSFILE_LIBDIR}/libopus.dll"
|
||||||
|
@ -39,6 +40,7 @@ if(IS_BUNDLED AND TARGET_OS STREQUAL "windows")
|
||||||
"${EXTRA_OPUSFILE_LIBDIR}/libgcc_s_sjlj-1.dll"
|
"${EXTRA_OPUSFILE_LIBDIR}/libgcc_s_sjlj-1.dll"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(OPUSFILE_COPY_FILES)
|
set(OPUSFILE_COPY_FILES)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
46
cmake/FindPnglite.cmake
Normal file
46
cmake/FindPnglite.cmake
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
if(NOT PREFER_BUNDLED_LIBS)
|
||||||
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
pkg_check_modules(PC_PNGLITE pnglite)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(PNGLITE_LIBRARY
|
||||||
|
NAMES pnglite
|
||||||
|
HINTS ${PC_PNGLITE_LIBDIR} ${PC_PNGLITE_LIBRARY_DIRS}
|
||||||
|
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
||||||
|
)
|
||||||
|
find_path(PNGLITE_INCLUDEDIR
|
||||||
|
NAMES pnglite.h
|
||||||
|
HINTS ${PC_PNGLITE_INCLUDEDIR} ${PC_PNGLITE_INCLUDE_DIRS}
|
||||||
|
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(PNGLITE_LIBRARY PNGLITE_INCLUDEDIR)
|
||||||
|
|
||||||
|
if(PNGLITE_LIBRARY AND PNGLITE_INCLUDEDIR)
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Pnglite DEFAULT_MSG PNGLITE_LIBRARY PNGLITE_INCLUDEDIR)
|
||||||
|
|
||||||
|
set(PNGLITE_LIBRARIES ${PNGLITE_LIBRARY})
|
||||||
|
set(PNGLITE_INCLUDE_DIRS ${PNGLITE_INCLUDEDIR})
|
||||||
|
set(PNGLITE_BUNDLED OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT PNGLITE_FOUND)
|
||||||
|
set(PNGLITE_SRC_DIR src/engine/external/pnglite)
|
||||||
|
set_glob(PNGLITE_SRC GLOB ${PNGLITE_SRC_DIR} pnglite.c pnglite.h)
|
||||||
|
add_library(pnglite EXCLUDE_FROM_ALL OBJECT ${PNGLITE_SRC})
|
||||||
|
list(APPEND TARGETS_DEP pnglite)
|
||||||
|
|
||||||
|
set(PNGLITE_INCLUDEDIR ${PNGLITE_SRC_DIR})
|
||||||
|
target_include_directories(pnglite PRIVATE ${ZLIB_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
set(PNGLITE_DEP $<TARGET_OBJECTS:pnglite>)
|
||||||
|
set(PNGLITE_INCLUDE_DIRS ${PNGLITE_INCLUDEDIR})
|
||||||
|
set(PNGLITE_LIBRARIES)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Pnglite DEFAULT_MSG PNGLITE_INCLUDEDIR)
|
||||||
|
set(PNGLITE_BUNDLED ON)
|
||||||
|
endif()
|
|
@ -25,12 +25,14 @@ find_package_handle_standard_args(SDL2 DEFAULT_MSG SDL2_LIBRARY SDL2_INCLUDEDIR)
|
||||||
|
|
||||||
mark_as_advanced(SDL2_LIBRARY SDL2_INCLUDEDIR)
|
mark_as_advanced(SDL2_LIBRARY SDL2_INCLUDEDIR)
|
||||||
|
|
||||||
set(SDL2_LIBRARIES ${SDL2_LIBRARY})
|
if(SDL2_FOUND)
|
||||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDEDIR})
|
set(SDL2_LIBRARIES ${SDL2_LIBRARY})
|
||||||
|
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDEDIR})
|
||||||
|
|
||||||
is_bundled(IS_BUNDLED "${SDL2_LIBRARY}")
|
is_bundled(SDL2_BUNDLED "${SDL2_LIBRARY}")
|
||||||
if(IS_BUNDLED AND TARGET_OS STREQUAL "windows")
|
if(SDL2_BUNDLED AND TARGET_OS STREQUAL "windows")
|
||||||
set(SDL2_COPY_FILES "${EXTRA_SDL2_LIBDIR}/SDL2.dll")
|
set(SDL2_COPY_FILES "${EXTRA_SDL2_LIBDIR}/SDL2.dll")
|
||||||
else()
|
else()
|
||||||
set(SDL2_COPY_FILES)
|
set(SDL2_COPY_FILES)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
52
cmake/FindWavpack.cmake
Normal file
52
cmake/FindWavpack.cmake
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
if(NOT PREFER_BUNDLED_LIBS)
|
||||||
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
pkg_check_modules(PC_WAVPACK wavpack)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(WAVPACK_LIBRARY
|
||||||
|
NAMES wavpack
|
||||||
|
HINTS ${PC_WAVPACK_LIBDIR} ${PC_WAVPACK_LIBRARY_DIRS}
|
||||||
|
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
||||||
|
)
|
||||||
|
find_path(WAVPACK_INCLUDEDIR
|
||||||
|
NAMES wavpack.h
|
||||||
|
PATH_SUFFIXES wavpack
|
||||||
|
HINTS ${PC_WAVPACK_INCLUDEDIR} ${PC_WAVPACK_INCLUDE_DIRS}
|
||||||
|
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(WAVPACK_LIBRARY WAVPACK_INCLUDEDIR)
|
||||||
|
|
||||||
|
if(WAVPACK_LIBRARY AND WAVPACK_INCLUDEDIR)
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Wavpack DEFAULT_MSG WAVPACK_LIBRARY WAVPACK_INCLUDEDIR)
|
||||||
|
|
||||||
|
set(WAVPACK_LIBRARIES ${WAVPACK_LIBRARY})
|
||||||
|
set(WAVPACK_INCLUDE_DIRS ${WAVPACK_INCLUDEDIR})
|
||||||
|
set(WAVPACK_BUNDLED OFF)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT WAVPACK_FOUND)
|
||||||
|
set(WAVPACK_SRC_DIR src/engine/external/wavpack)
|
||||||
|
set_glob(WAVPACK_SRC GLOB ${WAVPACK_SRC_DIR}
|
||||||
|
bits.c
|
||||||
|
float.c
|
||||||
|
metadata.c
|
||||||
|
unpack.c
|
||||||
|
wavpack.h
|
||||||
|
words.c
|
||||||
|
wputils.c
|
||||||
|
)
|
||||||
|
add_library(wavpack EXCLUDE_FROM_ALL OBJECT ${WAVPACK_SRC})
|
||||||
|
set(WAVPACK_DEP $<TARGET_OBJECTS:wavpack>)
|
||||||
|
set(WAVPACK_INCLUDEDIR ${WAVPACK_SRC_DIR})
|
||||||
|
set(WAVPACK_INCLUDE_DIRS ${WAVPACK_INCLUDEDIR})
|
||||||
|
|
||||||
|
list(APPEND TARGETS_DEP wavpack)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Wavpack DEFAULT_MSG WAVPACK_INCLUDEDIR)
|
||||||
|
set(WAVPACK_BUNDLED ON)
|
||||||
|
endif()
|
55
cmake/FindZLIB.cmake
Normal file
55
cmake/FindZLIB.cmake
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
if(NOT PREFER_BUNDLED_LIBS)
|
||||||
|
set(CMAKE_MODULE_PATH ${ORIGINAL_CMAKE_MODULE_PATH})
|
||||||
|
find_package(ZLIB)
|
||||||
|
set(CMAKE_MODULE_PATH ${OWN_CMAKE_MODULE_PATH})
|
||||||
|
if(ZLIB_FOUND)
|
||||||
|
set(ZLIB_BUNDLED OFF)
|
||||||
|
set(ZLIB_DEP)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT ZLIB_FOUND)
|
||||||
|
set(ZLIB_FOUND ON)
|
||||||
|
set(ZLIB_BUNDLED ON)
|
||||||
|
set(ZLIB_SRC_DIR src/engine/external/zlib)
|
||||||
|
set_glob(ZLIB_SRC GLOB ${ZLIB_SRC_DIR}
|
||||||
|
adler32.c
|
||||||
|
compress.c
|
||||||
|
crc32.c
|
||||||
|
crc32.h
|
||||||
|
deflate.c
|
||||||
|
deflate.h
|
||||||
|
gzclose.c
|
||||||
|
gzguts.h
|
||||||
|
gzlib.c
|
||||||
|
gzread.c
|
||||||
|
gzwrite.c
|
||||||
|
infback.c
|
||||||
|
inffast.c
|
||||||
|
inffast.h
|
||||||
|
inffixed.h
|
||||||
|
inflate.c
|
||||||
|
inflate.h
|
||||||
|
inftrees.c
|
||||||
|
inftrees.h
|
||||||
|
trees.c
|
||||||
|
trees.h
|
||||||
|
uncompr.c
|
||||||
|
zconf.h
|
||||||
|
zlib.h
|
||||||
|
zutil.c
|
||||||
|
zutil.h
|
||||||
|
)
|
||||||
|
add_library(zlib EXCLUDE_FROM_ALL OBJECT ${ZLIB_SRC})
|
||||||
|
set(ZLIB_INCLUDEDIR ${ZLIB_SRC_DIR})
|
||||||
|
target_include_directories(zlib PRIVATE ${ZLIB_INCLUDEDIR})
|
||||||
|
|
||||||
|
set(ZLIB_DEP $<TARGET_OBJECTS:zlib>)
|
||||||
|
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDEDIR})
|
||||||
|
set(ZLIB_LIBRARIES)
|
||||||
|
|
||||||
|
list(APPEND TARGETS_DEP zlib)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(ZLIB DEFAULT_MSG ZLIB_INCLUDEDIR)
|
||||||
|
endif()
|
|
@ -6,7 +6,7 @@
|
||||||
#define WINVER 0x0501
|
#define WINVER 0x0501
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "engine/external/glew/GL/glew.h"
|
#include <GL/glew.h>
|
||||||
#include <engine/storage.h>
|
#include <engine/storage.h>
|
||||||
|
|
||||||
#include <base/detect.h>
|
#include <base/detect.h>
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
|
||||||
|
#include <pnglite.h>
|
||||||
|
|
||||||
#include <engine/shared/config.h>
|
#include <engine/shared/config.h>
|
||||||
#include <engine/graphics.h>
|
#include <engine/graphics.h>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#ifndef ENGINE_CLIENT_OPENGL_SL_H
|
||||||
|
#define ENGINE_CLIENT_OPENGL_SL_H
|
||||||
|
|
||||||
#include "engine/external/glew/GL/glew.h"
|
#include <GL/glew.h>
|
||||||
|
|
||||||
class CGLSL {
|
class CGLSL {
|
||||||
public:
|
public:
|
||||||
|
@ -17,3 +18,5 @@ private:
|
||||||
int m_Type;
|
int m_Type;
|
||||||
bool m_IsLoaded;
|
bool m_IsLoaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // ENGINE_CLIENT_OPENGL_SL_H
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#ifndef ENGINE_CLIENT_OPENGL_SL_PROGRAM_H
|
||||||
|
#define ENGINE_CLIENT_OPENGL_SL_PROGRAM_H
|
||||||
|
|
||||||
#include "engine/external/glew/GL/glew.h"
|
#include <GL/glew.h>
|
||||||
|
|
||||||
class CGLSL;
|
class CGLSL;
|
||||||
|
|
||||||
|
@ -74,3 +75,5 @@ public:
|
||||||
int m_LocDir;
|
int m_LocDir;
|
||||||
int m_LocNum;
|
int m_LocNum;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // ENGINE_CLIENT_OPENGL_SL_PROGRAM_H
|
||||||
|
|
|
@ -12,9 +12,10 @@
|
||||||
|
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
extern "C" { // wavpack
|
extern "C"
|
||||||
#include <engine/external/wavpack/wavpack.h>
|
{
|
||||||
#include <opusfile.h>
|
#include <opusfile.h>
|
||||||
|
#include <wavpack.h>
|
||||||
}
|
}
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
@ -77,9 +78,9 @@ static int m_NextVoice = 0;
|
||||||
static int *m_pMixBuffer = 0; // buffer only used by the thread callback function
|
static int *m_pMixBuffer = 0; // buffer only used by the thread callback function
|
||||||
static unsigned m_MaxFrames = 0;
|
static unsigned m_MaxFrames = 0;
|
||||||
|
|
||||||
static const void *ms_pWVBuffer = 0x0;
|
static const void *s_pWVBuffer = 0x0;
|
||||||
static int ms_WVBufferPosition = 0;
|
static int s_WVBufferPosition = 0;
|
||||||
static int ms_WVBufferSize = 0;
|
static int s_WVBufferSize = 0;
|
||||||
|
|
||||||
const int DefaultDistance = 1500;
|
const int DefaultDistance = 1500;
|
||||||
|
|
||||||
|
@ -414,14 +415,6 @@ void CSound::RateConvert(int SampleID)
|
||||||
pSample->m_Rate = m_MixingRate;
|
pSample->m_Rate = m_MixingRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSound::ReadData(void *pBuffer, int Size)
|
|
||||||
{
|
|
||||||
int ChunkSize = min(Size, ms_WVBufferSize - ms_WVBufferPosition);
|
|
||||||
mem_copy(pBuffer, (const char *)ms_pWVBuffer + ms_WVBufferPosition, ChunkSize);
|
|
||||||
ms_WVBufferPosition += ChunkSize;
|
|
||||||
return ChunkSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CSound::DecodeOpus(int SampleID, const void *pData, unsigned DataSize)
|
int CSound::DecodeOpus(int SampleID, const void *pData, unsigned DataSize)
|
||||||
{
|
{
|
||||||
if(SampleID == -1 || SampleID >= NUM_SAMPLES)
|
if(SampleID == -1 || SampleID >= NUM_SAMPLES)
|
||||||
|
@ -468,6 +461,46 @@ int CSound::DecodeOpus(int SampleID, const void *pData, unsigned DataSize)
|
||||||
return SampleID;
|
return SampleID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ReadDataOld(void *pBuffer, int Size)
|
||||||
|
{
|
||||||
|
int ChunkSize = min(Size, s_WVBufferSize - s_WVBufferPosition);
|
||||||
|
mem_copy(pBuffer, (const char *)s_pWVBuffer + s_WVBufferPosition, ChunkSize);
|
||||||
|
s_WVBufferPosition += ChunkSize;
|
||||||
|
return ChunkSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(CONF_WAVPACK_OPEN_FILE_INPUT_EX64)
|
||||||
|
static int ReadData(void *pId, void *pBuffer, int Size)
|
||||||
|
{
|
||||||
|
(void)pId;
|
||||||
|
return ReadDataOld(pBuffer, Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ReturnFalse(void *pId)
|
||||||
|
{
|
||||||
|
(void)pId;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int64_t GetPos(void *pId)
|
||||||
|
{
|
||||||
|
(void)pId;
|
||||||
|
return s_WVBufferPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int64_t GetLength(void *pId)
|
||||||
|
{
|
||||||
|
(void)pId;
|
||||||
|
return s_WVBufferSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int PushBackByte(void *pId, int Char)
|
||||||
|
{
|
||||||
|
s_WVBufferPosition -= 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int CSound::DecodeWV(int SampleID, const void *pData, unsigned DataSize)
|
int CSound::DecodeWV(int SampleID, const void *pData, unsigned DataSize)
|
||||||
{
|
{
|
||||||
if(SampleID == -1 || SampleID >= NUM_SAMPLES)
|
if(SampleID == -1 || SampleID >= NUM_SAMPLES)
|
||||||
|
@ -477,12 +510,22 @@ int CSound::DecodeWV(int SampleID, const void *pData, unsigned DataSize)
|
||||||
char aError[100];
|
char aError[100];
|
||||||
WavpackContext *pContext;
|
WavpackContext *pContext;
|
||||||
|
|
||||||
ms_pWVBuffer = pData;
|
s_pWVBuffer = pData;
|
||||||
ms_WVBufferSize = DataSize;
|
s_WVBufferSize = DataSize;
|
||||||
ms_WVBufferPosition = 0;
|
s_WVBufferPosition = 0;
|
||||||
|
|
||||||
pContext = WavpackOpenFileInput(ReadData, aError);
|
#if defined(CONF_WAVPACK_OPEN_FILE_INPUT_EX64)
|
||||||
if (pContext)
|
WavpackStreamReader64 Callback = {0};
|
||||||
|
Callback.can_seek = ReturnFalse;
|
||||||
|
Callback.get_length = GetLength;
|
||||||
|
Callback.get_pos = GetPos;
|
||||||
|
Callback.push_back_byte = PushBackByte;
|
||||||
|
Callback.read_bytes = ::ReadData;
|
||||||
|
pContext = WavpackOpenFileInputEx64(&Callback,0, 0, aError, 0, 0);
|
||||||
|
#else
|
||||||
|
pContext = WavpackOpenFileInput(ReadDataOld, aError);
|
||||||
|
#endif
|
||||||
|
if(pContext)
|
||||||
{
|
{
|
||||||
int NumSamples = WavpackGetNumSamples(pContext);
|
int NumSamples = WavpackGetNumSamples(pContext);
|
||||||
int BitsPerSample = WavpackGetBitsPerSample(pContext);
|
int BitsPerSample = WavpackGetBitsPerSample(pContext);
|
||||||
|
@ -548,32 +591,32 @@ int CSound::LoadOpus(const char *pFilename)
|
||||||
if(!m_pStorage)
|
if(!m_pStorage)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
|
IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
|
||||||
if(!ms_File)
|
if(!File)
|
||||||
{
|
{
|
||||||
dbg_msg("sound/opus", "failed to open file. filename='%s'", pFilename);
|
dbg_msg("sound/opus", "failed to open file. filename='%s'", pFilename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SampleID = AllocID();
|
int SampleID = AllocID();
|
||||||
int DataSize = io_length(ms_File);
|
int DataSize = io_length(File);
|
||||||
if(SampleID < 0 || DataSize <= 0)
|
if(SampleID < 0 || DataSize <= 0)
|
||||||
{
|
{
|
||||||
io_close(ms_File);
|
io_close(File);
|
||||||
ms_File = NULL;
|
File = NULL;
|
||||||
dbg_msg("sound/opus", "failed to open file. filename='%s'", pFilename);
|
dbg_msg("sound/opus", "failed to open file. filename='%s'", pFilename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read the whole file into memory
|
// read the whole file into memory
|
||||||
char *pData = new char[DataSize];
|
char *pData = new char[DataSize];
|
||||||
io_read(ms_File, pData, DataSize);
|
io_read(File, pData, DataSize);
|
||||||
|
|
||||||
SampleID = DecodeOpus(SampleID, pData, DataSize);
|
SampleID = DecodeOpus(SampleID, pData, DataSize);
|
||||||
|
|
||||||
delete[] pData;
|
delete[] pData;
|
||||||
io_close(ms_File);
|
io_close(File);
|
||||||
ms_File = NULL;
|
File = NULL;
|
||||||
|
|
||||||
if(g_Config.m_Debug)
|
if(g_Config.m_Debug)
|
||||||
dbg_msg("sound/opus", "loaded %s", pFilename);
|
dbg_msg("sound/opus", "loaded %s", pFilename);
|
||||||
|
@ -598,32 +641,32 @@ int CSound::LoadWV(const char *pFilename)
|
||||||
if(!m_pStorage)
|
if(!m_pStorage)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
|
IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
|
||||||
if(!ms_File)
|
if(!File)
|
||||||
{
|
{
|
||||||
dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
|
dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SampleID = AllocID();
|
int SampleID = AllocID();
|
||||||
int DataSize = io_length(ms_File);
|
int DataSize = io_length(File);
|
||||||
if(SampleID < 0 || DataSize <= 0)
|
if(SampleID < 0 || DataSize <= 0)
|
||||||
{
|
{
|
||||||
io_close(ms_File);
|
io_close(File);
|
||||||
ms_File = NULL;
|
File = NULL;
|
||||||
dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
|
dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read the whole file into memory
|
// read the whole file into memory
|
||||||
char *pData = new char[DataSize];
|
char *pData = new char[DataSize];
|
||||||
io_read(ms_File, pData, DataSize);
|
io_read(File, pData, DataSize);
|
||||||
|
|
||||||
SampleID = DecodeWV(SampleID, pData, DataSize);
|
SampleID = DecodeWV(SampleID, pData, DataSize);
|
||||||
|
|
||||||
delete[] pData;
|
delete[] pData;
|
||||||
io_close(ms_File);
|
io_close(File);
|
||||||
ms_File = NULL;
|
File = NULL;
|
||||||
|
|
||||||
if(g_Config.m_Debug)
|
if(g_Config.m_Debug)
|
||||||
dbg_msg("sound/wv", "loaded %s", pFilename);
|
dbg_msg("sound/wv", "loaded %s", pFilename);
|
||||||
|
@ -930,6 +973,4 @@ void CSound::StopVoice(CVoiceHandle Voice)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IOHANDLE CSound::ms_File = 0;
|
|
||||||
|
|
||||||
IEngineSound *CreateEngineSound() { return new CSound; }
|
IEngineSound *CreateEngineSound() { return new CSound; }
|
||||||
|
|
|
@ -25,8 +25,6 @@ public:
|
||||||
static void RateConvert(int SampleID);
|
static void RateConvert(int SampleID);
|
||||||
|
|
||||||
// TODO: Refactor: clean this mess up
|
// TODO: Refactor: clean this mess up
|
||||||
static IOHANDLE ms_File;
|
|
||||||
static int ReadData(void *pBuffer, int Size);
|
|
||||||
static int DecodeWV(int SampleID, const void *pData, unsigned DataSize);
|
static int DecodeWV(int SampleID, const void *pData, unsigned DataSize);
|
||||||
static int DecodeOpus(int SampleID, const void *pData, unsigned DataSize);
|
static int DecodeOpus(int SampleID, const void *pData, unsigned DataSize);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "gamecore.h"
|
#include "gamecore.h"
|
||||||
|
|
||||||
#include <engine/shared/config.h>
|
#include <engine/shared/config.h>
|
||||||
#include <engine/server/server.h>
|
|
||||||
const char *CTuningParams::ms_apNames[] =
|
const char *CTuningParams::ms_apNames[] =
|
||||||
{
|
{
|
||||||
#define MACRO_TUNING_PARAM(Name,ScriptName,Value,Description) #ScriptName,
|
#define MACRO_TUNING_PARAM(Name,ScriptName,Value,Description) #ScriptName,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#ifndef GAME_VERSION_H
|
#ifndef GAME_VERSION_H
|
||||||
#define GAME_VERSION_H
|
#define GAME_VERSION_H
|
||||||
#include "generated/nethash.cpp"
|
#include <game/generated/nethash.cpp>
|
||||||
#define GAME_VERSION "0.6.4, 11.0.3"
|
#define GAME_VERSION "0.6.4, 11.0.3"
|
||||||
#define GAME_NETVERSION "0.6 626fce9a778df4d4"
|
#define GAME_NETVERSION "0.6 626fce9a778df4d4"
|
||||||
#define GAME_RELEASE_VERSION "11.0.3"
|
#define GAME_RELEASE_VERSION "11.0.3"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <base/math.h>
|
#include <base/math.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
#include <pnglite.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#include <game/mapitems.h>
|
#include <game/mapitems.h>
|
||||||
#include <game/gamecore.h>
|
#include <game/gamecore.h>
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
|
||||||
#include <engine/shared/datafile.h>
|
#include <engine/shared/datafile.h>
|
||||||
#include <engine/storage.h>
|
#include <engine/storage.h>
|
||||||
|
|
||||||
|
#include <pnglite.h>
|
||||||
|
|
||||||
bool Process(IStorage *pStorage, char **pMapNames)
|
bool Process(IStorage *pStorage, char **pMapNames)
|
||||||
{
|
{
|
||||||
CDataFileReader Maps[2];
|
CDataFileReader Maps[2];
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// Adapted from TWMapImagesRecovery by Tardo: https://github.com/Tardo/TWMapImagesRecovery
|
// Adapted from TWMapImagesRecovery by Tardo: https://github.com/Tardo/TWMapImagesRecovery
|
||||||
#include <game/mapitems.h>
|
#include <game/mapitems.h>
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
|
||||||
#include <engine/shared/datafile.h>
|
#include <engine/shared/datafile.h>
|
||||||
#include <engine/storage.h>
|
#include <engine/storage.h>
|
||||||
|
|
||||||
|
#include <pnglite.h>
|
||||||
|
|
||||||
bool Process(IStorage *pStorage, const char *pMapName, const char *pPathSave)
|
bool Process(IStorage *pStorage, const char *pMapName, const char *pPathSave)
|
||||||
{
|
{
|
||||||
CDataFileReader Map;
|
CDataFileReader Map;
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
#include <base/math.h>
|
#include <base/math.h>
|
||||||
#include <engine/shared/datafile.h>
|
#include <engine/shared/datafile.h>
|
||||||
#include <engine/storage.h>
|
#include <engine/storage.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
|
||||||
#include <engine/graphics.h>
|
#include <engine/graphics.h>
|
||||||
#include <game/mapitems.h>
|
#include <game/mapitems.h>
|
||||||
|
|
||||||
|
#include <pnglite.h>
|
||||||
/*
|
/*
|
||||||
Usage: map_replace_image <source map filepath> <dest map filepath> <current image name> <new image filepath>
|
Usage: map_replace_image <source map filepath> <dest map filepath> <current image name> <new image filepath>
|
||||||
Notes: map filepath must be relative to user default teeworlds folder
|
Notes: map filepath must be relative to user default teeworlds folder
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#include <base/math.h>
|
#include <base/math.h>
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
|
||||||
|
#include <pnglite.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
|
||||||
|
#include <pnglite.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#include <base/math.h>
|
#include <base/math.h>
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
|
||||||
|
#include <pnglite.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#include <base/math.h>
|
#include <base/math.h>
|
||||||
#include <base/system.h>
|
#include <base/system.h>
|
||||||
#include <engine/external/pnglite/pnglite.h>
|
|
||||||
|
#include <pnglite.h>
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue