fix Windows eventloop crash

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9510 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 50f2810b869040a5343e3b322cbd8f3dbcc09cc1
Former-commit-id: 6e4960da072b9cc99bf3540561bb15fe853f9e70
This commit is contained in:
iobyte 2024-07-31 01:03:57 +00:00
parent e06a519365
commit d7262c6526
6 changed files with 186 additions and 10 deletions

View file

@ -363,4 +363,24 @@ MACRO(CHECK_LIBRARIES)
MESSAGE(STATUS "Looking for library TinyGLTF - NOT found")
ENDIF(TINYGLTF_FOUND)
# cJSON
Find_Package(cJSON)
IF(CJSON_FOUND)
SET(HAVE_CJSON 1)
MESSAGE(STATUS "Looking for library cJSON - found")
ELSE(CJSON_FOUND)
MESSAGE(STATUS "Looking for library cJSON - NOT found")
ENDIF(CJSON_FOUND)
# minizip
Find_Package(minizip)
IF(MINIZIP_FOUND)
SET(HAVE_MINIZIP 1)
MESSAGE(STATUS "Looking for library minizip - found")
ELSE(MINIZIP_FOUND)
MESSAGE(STATUS "Looking for library GLM - NOT found")
ENDIF(MINIZIP_FOUND)
ENDMACRO(CHECK_LIBRARIES)

View file

@ -201,6 +201,18 @@ MACRO(_FIND_3RDPARTY_DEPENDENCIES ROOT_DIR)
ENDIF(ZLIB_FOUND)
# GLM.
_FIND_3RDPARTY_DEPENDENCY(GLM glm/glm.hpp.h "" "glm;libglm" ${ROOT_DIR} "")
# TinyGLTF.
_FIND_3RDPARTY_DEPENDENCY(TINYGLTF tinygltf.h "" "gltf;libgltf" ${ROOT_DIR} "")
# minizip.
_FIND_3RDPARTY_DEPENDENCY(MINIZIP minizip/zip.h "" "minizip;libminizip" ${ROOT_DIR} "")
# cJSON.
_FIND_3RDPARTY_DEPENDENCY(CJSON cjson/cJSON.h "" "cjson;libcjson" ${ROOT_DIR} "")
ENDMACRO(_FIND_3RDPARTY_DEPENDENCIES ROOT_DIR)
################################################################################################
@ -385,9 +397,18 @@ MACRO(SD_INSTALL_CUSTOM_3RDPARTY TARGET_NAME)
_FIND_3RDPARTY_DLL("${CURL_LIBRARY}" "curl" "lib" _DLL_PATHNAME)
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
_FIND_3RDPARTY_DLL("${GLM_LIBRARY}" "glm" "lib" _DLL_PATHNAME)
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
_FIND_3RDPARTY_DLL("${TINYGLTF_LIBRARY}" "tinygltf" "lib" _DLL_PATHNAME)
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
_FIND_3RDPARTY_DLL("${CJSON_LIBRARY}" "cjson" "lib" _DLL_PATHNAME)
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
_FIND_3RDPARTY_DLL("${MINIZIP_LIBRARY}" "minizip" "lib" _DLL_PATHNAME)
LIST(APPEND _THIRDPARTY_DLL_PATHNAMES "${_DLL_PATHNAME}")
# 2) Copy found 3rd party DLL files to the bin folder (for running without installing).
#MESSAGE(STATUS "3rdParty dependencies : Will install ${_THIRDPARTY_DLL_PATHNAMES}")
SET(_NOINST_DIR "${CMAKE_BINARY_DIR}/${SD_BINDIR}")

View file

@ -553,15 +553,18 @@ else(OPTION_TINYGLTF)
endif(OPTION_TINYGLTF)
if(OPTION_MINIZIP)
set(MINIZIP_ARGS ${EXTERNALS_CMAKE_ARGS} -D CMAKE_DEBUG_POSTFIX=
-D MZ_ZSTD=OFF
-D MZ_BZIP2=OFF
-D MZ_LZMA=OFF )
set(MINIZIP_ARGS ${EXTERNALS_CMAKE_ARGS} -D CMAKE_DEBUG_POSTFIX= _D ZEXPORT="dllexport")
ExternalProject_Add(${MINIZIP_PROJECT}
URL ${MINIZIP_URL}
URL_HASH ${MINIZIP_HASH}
CMAKE_ARGS ${MINIZIP_ARGS}
DEPENDS ${ZLIB_PROJECT})
ExternalProject_Add_Step(${MINIZIP_PROJECT} minizip_add_cmake
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/patches/minizip-1.3.CMakeLists.txt"
"<SOURCE_DIR>/CMakeLists.txt"
DEPENDEES update # do after update
DEPENDERS patch) # do before patch
else(OPTION_MINIZIP)
set(MINIZIP_PROJECT )
endif(OPTION_MINIZIP)

