Skip to content
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

[dylib] New port #34578

Merged
merged 9 commits into from
Oct 27, 2023
Merged

[dylib] New port #34578

merged 9 commits into from
Oct 27, 2023

Conversation

martin-olivier
Copy link
Contributor

  • Changes comply with the maintainer guide
  • The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines.
  • Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all find_package calls are REQUIRED, are satisfied by vcpkg.json's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx
  • The versioning scheme in vcpkg.json matches what upstream says.
  • The license declaration in vcpkg.json matches what upstream says.
  • The installed as the "copyright" file matches what upstream says.
  • The source code of the component installed comes from an authoritative source.
  • The generated "usage text" is accurate. See adding-usage for context.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is in the new port's versions file.
  • Only one version is added to each modified port's versions file.

Signed-off-by: Martin Olivier <martin.olivier@live.fr>
@martin-olivier
Copy link
Contributor Author

@microsoft-github-policy-service agree

@JonLiu1993 JonLiu1993 added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Oct 19, 2023
Signed-off-by: Martin Olivier <martin.olivier@live.fr>
Signed-off-by: Martin Olivier <martin.olivier@live.fr>
martin-olivier and others added 5 commits October 24, 2023 15:26
Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com>
Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com>
Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com>
@martin-olivier
Copy link
Contributor Author

Thanks for your review @JonLiu1993

I have an issue with the installation of the port.

vcpkg install dylib

[...]
Elapsed time to handle dylib:x64-windows: 7.5 s
Total install time: 8.3 s
dylib is header-only and can be used from CMake via:

    find_path(DYLIB_INCLUDE_DIRS "dylib.hpp")
    target_include_directories(main PRIVATE ${DYLIB_INCLUDE_DIRS})

Then, when building a project that uses dylib:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
C:/Users/molivier/Downloads/dylib/example/DYLIB_INCLUDE_DIRS
   used as include directory in directory C:/Users/molivier/Downloads/dylib/example

I expect something like cxxopts since it's a single file header only library like dylib

Elapsed time to handle cxxopts:x64-windows: 6.7 s
Total install time: 7.4 s
cxxopts provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(cxxopts CONFIG REQUIRED)
  target_link_libraries(main PRIVATE cxxopts::cxxopts)

@JonLiu1993
Copy link
Member

@martin-olivier, I tested the usage on my machine by your PR and I tested successfully.
CMakeLists.txt:

cmake_minimum_required (VERSION 3.8)

project(test)

find_path(DYLIB_INCLUDE_DIRS "dylib.hpp")
# Add source to this project's executable.
add_executable (test "usageTest.cpp")

target_include_directories(test PRIVATE ${DYLIB_INCLUDE_DIRS})

usageTest.cpp:

#include <stdio.h>
#include <dylib.hpp>

int main()
{
    printf("%s\n", "HELLO WORLD");
    return 0;
}

config:

1> CMake generation started for configuration: 'x64-Debug'.
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Visual Studio 17 2022" -A x64  -DCMAKE_CONFIGURATION_TYPES:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\v-test\source\repos\usageTest\out\install\x64-Debug" -DCMAKE_TOOLCHAIN_FILE=F:/Feature-test/dylib/vcpkg/scripts/buildsystems/vcpkg.cmake "C:\Users\v-test\source\repos\usageTest" 2>&1"
1> Working directory: C:\Users\v-test\source\repos\usageTest\out\build\x64-Debug
1> [CMake] -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
1> [CMake] -- The C compiler identification is MSVC 19.36.32538.0
1> [CMake] -- The CXX compiler identification is MSVC 19.36.32538.0
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - done
1> [CMake] -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting C compile features
1> [CMake] -- Detecting C compile features - done
1> [CMake] -- Detecting CXX compiler ABI info
1> [CMake] -- Detecting CXX compiler ABI info - done
1> [CMake] -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting CXX compile features
1> [CMake] -- Detecting CXX compile features - done
1> [CMake] -- Configuring done (12.7s)
1> [CMake] -- Generating done (0.0s)
1> [CMake] -- Build files have been written to: C:/Users/v-test/source/repos/usageTest/out/build/x64-debug
1> Extracted CMake variables.
1> Extracted source files and headers.
1> Extracted code model.
1> Extracted toolchain configurations.
1> Extracted includes paths.
1> CMake generation finished.

build:

>------ Build All started: Project: usageTest, Configuration: x64-Debug ------
  MSBuild version 17.6.3+07e294721 for .NET Framework
  
    Checking Build System
    Building Custom Rule C:/Users/v-test/source/repos/usageTest/usageTest/CMakeLists.txt
    usageTest.cpp
    test.vcxproj -> C:\Users\v-test\source\repos\usageTest\out\build\x64-debug\usageTest\Debug\test.exe
    Building Custom Rule C:/Users/v-test/source/repos/usageTest/CMakeLists.txt

Build All succeeded.

@martin-olivier
Copy link
Contributor Author

Hello @JonLiu1993,

Sorry, I forgot to specify the CMAKE_TOOLCHAIN_FILE for my previous build.

I have re-tested it and it works well.

@martin-olivier martin-olivier marked this pull request as ready for review October 26, 2023 12:08
@JonLiu1993 JonLiu1993 added the info:reviewed Pull Request changes follow basic guidelines label Oct 27, 2023
@data-queue data-queue merged commit e712423 into microsoft:master Oct 27, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR! info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants