Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions ports/wincpp/fix-install-and-w32.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9d5adce..eff939d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_path(SET include_dir "${CMAKE_CURRENT_SOURCE_DIR}/../include")
-
+include(GNUInstallDirs)
# Add the header files to the project
set(header_files
"${include_dir}/wincpp/process.hpp"
@@ -36,21 +36,21 @@ set(header_files

# Add the library to the project
add_library(_wincpp_core INTERFACE)
-
# Add the include directory to the project
-target_sources(_wincpp_core INTERFACE ${header_files})
+target_sources(_wincpp_core INTERFACE $<BUILD_INTERFACE:${header_files}>)
Comment on lines +18 to +19
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, what did upstream want to achieve? Is it still achieved after this change? Do we need a test port?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To the best of my understanding this doesn't actually do anything? INTERFACE says only applies to linkers but BUILD_INTERFACE says only applies during build...


# Add the include directories
target_include_directories(_wincpp_core SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/wincpp>
)

# Add the library to the project
-add_library(wincpp STATIC)
+add_library(wincpp)
+set_target_properties(wincpp PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder, this is not accepted in vcpkg.
https://learn.microsoft.com/en-us/vcpkg/contributing/maintainer-guide#do-not-add-cmake_windows_export_all_symbols
(That CMake variable determines the propery.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you can use vcpkg_check_linkage(ONLY_STATIC_LIBRARY)


# Link the library to the core
-target_link_libraries(wincpp INTERFACE _wincpp_core)
+target_link_libraries(wincpp PUBLIC _wincpp_core)

# Add the source files to the project
target_sources(wincpp PRIVATE
@@ -89,3 +89,38 @@ target_sources(wincpp PRIVATE

# Add the include directory to the project
target_include_directories(wincpp PRIVATE ${include_dir})
+
+# Install wincpp library
+install(TARGETS wincpp _wincpp_core EXPORT wincpp-export
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../include/wincpp" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/wincppConfigVersion.cmake"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a vcpkg_cmake_config_fixup call for this?

+ VERSION 1.5.3.6
+ COMPATIBILITY AnyNewerVersion
+)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/wincppConfig.cmake"
+ "include(\${CMAKE_CURRENT_LIST_DIR}/wincppTargets.cmake)\n"
+)
+
+set(wincpp_CONFFILE_DEST "${CMAKE_INSTALL_DATAROOTDIR}/wincpp")
+
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/wincppConfig.cmake"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder, the "unofficial" prefix must be used for config and targets unless provided officially by upstream.

+ "${CMAKE_CURRENT_BINARY_DIR}/wincppConfigVersion.cmake"
+ DESTINATION ${wincpp_CONFFILE_DEST}
+)
+
+install(EXPORT wincpp-export
+ FILE wincppTargets.cmake
+ NAMESPACE wincpp::
+ DESTINATION ${wincpp_CONFFILE_DEST}
+)
diff --git a/src/memory_factory.cpp b/src/memory_factory.cpp
index 50cd83d..82c1474 100644
--- a/src/memory_factory.cpp
+++ b/src/memory_factory.cpp
@@ -24,7 +24,7 @@ namespace wincpp
}
case wincpp::memory_type::remote_t:
{
- std::size_t read;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what this is doing and/or submit it upstream?

+ SIZE_T read;

if ( !ReadProcessMemory( p->handle->native, reinterpret_cast< void* >( address ), buffer, size, &read ) || read != size )
return false;
@@ -61,7 +61,7 @@ namespace wincpp
}
case wincpp::memory_type::remote_t:
{
- std::size_t written;
+ SIZE_T written;

WriteProcessMemory( p->handle->native, reinterpret_cast< void* >( address ), buffer, size, &written );
return written;
@@ -201,4 +201,4 @@ namespace wincpp

return nullptr;
}
-} // namespace wincpp
\ No newline at end of file
+} // namespace wincpp
22 changes: 22 additions & 0 deletions ports/wincpp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
vcpkg_from_github(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this file to LF line endings.

OUT_SOURCE_PATH SOURCE_PATH
REPO atrexus/wincpp
REF "v${VERSION}"
SHA512 43674f7e899ce1d4088ad76f4f224c8202aa6af508211cbbae69366ca6467cf61520e0c65d852d0ad805045e9b3d69d414b6ba434d4c8b64becac120d28df294
HEAD_REF main
PATCHES
fix-install-and-w32.patch
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_EXAMPLES=OFF
-DBUILD_PACKAGE=OFF
Comment on lines +14 to +15
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-DBUILD_EXAMPLES=OFF
-DBUILD_PACKAGE=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_PACKAGE=OFF

)

vcpkg_cmake_install()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
13 changes: 13 additions & 0 deletions ports/wincpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "wincpp",
"version": "1.5.3.6",
"description": "A fully featured Win32 wrapper written in modern C++",
"license": "MIT",
"supports": "windows",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -10776,6 +10776,10 @@
"baseline": "0.4.6",
"port-version": 1
},
"wincpp": {
"baseline": "1.5.3.6",
"port-version": 0
},
"wincrypt": {
"baseline": "0.0",
"port-version": 4
Expand Down
9 changes: 9 additions & 0 deletions versions/w-/wincpp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "b68b4c8b039836d63d3092c3c1545b90ae3400a4",
"version": "1.5.3.6",
"port-version": 0
}
]
}