mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-22 18:47:09 +01:00
[minifb] Add new port (#7766)
* [minifb] Add new port * Fix arm build error * Add fix-arm-build-error.patch file * Update fix-arm-build-error.patch file
This commit is contained in:
parent
4fd3b5bfbb
commit
408990caef
4
ports/minifb/CONTROL
Normal file
4
ports/minifb/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: minifb
|
||||
Version: 2019-08-20-1
|
||||
Homepage: https://github.com/emoon/minifb
|
||||
Description: MiniFB (Mini FrameBuffer) is a small cross platform library that makes it easy to render (32-bit) pixels in a window.
|
40
ports/minifb/fix-arm-build-error.patch
Normal file
40
ports/minifb/fix-arm-build-error.patch
Normal file
@ -0,0 +1,40 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 06ba472..0f5874c 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -54,6 +54,27 @@ add_library(minifb STATIC
|
||||
${SrcLib}
|
||||
)
|
||||
|
||||
+if (WIN32)
|
||||
+add_executable(noise
|
||||
+ tests/noise.c
|
||||
+)
|
||||
+target_link_libraries(noise minifb Gdi32.lib)
|
||||
+
|
||||
+add_executable(input_events
|
||||
+ tests/input_events.c
|
||||
+)
|
||||
+target_link_libraries(input_events minifb Gdi32.lib)
|
||||
+
|
||||
+add_executable(input_events_cpp
|
||||
+ tests/input_events_cpp.cpp
|
||||
+)
|
||||
+target_link_libraries(input_events_cpp minifb Gdi32.lib)
|
||||
+
|
||||
+add_executable(multiple_windows
|
||||
+ tests/multiple_windows.c
|
||||
+)
|
||||
+target_link_libraries(multiple_windows minifb Gdi32.lib)
|
||||
+else()
|
||||
add_executable(noise
|
||||
tests/noise.c
|
||||
)
|
||||
@@ -73,6 +94,7 @@ add_executable(multiple_windows
|
||||
tests/multiple_windows.c
|
||||
)
|
||||
target_link_libraries(multiple_windows minifb)
|
||||
+endif()
|
||||
|
||||
if (MSVC)
|
||||
elseif (MINGW)
|
25
ports/minifb/fix-build-error.patch
Normal file
25
ports/minifb/fix-build-error.patch
Normal file
@ -0,0 +1,25 @@
|
||||
diff --git a/src/windows/WinMiniFB.c b/src/windows/WinMiniFB.c
|
||||
index 84ed0cb..b33f252 100644
|
||||
--- a/src/windows/WinMiniFB.c
|
||||
+++ b/src/windows/WinMiniFB.c
|
||||
@@ -19,7 +19,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT res = 0;
|
||||
|
||||
- SWindowData *window_data = (SWindowData *) GetWindowLongPtr(hWnd, GWL_USERDATA);
|
||||
+ SWindowData *window_data = (SWindowData *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||
SWindowData_Win *window_data_win = 0x0;
|
||||
if(window_data != 0x0) {
|
||||
window_data_win = (SWindowData_Win *) window_data->specific;
|
||||
diff --git a/tests/multiple_windows.c b/tests/multiple_windows.c
|
||||
index 4b301c0..29276be 100644
|
||||
--- a/tests/multiple_windows.c
|
||||
+++ b/tests/multiple_windows.c
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <MiniFB.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
+#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
#define kUnused(var) (void) var;
|
54
ports/minifb/fix-install-error.patch
Normal file
54
ports/minifb/fix-install-error.patch
Normal file
@ -0,0 +1,54 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 06ba472..6dc7988 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -17,6 +17,12 @@ file(GLOB SrcMacOSX "src/macosx/*.c"
|
||||
file(GLOB SrcWayland "src/wayland/*.c")
|
||||
file(GLOB SrcX11 "src/x11/*.c")
|
||||
|
||||
+file(GLOB HEADERS "include/*.h")
|
||||
+file(GLOB HeaderWindows "src/windows/*.h")
|
||||
+file(GLOB HeaderMacOSX "src/macosx/*.h")
|
||||
+file(GLOB HeaderWayland "src/wayland/*.h")
|
||||
+file(GLOB HeaderX11 "src/x11/*.h")
|
||||
+
|
||||
if (NOT MSVC)
|
||||
set (CMAKE_C_FLAGS "-g -Wall -Wextra -pedantic -Wno-switch -Wno-unused-function")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11")
|
||||
@@ -34,19 +40,24 @@ if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-D_WIN32_WINNT=0x0600)
|
||||
list (APPEND SrcLib ${SrcWindows})
|
||||
+ list (APPEND HEADERS ${HeaderWindows})
|
||||
elseif (MINGW)
|
||||
add_definitions(-D_WIN32_WINNT=0x0600)
|
||||
list(APPEND SrcLib ${SrcWindows})
|
||||
+ list (APPEND HEADERS ${HeaderWindows})
|
||||
elseif (APPLE)
|
||||
if(USE_METAL_API)
|
||||
add_definitions(-DUSE_METAL_API)
|
||||
endif()
|
||||
list(APPEND SrcLib ${SrcMacOSX})
|
||||
+ list (APPEND HEADERS ${HeaderMacOSX})
|
||||
elseif (UNIX)
|
||||
if(USE_WAYLAND_API)
|
||||
list(APPEND SrcLib ${SrcWayland})
|
||||
+ list (APPEND HEADERS ${HeaderWayland})
|
||||
else()
|
||||
list(APPEND SrcLib ${SrcX11})
|
||||
+ list (APPEND HEADERS ${HeaderX11})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -112,3 +123,11 @@ elseif (UNIX)
|
||||
target_link_libraries(multiple_windows -lX11)
|
||||
endif()
|
||||
endif()
|
||||
+
|
||||
+install(TARGETS minifb
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+ )
|
||||
+
|
||||
+install(FILES ${HEADERS} DESTINATION include)
|
32
ports/minifb/portfile.cmake
Normal file
32
ports/minifb/portfile.cmake
Normal file
@ -0,0 +1,32 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
message(FATAL_ERROR "${PORT} currently doesn't supports UWP.")
|
||||
endif()
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO emoon/minifb
|
||||
REF 25a440f8226f12b8014d24288ad0587724005afc
|
||||
SHA512 e54d86e43193d22263003a9539b11cc61cfd4a1b7093c982165cdd6e6f150b431a44e7d4dc8512b62b9853a7605e29cee19f85b8d25a34b3b530f9aa41a2f4a9
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-install-error.patch
|
||||
fix-build-error.patch
|
||||
fix-arm-build-error.patch
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
# Handle copyright
|
||||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
|
Loading…
x
Reference in New Issue
Block a user