Skip to content

Commit a50e120

Browse files
committed
Change editor DLL distribution method.
- `cmedit*.dll` will now be distributed under the AGPL 3 as part of the POV-Ray installer proper; only `povcmax*.dll` will continue to be deployed separately. - Editor DLLs no longer come in a 32-bit SSE2 flavor. Instead, both 32-bit variants of POV-Ray for Windows now use the same set of DLLs.
1 parent b408434 commit a50e120

File tree

8 files changed

+524
-71
lines changed

8 files changed

+524
-71
lines changed

.github/workflows/release_build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ jobs:
164164
bin-dir: bin64
165165
bin-name: pvengine64.exe
166166
install-name: pvengine64.exe
167+
dll-name: cmedit64.dll
167168
compatibility: ''
168169
os: windows-2016
169170
solution-dir: vs2015
@@ -176,6 +177,7 @@ jobs:
176177
bin-dir: bin32
177178
bin-name: pvengine32-sse2.exe
178179
install-name: pvengine-sse2.exe
180+
dll-name: ''
179181
compatibility: ''
180182
os: windows-2016
181183
solution-dir: vs2015
@@ -188,6 +190,7 @@ jobs:
188190
bin-dir: bin32
189191
bin-name: pvengine32.exe
190192
install-name: pvengine.exe
193+
dll-name: cmedit32.dll
191194
compatibility: ''
192195
os: windows-2016
193196
solution-dir: vs2015
@@ -236,6 +239,10 @@ jobs:
236239
$env:pov_binary = "windows/${{matrix.solution-dir}}/${{matrix.bin-dir}}/${{matrix.bin-name}}"
237240
New-Item -ItemType directory -Path "installer/core/bin" | Out-Null
238241
Copy-Item $env:pov_binary "installer/core/bin/${{matrix.install-name}}"
242+
if ( '${{matrix.dll-name}}' -ne '' ) {
243+
$env:pov_dll = "windows/${{matrix.solution-dir}}/${{matrix.bin-dir}}/${{matrix.dll-name}}"
244+
Copy-Item $env:pov_dll "installer/core/bin/${{matrix.dll-name}}"
245+
}
239246
240247
- name: 'Upload Artifacts for Installer Build'
241248
uses: actions/upload-artifact@v2

windows/cmedit/cmedit.rc

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88
// Generated from the TEXTINCLUDE 2 resource.
99
//
10+
#include "../povwin_version.h"
1011
#include "winuser.h"
1112
#define APSTUDIO_HIDDEN_SYMBOLS
1213
#include "windows.h"
@@ -268,6 +269,7 @@ END
268269

269270
2 TEXTINCLUDE
270271
BEGIN
272+
"#include ""../povwin_version.h""\r\n"
271273
"#include ""winuser.h""\r\n"
272274
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
273275
"#include ""windows.h""\r\n"
@@ -284,8 +286,8 @@ BEGIN
284286
"#endif\r\n"
285287
"\r\n"
286288
"1 VERSIONINFO\r\n"
287-
"FILEVERSION 3,7,0,0\r\n"
288-
"PRODUCTVERSION 3,7,0,0\r\n"
289+
"FILEVERSION POVWIN_VERSION_RC\r\n"
290+
"PRODUCTVERSION POVWIN_VERSION_RC\r\n"
289291
"FILEFLAGSMASK 0x3fL\r\n"
290292
"#ifdef _DEBUG\r\n"
291293
"FILEFLAGS 0x1L\r\n"
@@ -300,14 +302,15 @@ BEGIN
300302
" BEGIN\r\n"
301303
" BLOCK ""0c0904e4""\r\n"
302304
" BEGIN\r\n"
303-
" VALUE ""CompanyName"", ""Persistence of Vision Raytracer Pty. Ltd.""\r\n"
304-
" VALUE ""FileDescription"", ""POV-Ray for Windows editor interface DLL""\r\n"
305-
" VALUE ""FileVersion"", ""3.8.0.0""\r\n"
306-
" VALUE ""InternalName"", DLLNAME\r\n"
307-
" VALUE ""LegalCopyright"", ""Copyright 2004-2017 Persistence of Vision Raytracer Pty. Ltd.""\r\n"
308-
" VALUE ""OriginalFilename"", DLLNAME\r\n"
309-
" VALUE ""ProductName"", ""The Persistence of Vision Raytracer""\r\n"
310-
" VALUE ""ProductVersion"", ""3.8.0.0""\r\n"
305+
" VALUE ""CompanyName"", POVWIN_WINRC_COMPANY_NAME\r\n"
306+
" VALUE ""FileDescription"", POVWIN_APPLICATION_NAME "" editor interface DLL""\r\n"
307+
" VALUE ""FileVersion"", POVWIN_WINRC_FILE_VERSION\r\n"
308+
" VALUE ""InternalName"", DLLNAME\r\n"
309+
" VALUE ""LegalCopyright"", POVWIN_WINRC_LEGAL_COPYRIGHT\r\n"
310+
" VALUE ""LegalTrademarks"", POVWIN_WINRC_LEGAL_TRADEMARKS\r\n"
311+
" VALUE ""OriginalFilename"", DLLNAME\r\n"
312+
" VALUE ""ProductName"", POVWIN_WINRC_PRODUCT_NAME\r\n"
313+
" VALUE ""ProductVersion"", POVWIN_WINRC_PRODUCT_VERSION\r\n"
311314
" END\r\n"
312315
" END\r\n"
313316
" BLOCK ""VarFileInfo""\r\n"
@@ -804,8 +807,8 @@ END
804807
#endif
805808

