aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>2019-08-27 15:53:18 -0700
committerPhil Christensen <philc@microsoft.com>2019-08-27 15:53:18 -0700
commit408990caef15655705d407aff4f5edb32916add0 (patch)
treea0cad901fd3f19e5dadf705a215666dfb13086dc
parent4fd3b5bfbb2edb97a553666842a6232f227f95b7 (diff)
downloadvcpkg-408990caef15655705d407aff4f5edb32916add0.tar.gz
vcpkg-408990caef15655705d407aff4f5edb32916add0.zip
[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
-rw-r--r--ports/minifb/CONTROL4
-rw-r--r--ports/minifb/fix-arm-build-error.patch40
-rw-r--r--ports/minifb/fix-build-error.patch25
-rw-r--r--ports/minifb/fix-install-error.patch54
-rw-r--r--ports/minifb/portfile.cmake32
5 files changed, 155 insertions, 0 deletions
diff --git a/ports/minifb/CONTROL b/ports/minifb/CONTROL
new file mode 100644
index 000000000..cff3a97c0
--- /dev/null
+++ b/ports/minifb/CONTROL
@@ -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.
diff --git a/ports/minifb/fix-arm-build-error.patch b/ports/minifb/fix-arm-build-error.patch
new file mode 100644
index 000000000..66579d449
--- /dev/null
+++ b/ports/minifb/fix-arm-build-error.patch
@@ -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)
diff --git a/ports/minifb/fix-build-error.patch b/ports/minifb/fix-build-error.patch
new file mode 100644
index 000000000..e1a4c0775
--- /dev/null
+++ b/ports/minifb/fix-build-error.patch
@@ -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;
diff --git a/ports/minifb/fix-install-error.patch b/ports/minifb/fix-install-error.patch
new file mode 100644
index 000000000..64f5af046
--- /dev/null
+++ b/ports/minifb/fix-install-error.patch
@@ -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)
diff --git a/ports/minifb/portfile.cmake b/ports/minifb/portfile.cmake
new file mode 100644
index 000000000..d4ea8c676
--- /dev/null
+++ b/ports/minifb/portfile.cmake
@@ -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) \ No newline at end of file