View file

@ -0,0 +1,132 @@
# author Philippe Verney from F2I-CONSULTING
cmake_minimum_required(VERSION 3.6)
project(minizip VERSION 1.1)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
find_package(ZLIB)
add_library(${PROJECT_NAME} "")
add_library(minizip::${PROJECT_NAME} ALIAS minizip)
target_sources(${PROJECT_NAME}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/crypt.h"
"${CMAKE_CURRENT_LIST_DIR}/ioapi.c"
"${CMAKE_CURRENT_LIST_DIR}/ioapi.h"
"${CMAKE_CURRENT_LIST_DIR}/unzip.h"
"${CMAKE_CURRENT_LIST_DIR}/unzip.c"
"${CMAKE_CURRENT_LIST_DIR}/zip.h"
"${CMAKE_CURRENT_LIST_DIR}/zip.c"
)
if(WIN32)
target_sources(${PROJECT_NAME}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/iowin32.h"
"${CMAKE_CURRENT_LIST_DIR}/iowin32.c"
)
endif()
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB)
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
set_target_properties(${PROJECT_NAME} PROPERTIES ${CMAKE_DEBUG_POSTFIX} EXPORT_NAME minizip)
include(GNUInstallDirs)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT minizip_headers
FILES_MATCHING PATTERN "*.h"
PATTERN ".git" EXCLUDE
REGEX "iowin32.h" EXCLUDE
)
if(WIN32)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iowin32.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT minizip_headers
)
endif()
include(CMakePackageConfigHelpers)
######## 1. Build tree
export(TARGETS ${PROJECT_NAME}
NAMESPACE minizip::
FILE "${CMAKE_BINARY_DIR}/lib/cmake/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake"
)
export(PACKAGE ${PROJECT_NAME})
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in"
"${CMAKE_BINARY_DIR}/lib/cmake/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_BINARY_DIR}/lib/cmake/${PROJECT_NAME}"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/lib/cmake/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY ExactVersion
)
######## 2. Install tree
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT ${PROJECT_NAME}_applications
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${PROJECT_NAME}_libraries
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${PROJECT_NAME}_libraries
)
install(EXPORT ${PROJECT_NAME}Targets
NAMESPACE minizip::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
COMPONENT ${PROJECT_NAME}_libraries
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in"
"${CMAKE_BINARY_DIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
install(FILES "${CMAKE_BINARY_DIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
COMPONENT ${PROJECT_NAME}_libraries
)
write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY ExactVersion
)
install(FILES "${CMAKE_BINARY_DIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
COMPONENT ${PROJECT_NAME}_libraries
)

View file

@ -223,11 +223,11 @@ set(TINYGLTF_URL https://github.com/syoyo/tinygltf/archive/refs/tags/v${TINYGLTF
set(TINYGLTF_HASH SHA256=97c3eb1080c1657cd749d0b49af189c6a867d5af30689c48d5e19521e7b5a070)
# minizip
set(MINIZIP_VERSION 4.0.7)
set(MINIZIP_VERSION 1.3)
set(MINIZIP_PROJECT minizip-${MINIZIP_VERSION})
set(MINIZIP_FILE ${MINIZIP_PROJECT}.tar.gz)
set(MINIZIP_URL https://github.com/zlib-ng/minizip-ng/archive/refs/tags/${MINIZIP_VERSION}.tar.gz)
set(MINIZIP_HASH SHA256=a87f1f734f97095fe1ef0018217c149d53d0f78438bcb77af38adc21dff2dfbc)
set(MINIZIP_URL https://github.com/F2I-Consulting/Minizip/archive/refs/tags/v1.3_cmake0.1.tar.gz)
set(MINIZIP_HASH SHA256=4ab1ffdc954e10faf2e756bd26e52ac4c339389159725dacb3d9104560f7f1a3)
# cjson
set(CJSON_VERSION 1.7.18)

View file

@ -46,9 +46,9 @@ class GfEventLoop::Private
void (*cbKeyboardDown)(int key, int modifiers, int x, int y);
void (*cbKeyboardUp)(int key, int modifiers, int x, int y);
void (*cbRecompute)(void);
void (*cbRecomputeArgsFn)(unsigned ms, void *args);
void *cbRecomputeArgsData;
void (*cbRecompute)(void) = nullptr;
void (*cbRecomputeArgsFn)(unsigned ms, void *args) = nullptr;
void *cbRecomputeArgsData = nullptr;
void (*cbTimer)(int value);