Add gcc 32-bit build and improve build process

1. Include SciLexer build in Notepad++ build.
2. Remove -fpermissive, auto -j in make.

Fix #9989, close #10540
pull/10547/head
Ivan Ustûžanin 3 years ago committed by Don Ho
parent 73b41ec74f
commit 049ededf9f

11
.gitignore vendored

@ -149,18 +149,11 @@ PowerEditor/bin/SourceCodePro-Regular.ttf
*.zip *.zip
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# GNU GCC MinGW # MinGW-w64 GCC
#-- Generated during makefile build bin.*
PowerEditor/gcc/*.build/
PowerEditor/bin/NotepadPP*.exe
scintilla/win32/*.o scintilla/win32/*.o
scintilla/bin/libscilexer.a
#-- Generated manually to make Notepad++ execute properly on Linux using Wine
/PowerEditor/bin/libgcc_s_sjlj-1.dll
/PowerEditor/bin/libstdc++-6.dll
/PowerEditor/bin/libwinpthread-1.dll
PowerEditor/src/MISC/md5/RCa06792 PowerEditor/src/MISC/md5/RCa06792
*.db *.db

@ -1,5 +1,4 @@
How to build Notepad++ # Building Notepad++ with Microsoft Visual Studio
----------------------
**Pre-requisites:** **Pre-requisites:**
@ -41,33 +40,22 @@ More about the previous build process: https://community.notepad-plus-plus.org/t
Since `Notepad++` version 6.0 - 7.9.5, the build of dynamic linked `SciLexer.dll` that is distributed Since `Notepad++` version 6.0 - 7.9.5, the build of dynamic linked `SciLexer.dll` that is distributed
uses features from Boost's `Boost.Regex` library. uses features from Boost's `Boost.Regex` library.
## Build 64 bits binaries with GCC: # Building Notepad++ with GCC
If you have installed [MinGW-w64](https://mingw-w64.org/doku.php/start), then you can compile Notepad++ & libscilexer.a 64 bits binaries with GCC. If you have [MinGW-w64](https://www.mingw-w64.org/) installed, you can compile Notepad++ with GCC.
* Compile libscilexer.a MinGW-w64 can be downloaded from [SourceForge](https://sourceforge.net/projects/mingw-w64/files/). Building Notepad++ is regularly tested on a Windows system with [x86_64-8.1.0-release-posix-seh-rt_v6-rev0](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z) and with [i686-8.1.0-release-posix-dwarf-rt_v6-rev0](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z) versions of MinGW-w64 GCC. Other versions may also work but are untested.
This step is not necessary anymore as it will be build in the process of compiling the Notepad++ binary. It is here just for completeness sake as this option is still available. **Note:** If you use MinGW-w64 GCC from a package (7z), you need to manually add the `$MinGW-root$\bin` directory to the system `PATH` environment variable for the `mingw32-make` invocation below to work. One can use a command like `set PATH=$MinGW-root$\bin;%PATH%` each time `cmd` is launched. But beware that if `PATH` contains several versions of MinGW-w64 GCC, only the first one will be usable.
1. Launch cmd. ## Comping Notepad++ binary
2. Change dir into `notepad-plus-plus\scintilla\win32`.
3. Type `mingw32-make.exe -j%NUMBER_OF_PROCESSORS%`
4. `libscilexer.a` is generated in `notepad-plus-plus\scintilla\bin\`.
* Compile Notepad++ binary 1. Launch `cmd` and add `$MinGW-root$\bin` to `PATH` if necessary.
2. `cd` into `notepad-plus-plus\PowerEditor\gcc`.
3. Run `mingw32-make`.
4. The 32-bit or 64-bit `notepad++.exe` will be generated either in `bin.i686` or in `bin.x86_64` directory respectively, depending on the target CPU of the compiler — look for the full path to the resulting binary at the end of the build process.
1. Launch cmd. * The directory containing `notepad++.exe` will also contain everything needed for Notepad++ to start.
2. Change dir into `notepad-plus-plus\PowerEditor\gcc`. * To have a debug build just add `DEBUG=1` to the `mingw32-make` invocation above. The output directory then will be suffixed with `-debug`.
3. Type `mingw32-make.exe -j%NUMBER_OF_PROCESSORS%` * To see commands being executed add `VERBOSE=1` to the same command.
4. `NotepadPP-release.exe` is generated in `notepad-plus-plus\PowerEditor\bin\`. * When switching between compilers or between release/debug modes, `mingw32-make clean` must be executed first.
To have a debug build just add `DEBUG=1` to the `mingw32-make.exe` invocation. The binary will be called `NotepadPP-debug.exe` in this case.
To see commands being executed add `VERBOSE=1` to the same command.
You can download MinGW-w64 from https://sourceforge.net/projects/mingw-w64/files/. On Notepad++ Github page (this project), the build system use [MinGW 8.1](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z).
Note 1: if you use MinGW from the package (7z), you need manually add the MinGW/bin folder path to system Path variable to make mingw32-make.exe invoke works (or you can use command :`set PATH=%PATH%;C:\xxxx\mingw64\bin` for adding it on each time you launch cmd).
Note 2: For 32-bit build, https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/sjlj/i686-8.1.0-release-posix-sjlj-rt_v6-rev0.7z could be used. The rest of the instructions are still valid.

@ -0,0 +1,14 @@
// this file contains fixes needed for Notepad++ to be built by GCC
// the makefile automatically includes this file
static constexpr unsigned int max(unsigned int a, unsigned int b) {
return a > b ? a : b;
}
static constexpr unsigned int min(unsigned int a, unsigned int b) {
return a < b ? a : b;
}
// __try and __except are unknown to GCC, so convert them to something eligible
#define __try try
#define __except(x) catch(...)

@ -1,52 +0,0 @@
//this file contains definitions not available in gcc 3.4.5,
//but are needed for Notepad++
//the makefile will automatically include this header file
//GetLongPathName = 410
//Multimonitor: 410
//#define _WIN32_WINDOWS 0x0410
//Toolbar imagelist = 300
//TCS_BOTTOM = 300
//LVS_EX_BORDERSELECT = 500
//TBSTYLE_EX_HIDECLIPPEDBUTTONS = 501
//#define _WIN32_IE 0x501
//Theme (uxtheme)
//#define _WIN32_WINNT 0x0600
//#include <windows.h>
//#if (_WIN32_IE >= 0x0400)
//#define TCN_GETOBJECT (TCN_FIRST - 3)
//#endif
//#if (_WIN32_IE >= 0x0500)
//#define RBN_CHEVRONPUSHED (RBN_FIRST - 10)
//#endif // _WIN32_IE >= 0x0500
/*
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
*/
static inline int max(unsigned int a, unsigned int b) {
return (((a) > (b)) ? (a) : (b));
}
static inline int min(unsigned int a, unsigned int b) {
return (((a) < (b)) ? (a) : (b));
}
//__try and __except dont work in gcc, so heres some defines to take em out
#define __try try
#define __except(x) catch(...)
//Missing unicode CRT funcs
//double _wtof(const wchar_t * string);
// from MinGW include/driverspecs.h
//#define __inout
//#define __inout_opt

