Skip to content

Feature/msvc#80

Open
Aiiaiiio wants to merge 80 commits into
mainfrom
feature/msvc
Open

Feature/msvc#80
Aiiaiiio wants to merge 80 commits into
mainfrom
feature/msvc

Conversation

@Aiiaiiio
Copy link
Copy Markdown
Member

This PR makes it possible to build core components and their dependencies on Windows with MSVC and CMake.

To achieve this I've re-written all dependency building in python (Common/3dParty/build_3rdparty.py). Atm this doesn't use vcpkg or any pre-built binaries at all. That is a "TODO".

The setup on Windows is not the most straight forward. One needs:

  • MSVC
  • Windows SDK
  • MSYS
  • CMake
  • Python
  • Git
    I plan to document this exactly later.

Aiiaiiio added 30 commits May 28, 2026 10:12
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Aiiaiiio added 5 commits May 28, 2026 10:16
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Copilot AI review requested due to automatic review settings May 28, 2026 08:27
@Aiiaiiio Aiiaiiio requested a review from a team as a code owner May 28, 2026 08:27
@Aiiaiiio Aiiaiiio requested review from DmySyz and removed request for a team May 28, 2026 08:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces support for building the core components and their dependencies on Windows with MSVC and CMake. To achieve this, every nc-build.sh shell script for third-party dependencies has been replaced with a cross-platform nc-build.py Python orchestration, and CMake files are reorganized to gate Unix-only flags behind if(UNIX)/if(NOT MSVC) and to add MSVC-specific defines (_UNICODE/UNICODE, /bigobj, Windows libraries, etc.). A new msvc_fix.h header undefines Windows API macros that conflict with codebase symbols, and common.cmake centralizes the 3rd-party install paths and find_package(Boost) setup.

Changes:

  • Replaced shell-based 3rd-party fetch/build (ICU, OpenSSL, Boost, V8, harfbuzz, brotli, hyphen, md4c, socket.io, hunspell, katana/gumbo) with a Python orchestrator (Common/3dParty/build_3rdparty.py) and per-dependency nc-build.py scripts using a shared build_3rdparty_common.py helper.
  • Refactored ~30 CMakeLists.txt files to make Unix-only compile/link flags conditional, add MSVC equivalents (_UNICODE, /bigobj, Windows system libs, WINDOWS_EXPORT_ALL_SYMBOLS), and append a declare_victory() post-build banner per target.
  • Converted OfficeUtils and libxml from standalone targets to reusable CMake functions (add_officeutils, add_libxml) invoked from Common/CMakeLists.txt, and switched WASM/Apple include paths to use install-dir variables.

Reviewed changes