806809
1 VERSIONINFO
807-
FILEVERSION 3,7,0,0
808-
PRODUCTVERSION 3,7,0,0
810+
FILEVERSION POVWIN_VERSION_RC
811+
PRODUCTVERSION POVWIN_VERSION_RC
809812
FILEFLAGSMASK 0x3fL
810813
#ifdef _DEBUG
811814
FILEFLAGS 0x1L
@@ -820,14 +823,15 @@ BEGIN
820823
BEGIN
821824
BLOCK "0c0904e4"
822825
BEGIN
823-
VALUE "CompanyName", "Persistence of Vision Raytracer Pty. Ltd."
824-
VALUE "FileDescription", "POV-Ray for Windows editor interface DLL"
825-
VALUE "FileVersion", "3.8.0.0"
826-
VALUE "InternalName", DLLNAME
827-
VALUE "LegalCopyright", "Copyright 2004-2017 Persistence of Vision Raytracer Pty. Ltd."
828-
VALUE "OriginalFilename", DLLNAME
829-
VALUE "ProductName", "The Persistence of Vision Raytracer"
830-
VALUE "ProductVersion", "3.8.0.0"
826+
VALUE "CompanyName", POVWIN_WINRC_COMPANY_NAME
827+
VALUE "FileDescription", POVWIN_APPLICATION_NAME " editor interface DLL"
828+
VALUE "FileVersion", POVWIN_WINRC_FILE_VERSION
829+
VALUE "InternalName", DLLNAME
830+
VALUE "LegalCopyright", POVWIN_WINRC_LEGAL_COPYRIGHT
831+
VALUE "LegalTrademarks", POVWIN_WINRC_LEGAL_TRADEMARKS
832+
VALUE "OriginalFilename", DLLNAME
833+
VALUE "ProductName", POVWIN_WINRC_PRODUCT_NAME
834+
VALUE "ProductVersion", POVWIN_WINRC_PRODUCT_VERSION
831835
END
832836
END
833837
BLOCK "VarFileInfo"

windows/pvedit.cpp

Lines changed: 58 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/// @parblock
1111
///
1212
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
13-
/// Copyright 1991-2018 Persistence of Vision Raytracer Pty. Ltd.
13+
/// Copyright 1991-2021 Persistence of Vision Raytracer Pty. Ltd.
1414
///
1515
/// POV-Ray is free software: you can redistribute it and/or modify
1616
/// it under the terms of the GNU Affero General Public License as
@@ -42,6 +42,7 @@
4242
#include <shellapi.h>
4343
#include <cstring>
4444
#include <sys/stat.h>
45+
#include <delayimp.h>
4546
#include "pvengine.h"
4647
#include "pvedit.h"
4748
#include "parser/reservedwords.h"
@@ -162,6 +163,37 @@ char *FunctionNames [] =
162163
NULL
163164
} ;
164165