@ -14,58 +14,127 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# Definitions: #
SOURCE_DIR := ../src # definitions
SOURCE_EXCLUDE := $(SOURCE_DIR)/tools/% #
TARGET_DIR := ../bin
TARGET_BASE := NotepadPP GCC_DIRECTORY := ../gcc
TARGET_SUFFIX := .exe GCC_EXCLUDE := $(GCC_DIRECTORY)/gcc-%
CONFIG_FILES := langs.model.xml stylers.model.xml shortcuts.xml contextMenu.xml SRC_DIRECTORY := ../src
GCC_DIR := . SRC_EXCLUDE := $(SRC_DIRECTORY)/tools/%
SCINTILLA_DIR := ../../scintilla BIN_DIRECTORY := ../bin
INSTALLER_DIRECTORY := ../installer
TARGET_BINARY := notepad++.exe
SRC_DATA := contextMenu.xml langs.model.xml shortcuts.xml stylers.model.xml
BIN_DATA := change.log doLocalConf.xml readme.txt userDefineLangs/
INSTALLER_DATA := autoCompletion/ functionList/ localization/ themes/
SCINTILLA_DIRECTORY := ../../scintilla
SCINTILLA_TARGET := libscilexer.a
CXX := $(CROSS_COMPILE)g++ CXX := $(CROSS_COMPILE)g++
CXXFLAGS := -include $(GCC_DIR)/include/various.h -std=c++17 -fpermissive -Wno-conversion-null CXXFLAGS := -include $(GCC_DIRECTORY)/gcc-fixes.h -std=c++17 -Wno-conversion-null
RC := $(CROSS_COMPILE)windres RC := $(CROSS_COMPILE)windres
RCFLAGS := RCFLAGS :=
DEFINES := UNICODE _UNICODE _WIN32_WINNT=0x0600 TIXML_USE_STL TIXMLA_USE_STL CPP_PATH := $(SCINTILLA_DIRECTORY)/include
INCLUDES := $(SCINTILLA_DIR)/include CPP_DEFINE := UNICODE _UNICODE _WIN32_WINNT=0x0600 TIXML_USE_STL TIXMLA_USE_STL
LD := $(CROSS_COMPILE)g++ LD := $(CXX)
LDFLAGS := -municode -mwindows LDFLAGS := -municode -mwindows
LIBRARIES := comctl32 crypt32 dbghelp ole32 sensapi shlwapi uuid uxtheme version wininet wintrust LD_PATH :=
SCINTILLA_TARGET := $(SCINTILLA_DIR)/bin/libscilexer.a LD_LINK := comctl32 crypt32 dbghelp ole32 sensapi shlwapi uuid uxtheme version wininet wintrust
SCINTILLA_LIBRARIES := imm32 msimg32 oleaut32 LD_LINK += $(patsubst lib%.a,%,$(SCINTILLA_TARGET)) imm32 msimg32 ole32 oleaut32
SUBMAKEFLAGS := -O --no-print-directory SUBMAKEFLAGS := -O --no-print-directory
ifeq "$(strip $(DEBUG))" "" # detect a request for a debug build
ifeq "$(filter-out 0,$(DEBUG))" ""
BUILD_TYPE := release
BUILD_SUFFIX :=
CXXFLAGS += -O2 -Os CXXFLAGS += -O2 -Os
CPP_DEFINE += NDEBUG
LDFLAGS += -s LDFLAGS += -s
DEFINES += NDEBUG
BUILD_TYPE := $(CROSS_COMPILE)release
else else
CXXFLAGS += -g -Wall -Wpedantic -Wconversion-null BUILD_TYPE := debug
#DEFINES += DEBUG BUILD_SUFFIX := -debug
BUILD_TYPE := $(CROSS_COMPILE)debug CXXFLAGS += -Og -g -Wall -Wpedantic -Wconversion-null
#CPP_DEFINE += DEBUG
endif
#
# preparations
#
# detect target CPU
TARGET_CPU := $(firstword $(subst -, ,$(shell $(CXX) -dumpmachine)))
ifeq "$(TARGET_CPU)" ""
$(error TARGET_CPU detection failed)
endif endif
ifneq "$(filter-out x86_64 i686,$(TARGET_CPU))" ""
$(error $(TARGET_CPU) build is unsupported)
endif
ifeq "$(TARGET_CPU)" "i686"
# for some reason i686 versions of MinGW-w64 GCC don't include a linking library for SensApi.dll
# thus it is generated on the fly, but first check if the DLL is available
ifeq "$(wildcard $(windir)/system32/SensApi.dll)" ""
$(error $(TARGET_CPU) build requires "%windir%/system32/SensApi.dll" to be present)
endif
# detect explicit definition of TARGET_CPU via command line to force a 32-bit build
ifeq "$(origin TARGET_CPU)" "command line"
export CXX += -m32
export LD += -m32
export RC += -Fpe-i386
endif
endif
# define target and build directories and update dependent variables
TARGET_DIRECTORY := bin.$(TARGET_CPU)$(BUILD_SUFFIX)
BUILD_DIRECTORY := $(TARGET_DIRECTORY).build
TARGET_BINARY := $(TARGET_DIRECTORY)/$(TARGET_BINARY)
SRC_DATA := $(addprefix $(TARGET_DIRECTORY)/,$(SRC_DATA))
BIN_DATA := $(addprefix $(TARGET_DIRECTORY)/,$(BIN_DATA))
INSTALLER_DATA := $(addprefix $(TARGET_DIRECTORY)/,$(INSTALLER_DATA))
SCINTILLA_TARGET := $(BUILD_DIRECTORY)/$(SCINTILLA_TARGET)
LD_PATH += $(BUILD_DIRECTORY)
# detect a build outside of PowerEditor/gcc and update dependent variables
MAKEFILE_DIRECTORY := $(patsubst %/,%,$(dir $(subst \,/,$(firstword $(MAKEFILE_LIST)))))
ifneq "$(MAKEFILE_DIRECTORY)" "."
MAKEFILE_PARENT := $(patsubst %/,%,$(dir $(MAKEFILE_DIRECTORY)))
BUILD_DIR := $(BUILD_TYPE).build BIN_DIRECTORY := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(BIN_DIRECTORY))
TARGET_BINARY := $(TARGET_DIR)/$(TARGET_BASE)-$(BUILD_TYPE)$(TARGET_SUFFIX) GCC_DIRECTORY := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(GCC_DIRECTORY))
GCC_EXCLUDE := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(GCC_EXCLUDE))
SRC_DIRECTORY := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(SRC_DIRECTORY))
SRC_EXCLUDE := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(SRC_EXCLUDE))
INSTALLER_DIRECTORY := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(INSTALLER_DIRECTORY))
# Preparations: SCINTILLA_DIRECTORY := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(SCINTILLA_DIRECTORY))
ifeq "$(strip $(VERBOSE))" ""
CXXFLAGS := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(CXXFLAGS))
CPP_PATH := $(patsubst ../%,$(MAKEFILE_PARENT)/%,$(CPP_PATH))
endif
# detect a request for a verbose output
ifeq "$(filter-out 0,$(VERBOSE))" ""
AT := @ AT := @
endif endif
ifeq "$(strip $(windir))" "" # detect the current operating system
ifeq "$(windir)" ""
# not a Windows system # not a Windows system
MKDIR := mkdir -p MKDIR := mkdir -p
CPDIR := cp -r
RMDIR := rm -rf RMDIR := rm -rf
CP := cp CP := cp
RM := rm -f RM := rm -f
normalize-path = $1 normalize-path = $1
else ifneq "$(wildcard $(dir $(SHELL))ls.exe)" "" else ifneq "$(wildcard $(dir $(SHELL))ls.exe)" ""
# a Windows system with UNIX-like shell # a Windows system with a proper shell
MKDIR := $(dir $(SHELL))mkdir.exe -p MKDIR := $(dir $(SHELL))mkdir.exe -p
CPDIR := $(dir $(SHELL))cp.exe -r
RMDIR := $(dir $(SHELL))rm.exe -rf RMDIR := $(dir $(SHELL))rm.exe -rf
CP := $(dir $(SHELL))cp.exe CP := $(dir $(SHELL))cp.exe
RM := $(dir $(SHELL))rm.exe -f RM := $(dir $(SHELL))rm.exe -f
@ -73,72 +142,116 @@ normalize-path = $1
else else
# a standard Windows system # a standard Windows system
MKDIR := mkdir MKDIR := mkdir
CPDIR := xcopy /q /e /i /y
RMDIR := rmdir /q /s RMDIR := rmdir /q /s
CP := copy /y CP := copy /y
RM := del /q RM := del /q
normalize-path = $(subst /,\,$1) normalize-path = $(subst /,\,$1)
endif endif
list-subtree = $(foreach entry,$(wildcard $1/*),$(entry) $(call list-subtree,$(entry))) # discover files
GCC_DIR_TREE := $(patsubst $(GCC_DIR)/%,%,$(call list-subtree,$(GCC_DIR))) list-subtree = $(foreach i,$(wildcard $1/*),$i $(call list-subtree,$i))
SOURCE_DIR_TREE := $(patsubst $(SOURCE_DIR)/%,%,$(filter-out $(SOURCE_EXCLUDE),$(call list-subtree,$(SOURCE_DIR))))
INCLUDES += $(addprefix $(SOURCE_DIR)/,$(sort $(dir $(filter %.h %.hpp,$(SOURCE_DIR_TREE))))) GCC_SUBTREE := $(patsubst $(GCC_DIRECTORY)/%,%,$(filter-out $(GCC_EXCLUDE),$(call list-subtree,$(GCC_DIRECTORY))))
SRC_SUBTREE := $(patsubst $(SRC_DIRECTORY)/%,%,$(filter-out $(SRC_EXCLUDE),$(call list-subtree,$(SRC_DIRECTORY))))
vpath %.cpp $(GCC_DIR) $(SOURCE_DIR) CPP_PATH += $(addprefix $(GCC_DIRECTORY)/,$(sort $(patsubst %/,%,$(dir $(filter %.h %.hpp,$(GCC_SUBTREE))))))
CXX_TARGETS := $(patsubst %.cpp,$(BUILD_DIR)/%.o,$(sort $(filter %.cpp,$(GCC_DIR_TREE)) $(filter %.cpp,$(SOURCE_DIR_TREE)))) CPP_PATH += $(addprefix $(SRC_DIRECTORY)/,$(sort $(patsubst %/,%,$(dir $(filter %.h %.hpp,$(SRC_SUBTREE))))))
vpath %.rc $(GCC_DIR) $(SOURCE_DIR) vpath %.cpp $(GCC_DIRECTORY) $(SRC_DIRECTORY)
RC_TARGETS := $(patsubst %.rc,$(BUILD_DIR)/%.res,$(sort $(filter %.rc,$(GCC_DIR_TREE)) $(filter %.rc,$(SOURCE_DIR_TREE)))) CXX_TARGETS := $(patsubst %.cpp,$(BUILD_DIRECTORY)/%.o,$(sort $(filter %.cpp,$(GCC_SUBTREE) $(SRC_SUBTREE))))
CONFIG_TARGETS := $(addprefix $(TARGET_DIR)/,$(CONFIG_FILES)) vpath %.rc $(GCC_DIRECTORY) $(SRC_DIRECTORY)
RC_TARGETS := $(patsubst %.rc,$(BUILD_DIRECTORY)/%.res,$(sort $(filter %.rc,$(GCC_SUBTREE) $(SRC_SUBTREE))))
# Actions: #
.PHONY: .force all binary clean # actions
.force: #
GOALS := $(addprefix $(MAKELEVEL)-,$(if $(MAKECMDGOALS),$(MAKECMDGOALS),all)) GOALS := $(addprefix $(MAKELEVEL)-,$(if $(MAKECMDGOALS),$(MAKECMDGOALS),all))
.PHONY: .force all binary data clean fullclean
.force:
ifneq "$(filter 0-all,$(GOALS))" "" ifneq "$(filter 0-all,$(GOALS))" ""
SUBMAKEFLAGS += $(if $(NUMBER_OF_PROCESSORS),-j$(NUMBER_OF_PROCESSORS),)
.NOTPARALLEL: .NOTPARALLEL:
all: $(SCINTILLA_TARGET) all: $(SCINTILLA_TARGET)
$(AT)$(MAKE) $(SUBMAKEFLAGS) binary $(AT)$(MAKE) -f $(firstword $(MAKEFILE_LIST)) $(SUBMAKEFLAGS) binary
else else
all: binary all: binary
endif endif
ifeq "$(filter 1-binary,$(GOALS))" ""
$(SCINTILLA_TARGET): .force
endif
$(SCINTILLA_TARGET): $(if $(filter 1-binary,$(GOALS)),,.force) $(BUILD_DIRECTORY):
$(AT)$(MAKE) $(SUBMAKEFLAGS) -C $(SCINTILLA_DIR)/win32 $(SCINTILLA_TARGET:$(SCINTILLA_DIR)/%=../%) @echo * creating BUILD_DIRECTORY $@
$(AT)$(MKDIR) $(call normalize-path,$(sort $@ $(patsubst %/,%,$(dir $(CXX_TARGETS) $(RC_TARGETS)))))
binary: $(TARGET_BINARY) $(CONFIG_TARGETS) $(SCINTILLA_TARGET): | $(BUILD_DIRECTORY)
$(AT)$(MAKE) $(SUBMAKEFLAGS) -C $(SCINTILLA_DIRECTORY)/win32 LIBLEX=$(CURDIR)/$(SCINTILLA_TARGET) $(CURDIR)/$(SCINTILLA_TARGET)
$(BUILD_DIR): binary: $(TARGET_BINARY) data
@echo BUILD_DIR = $@ @echo *** $(TARGET_CPU) $(BUILD_TYPE) : $(CURDIR)/$(TARGET_BINARY) ***
$(AT)$(MKDIR) $(call normalize-path,$(sort $(BUILD_DIR)/ $(dir $(CXX_TARGETS) $(dir $(RC_TARGETS)))))
$(CXX_TARGETS): | $(BUILD_DIR) $(CXX_TARGETS): $(BUILD_DIRECTORY)/%.o: %.cpp | $(BUILD_DIRECTORY)
$(CXX_TARGETS): $(BUILD_DIR)/%.o: %.cpp @echo * compiling $<
@echo compiling $< $(AT)$(CXX) $(CXXFLAGS) $(addprefix -I,$(CPP_PATH)) $(addprefix -D,$(CPP_DEFINE)) -MMD -c -o $@ $<
$(AT)$(CXX) $(CXXFLAGS) $(addprefix -D,$(DEFINES)) $(addprefix -I,$(INCLUDES)) -MMD -c -o $@ $<
$(RC_TARGETS): | $(BUILD_DIR) $(RC_TARGETS): $(BUILD_DIRECTORY)/%.res: %.rc | $(BUILD_DIRECTORY)
$(RC_TARGETS): $(BUILD_DIR)/%.res: %.rc @echo * compiling $<
@echo compiling $< $(AT)$(RC) $(RCFLAGS) $(addprefix -I,$(CPP_PATH)) $(addprefix -D,$(CPP_DEFINE)) -O coff -o $@ -i $<
$(AT)$(RC) $(RCFLAGS) $(addprefix -D,$(DEFINES)) $(addprefix -I,$(INCLUDES)) -O coff -o $@ -i $<
$(TARGET_BINARY): $(CXX_TARGETS) $(RC_TARGETS) $(SCINTILLA_TARGET) ifeq "$(TARGET_CPU)" "i686"
@echo linking $@ $(TARGET_BINARY): $(BUILD_DIRECTORY)/libsensapi.a
$(AT)$(LD) $(LDFLAGS) $^ $(addprefix -l,$(LIBRARIES) $(SCINTILLA_LIBRARIES)) -static -o $@ $(BUILD_DIRECTORY)/libsensapi.a: | $(BUILD_DIRECTORY)
@echo * generating $@
$(AT)gendef $(call normalize-path,$(firstword $(wildcard $(windir)/syswow64/SensApi.dll $(windir)/system32/SensApi.dll)))
$(AT)dlltool -mi386 -f--32 -d SensApi.def -k -l $(call normalize-path,$@)
$(AT)$(RM) SensApi.def
endif
$(TARGET_DIRECTORY):
@echo * creating TARGET_DIRECTORY $@
$(AT)$(MKDIR) $(call normalize-path,$@)
$(TARGET_BINARY): $(CXX_TARGETS) $(RC_TARGETS) $(SCINTILLA_TARGET) | $(TARGET_DIRECTORY)
@echo * linking $@
$(AT)$(LD) $(LDFLAGS) $(filter-out %.a,$^) $(addprefix -L,$(LD_PATH)) $(addprefix -l,$(LD_LINK)) -static -o $@
$(CONFIG_TARGETS): $(TARGET_DIR)/%.xml: $(SOURCE_DIR)/%.xml data: $(patsubst %/,%,$(SRC_DATA) $(BIN_DATA) $(INSTALLER_DATA))
@echo config $@
$(patsubst %/,%,$(filter %/,$(SRC_DATA))): $(TARGET_DIRECTORY)/%: $(SRC_DIRECTORY)/% | $(TARGET_DIRECTORY)
@echo * copying $@
$(AT)$(CPDIR) $(call normalize-path,$< $@)
$(filter-out %/,$(SRC_DATA)): $(TARGET_DIRECTORY)/%: $(SRC_DIRECTORY)/% | $(TARGET_DIRECTORY)
@echo * copying $@
$(AT)$(CP) $(call normalize-path,$< $@)
$(patsubst %/,%,$(filter %/,$(BIN_DATA))): $(TARGET_DIRECTORY)/%: $(BIN_DIRECTORY)/% | $(TARGET_DIRECTORY)
@echo * copying $@
$(AT)$(CPDIR) $(call normalize-path,$< $@)
$(filter-out %/,$(BIN_DATA)): $(TARGET_DIRECTORY)/%: $(BIN_DIRECTORY)/% | $(TARGET_DIRECTORY)
@echo * copying $@
$(AT)$(CP) $(call normalize-path,$< $@)
$(TARGET_DIRECTORY)/autoCompletion: $(INSTALLER_DIRECTORY)/APIs
$(TARGET_DIRECTORY)/functionList: $(INSTALLER_DIRECTORY)/functionList
$(TARGET_DIRECTORY)/localization: $(INSTALLER_DIRECTORY)/nativeLang
$(TARGET_DIRECTORY)/themes: $(INSTALLER_DIRECTORY)/themes
$(patsubst %/,%,$(filter %/,$(INSTALLER_DATA))): | $(TARGET_DIRECTORY)
@echo * copying $@
$(AT)$(CPDIR) $(call normalize-path,$< $@)
$(filter-out %/,$(INSTALLER_DATA)): | $(TARGET_DIRECTORY)
@echo * copying $@
$(AT)$(CP) $(call normalize-path,$< $@) $(AT)$(CP) $(call normalize-path,$< $@)
clean: clean:
-$(AT)$(RM) $(call normalize-path,$(TARGET_BINARY) $(CONFIG_TARGETS)) -$(AT)$(RMDIR) $(call normalize-path,$(BUILD_DIRECTORY))
-$(AT)$(RMDIR) $(call normalize-path,$(BUILD_DIR)) -$(AT)$(MAKE) $(SUBMAKEFLAGS) -C $(SCINTILLA_DIRECTORY)/win32 $@
-$(AT)$(MAKE) $(SUBMAKEFLAGS) -C $(SCINTILLA_DIR)/win32 $@
# the `clean` target of Scintilla leaves some artifacts, thus clean up after it fullclean: clean
-$(AT)$(RM) $(call normalize-path,$(SCINTILLA_DIR)/bin/*.a $(SCINTILLA_DIR)/bin/*.dll) -$(AT)$(RMDIR) $(call normalize-path,$(TARGET_DIRECTORY))
-include $(CXX_TARGETS:%.o=%.d) -include $(CXX_TARGETS:%.o=%.d)

@ -1,24 +0,0 @@
makefile was renewed after the v6.8.7 release.
It was tested with a MinGW-w64 distribution containing
GCC 5.2.0 (cross-compiled with i686-w64-mingw32 on Arch Linux) and
GCC 4.9.2 (natively on Windows 7, will not work anymore with this version).
The default make rule should suffice for building Notepad++,
and copying the required .xml config files.
If cross-compiling you may have to pass a custom CROSS_COMPILE
variable depending on your Linux distribution.
The clean rule removes .o/.d and .res and the copied .xml files
For localization support in the editor preferences you have to copy the
PowerEditor/installer/nativeLang/ directory to PowerEditor/bin/ with the new
directory name "localization".
On Linux a symbolic link suffices:
$ ln -s ../installer/nativeLang localization
For execution with Wine some additional DLLs from the MinGW package have to be
found inside of the PowerEditor/bin/ directory, which can be achieved by using
links again, e.g.:
$ ln -s /usr/i686-w64-mingw32/bin/libgcc_s_sjlj-1.dll
$ ln -s /usr/i686-w64-mingw32/bin/libstdc++-6.dll
$ ln -s /usr/i686-w64-mingw32/bin/libwinpthread-1.dll

@ -10,6 +10,14 @@
#include <unordered_set> #include <unordered_set>
#include <mutex> #include <mutex>
#if defined(__GNUC__) && __GNUC__ > 8
#define WINAPI_LAMBDA_RETURN(return_t) -> return_t WINAPI
#elif defined(__GNUC__)
#define WINAPI_LAMBDA_RETURN(return_t) WINAPI -> return_t
#else
#define WINAPI_LAMBDA_RETURN(return_t) -> return_t
#endif
enum IMMERSIVE_HC_CACHE_MODE enum IMMERSIVE_HC_CACHE_MODE
{ {
IHCM_USE_CACHED_VALUE, IHCM_USE_CACHED_VALUE,
@ -221,7 +229,7 @@ void FixDarkScrollBar()
DWORD oldProtect; DWORD oldProtect;
if (VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), PAGE_READWRITE, &oldProtect) && _OpenNcThemeData) if (VirtualProtect(addr, sizeof(IMAGE_THUNK_DATA), PAGE_READWRITE, &oldProtect) && _OpenNcThemeData)
{ {
auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) -> HTHEME { auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) WINAPI_LAMBDA_RETURN(HTHEME) {
if (wcscmp(classList, L"ScrollBar") == 0) if (wcscmp(classList, L"ScrollBar") == 0)
{ {
if (IsWindowOrParentUsingDarkScrollBar(hWnd)) { if (IsWindowOrParentUsingDarkScrollBar(hWnd)) {

@ -30,7 +30,7 @@ PIMAGE_THUNK_DATA FindAddressByName(void *moduleBase, PIMAGE_THUNK_DATA impName,
continue; continue;
auto import = RVA2VA<PIMAGE_IMPORT_BY_NAME>(moduleBase, impName->u1.AddressOfData); auto import = RVA2VA<PIMAGE_IMPORT_BY_NAME>(moduleBase, impName->u1.AddressOfData);
if (strcmp(import->Name, funcName) != 0) if (strcmp(reinterpret_cast<const char *>(import->Name), funcName) != 0)
continue; continue;
return impAddr; return impAddr;
} }

@ -28,8 +28,11 @@
#include <Shlwapi.h> #include <Shlwapi.h>
#ifdef __MINGW32__ #ifdef __GNUC__
#include <cmath> #include <cmath>
#define WINAPI_LAMBDA WINAPI
#else
#define WINAPI_LAMBDA
#endif #endif
#pragma comment(lib, "uxtheme.lib") #pragma comment(lib, "uxtheme.lib")
@ -1435,7 +1438,7 @@ namespace NppDarkMode
::EnableThemeDialogTexture(hwndParent, theme && !NppDarkMode::isEnabled() ? ETDT_ENABLETAB : ETDT_DISABLE); ::EnableThemeDialogTexture(hwndParent, theme && !NppDarkMode::isEnabled() ? ETDT_ENABLETAB : ETDT_DISABLE);
EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) { EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) WINAPI_LAMBDA {
auto& p = *reinterpret_cast<Params*>(lParam); auto& p = *reinterpret_cast<Params*>(lParam);
const size_t classNameLen = 16; const size_t classNameLen = 16;
TCHAR className[classNameLen] = { 0 }; TCHAR className[classNameLen] = { 0 };

@ -1,77 +1,79 @@
version: 8.1.{build} version: 8.1.{build}
image: Visual Studio 2019 image: Visual Studio 2019
#skip_commits:
# files:
# - PowerEditor/bin/*/*.xml
# - PowerEditor/installer/*/*.xml
environment: environment:
matrix: matrix:
- platform: Win32 - compiler: MSC
archi: x86 platform: Win32
platform_input: Win32
PYTHON: "C:\\Python38"
- platform: x64 - compiler: MSC
archi: amd64 platform: x64
platform_input: x64
- platform: mingw-w64_810_X64 - compiler: MSC
platform_input: mingw platform: arm64
- platform: arm64 - compiler: GCC
archi: amd64_arm64 platform: i686
platform_input: arm64
- compiler: GCC
platform: x86_64
configuration: configuration:
- Release - Release
- Debug - Debug
install: matrix:
- if "%Platform%"=="mingw-w64_810_X64" set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin;=% exclude:
- if "%archi%" NEQ "" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %archi% - compiler: GCC
configuration: Debug
build_script: before_build:
- ps: | - ps: |
Write-Output "Configuration: $env:CONFIGURATION" Write-Output "Compiler : $env:compiler"
Write-Output "Platform: $env:PLATFORM" Write-Output "Platform : $env:platform"
Write-Output "Configuration : $env:configuration"
- if "%configuration%"=="Debug" set build_options=DEBUG=1
- if "%configuration%"=="Release" set build_options= for:
- cd "%APPVEYOR_BUILD_FOLDER%"\PowerEditor\visual.net\ - matrix:
- if "%archi%" NEQ "" msbuild /m notepadPlus.sln /p:configuration="%configuration%" /p:platform="%platform_input%" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" only:
- if "%Platform%"=="mingw-w64_810_X64" cd c:\projects\notepad-plus-plus\PowerEditor\gcc\ & mingw32-make -j%NUMBER_OF_PROCESSORS% VERBOSE=1 %build_options% - compiler: MSC
build:
parallel: true
after_build: project: PowerEditor\visual.net\notepadPlus.sln
- cd "%APPVEYOR_BUILD_FOLDER%" after_build:
#xml files syntax checks # artifacts
- if "%platform_input%"=="Win32" if "%configuration%"=="Debug" SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH% - ps: |
- if "%platform_input%"=="Win32" if "%configuration%"=="Debug" python -m pip install requests rfc3987 pywin32 lxml $nppFileName = "Notepad++.$env:platform.$env:configuration.exe"
- if "%platform_input%"=="Win32" if "%configuration%"=="Debug" call python PowerEditor\Test\xmlValidator\validator_xml.py if ("$env:platform/$env:configuration" -eq "Win32/Release") {
Push-AppveyorArtifact "PowerEditor\bin\Notepad++.exe" -FileName "$nppFileName"
- ps: >-
if ($env:CONFIGURATION -eq "Release") {
$nppFileName = "Notepad++.$env:PLATFORM_INPUT.Release.exe"
} }
else if ("$env:platform/$env:configuration" -eq "Win32/Debug") {
{ Push-AppveyorArtifact "PowerEditor\visual.net\Debug\Notepad++.exe" -FileName "$nppFileName"
$nppFileName = "Notepad++.$env:PLATFORM_INPUT.Debug.exe"
} }
if ("$env:platform/$env:configuration" -eq "x64/Release") {
if ($env:PLATFORM_INPUT -eq "x64" -and $env:CONFIGURATION -eq "Release") {
Push-AppveyorArtifact "PowerEditor\bin64\Notepad++.exe" -FileName "$nppFileName" Push-AppveyorArtifact "PowerEditor\bin64\Notepad++.exe" -FileName "$nppFileName"
} }
if ("$env:platform/$env:configuration" -eq "x64/Debug") {
if ($env:PLATFORM_INPUT -eq "x64" -and $env:CONFIGURATION -eq "Debug") {
Push-AppveyorArtifact "PowerEditor\visual.net\x64\Debug\Notepad++.exe" -FileName "$nppFileName" Push-AppveyorArtifact "PowerEditor\visual.net\x64\Debug\Notepad++.exe" -FileName "$nppFileName"
} }
if ("$env:platform/$env:configuration" -eq "arm64/Release") {
if ($env:PLATFORM_INPUT -eq "Win32" -and $env:CONFIGURATION -eq "Release") { Push-AppveyorArtifact "PowerEditor\binarm64\Notepad++.exe" -FileName "$nppFileName"
Push-AppveyorArtifact "PowerEditor\bin\Notepad++.exe" -FileName "$nppFileName"
} }
if ("$env:platform/$env:configuration" -eq "arm64/Debug") {
if ($env:PLATFORM_INPUT -eq "Win32" -and $env:CONFIGURATION -eq "Debug") { Push-AppveyorArtifact "PowerEditor\visual.net\arm64\Debug\Notepad++.exe" -FileName "$nppFileName"
Push-AppveyorArtifact "PowerEditor\visual.net\Debug\Notepad++.exe" -FileName "$nppFileName" }
# xml files syntax checks
- if "%platform%/%configuration%" EQU "Win32/Debug" set PATH=C:\Python38;C:\Python38\Scripts;%PATH%
- if "%platform%/%configuration%" EQU "Win32/Debug" python -m pip install requests rfc3987 pywin32 lxml
- if "%platform%/%configuration%" EQU "Win32/Debug" python PowerEditor\Test\xmlValidator\validator_xml.py
# tests
- ps: |
if ("$env:platform/$env:configuration" -eq "Win32/Debug") {
Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\visual.net\Debug\Notepad++.exe" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\visual.net\Debug\Notepad++.exe" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin"
Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\langs.model.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\langs.model.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin"
Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\stylers.model.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin" Copy-Item "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\src\stylers.model.xml" -Destination "$env:APPVEYOR_BUILD_FOLDER\PowerEditor\bin"
@ -86,24 +88,27 @@ after_build:
.\unitTestLauncher.ps1 .\unitTestLauncher.ps1
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
#ATTENTION: current working dir is no longer at APPVEYOR_BUILD_FOLDER
cd ..\UrlDetection cd ..\UrlDetection
.\verifyUrlDetection.ps1 .\verifyUrlDetection.ps1
}
if ($env:PLATFORM_INPUT -eq "arm64" -and $env:CONFIGURATION -eq "Release") { cd "$env:APPVEYOR_BUILD_FOLDER"
Push-AppveyorArtifact "PowerEditor\binarm64\Notepad++.exe" -FileName "$nppFileName"
} }
if ($env:PLATFORM_INPUT -eq "arm64" -and $env:CONFIGURATION -eq "Debug") { - matrix:
Push-AppveyorArtifact "PowerEditor\visual.net\arm64\Debug\Notepad++.exe" -FileName "$nppFileName" only:
} - compiler: GCC
install:
if ($env:PLATFORM_INPUT -eq "mingw" -and $env:CONFIGURATION -eq "Release") { - if "%platform%" EQU "i686" set PATH=C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH:C:\Program Files\Git\usr\bin;=%
Push-AppveyorArtifact "PowerEditor\bin\NotepadPP-release.exe" -FileName "$nppFileName" - if "%platform%" EQU "x86_64" set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH:C:\Program Files\Git\usr\bin;=%
build_script:
- mingw32-make -f PowerEditor\gcc\makefile
after_build:
# artifacts
- ps: |
$nppFileName = "Notepad++.$env:compiler.$env:platform.$env:configuration.exe"
if ("$env:platform/$env:configuration" -eq "i686/Release") {
Push-AppveyorArtifact "bin.i686\notepad++.exe" -FileName "$nppFileName"
} }
if ("$env:platform/$env:configuration" -eq "x86_64/Release") {
if ($env:PLATFORM_INPUT -eq "mingw" -and $env:CONFIGURATION -eq "Debug") { Push-AppveyorArtifact "bin.x86_64\notepad++.exe" -FileName "$nppFileName"
Push-AppveyorArtifact "PowerEditor\bin\NotepadPP-debug.exe" -FileName "$nppFileName"
} }

Loading…
Cancel
Save