-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[jinja2cpp] New port #39537
base: master
Are you sure you want to change the base?
[jinja2cpp] New port #39537
Conversation
@microsoft-github-policy-service agree |
probably will fix non-windows builds
ports/jinja2cpp/portfile.cmake
Outdated
file(INSTALL | ||
${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright | ||
) |
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.
file(INSTALL | |
${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright | |
) | |
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
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.
As a new port, could you please unify the file EOL from CRLF
to LF
?
Compilation fails when using this library, could you help take a look or provide a simple example? cmake_minimum_required(VERSION 3.25.1)
project(Example VERSION 0.1.2.3 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_executable(main c.cpp)
find_package(jinja2cpp CONFIG REQUIRED)
target_link_libraries(main PRIVATE jinja2cpp) #include "jinja2cpp/config.h"
#include <iostream>
int main() {
std::cout << "jinja2cpp" << std::endl;
std::cout << JINJA2CPP_VERSION << std::endl;
return 0;
} |
It tries to link binary with jinja2cpp.dll instead of jinja2cpp.lib for some reason. vcpkg\installed\x64-windows\share\jinja2cpp\jinja2cpp-cfg-debug.cmake:
It completely ignores the IMPORTED_IMPLIB_DEBUG and uses IMPORTED_LOCATION_DEBUG as a library interface file. PS While using exactly the same vcpkg branch but with msbuild+vcpkg manifest - works as intended. |
ports/jinja2cpp/portfile.cmake
Outdated
find_library(JINJA2CPP_REL NAMES jinja2cpp ${REL_NAMES} PATHS "${CURRENT_PACKAGES_DIR}/lib/static" NO_DEFAULT_PATH) | ||
find_library(JINJA2CPP_DBG NAMES jinja2cpp ${DBG_NAMES} PATHS "${CURRENT_PACKAGES_DIR}/debug/lib/static" NO_DEFAULT_PATH) | ||
|
||
if(JINJA2CPP_REL) | ||
get_filename_component(JINJA2CPP_REL_EXT "${JINJA2CPP_REL}" EXT) | ||
file(RENAME "${JINJA2CPP_REL}" "${CURRENT_PACKAGES_DIR}/lib/jinja2cpp.${JINJA2CPP_REL_EXT}") | ||
endif() | ||
|
||
if(JINJA2CPP_DBG) | ||
get_filename_component(JINJA2CPP_DBG_EXT "${JINJA2CPP_DBG}" EXT) | ||
file(RENAME "${JINJA2CPP_DBG}" "${CURRENT_PACKAGES_DIR}/debug/lib/jinja2cpp.${JINJA2CPP_DBG_EXT}") | ||
endif() |
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.
This looks like asking for trouble with CMake config.
I would recommend to use options and patching to directly install to vcpkg's desired locations.
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.
@dg0yt Changed location using patch, still the same issue.
-DCMAKE_DISABLE_FIND_PACKAGE_expected-lite=ON | ||
-DCMAKE_DISABLE_FIND_PACKAGE_variant-lite=ON | ||
-DCMAKE_DISABLE_FIND_PACKAGE_optional-lite=ON | ||
-DCMAKE_DISABLE_FIND_PACKAGE_string-view-lite=ON |
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.
I see corresponding names being listed as dependencies in vcpkg.json
. Did you mean to write -DCMAKE_REQUIRE_FIND_PACKAGE_...=ON
?
I was able to build this with the example @WangWeiLin-MV provided. However, I think the heuristically generated usage instructions are wrong:
Only |
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") | ||
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/share/pkgconfig/jinja2cpp.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/jinja2cpp.pc") | ||
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig/jinja2cpp.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/jinja2cpp.pc") | ||
|
||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/pkgconfig") | ||
|
||
vcpkg_fixup_pkgconfig() |
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.
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") | |
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/share/pkgconfig/jinja2cpp.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/jinja2cpp.pc") | |
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig/jinja2cpp.pc" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/jinja2cpp.pc") | |
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | |
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") | |
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/pkgconfig") | |
vcpkg_fixup_pkgconfig() | |
if(NOT VCPKG_BUILD_TYPE) | |
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/share/pkgconfig" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") | |
endif() | |
file(RENAME "${CURRENT_PACKAGES_DIR}/share/pkgconfig" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") | |
vcpkg_fixup_pkgconfig() | |
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | |
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") |
|
||
vcpkg_fixup_pkgconfig() | ||
|
||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
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.
End with a newline.
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") | |
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
find_package
calls are REQUIRED, are satisfied byvcpkg.json
's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.vcpkg.json
matches what upstream says.vcpkg.json
matches what upstream says../vcpkg x-add-version --all
and committing the result.