166+
void EditorDLLNotFoundPopup(const char* function, long err)
167+
{
168+
char str[2048];
169+
#ifdef _DEBUG
170+
sprintf(str,
171+
"Editor DLL initialisation failed [%s failed, code is %08lx]\n\n"
172+
"Debug build: if you have renamed cmedit as cmeditd, keep in mind that it "
173+
"will still look for povcmax.dll, not povcmaxd.dll. Also, for debug builds "
174+
"the build output directory is checked for the DLL's before the install dir.\n\n"
175+
"Check the README in the source for instructions on how to copy the DLL's from "
176+
"the official distribution to the naming convention used by debug builds.",
177+
function, err);
178+
PovMessageBox(str, "POV-Ray Editor error");
179+
PovMessageBox("See the 'Internal Editor Reference' section in the help file for\n"
180+
"instructions on how to correct this or turn editor loading off.", "Important!");
181+
#else
182+
if (MessageBox(main_window,
183+
"POV-Ray could not load its internal editor. This is to be expected "
184+
"if you installed the AGPL-licensed distribution, as the editor DLL "
185+
"is not included. If you do not wish to use the editor you can turn "
186+
"it off (and stop this message appearing) by unchecking 'Use Editor' "
187+
"under the 'Other Settings' sub-menu of the Options menu.\n\n"
188+
"If you wish to enable the editor, clicking 'Yes' below will take "
189+
"you to its download page.",
190+
"Could not load internal editor - download it?",
191+
MB_ICONQUESTION | MB_YESNO) == IDYES)
192+
ShellExecute(NULL, NULL, "http://www.povray.org/download/wineditdll/" POV_RAY_VERSION,
193+
NULL, NULL, SW_SHOWNORMAL);
194+
#endif
195+
}
196+
165197
bool LoadEditorDLL (char *path, bool errorOK)
166198
{
167199
int DllVersion ;
@@ -171,7 +203,7 @@ bool LoadEditorDLL (char *path, bool errorOK)
171203
void ***f ;
172204
struct stat statbuf ;
173205

174-
if (!editors_enabled)
206+
if (!editors_enabled)
175207
return (false) ;
176208
if (debugging)
177209
debug_output ("Trying to load editor DLL from '%s' [%s]\n", path, stat (path, &statbuf) != 0 ? "missing" : "found") ;
@@ -181,36 +213,9 @@ bool LoadEditorDLL (char *path, bool errorOK)
181213
{
182214
err = GetLastError () ;
183215
if (debugging)
184-
debug_output ("Could not load editor DLL '%s', error code is %08lx\n", path, err) ;
216+
debug_output ("Could not load editor DLL '%s', error code is %08x\n", path, err) ;
185217
if (!errorOK)
186-
{
187-
#ifdef _DEBUG
188-
sprintf (str,
189-
"Editor DLL initialisation failed [LoadLibrary failed, code is %08lx]\n\n"
190-
"Debug build: if you have renamed cmedit as cmeditd, keep in mind that it "
191-
"will still look for povcmax.dll, not povcmaxd.dll. Also, for debug builds "
192-
"the build output directory is checked for the DLL's before the install dir.\n\n"
193-
"Check the README in the source for instructions on how to copy the DLL's from "
194-
"the official distribution to the naming convention used by debug builds.",
195-
err) ;
196-
PovMessageBox (str, "POV-Ray Editor error") ;
197-
PovMessageBox ("See the 'Internal Editor Reference' section in the help file for\n"
198-
"instructions on how to correct this or turn editor loading off.", "Important!") ;
199-
#else
200-
if (MessageBox (main_window,
201-
"POV-Ray could not load its internal editor. This is to be expected "
202-
"if you installed the AGPL-licensed distribution, as the editor DLL "
203-
"is not included. If you do not wish to use the editor you can turn "
204-
"it off (and stop this message appearing) by unchecking 'Use Editor' "
205-
"under the 'Other Settings' sub-menu of the Options menu.\n\n"
206-
"If you wish to enable the editor, clicking 'Yes' below will take "
207-
"you to its download page.",
208-
"Could not load internal editor - download it?",
209-
MB_ICONQUESTION | MB_YESNO) == IDYES)
210-
ShellExecute (NULL, NULL, "http://www.povray.org/download/wineditdll/" POV_RAY_VERSION,
211-
NULL, NULL, SW_SHOWNORMAL) ;
212-
#endif
213-
}
218+
EditorDLLNotFoundPopup("LoadLibraryEx", err);
214219
return (false) ;
215220
}
216221

@@ -337,22 +342,32 @@ HWND InitialiseEditor (HWND ParentWindow, HWND StatusWindow, const char *Binarie
337342
{
338343
HWND hwnd ;
339344

340-
if (!editors_enabled || !use_editors)
345+
__try // First call to the delay-loaded editor DLL might fail spectacularly if the DLL can't be found.
346+
{
347+
if (!editors_enabled || !use_editors)
341348
return (NULL) ;
342349

343-
char *s1 = Get_User_Keywords(DocumentsPath);
344-
char *s2 = Get_Reserved_Words(s1) ;
345-
char *s3 = Get_INI_Keywords() ;
346-
EditSetKeywords (s2, s3) ;
347-
free(s1) ;
348-
free(s2);
349-
free(s3);
350-
if ((hwnd = CreateTabWindow (ParentWindow, StatusWindow, BinariesPath, DocumentsPath)) == NULL)
350+
char *s1 = Get_User_Keywords(DocumentsPath);
351+
char *s2 = Get_Reserved_Words(s1) ;
352+
char *s3 = Get_INI_Keywords() ;
353+
EditSetKeywords (s2, s3) ;
354+
free(s1) ;
355+
free(s2);
356+
free(s3);
357+
if ((hwnd = CreateTabWindow (ParentWindow, StatusWindow, BinariesPath, DocumentsPath)) == NULL)
358+
{
359+
PovMessageBox ("TabWindow error: see the 'Built-In Editors' section in the help file", "Important!") ;
360+
return (NULL) ;
361+
}
362+
return (hwnd) ;
363+
}
364+
__except (GetExceptionCode() == VcppException(ERROR_SEVERITY_ERROR, ERROR_MOD_NOT_FOUND))
351365
{
352-
PovMessageBox ("TabWindow error: see the 'Built-In Editors' section in the help file", "Important!") ;
353-
return (NULL) ;
366+
if (debugging)
367+
debug_output("Could not delayed-link editor DLL\n");
368+
EditorDLLNotFoundPopup("delayed linkage", GetExceptionCode());
369+
return (NULL);
354370
}
355-
return (hwnd) ;
356371
}
357372

358373
void SetEditorPosition (int x, int y, int w, int h)

windows/pvengine.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/// @parblock
1111
///
1212
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
13-
/// Copyright 1991-2017 Persistence of Vision Raytracer Pty. Ltd.
13+
/// Copyright 1991-2021 Persistence of Vision Raytracer Pty. Ltd.
1414
///
1515
/// POV-Ray is free software: you can redistribute it and/or modify
1616
/// it under the terms of the GNU Affero General Public License as
@@ -122,12 +122,7 @@
122122
#else
123123
#define BINDIRNAME "bin32"
124124
#define INSTALLTIMEKEY "InstallTime32"
125-
// TODO - use the standard editor DLLs regardless of architecture optimization (e.g. SSE2)
126-
#ifdef BUILD_SSE2
127-
#define EDITDLLNAME "cmedit32-sse2.dll"
128-
#else
129-
#define EDITDLLNAME "cmedit32.dll"
130-
#endif
125+
#define EDITDLLNAME "cmedit32.dll"
131126
#define EDITDLLNAME_DEBUG "cmedit32d.dll"
132127
#define VERSIONVAL POVWIN_BETA_PREFIX "VersionNo32"
133128
#endif

windows/pvengine.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Microsoft Visual C++ generated resource script.
22
//
33
#include "resource.h"
4-
#include "povwin_version.h"
54

65
#define APSTUDIO_READONLY_SYMBOLS
76
/////////////////////////////////////////////////////////////////////////////
87
//
98
// Generated from the TEXTINCLUDE 2 resource.
109
//
10+
#include "povwin_version.h"
1111
#include "winuser.h"
1212
#define APSTUDIO_HIDDEN_SYMBOLS
1313
#include "windows.h"

0 commit comments

Comments
 (0)