-
Notifications
You must be signed in to change notification settings - Fork 266
Build Notepad4
Open build/VisualStudio/Notepad4.sln
, select appreciate project, configuration and platform to build. The build output directory is build/bin/${Configuration}/${Platform}
.
For Visual Studio 2019, 2022 or 2026, VS_PATH
environment variable may need manually set to the installation path (e.g.: C:\Program Files\Microsoft Visual Studio\2022\Community
).
Batch File | Usage |
---|---|
build_x64.bat | build x64 release |
build_win32.bat | build Win32 release |
build_arm64.bat | build ARM64 release |
build_avx2.bat | build x64 release with AVX2 instructions |
build_avx512.bat | build x64 release with AVX512 instructions |
build.bat | build.bat [Action] [Platform] [Configuration] |
- | - |
Action | Help, Build (the default), Clean, Rebuild |
Platform | all (the default), x86, Win32, x64, AVX2, AVX512, ARM64, No32bit (x64, AVX2, AVX512 and ARM64) |
Configuration | all (Release and Debug), Release (the default), Debug, LLVMDebug, LLVMRelease |
Install LLVM from https://github.com/llvm/llvm-project/releases and install LLVM for Visual Studio from https://github.com/zufuliu/llvm-utils. Then select *LLVM*
configuration to build. The build output directory is build/bin/LLVM$(Configuration)/$(Platform)
.
If you already installed "C++ Clang-cl for v14* build tools (x64/x86)" (Visual Studio 2019 v142, 2022 v143 or 2026 v145), you can change "Platform Toolset" to LLVM (clang-cl)
to use it. See the document at https://docs.microsoft.com/en-us/cpp/build/clang-support-msbuild.
Right-click "Solution 'Notepad4'" in Solution Explorer or click Visual Studio's Project menu, then click Intel Compiler -> Use Intel C++.
Suggest using latest mingw-w64 GCC x86_64-posix-seh
for x64 build and i686-posix-dwarf
for Win32 build. They can be installed inside MSYS2 using pacman:
pacman -Syuu
# x64, AVX2, AVX512 build
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-tools-git
# x64, AVX2, AVX512 build with Clang
pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-lld
# Win32 build
pacman -S mingw-w64-i686-gcc mingw-w64-i686-make mingw-w64-i686-tools-git
# Win32 build with Clang
pacman -S mingw-w64-i686-clang mingw-w64-i686-lld
You can also use other ready for use standalone GCC/Clang packages, such as https://github.com/mstorsjo/llvm-mingw, https://github.com/brechtsanders/winlibs_mingw, etc.
llvm-mingw is required to build for ARM64.
Following table are options (all are optional) for Makefile (in build\mingw\
folder). The build output directory is build\bin\Debug_<ARCH>
, build\bin\Release_<ARCH>
(or build\bin\ClangDebug_<ARCH>
, build\bin\ClangRelease_<ARCH>
when Clang is used).
Option | Description |
---|---|
DEBUG | Debug build, default is release build |
TRIPLET | Cross compiling target triplet (x86_64-w64-mingw32, i686-w64-mingw32, aarch64-w64-mingw32) |
ARCH | Cross compiling target architecture (x64, AVX2, AVX512, Win32, ARM64), default auto detection |
CLANG | Use clang and clang++ instead of gcc and g++ |
LLD | Use lld as the linker |
LTO | Enable LTO for release build |
WIN7 | Set x64 or Win32 build to target Windows 7 instead of Windows Vista |
Download and install CodeLite from https://codelite.org/. Add GCC (and/or Clang) to build settings (Menu -> Settings -> Build Settings
).
Open build/CodeLite/Notepad4.workspace
, in Workspace panel, select appreciate project and configuration to build. The build output directory is build/bin/$(Configuration)_$(Platform)
or build/CodeLite/build_$(Configuration)_$(Platform)/bin
, depends on CodeLite version. You can change project settings by right-click project folder in Workspace panel, then click "Settings...". More document for CodeLite can be found at https://wiki.codelite.org/.
Note: C++ language standard is not specified in C++ Compiler Options
, if you GCC's default C++ standard is not gnu++20 or later, please add language standard (such as -std=gnu++20
for C++) to compiler options in Project Settings
.
Currently compiler support for C++20 is required.
Some functions (encoding validating, line endings detection, etc.) in Notepad4 are optimized for SSE2, AVX2 and AVX512, they can be enabled by editing scintilla\include\VectorISA.h
, and set NP2_USE_SSE2
, NP2_USE_AVX2
or NP2_USE_AVX512
to 1.
The AVX2 build requires 64-bit Windows 7 SP1 (or Windows Server 2008 R2 SP1) and later, requires target CPU additional support for POPCNT (included in SSE4.2), e.g. CPU sold since 2013, such as Intel Core i3, i5, i7, i9 or AMD Excavator, Zen, and more.
The AVX512 build requires 64-bit Windows 10 (or Windows Server 2019) and later.
Clang and GCC need using -march=x86-64-v3
(see https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html) compiler options to enable full AVX2 build, and -march=x86-64-v4
for AVX512 build.
MSVC need to enable /arch:AVX2
(in project Property Pages, C/C++ -> Code Generation -> Enable Enhanced Instruction Set) when build for AVX2, and /arch:AVX512
for AVX512 build.
SSE2 is introduced since Pentium 4 in 2000, SSE is introduced since Pentium III in 1999. If you need to use Notepad4 and matepath on system with old CPUs that do not support them, you need to build Notepad4 and matepath manually by set NP2_USE_SSE2
to 0 and change project files before build.
Open project Property Pages for Release configuration for Win32 platform, click "C/C++", then "Code Generation", Change "Enable Enhanced Instruction Set" to "Not Set" or "Streaming SIMD Extensions (/arch:SSE)".
Or you can open Notepad4.vcxproj and matepath.vcxproj using some text editor, remove the line <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
directly from the project file.
Open the Project Settings dialog for Notepad4 and matepath, Select "Release_Win32", click "Compiler", In "C++ Compiler Options" and "C Compiler Options" fields, remove -msse2;-mfpmath=sse;
.
Or you can open Notepad4.project and matepath.project using some text editor, remove -msse2;-mfpmath=sse;
directly from the project file.
winxp
branch contains latest code for Windows XP and Windows RT, compiler support for C++17 is required to build the code, "Windows XP support for C++" component is required when building with Visual Studio.
Code before Cleanup LoadLibrary() and GetModuleHandle() for Windows 2000 support build for Window 2000 (may require some tweaks). Legacy code for Windows 2000 is completely removed by commit 626becd.
Tweak current code for Windows 2000 need more work and test, though used Windows XP and above only function is very small.
Other broken changes for Windows 2000:
- uxtheme.dll (not available on Windows 2000) is directly linked instead of dynamic loaded at runtime since commit c951b0b.
- GdiAlphaBlend() is used other than AlphaBlend(), some old compiler (such as originally MinGW, see https://sourceforge.net/p/scintilla/bugs/1923/) may not have this function in SDK headers.