transmitterdan / BatchUTILS

Windows batch files I use to make building OpenCPN and other things easier.
2 stars 2 forks source link

Reference in the Dev Manual #4

Closed rgleason closed 2 years ago

rgleason commented 2 years ago

I started writing this but lost the issue somehow earlier today. In the new Dev Manual reference batchutils here https://opencpn-manuals.github.io/development/ocpn-dev-manual/5.3.1/od-compile-windows.html#_batchutils

First I think the title should be larger and there seems to be a bad link in the text. I will try to fix those.

Would you mind reviewing this paragraph and making any improvements you think are necessary? You can suggest here in this issue, or you can just hit the "Edit this page" button in the upper right and then make a pr to be merged later (which would be better). Editing is in asciidoc/antora and I found it pretty easy to pick up and quite familiar.

Thank you for updating to VS2022. I had two questions about that.

  1. Does BatchUtil automatically sense the VS version?
  2. When should we be moving to VS2022?

Also I currently have my widgets located in c:/users/fcgle/source/wxwidgets and I currently have these environment variables set to

wxWidgets_INCLUDE_DIRS   =%WXWIN%
wxWidgets_LIB_DIR  = %WXWIN%\lib\vc_dll
wxWidgetsROOT_DIR = %WXWIN%
WXWIN  = C:\Users\fcgle\source\wxWidgets 

Is it ok to have WXWIN defined at the end? What batch file would I modify to have Batchutil match to this setup? oesetup?

transmitterdan commented 2 years ago

Yes, it senses the version of V-Studio. Right now 2022 is only available in pre-release. I'll have to update once they release it later in November.

The wx environment variables are in oesetup.bat

I'll take a look when I get some time. Busy with a bunch of work related stuff right now.

rgleason commented 2 years ago

I've cloned wxwidgets-3.1.2 again and built release and debug. I've modified oesetup.bat accordingly and copied that into

For Visual Studio 2017 and 2019 do not edit VsDevCmd.bat. Rather copy Osetup.bat to this folder:
         "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\ext"

Now when I open a vs command prompt I get

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.40
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
"********************************"
"*   Entering Osetup.bat...V1.1  *"
"********************************"
Found OpenCPN development folder at C:\Users\fcgle\source\OpenCPN
Trying to find Visual Studio version
Searching in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\"
Configuring for VS2017
"__get__ = "
"vcgen=Visual Studio 15 2017"
"vcts=141_xp"
"vcgen=Visual Studio 15 2017"
"vcts=141_xp"
Found most recent version of wxWidgets at C:\Users\fcgle\source\wxWidgets-3.1.2
wxWidgets folder is "C:\Users\fcgle\source\wxWidgets-3.1.2"
wxWidgets_LIB_DIR folder is "C:\Users\fcgle\source\wxWidgets-3.1.2\lib\vc141_xp_dll"
Warning: Could not add directory to PATH "C:\Users\fcgle\source\wxWidgets-3.1.2\lib\vc141_xp_dll"
Adding "C:\Users\fcgle\source\wxWidgets-3.1.2" to path
Adding "C:\Program Files (x86)\Poedit\GettextTools\bin" to path
Adding "C:\Program Files\CMake\bin" to path
Adding "C:\Program Files\7-Zip" to path
Adding "C:\Program Files\Notepad++" to path
Adding "C:\Program Files\Git\cmd" to path
Warning: Could not add directory to PATH "C:\Program Files\doxygen\bin"
Warning: Could not add directory to PATH "C:\Program Files (x86)\Graphviz2.38\bin"
Adding "C:\Users\fcgle\source\BatchUTILS" to path
[vcvarsall.bat] Environment initialized for: 'x86'

C:\Users\fcgle\source\OpenCPN>

The problem is Warning: Could not add directory to PATH "C:\Users\fcgle\source\wxWidgets-3.1.2\lib\vc141_xp_dll" because this file does not seem to exist there. It would think this is a microsoft dll? Perhaps I edited the oesetup.bat improperly.

rgleason commented 2 years ago
:foundWX
@echo Found most recent version of wxWidgets at %WXDIR%
@set "wxWIN=%WXDIR%"
@set "wxWidgets_ROOT_DIR=%WXDIR%"
@set "wxWidgets_LIB_DIR=%WXDIR%\lib\vc%vcts%_dll"    <--------The line comes from here.
@ECHO wxWidgets folder is "%WXDIR%"

@ECHO wxWidgets_LIB_DIR folder is "%wxWidgets_LIB_DIR%"

call :add_to_path "%wxWidgets_LIB_DIR%"

call :add_to_path "%wxWin%"
rgleason commented 2 years ago

I've gone ahead and executed config.bat from sources/opencpn/build directory and this is the output. I think there are some wxWidgets not found around line 695 but then perhaps they were found. config-bat-output.txt

My goal is to be able to debug opencpn and polar_pi

PS: Happy TG.

rgleason commented 2 years ago

Note: When I open wxWidgets in VS2017 it looks like it is building an x64 bit version. Isn't that a problem? Now it finished and stuck the files in an x64 directory somewhere.

Doesn't this have to be 32 bit for Opencpn? How do I set that?

rgleason commented 2 years ago

Also when I build and try to debug wxwidgets is not found, although I think I have all the right env paths.

transmitterdan commented 2 years ago

How are you building wxWidgets? Where does it put the resulting dolls?

rgleason commented 2 years ago

I build it from C:\Users\fcgle\source\wxWidgets-3.1.2 Using Dev Manual

Get the wxWidgets_3.1.2 source and build them

cd wxWidgets git submodule init git submodule update

cd build\msw
nmake /f makefile.vc BUILD=release SHARED=1 CXXFLAGS=/D_USING_V141_SDK71_ CFLAGS=/D_USING_V141_SDK71_ LDFLAGS=/SUBSYSTEM:WINDOWS,5.01
nmake /f makefile.vc BUILD=debug SHARED=1 CXXFLAGS=/D_USING_V141_SDK71_ CFLAGS=/D_USING_V141_SDK71_ LDFLAGS=/SUBSYSTEM:WINDOWS,5.01 

C:\Users\fcgle\source\wxWidgets-3.1.2\build\msw has many wx filters and two dir

rgleason commented 2 years ago

I think they are landing here C:\Users\fcgle\source\wxWidgets-3.1.2\lib\vc_dll wxwidgets-built

rgleason commented 2 years ago
wxWidgets_LIB_DIR folder is "C:\Users\fcgle\source\wxWidgets-3.1.2\lib\vc141_xp_dll"
Warning: Could not add directory to PATH "C:\Users\fcgle\source\wxWidgets-3.1.2\lib\vc141_xp_dll"

There is no vc141_xp.dll folder/file here.

rgleason commented 2 years ago

I think the path should be

C:\Users\fcgle\source\wxWidgets-3.1.2\lib\vc_dll

and will try that.

rgleason commented 2 years ago

In oesetup.bat this appears to be working now and finding wxWidgets.

:foundWX
@echo Found most recent version of wxWidgets at %WXDIR%
@set "wxWIN=%WXDIR%"
@set "wxWidgets_ROOT_DIR=%WXDIR%"
rem For Visual Studio 2017 this directory does not appear to exist
rem @set "wxWidgets_LIB_DIR=%WXDIR%\lib\vc%vcts%_dll"
@set "wxWidgets_LIB_DIR=%WXDIR%\lib\vc_dll"