Skip to content

Commit

Permalink
Merge pull request #196 from microsoft/pete-dev
Browse files Browse the repository at this point in the history
Attempt at nodejs projection again, and prep for Dev Preview 3
  • Loading branch information
Psychlist1972 authored Jan 8, 2024
2 parents b83f38b + 6302383 commit 8dda8a4
Show file tree
Hide file tree
Showing 166 changed files with 66,807 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
NOTE: I know very little about electron development. These are raw notes. --Pete


Modified from this project
https://github.com/MaySoMusician/NodeRT/tree/feature/136-vs2019

Assuming you have winget installed

winget install nodejs
or download from https://nodejs.org/en

npm install npm@latest -g

npm install node-gyp -g

in windows environment variables (so they are global)
LIBPATH = C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.20348.0

npm config edit
add a line which says:
msvs_version=2022


nodert\src\NodeRTCmd\bin\Debug\NodeRTCmd.exe --winmd ..\Windows.Devices.Midi2.winmd --outdir .\projection

In VS C++ project, for all configurations, update the AdditionalUsingDirectories property to include
%Program Files (x86)%\Windows Kits\10\UnionMetadata\10.0.20348.0

copy Windows.Devices.Midi2.winmd to projection\windows.devices.midi2\build
copy Windows.winmd from the unionmetadata to same folder

copy C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\VC\vcpackages platform.winmd to same folder


Comment out SendMessageStruct body and reference

Open binding.sln in VS and recompile in BOTH debug and release


binding.gyp

["WIN_VER==\"v10\"", {
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalUsingDirectories": [
"%ProgramFiles(x86)%/Microsoft Visual Studio 14.0/VC/lib/store/references",
"%ProgramFiles%/Microsoft Visual Studio 14.0/VC/lib/store/references",
"%ProgramFiles(x86)%/Windows Kits/10/UnionMetadata/10.0.20348.0",
"$(VCToolsInstallDir)/lib/x86/store/references",
"%MIDI_REPO_ROOT%/build/release/api/"
]
}
}
}],


download
npm pack @nodert-win11/windows.data.json
npm pack @nodert-win11/windows.devices.midi
npm pack @nodert-win11/windows.devices.enumeration

unzip them, copy to appropriate folders under node_modules, and then make these changes:

(this change needs to be made in binding.gyp in ALL downloaded packages as well or you need to download and install 10.0.22000 sdk, or whatever version the binding.gyp specifies)

["USE_ADDITIONAL_WINMD==\"true\"", {
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalUsingDirectories": [
"%ProgramFiles%/Windows Kits/10/UnionMetadata/10.0.20348.0",
"%ProgramFiles%/Windows Kits/10/Include/10.0.20348.0/um",
"%ProgramFiles(x86)%/Windows Kits/10/UnionMetadata/10.0.20348.0",
"%ProgramFiles(x86)%/Windows Kits/10/Include/10.0.20348.0/um"
]
}
}
}]



copy windows.devices.midi2 folder from projection to node_modules in sample

To deal with mismatch node_module versions:

in projection windows.devices.midi2 folder:
npm install --save-dev electron
npm install --save-dev @electron/rebuild
node_modules\.bin\electron-rebuild

Then do the same for each app. After the npm install commands, you'll need to re-copy the windows.devices.midi2 folder into node_modules

from electron-midi-sample folder
npm start to run
26 changes: 26 additions & 0 deletions build/electron-projection/gen-projection.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off

echo this will fail if you aren't on the right drive already
cd %midi_repo_root%
cd "build\release\electron-projection"

mkdir projection\windows.devices.midi2\build

rmdir /S /Q ./projection2


echo STEP 1: copy the current Windows.Devices.Midi2.winmd metadata to the electron build folder
copy /Y %midi_repo_root%\build\release\api\Windows.Devices.Midi2.winmd .\projection\windows.devices.midi2\build

echo STEP 1.2: copy Windows.winmd metadata to the same folder
copy /Y "C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.20348.0\Windows.winmd" .\projection\windows.devices.midi2\build

echo STEP 2: This will fail to build the project. Needs to be done from inside Visual Studio
nodert\src\NodeRTCmd\bin\Debug\NodeRTCmd.exe --winmd .\projection\windows.devices.midi2\build\Windows.Devices.Midi2.winmd --outdir .\projection2 --verbose

echo STEP 3: If it was generated, open projection2\windows.devices.midi2\build\binding.sln and recompile. If not, you need to debug. It may be the projection2 folder was in use.

echo STEP 4: need to deal with SendMessageStruct by removing it from the C++ source _nodert_generated.cpp. Remove all references to SendMessageStruct and FillMessageStruct and rebuild.

echo STEP 5: need to run node-modules\.bin\electron-rebuild

157 changes: 157 additions & 0 deletions build/electron-projection/nodert/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml
*.pubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf

# =========================
# Windows detritus
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Mac crap
.DS_Store

# VS2017
src/.vs/NodeRT/v15

# VS2019
src/.vs/NodeRT/v16
49 changes: 49 additions & 0 deletions build/electron-projection/nodert/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
NodeRT License:

Copyright (c) Microsoft Corporation
All rights reserved.
Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.


RazorTemplates Library License:
https://github.com/volkovku/RazorTemplates/blob/master/license.txt

Microsoft Public License (Ms-PL)

This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.

Definitions
The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
A "contribution" is the original software, or any additions or changes to the software.
A "contributor" is any person that distributes its contribution under this license.
"Licensed patents" are a contributor's patent claims that read directly on its contribution.
Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
Conditions and Limitations
(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.

RX.Net Library License:
https://github.com/Reactive-Extensions/Rx.NET/blob/master/Rx.NET/Source/license.txt

Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
Microsoft Open Technologies would like to thank its contributors, a list
of whom are at http://rx.codeplex.com/wikipage?title=Contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you
may not use this file except in compliance with the License. You may
obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing permissions
and limitations under the License.
Loading

0 comments on commit 8dda8a4

Please sign in to comment.