diff --git a/ports/gainput/CONTROL b/ports/gainput/CONTROL index 834f5d6fc..70ec0210f 100644 --- a/ports/gainput/CONTROL +++ b/ports/gainput/CONTROL @@ -1,4 +1,4 @@ Source: gainput -Version: 1.0.0-2 +Version: 1.0.0-3 Homepage: https://github.com/jkuhlmann/gainput Description: Gainput is a multiplatform C++ input library, supporting mouse, keyboard and controllers diff --git a/ports/gainput/install_as_cmake_package.patch b/ports/gainput/install_as_cmake_package.patch new file mode 100644 index 000000000..aaee43a2f --- /dev/null +++ b/ports/gainput/install_as_cmake_package.patch @@ -0,0 +1,69 @@ +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index 14d5e85..cb7232f 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -30,19 +30,27 @@ if (GAINPUT_BUILD_SHARED) + endif (GAINPUT_BUILD_SHARED) + + if (GAINPUT_BUILD_STATIC) +- message(STATUS "..Building shared libraries (-DGAINPUT_BUILD_STATIC=OFF to disable)") ++ message(STATUS "..Building static libraries (-DGAINPUT_BUILD_STATIC=OFF to disable)") + add_library(gainputstatic STATIC ${sources} ${mmsources}) + set_target_properties(gainputstatic PROPERTIES DEBUG_POSTFIX -d FOLDER gainput) + set(install_libs ${install_libs} gainputstatic) + endif (GAINPUT_BUILD_STATIC) + + if(WIN32) +- target_link_libraries(gainput ${XINPUT} ws2_32) +- target_link_libraries(gainputstatic ${XINPUT} ws2_32) ++ if (GAINPUT_BUILD_SHARED) ++ target_link_libraries(gainput ${XINPUT} ws2_32) ++ endif(GAINPUT_BUILD_SHARED) ++ if(GAINPUT_BUILD_STATIC) ++ target_link_libraries(gainputstatic ${XINPUT} ws2_32) ++ endif(GAINPUT_BUILD_STATIC) + add_definitions(-DGAINPUT_LIB_DYNAMIC=1) + elseif(ANDROID) +- target_link_libraries(gainputstatic native_app_glue log android) +- target_link_libraries(gainput native_app_glue log android) ++ if (GAINPUT_BUILD_SHARED) ++ target_link_libraries(gainput native_app_glue log android) ++ endif(GAINPUT_BUILD_SHARED) ++ if(GAINPUT_BUILD_STATIC) ++ target_link_libraries(gainputstatic native_app_glue log android) ++ endif(GAINPUT_BUILD_STATIC) + elseif(APPLE) + find_library(FOUNDATION Foundation) + find_library(IOKIT IOKit) +@@ -65,6 +73,14 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + endif(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + ++foreach(t ${install_libs}) ++ target_include_directories( ++ ${t} ++ INTERFACE $ ++ $ ++ ) ++endforeach() ++ + install( + DIRECTORY "include/gainput" + DESTINATION "include" +@@ -73,7 +89,15 @@ install( + + install( + TARGETS ${install_libs} ++ EXPORT unofficial-${PROJECT_NAME}-Targets + LIBRARY DESTINATION "${libdir}" + ARCHIVE DESTINATION "${libdir}" + RUNTIME DESTINATION "bin" + ) ++ ++install( ++ EXPORT unofficial-${PROJECT_NAME}-Targets ++ FILE unofficial-${PROJECT_NAME}Config.cmake ++ NAMESPACE unofficial::${PROJECT_NAME}:: ++ DESTINATION share/unofficial-${PROJECT_NAME} ++) +\ No newline at end of file diff --git a/ports/gainput/portfile.cmake b/ports/gainput/portfile.cmake index b84ed79dc..4c568f171 100644 --- a/ports/gainput/portfile.cmake +++ b/ports/gainput/portfile.cmake @@ -6,26 +6,34 @@ vcpkg_from_github( REF v1.0.0 SHA512 56fdc4c0613d7260861885b270ebe9e624e940175f41e3ac82516e2eb0d6d229e405fbcc2e54608e7d6751c1d8658b5b5e186153193badc6487274cb284a8cd6 HEAD_REF master + PATCHES + "install_as_cmake_package.patch" ) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(GAINPUT_BUILD_SHARED OFF) + set(GAINPUT_BUILD_STATIC ON) +else() + set(GAINPUT_BUILD_SHARED ON) + set(GAINPUT_BUILD_STATIC OFF) +endif() +if(APPLE) + set(GAINPUT_BUILD_SHARED ON) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS + -DGAINPUT_BUILD_SHARED=${GAINPUT_BUILD_SHARED} + -DGAINPUT_BUILD_STATIC=${GAINPUT_BUILD_STATIC} -DGAINPUT_TESTS=OFF -DGAINPUT_SAMPLES=OFF ) vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-gainput TARGET_PATH share/unofficial-gainput) vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/gainputstatic.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gainputstatic.lib ${CURRENT_PACKAGES_DIR}/lib/gainput.lib) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gainputstaticd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/gainputd.lib) - endif() -endif() - file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 3e83be2f3..61e8d8629 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -504,7 +504,6 @@ g3log:x64-uwp=fail gainput:arm-uwp=fail gainput:x64-linux=fail gainput:x64-uwp=fail -gainput:x64-windows-static=fail gamma:x64-linux=fail gamma:x64-osx=fail gasol:arm64-windows=fail