Copilot reviewed 72 out of 72 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
common.cmake Centralizes 3rd-party install dirs, Boost/ICU/V8/OpenSSL variables, MSVC vs GCC flag sets, and adds declare_victory helper.
CMakeLists.txt Removes large commented-out artifact-copy block.
Apple/CMakeLists.txt Switches to add_libxml/add_cpp_sources_from_dir_recurive; removes embedded OfficeUtils/librevenge file lists.
Common/CMakeLists.txt Calls new add_officeutils/add_libxml functions; gates -include posix_compat.h behind non-MSVC.
Common/cfcpp/CMakeLists.txt Adds declare_victory call.
Common/Network/CMakeLists.txt Adds MSVC Windows libs (Crypt32, urlmon...) and FileTransporter_win.cpp path; fixes prior WIN_32 typo to MSVC.
Common/Network/WebSocket/src/socketio/socketio_internal_private*.h Updates socketio header paths to new install dir layout.
Common/3dParty/*/nc-build.py (new) Python rewrite of fetch/build for each dependency.
Common/3dParty/build_3rdparty.py, build_3rdparty_common.py Orchestrator and shared helpers (workdir/install markers, run_command, shallow_checkout).
Common/3dParty/cryptopp/project/CMakeLists.txt Switches Boost link to PUBLIC; drops copy_boost_libs.
Common/3dParty/hunspell/CMakeLists.txt Sources from new install dir; adds declare_victory.
Common/3dParty/md/md2html.cpp Updates md4c/src/... include to md/src/....
Common/3dParty/v8/tools/8.9/x64-*/patch Adds Windows toolchain patch; tweaks Linux cflags patch to skip when is_win.
msvc_fix.h (new) Undefines GetCharWidth/CreateFile Windows API macros.
DesktopEditor/{xml,xmlsec,graphics,fontengine,pluginsmanager,allthemesgen,AllFontsGen,doctrenderer,...}/CMakeLists.txt Replace ad-hoc execute_process-driven 3rd-party fetches with shared variables; add MSVC paths/defines; rename KATANA/GUMBO/HARFBUZZ/BROTLI/HYPHEN/ICU_INSTALL_DIR references to their _ABS counterparts; add declare_victory.
DesktopEditor/doctrenderer/CMakeLists.txt Adds MSVC defines, Rpcrt4/Winmm/Dbghelp, gates pthread to Unix; changes a Boost link target.
DesktopEditor/xmlsec/src/CMakeLists.txt Reworks to use shared OpenSSL vars; gates UNICODE handling to Unix; capitalizes Windows libs.
DesktopEditor/xml/build/cmake/CMakeLists.txt Converts to add_libxml() function form.
OfficeUtils/CMakeLists.txt Replaces target/library with add_officeutils() function.
OfficeUtils/js/CMakeLists.txt Drops local C++ standard set; adds declare_victory.
PdfFile/CMakeLists.txt Gates HAVE_UNISTD_H/FCNTL_H and -include limits to Unix; comments out Windows -UUNICODE block.
PdfFile/Resources/CMapMemory/CMakeLists.txt Uses TARGET_FILE_NAME + cmake -E remove instead of hardcoded path/rm.
{OOXML,MsBinaryFile,Rtf,Txt,Odf,Hwp,Fb2,Html,Epub,Djvu,Xps,Ofd,DocxRenderer,X2t,X2tTester,UnicodeConverter}/.../CMakeLists.txt Drop hardcoded vcpkg Boost root and explicit find_package(Boost); add MSVC _UNICODE/UNICODE defines and declare_victory.
X2tConverter/build/cmake/library/CMakeLists.txt Removes inline ICU fetch; reorganizes source list; uses ${LIBICUUC}/${LIBICUDATA}.
OdfFile/Reader/Converter/StarMath2OOXML/CMakeLists.txt Adds absolute paths, gates remove_definitions(-DUNICODE) to Unix, replaces SUPPORT_MS_CRYPTO block with STARMATH_USE_DYNAMIC_LIBRARY.
HwpFile/CMakeLists.txt Adds StarMathConverter target dependency and link.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Common/3dParty/socketio/nc-build.py Outdated
Comment thread Common/3dParty/openssl-hash/nc-build.py Outdated
Comment thread OfficeUtils/CMakeLists.txt
Comment thread Common/CMakeLists.txt Outdated
Comment thread DesktopEditor/graphics/cmake/CMakeLists.txt Outdated
Comment thread Common/3dParty/html/nc-build.py
Comment thread Common/3dParty/md/nc-build.py
Comment thread DesktopEditor/doctrenderer/CMakeLists.txt
Comment thread PdfFile/CMakeLists.txt Outdated
Comment thread OfficeUtils/CMakeLists.txt
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
@Aiiaiiio Aiiaiiio requested a review from rikled May 28, 2026 08:36
Aiiaiiio added 13 commits May 28, 2026 10:42
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
…utput

Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
@rikled
Copy link
Copy Markdown
Member

rikled commented May 29, 2026

I took a look at your third-party approach and think it’s generally good. I think we can simply integrate vcpkg independently of that once we upgrade the packages. (We’ll probably never be able to completely replace your approach with vcpkg anyway.)
Two things:

  • we definitely need to make sure we have a remote cache. I’ve already gotten used to the much faster builds :).
  • we probably won’t be able to build CEF that way. The question is whether we even want to build it ourselves or if we should just use the Spotify CEF automated build. What do you think?

Edit: I made some small fixes to the python script to make it work with python 3.10 on ubuntu 22.04. Shall i push them?

rikled added 2 commits May 29, 2026 13:33
Signed-off-by: Hendrik Leidinger <hendrik.leidinger@nextcloud.com>
Signed-off-by: Hendrik Leidinger <hendrik.leidinger@nextcloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants