-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libmem] add new port #41345
[libmem] add new port #41345
Conversation
@microsoft-github-policy-service agree |
This will need many changes.
Does it really have to use nmake? This limits the port to Windows hosts. |
Removed GENERATOR "NMake Makefiles" enforcing line.
Added keystone & capstone deps
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_CRT_LINKAGE STREQUAL "static")
list(APPEND ADDITIONAL_OPTIONS
-DITK_MSVC_STATIC_RUNTIME_LIBRARY=ON
-DITK_MSVC_STATIC_CRT=ON
)
endif() Maybe I should enforce Unix Makefiles generator for x64-osx ? |
I tried to fix vcpkg.json for LLVM but it did not work, it just fallback to default features of LLVM package. |
In a port manifest, |
I got below error when I test the usage of
|
We could go for Findkeystone.cmake. |
The module you had didn't solve the problem but just added a layer of indirection. (#41345 (comment)).
It does, when building libmem. That's why building succeeds. The problem occurs when using libmem (exported config). |
Can you please provide more information about further changes that should be done @dg0yt ? Do we need to remain everything as is and change .cmake.in file like this @PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(capstone CONFIG REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/libmem-target.cmake")
set(INSTALLED_ROOT "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}")
set(KEYSTONE_LIBRARY_DIRS "${INSTALLED_ROOT}/lib")
set(KEYSTONE_INCLUDE_DIRS "${INSTALLED_ROOT}/include")
find_path(KEYSTONE_INCLUDE_DIR
NAMES keystone.h
PATHS ${KEYSTONE_INCLUDE_DIRS}
PATH_SUFFIXES keystone
REQUIRED
)
find_library(KEYSTONE_LIBRARY_DEBUG
NAMES keystoned
PATHS ${KEYSTONE_LIBRARY_DIRS}
PATH_SUFFIXES debug
REQUIRED
)
find_library(KEYSTONE_LIBRARY_RELEASE
NAMES keystone
PATHS ${KEYSTONE_LIBRARY_DIRS}
REQUIRED
)
include(SelectLibraryConfigurations)
select_library_configurations(keystone)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
keystone
REQUIRED_VARS KEYSTONE_LIBRARY KEYSTONE_INCLUDE_DIR
)
target_link_libraries(libmem::libmem INTERFACE capstone::capstone ${KEYSTONE_LIBRARY})
#This line is redundant because we already have required dependencies
#check_required_components(libmem) Or I need to copy paste keystone search mechanics into CMakeLists.txt as well & link against found keystone? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do the right thing in CMakeLists.txt, you need do nothing in the exported cmake config.
Co-authored-by: Kai Pastor <[email protected]>
Co-authored-by: Kai Pastor <[email protected]>
Co-authored-by: Kai Pastor <[email protected]>
It's success over static builds but fails over dynamic builds due keystone linkage as for my side & as azure CI side in case of Windows OS. |
Tested over x86-windows working. |
Usage test passed with x64-windows-static. |
This is kind of a lot of patching, have these patches been submitted upstream? |
rdbo/libmem@04830fb It took lot of time to make CMakeLists.txt to behave expected way for vcpkg (dependencies & .in files), honestly I do not find idea of mimic that being created by upstream useful, hence vcpkg is tend to avoid using something like add_custom_command, execute_process & so on. |
Thanks! |
@BillyONeal "supports": "(windows | linux | freebsd) & (x86 | x64)" |
https://github.com/rdbo/libmem
It should be DLL or LIB.
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
is removed & followed upstream by rdbo/libmem@04830fb as patch.INTERFACE $<INSTALL_INTERFACE:include>
is applied.vcpkg_from_github
usesREF ${VERSION}
as param.vcpkg_find_acquire_program(PKGCONFIG)
, and pass it to CMake with"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
.