-
-
Notifications
You must be signed in to change notification settings - Fork 7
Add experimental VCPKG packaging #58
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
base: main
Are you sure you want to change the base?
Changes from all commits
b50b0d7
2ea9494
9959dec
a830abb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| testcontainers-bridge provides CMake targets: | ||
|
|
||
| find_package(testcontainers-bridge CONFIG REQUIRED) | ||
| target_link_libraries(main PRIVATE testcontainers-bridge::testcontainers-bridge) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "name": "testcontainers-bridge", | ||
| "version-string": "0.1.0", | ||
| "description": "Testcontainers Go bridge library for native languages", | ||
| "homepage": "https://github.com/testcontainers/testcontainers-native", | ||
| "license": "MIT", | ||
| "dependencies":[ | ||
| { | ||
| "name": "vcpkg-cmake", | ||
| "host": true | ||
| }, | ||
| { | ||
| "name": "vcpkg-cmake-config", | ||
| "host": true | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Build using the port directory as source. We expect this repository to be | ||
| # available to the vcpkg build as a submodule or local path. If building from | ||
| # a remote registry, replace this with vcpkg_from_github / vcpkg_from_git. | ||
|
|
||
| set(ROOT_SRC ${CURRENT_PORT_DIR}/../../testcontainers-c) | ||
|
|
||
|
|
||
| # Configure from repository root so that testcontainers-bridge is built first | ||
| vcpkg_cmake_configure( | ||
| SOURCE_PATH ${ROOT_SRC} | ||
| GENERATOR "Unix Makefiles" | ||
| OPTIONS | ||
| -DCMAKE_POSITION_INDEPENDENT_CODE=ON | ||
| ) | ||
|
|
||
| vcpkg_build_cmake() | ||
|
|
||
| # Install from CMake install rules | ||
| vcpkg_install_cmake() | ||
|
|
||
| file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
|
|
||
| # Add a short README to the package to indicate local build origin | ||
| file(WRITE ${CURRENT_PACKAGES_DIR}/debug/share/${PORT}/README "This package was built from local repo source.\n") | ||
|
|
||
| file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
| vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| testcontainers-c provides CMake targets: | ||
|
|
||
| find_package(testcontainers-c CONFIG REQUIRED) | ||
| target_link_libraries(main PRIVATE testcontainers-c::testcontainers-c) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "name": "testcontainers-c", | ||
| "version-string": "0.1.0", | ||
| "description": "Testcontainers library for C - C API and shared library", | ||
| "homepage": "https://github.com/testcontainers/testcontainers-native", | ||
| "license": "MIT", | ||
| "dependencies": [ | ||
| { | ||
| "name": "testcontainers-bridge", | ||
| "host": true | ||
| }, | ||
| { | ||
| "name": "vcpkg-cmake", | ||
| "host": true | ||
| }, | ||
| { | ||
| "name": "vcpkg-cmake-config", | ||
| "host": true | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,11 @@ | ||
| cmake_minimum_required (VERSION 3.26) | ||
| project (TESTCONTAINERS-BRIDGE | ||
| VERSION 0.1.0 | ||
| DESCRIPTION "Testcontainers Go library for native languages" | ||
| LANGUAGES C | ||
| ) | ||
| include(GNUInstallDirs) | ||
|
|
||
| set(SRCS testcontainers-bridge.go) | ||
|
|
||
| set(SHIM_TARGET testcontainers-bridge-shim) | ||
|
|
@@ -16,7 +24,7 @@ add_custom_target(${SHIM_TARGET} DEPENDS ${SHIM_TARGET_LIB} ${SHIM_TARGET_HEADER | |
|
|
||
| set(TARGET testcontainers-bridge) | ||
| set(TARGET_NAME ${TARGET}) | ||
| set(TARGET_DESCRIPTION "Go to C bridge for Testcontainers functionality") | ||
| set(TARGET_DESCRIPTION "Go to C bridge for Testcontainers Go functionality") | ||
| set(TARGET_VERSION ${PROJECT_VERSION}) | ||
|
|
||
| add_library(${TARGET} STATIC IMPORTED GLOBAL) | ||
|
|
@@ -27,3 +35,9 @@ set_target_properties(${TARGET} PROPERTIES | |
| PUBLIC_HEADER ${SHIM_TARGET_HEADER} | ||
| IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${SHIM_TARGET_LIB} | ||
| INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}) | ||
|
|
||
| # Install library and header files | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am still not sure about making
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My vision was that
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. That's easy with CMake. I just need to figure our how to do vcpkg ports in such a case, without breaking the dependency graph. Idea of having 2 packages is very debatable, maysbe I will just do twqo modes in the |
||
| configure_file(cmake.pc.in ${TARGET}.pc @ONLY) | ||
| install(FILES ${SHIM_TARGET_LIB} DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
| install(FILES ${SHIM_TARGET_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
| install(FILES ${CMAKE_BINARY_DIR}/${TARGET}.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| prefix=@CMAKE_INSTALL_PREFIX@ | ||
| exec_prefix=@CMAKE_INSTALL_PREFIX@ | ||
| libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ | ||
| includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ | ||
|
|
||
| Name: @TARGET_NAME@ | ||
| Description: @TARGET_DESCRIPTION@ | ||
| Version: @TARGET_VERSION@ | ||
|
|
||
| Requires: | ||
| Libs: -L${libdir} | ||
| Cflags: -I${includedir} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| @PACKAGE_INIT@ | ||
|
|
||
| include("${CMAKE_CURRENT_LIST_DIR}/testcontainers-bridge-targets.cmake") | ||
|
|
||
| check_required_components(testcontainers-bridge) |
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.
That part does not work in
vcpkgruns yet, even if local installation is fine.Likely, the port files are messed up somehow