From 0e9c15ed8d6eaad1eb0b8f0ebec017b30d80fa23 Mon Sep 17 00:00:00 2001 From: Felipe Ferreira Date: Sat, 19 Feb 2022 13:37:35 +0000 Subject: [PATCH] Fix errors to generate C++ main dll with nmake or jom. --- .gitignore | 2 ++ docs/README.md | 56 ++++++++++++++++++++++++++++++++++++ src/Makefile | 4 ++- src/ScreenReaderDriver.h | 2 +- src/ScreenReaderDriverSAPI.h | 1 + src/fsapi.c | 2 +- src/wineyes.c | 2 +- src/zt.c | 2 +- 8 files changed, 66 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 0a762ae..a460b4b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ *.pyo *.html *.zip +RC* +build/ diff --git a/docs/README.md b/docs/README.md index c0780e0..e1cfed5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -34,6 +34,62 @@ Finally, a few words on multi-threaded applications. Tolk is not thread-safe. Al ## Usage +### Generate the `.dll` + +1. Install the dependencies: + + 1.1 CLI dependencies to build the C++ `.dll` + + ```bash + choco install jom pandoc + ``` + + > **PS:** [jom](https://community.chocolatey.org/packages/jom#install) is a CLI alternative to `nmake.exe` that is installed with Visual Studio. This is great to avoid to add manually `nmake` to the environment PATH variable + + 1.2 Install Java JDK and configure `$JAVA_HOME` environment variable to point to their path + + +2. Install [Visual Studio](https://visualstudio.microsoft.com) and the Workload: **C++ Desktop development** + + Visual Studio is required to use the CLI tools such as: `rc`, `cl`. The IDE is required to use the **Developer Powershell for VS as well**. + + Besides that, the Windows 10 SDK is required to use some `.dll's` that the CLI tools mentioned above requires. + + 2.1 Also, make sure that you installed the Windows 10 SDK (`10.0.19041.0`) + + > **Warning:** For now, the version `10.0.2+` doesn't works to compile and generate the dll + +3. Put the path below into you PATH environment variable + + This is required to use the `cl` C++ compiler and set some dependencies into the INCLUDE path: (e.g `windows.h`) + + ```bash + C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\[latest-version]\bin\Hostx86\arm64 + ``` +4. Open the **Developer Powershell for VS [version]** CLI as a administrator user + +5. Go to the directory of this cloned repository, and run [jom](https://community.chocolatey.org/packages/jom#install) (or `nmake.exe`, from Visual Studio folder) CLI to compiles the `.dll` + + ```powershell + cd tolk + jom /f .\Makefile + ``` + + **Output** + + ```powershell + jom x.x.x - empower your cores + + cd tolk\src && C:\ProgramData\chocolatey\lib\jom\tools\jom.exe / + cd tolk\src\dotnet && C:\ProgramData\chocolatey\lib\jom\tools\jom.exe / + cd tolk\src\java && C:\ProgramData\chocolatey\lib\jom\tools\jom.exe / + cd tolk\docs && C:\ProgramData\chocolatey\lib\jom\tools\jom.exe / + pandoc -s --toc -M title="Tolk" -M author="Davy Kager" -r markdown -w html5 -o .\README.html README.md + ``` +6. Use the generated `src/Tolk.dll` lib together with any language wrapper that you wish (dotnet, java...) + + This command above will run the all `Makefile` on this project. You should see the generated C++ dll into `src/Tolk.dll` and the language wrappers as well: `src/dotnet/TolkDotNet.dll`, `src/java/Tolk.jar`... + Tolk has functions for (un)initialization, querying and using the active screen reader, and for working with Microsoft SAPI. To use Tolk, import the appropriate version of `Tolk.dll` into your application. In C/C++ this is usually done by including `Tolk.h` and linking with the appropriate import library `Tolk.lib`. You could also use the Windows API functions `LoadLibrary` and `FreeLibrary`. Other languages are also supported, see `Wrappers`. If you're working in an unsupported language, use its specific facilities to call into the DLL. ### Required files diff --git a/src/Makefile b/src/Makefile index 2afdbfb..a2812c4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,8 +2,10 @@ OUTDIR = $(MAKEDIR) !endif +# Referece "/I" flag: +# https://docs.microsoft.com/en-us/cpp/build/reference/i-additional-include-directories?view=msvc-170 CFLAGS = /nologo /O2 /EHsc /LD /Gw /W4 /WL \ - /D_EXPORTING /DUNICODE /D_WITH_JNI + /D_EXPORTING /DUNICODE /D_WITH_JNI /I "$(JAVA_HOME)include" /I"$(JAVA_HOME)include\win32" RFLAGS = /nologo SYSLIBS = User32.Lib Ole32.Lib OleAut32.Lib diff --git a/src/ScreenReaderDriver.h b/src/ScreenReaderDriver.h index 9053d1f..aa57278 100644 --- a/src/ScreenReaderDriver.h +++ b/src/ScreenReaderDriver.h @@ -16,7 +16,7 @@ class ScreenReaderDriver { hasSpeech(speech), hasBraille(braille) {} - ScreenReaderDriver& operator=(const ScreenReaderDriver&) {} + ScreenReaderDriver& operator=(const ScreenReaderDriver&); public: virtual ~ScreenReaderDriver() {} diff --git a/src/ScreenReaderDriverSAPI.h b/src/ScreenReaderDriverSAPI.h index 44cbb04..5c1da36 100644 --- a/src/ScreenReaderDriverSAPI.h +++ b/src/ScreenReaderDriverSAPI.h @@ -9,6 +9,7 @@ #ifndef _SCREEN_READER_DRIVER_SAPI_H_ #define _SCREEN_READER_DRIVER_SAPI_H_ +#include #include #include "ScreenReaderDriver.h" diff --git a/src/fsapi.c b/src/fsapi.c index 9f62f45..0bcb9aa 100644 --- a/src/fsapi.c +++ b/src/fsapi.c @@ -65,7 +65,7 @@ typedef IID CLSID; #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} -#endif !_MIDL_USE_GUIDDEF_ +#endif // !_MIDL_USE_GUIDDEF_ MIDL_DEFINE_GUID(IID, LIBID_FSAPILib,0xF152C4EF,0xB92F,0x4139,0xA9,0x01,0xE8,0xF1,0xE2,0x8C,0xC8,0xE0); diff --git a/src/wineyes.c b/src/wineyes.c index 832fbe3..e6d1e39 100644 --- a/src/wineyes.c +++ b/src/wineyes.c @@ -65,7 +65,7 @@ typedef IID CLSID; #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} -#endif !_MIDL_USE_GUIDDEF_ +#endif // !_MIDL_USE_GUIDDEF_ MIDL_DEFINE_GUID(IID, LIBID_WindowEyes,0x9AA48166,0x4D1C,0x4C57,0xB5,0x43,0x4B,0x59,0x6C,0x5E,0x1C,0x2F); diff --git a/src/zt.c b/src/zt.c index d22cfe9..efd48fa 100644 --- a/src/zt.c +++ b/src/zt.c @@ -65,7 +65,7 @@ typedef IID CLSID; #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} -#endif !_MIDL_USE_GUIDDEF_ +#endif // !_MIDL_USE_GUIDDEF_ MIDL_DEFINE_GUID(IID, LIBID_AiSquared,0x9FBBC98E,0xAE78,0x4A1C,0xB6,0x35,0x1E,0xCA,0x2F,0xBF,0xFB,0x40);