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
Build enhancement for scintilla static linkage #9594
Conversation
For me, it seems like syntax highlighting doesn't work anymore. Only plain black texts. |
@Uhf7 I must have been blind at the time I took a look at it. Indeed the highlighting is missing. |
9d5da94
to
69b9b07
Compare
Syntax highlighting works now, and the size of the new |
4f35526
to
82487b5
Compare
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.
- Modify Scintilla register error message.
- Make boost lib path more generic.
@@ -122,6 +122,7 @@ | |||
<SubSystem>Windows</SubSystem> | |||
<TargetMachine>MachineX86</TargetMachine> | |||
<MinimumRequiredVersion>5.01</MinimumRequiredVersion> | |||
<AdditionalLibraryDirectories>..\..\scintilla\bin;C:\Libraries\boost_1_69_0\lib32-msvc-14.1\</AdditionalLibraryDirectories> |
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.
This path C:\Libraries\boost_1_69_0\lib32-msvc-14.1\
is for Appveyor only.
Could we use a more generic directory like ..\..\boost.pcreLib\
instead, so in both devs' env and Appveyor, we copy boost regexpr lib previously ?
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.
I think the preferable solution would be:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/c5fa62ac-e84f-4d61-a9bf-eb8136305393/creating-a-static-libraries-that-depends-on-other-libraries?forum=vclanguage
- modify the build of libscilexer.lib to already contain the dependent libs of boost, imm32, msimg32.lib within the static one
-
We could add a prop file and define there the boost path
-
add some default path which is working for manual usage and configure appveyor via commandline
-
use nuget packages for boost within N++
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.
@chcg
Ideally it would be great to add Scintilla project into the solution and the compiled boost regexpr static lib into repo, so any dev can pull the repo and build Notepad++ with whole features via VS2017(VS2019 in the future)'s Build Solution
command.
But so far I'm trying to find a middle term solution for both dev (like you & me) and Appveyor build system. So C:\Libraries\boost_1_69_0\lib32-msvc-14.1\
cannot be used, because it's only for build system. The middle term solution for me is this PR with a empty boost lib directory (without version number) in repository (a placeholder dummy file inside it), plus the additional build instruction to tell users to put the compiled boost pcre lib into this directory.
In this way we have the solution now for both dev & build environment, and users can tests new binary immediately.
What do you think?
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.
@donho Did I get you right that a only VS solution (N++ with scilexer) would be the goal?
In this case we had already something like that, see below. The boost stuff in that case is coming from a nuget package (https://github.com/sergey-shandar/getboost) which contains prebuilt binaries, taken from https://dl.bintray.com/boostorg/release/1.72.0/binaries/ and is automatically downloaded by VS studio. This could be also easily adapted for the static build.
What do you think about "Unicode Release" vs. just "Release"
Revision: eba913d
Author: Christian Grasser christian.grasser@live.de
Date: 13.03.2017 21:28:02
Message:
Scintilla Namespace
- corrected missing scintilla namespaces
- activated usage of scintilla namespace in nmakefile and vcxproj
Closes #3033
Modified: scintilla/boostregex/AnsiDocumentIterator.h
Modified: scintilla/boostregex/UTF8DocumentIterator.cxx
Modified: scintilla/boostregex/UTF8DocumentIterator.h
Modified: scintilla/lexers/LexObjC.cxx
Modified: scintilla/lexers/LexSearchResult.cxx
Modified: scintilla/win32/SciLexer.vcxproj
Modified: scintilla/win32/scintilla.makRevision: fdd2dbc
Author: Christian Grasser christian.grasser@live.de
Date: 11.06.2015 17:37:54
Message:
- add npp boostregex dir/sources and define SCI_OWNREGEX
- add boost via nuget package
Modified: scintilla/win32/SciLexer.vcxproj
Added: scintilla/win32/packages.configRevision: a6e0dd9
Author: Christian Grasser christian.grasser@live.de
Date: 11.06.2015 11:31:59
Message:
adapted scintilla vs project to notepad++ naming of build configurations from
Debug -> Unicode Debug and Release -> Unicode Release, to hav a consistent look in VS solution
Used same
ToolsVersion="12.0"
and
v120_xpModified: scintilla/win32/SciLexer.vcxproj
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.
Ideally it would be great to add Scintilla project into the solution and the compiled boost regexpr static lib into repo, so any dev can pull the repo and build Notepad++ with whole features via VS2017(VS2019 in the future)'s
Build Solution
command.
Just an idea. In theory, CMake could be used for that without the need of a project/solution file.
I think, it could allow building the entire N++ in "one click".
It should handle any subprojects whether they're using Make or anything else.
It is integrated right into Visual Studio: https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-160#ide-integration
Adding a NuGet package to the CMake setup or any other package (e.g. vcpkg) should be relatively easy.
I can research this more and provide more info with a full list of pros/cons in a separate issue, if anybody is interested.
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.
The nuget regex package contains also pre-built boost libs. And the same issue appears on using the ones from appveyor, so we remain with the problem to add an additional path to the boost libs into the N++ vcxproj file. I will try to find out why it is not sufficient to have the static lib be part of libscilexer.lib. This is working for e.g. imm32.lib.
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.
@chcg
Sorry I wasn't clear. By "include pre-built boost lib", I meant do without nuget package since you said "This requires the nuget package also in the n++ vcxproj files.".
My vision to the future solution is:
Solution notepadPlus (notepadPlus.sln)
Notepad++ (notepadPlus.vcxproj) - generate notepad++.exe (include libscilexer.lib)
Scintilla (scintilla/win32/libSciLexer.vcxproj) - generate libscilexer.lib (include boostRegexpr.lib)
boostRegexpr.lib
could be pre-built and included in the repository. In this way we have complete chain to build notepad++.exe
, Building Notepad++ will be much easier for whomever - it needs only to fork the project locally, launch the solution then "Build the solution" or "Build Notepad++" command.
What do you think?
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.
@donho There are interesting things ongoing with boost 1.76 beta1, see https://www.boost.org/users/history/version_1_76_0.html. Regex will be changed to be a header only version.
Regex:
Regex is now header only except in C++03 mode. Support for C++03 is now deprecated. The library can now be used "standalone" without the rest of Boost being present.
So maybe that will make it easier to use it for use. In the future.
Additionally there is already https://www.boost.org/doc/libs/1_75_0/doc/html/xpressive.html available, which is also header only and might be worth a look, if updated regex doesn't evolve in the right direction.
For now I will try to modify the PR and add the binary libs directly into git. This would be
libboost_regex-vc141-mt-s-x32-1_72.lib 12 MB
libboost_regex-vc141-mt-s-x64-1_72.lib 16 MB
I hope I got your proposal right.
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.
The library can now be used "standalone" without the rest of Boost being present.
If that does mean boost regexpr contains only it-self, why don't we include it in the repository directly?
Solution notepadPlus (notepadPlus.sln)
Notepad++ (notepadPlus.vcxproj) - generate notepad++.exe (include libscilexer.lib)
Scintilla (scintilla/win32/libSciLexer.vcxproj) - generate libscilexer.lib (include boostRegexpr.lib)
BoostRegExpr (BoostRegExpr/boostRegExpr.vcxproj) generate boostRegexpr.lib
I hate git sub-Module and don't like the idea of Nuget - my goal is make build process as simple as possible so a 80 year-old grand-mom or a 8 year-old kid can build Notepad++ without RTFM. And with such simplicity, the binary generated by Appveyor will be near the binary of release - that's a great gain IMO.
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.
@donho Just spotted the boost beta today, so I didn't have a closer look on it yet. So it is unclear to me what "standalone" means exactly.
Maybe you like subtree more than submodule:
https://blog.developer.atlassian.com/the-power-of-git-subtree/?_ga=2-71978451-1385799339-1568044055-1068396449-1567112770
As long as you are staying within VisualStudio nuget packages are hidden behind the scenes for the "end user" and just pressing F7 is doing the build + checkin that the package exists. So not too far away from your expectation.
throw std::runtime_error("ScintillaEditView::init : SCINTILLA ERROR - Can not load the dynamic library"); | ||
if (!Scintilla_RegisterClasses(hInst)) | ||
{ | ||
throw std::runtime_error("ScintillaEditView::init : SCINTILLA ERROR - Can not load the dynamic library"); |
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.
This error message should be modified.
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.
Changed to:
ScintillaEditView::init : SCINTILLA ERROR - Scintilla_RegisterClasses failed
82487b5
to
d321ec6
Compare
@chcg Very nice progress so far. Somewhat unrelated but I'll ask because you're in there working on the build... The .exe "artifacts" have a space in their names, e.g. How long do we carry along the baggage of "Unicode" in the name? (... and truly elsewhere in the project's embedded names also). |
@sasumner The name is created in appveyor.yml by:
As the space is part of the configuration name this could be changed by some additional env variable or easier as you suggested to remove the unicode from the config name. |
cb0c2ab
to
2dd086c
Compare
b050e60
to
6c64e55
Compare
@donho With the last checkin I removed the nuget again and replaced it with the new header only boost regex from 1.76 beta1. Seems to be a quite easy solution which works for nmake build and also one stop VS solution.
|
Sorry, I don't quite follow you. Did you add the project (and source code) of boost regex 1.76 beta1 into notepad_plus solution? |
@donho See 6c64e55. I added the stripped regex folder from the boost distribution 1.76 beta1 under scintilla/boostregex/boost. Just the new header only V5 version as we don't need c++03 support. The build always is done with boost regex and has no longer the option to switch based on the existence of boost path and libs environment vars. If that way is ok, I think we need some testing for the regex functionality to be sure that nothing is broken with this new version or maybe we should wait at least for the boost 1.76 release and see if some bugs are still found in the regex component. |
@chcg
I think we should wait for the official release to include it. In the meanwhile, we can test the binary & refine the PR. Bravo! edit: I see the ARM build is in the config, it's great - Notepad++ will support ARM in the future, if it's possible. |
@donho We might see some migration issues between arm and x86 at runtime, see https://docs.microsoft.com/en-us/cpp/build/common-visual-cpp-arm-migration-issues?view=msvc-160. So we should get some guys from #5158 who have the necessary win10 on arm to test it. |
Yes please.
Once PR #6196 is merged into this PR and it does be compiled, we will ask them for testing. |
e0b02ca
to
e5a2bf5
Compare
Fixed merge conflict with change from #9566
See https://www.boost.org/doc/libs/1_75_0/libs/exception/doc/frequently_asked_questions.html maybe it makes sense to use |
@chcg Do you have any idea for this error? |
@donho Seems you have not installed the arm64 compiler for VS2017 |
…a dynamic one - moved boostregex out of scintilla dir and adapted build configs therefore - reverted changes to deps.mak, nmdeps.mak, DepGen.py
ce55cad
to
1b6f15e
Compare
Thank you @chcg !
No problem. I can do it.
That could be done later. Could you share your knowledge/experience to change I notice one strange behaviour while using the command In any configuration after the first |
2 days more... |
Further todo:
|
@chcg |
1.76 RC1 ? |
@chcg |
It is nice this finally got checked in! |
@donho Final release of boost 1.76 is out, no change except of an additional |
@mere-human Slower compared to what? Nmake build? Now boost regex is header only and needs to be also built instead of just linked. Warnings are there for the boostregex iterators: c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\xutility(462): warning C4996: 'std::iterator<std::bidirectional_iterator_tag,char,ptrdiff_t,_Ty *,_Ty &>::iterator_category': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [C:\projects\notepad-plus-plus\scintilla\win32\SciLexer.vcxproj] See e.g. https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/ , so we need to define something like:
instead of :
|
I second this sentiment! Nice work, @chcg Christian! @chcg Will you work to update BUILD.md since you are most-knowing on this topic? Note: I will make slight tweaks to this because of the build change: |
UPDATE: The testing document has been modified to correspond to the changes made by this PR commit. |
@sasumner I could create another PR with the BUILD.md update |
Please create a PR for this - the point is to align with v1.76 boost RegExpr release.
You mean nppPluginList. Yes sure, please. |
Right. Plus I forgot we had a prebuilt SciLexer.dll anyway. |
SCI_LOADLEXERLIBRARY has been removed since Scintilla 5, and I belive that Scintilla won't support it anymore: https://sourceforge.net/p/scintilla/bugs/2236/ Close #11451
See #9574:
@donho Adapted VS build to link against static libscintilla.lib. Boost path in Vvcxproj is just hardcoded to the appveyor path C:\Libraries\boost_1_69_0\lib32|64-msvc-14.1\ and mingw is not adapted yet.
So just a first testversion as proof of concept to show what needs to be adapted. The build result is usable and seems to show no problem during my first tests.