Closed bangusi closed 5 years ago
vcpkg create libxlsxwriter https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_0.8.6.tar.gz
set EDITOR="C:\Program Files (x86)\Notepad++\notepad++.exe"
vcpkg edit libxlsxwriter
write of file CONTROL
Source: libxlsxwriter
Version: 0.8.6
Description: A C library for creating Excel XLSX files
vcpkg install libxlsxwriter
- Found 2 error
Include files should not be duplicated into the /debug/include directory. If this cannot be disabled in the project cmake, use file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) The software license must be available at ${CURRENT_PACKAGES_DIR}/share/libxlsxwriter/copyright
cd ..\vcpkg\buildtrees\libxlsxwriter\x86-windows-rel
cmake . -LA
BUILD_EXAMPLES:BOOL=OFF
BUILD_TESTS:BOOL=OFF
CMAKE_BUILD_TYPE:STRING=Release
...
IOAPI_NO_64:BOOL=OFF
PROJECT_NAME:STRING=xlsxwriter
USE_STANDARD_TMPFILE:BOOL=OFF
USE_STATIC_MSVC_RUNTIME:BOOL=OFF
USE_SYSTEM_MINIZIP:BOOL=OFF
VCPKG_APPLOCAL_DEPS:BOOL=OFF
VCPKG_TARGET_TRIPLET:STRING=x86-windows
ZLIB_INCLUDE_DIR:PATH=E:/tools/vcpkg/installed/x86-windows/include
ZLIB_LIBRARY:FILEPATH=E:/tools/vcpkg/installed/x86-windows/lib/zlib.lib
ZLIB_ROOT:STRING=
dependencies
ZLIB_LIBRARY = zlib
vcpkg edit libxlsxwriter
write of file CONTROL
Source: libxlsxwriter
Version: 0.8.6
Description: A C library for creating Excel XLSX files
Build-Depends: zlib
write of file portfile.cmake
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxlsxwriter RENAME copyright)
send the port for review https://github.com/Microsoft/vcpkg/pulls
Are those the steps I need to follow to create a port? Never done it before. But I did attempt those steps on my Windows box. No luck. Why does vcpkg insist on searching for Visual Studio Code? I don't have it but I do have Notepad++ x64 and it won't use
set EDITOR="C:\Program Files (x86)\Notepad++\notepad++.exe"
set EDITOR="notepad.exe"
this is just an option, and there may be a lot of them, like the MSVC editions
Nope:
set EDITOR="notepad.exe" F:\vcpkg>vcpkg edit libxlsxwriter Error: Visual Studio Code was not found and the environment variable EDITOR is not set or invalid. The following paths were examined:
"notepad.exe"
C:/Program Files/Microsoft VS Code Insiders/Code - Insiders.exe
C:/Program Files/Microsoft VS Code/Code.exe
C:/Program Files (x86)/Microsoft VS Code Insiders/Code - Insiders.exe
C:/Program Files (x86)/Microsoft VS Code/Code.exe
C:/Users/me/AppData/Local/Programs/Microsoft VS Code Insiders/Code - Insiders.exe
C:/Users/me/AppData/Local/Programs/Microsoft VS Code/Code.exe
You can also set the environmental variable EDITOR to your editor of choice.
This is my env variable
F:\vcpkg>echo %EDITOR% "notepad.exe"
https://github.com/Microsoft/vcpkg/blob/master/docs/examples/packaging-zipfiles.md
EDITOR This environment variable can be set to the full path of an executable to be used for vcpkg edit. Please see vcpkg help edit for command-specific help.
But that is exactly what I initially did with Notepad++
set EDITOR="C:\Program Files\Notepad++\notepad++.exe"
without success.
I guess I will wait for the authors to do the port.
And If without "" ?
Re-opened in case some knowledgeable volunteer shows interest
hmmm.... , why do you need a port, even if you can’t configure your environment
Because I am spoiled. I want to do ./vcpkg install libxlsxwriter:x64-windows-static and start using the library like I do with rest. BTW I already had those zipped files ( the EDITOR env does work without the quotes ) but ran into errors when I executed cmake. Not going to fight this one I will wait.
good luck waiting for volunteers)))
I'm the author of libxlsxwriter. I'll look into adding it.
@Voskrese I got it working thanks to you instructions above:
C:\Users\John\vcpkg>.\vcpkg list
libxlsxwriter:x86-windows 0.8.6 A C library for creating Excel XLSX files
zlib:x86-windows 1.2.11-5 A compression library
I'll do a bit more testing and then submit a PR.
How does the versioning work? Will I have to submit new PR (with a new CONTROL version) each time the library version is updated?
yes
@Voskrese I got it working thanks to you instructions above:
C:\Users\John\vcpkg>.\vcpkg list libxlsxwriter:x86-windows 0.8.6 A C library for creating Excel XLSX files zlib:x86-windows 1.2.11-5 A compression library
I'll do a bit more testing and then submit a PR.
How does the versioning work? Will I have to submit new PR (with a new CONTROL version) each time the library version is updated?
Excellent!. Please , don't forget to test x64 static build
After install
and integrate
I tried to compile the following Win32 Console application as Release-x86:
#include "stdafx.h"
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = workbook_new("hello_world.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
worksheet_write_number(worksheet, 1, 0, 123, NULL);
workbook_close(workbook);
return 0;
}
It compiled but didn't link. The errors were:
1>------ Build started: Project: ConsoleApplication8, Configuration: Release Win32 ------
1> ConsoleApplication8.cpp
1>ConsoleApplication8.obj : error LNK2001: unresolved external symbol _workbook_new
1>ConsoleApplication8.obj : error LNK2001: unresolved external symbol _workbook_add_worksheet
1>ConsoleApplication8.obj : error LNK2001: unresolved external symbol _worksheet_write_string
1>ConsoleApplication8.obj : error LNK2001: unresolved external symbol _worksheet_write_number
1>ConsoleApplication8.obj : error LNK2001: unresolved external symbol _workbook_close
1>c:\users\John\documents\visual studio 2015\Projects\ConsoleApplication8\Release\ConsoleApplication8.exe : fatal error LNK1120: 5 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I tried the sqlite3 example from the getting started docs and that built successfully. And ideas about what might be wrong/missing?
Here are the CONSOLE and portmap.cmake files:
Source: libxlsxwriter
Version: 0.8.6
Description: A C library for creating Excel XLSX files
Build-Depends: zlib
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_0.8.6.tar.gz"
FILENAME "RELEASE_0.8.6.tar.gz"
SHA512 60822dc5f87531edc97cf774e234f25229a605d4430061c24b95c387318e6e05dde1b0f2f433cea14c6f84ee901c1dffe0d174bfd7e2a8459f59bcee900097db
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxlsxwriter RENAME copyright)
Try to add the linked lib manually if you didn't. I found relying on "Integrate" does not always work for me.
libxlsxwriter\src\RELEASE_0-ff135fa51e\ CMakeLists.txt
if(MSVC)
if(CMAKE_CL_64)
set(MSVC_FOLDER_PREFIX x64)
else()
set(MSVC_FOLDER_PREFIX Win32)
endif()
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION "lib/${MSVC_FOLDER_PREFIX}/\${CMAKE_INSTALL_CONFIG_NAME}"
ARCHIVE DESTINATION "lib/${MSVC_FOLDER_PREFIX}/\${CMAKE_INSTALL_CONFIG_NAME}"
RUNTIME DESTINATION "bin/${MSVC_FOLDER_PREFIX}/\${CMAKE_INSTALL_CONFIG_NAME}"
)
if (NOT BUILD_SHARED_LIBS)
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb
DESTINATION "lib/${MSVC_FOLDER_PREFIX}/\${CMAKE_INSTALL_CONFIG_NAME}"
)
endif()
=
`vcpkg\packages\libxlsxwriter_x64-windows\lib\ x64\Release\xlsxwriter.lib
=
vcpkg\installed\x64-windows\lib\ x64\Release\xlsxwriter.lib
x64\Release
-->> vcpkg\installed\x64-windows\lib\xlsxwriter.lib
- ok
delete
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION "lib/${MSVC_FOLDER_PREFIX}/\${CMAKE_INSTALL_CONFIG_NAME}"
ARCHIVE DESTINATION "lib/${MSVC_FOLDER_PREFIX}/\${CMAKE_INSTALL_CONFIG_NAME}"
RUNTIME DESTINATION "bin/${MSVC_FOLDER_PREFIX}/\${CMAKE_INSTALL_CONFIG_NAME}"
)
if (NOT BUILD_SHARED_LIBS)
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb
DESTINATION "lib/${MSVC_FOLDER_PREFIX}/\${CMAKE_INSTALL_CONFIG_NAME}"
)
endif()
else(MSVC)
elseif(MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /O0 /Fd${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb")
cl : Command line warning D9002 : ignoring unknown option '/O0'
/Ob0
?
@Voskrese Thanks for that.
Can I test local changes that I make to the Cmake file with vpkg without creating a new release tarball?
patch and vcpkg_fix... look for examples in this repo
https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
I'm the author of libxlsxwriter. I'll look into adding it.
Just checking if you were successful in creating the port.
Hi @bangusi, thanks for posting this issue. The port has been added to the vcpkg list. Please try to use it.
@NancyLi1013 Thank you for the port.
@Voskrese or @NancyLi1013 When I update the libxlsxwriter library for a release do I have to update the version number and SHA in the portfile and submit a PR?
I'm referring to the metadata here: https://github.com/microsoft/vcpkg/blob/master/ports/libxlsxwriter/portfile.cmake#L6-L7
Yup that's right.
https://github.com/jmcnamara/libxlsxwriter
Libxlsxwriter is a C library that can be used to write text, numbers, formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.
It supports features such as:
100% compatible Excel XLSX files. Full Excel formatting. Merged cells. Defined names. Autofilters. Charts. Data validation and drop down lists. Worksheet PNG/JPEG images. Memory optimization mode for writing large files. Source code available on GitHub. FreeBSD license. ANSI C. Works with GCC, Clang, Xcode, MSVC 2015, ICC, TCC, MinGW, MingGW-w64/32. Works on Linux, FreeBSD, OpenBSD, OS X, iOS and Windows. Also works on MSYS/MSYS2 and Cygwin. Compiles for 32 and 64 bit. Compiles and works on big and little endian systems. The only dependency is on zlib.