Skip to content
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: add scrypt-windows as submodule #43

Merged
merged 3 commits into from
Nov 10, 2023

Conversation

stefanb2
Copy link
Contributor

@stefanb2 stefanb2 commented Nov 7, 2023

This is the simple approach: we know that the code from scrypt-windows repository compiles to a working static library on Windows.

  • add git repository barrysteyn/scrypt-windows as submodule
  • enable submodules checkout feature in Windows workflow
  • convert the information from binding.gyp to a CMakeList.txt
  • enable language C in project to enable CMake support for C modules
  • add new directory src/3rdparty/scrypt to Windows build
  • remove imported scrypt static library bits from Windows build
  • remove scypt-windows steps from Windows workflow
  • update build instructions accordingly
  • README: add titles to links
  • README: add status badge for GitHub actions

@stefanb2 stefanb2 force-pushed the topic-add-scrypt-sources-for-windows branch 9 times, most recently from 45e6bb6 to a614d7d Compare November 7, 2023 17:01
@stefanb2
Copy link
Contributor Author

stefanb2 commented Nov 7, 2023

The --verbose finally revealed what is going on:

PreBuildEvent:
  Automatic MOC and UIC for target scrypt-windows
...
  "C:\Program Files\CMake\bin\cmake.exe" -E cmake_autogen D:/a/_temp/build/CMakeFiles/scrypt-windows_autogen.dir/AutogenInfo.json Debug
  if %errorlevel% neq 0 goto :cmEnd
  "C:\Program Files\CMake\bin\cmake.exe" -E touch D:/a/_temp/build/scrypt-windows_autogen/autouic_Debug.stamp
....
Lib:
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\Lib.exe /OUT:"D:\a\_temp\build\Debug\scrypt-windows.lib" /NOLOGO /MACHINE:X64  /machine:x64 "scrypt-windows.dir\Debug\mocs_compilation_Debug.obj"
  scrypt-windows.vcxproj -> D:\a\_temp\build\Debug\scrypt-windows.lib
...
Done Building Project "D:\a\_temp\build\scrypt-windows.vcxproj" (default targets).

So instead of compiling the source codes into the library, it creates 0 moc files and links those into the static library. No wonder why it looked like that the static library wasn't build at all...

@stefanb2 stefanb2 force-pushed the topic-add-scrypt-sources-for-windows branch from a614d7d to 1b555ee Compare November 7, 2023 17:34
@stefanb2
Copy link
Contributor Author

stefanb2 commented Nov 7, 2023

OK, I give up for now. I'm either too dumb to understand cmake, or there is something fundamentally undocumented, f.ex. that add_library(STATIC) doesn't work for msbuild on Windows.

No matter how I slice or dice it, msbuild does not add the source files I added to the static library to the build. Hence the static library is always empty and the final binary link fails.

@stefanb2 stefanb2 force-pushed the topic-add-scrypt-sources-for-windows branch 5 times, most recently from 3be4b4a to 440099d Compare November 8, 2023 09:15
@stefanb2
Copy link
Contributor Author

stefanb2 commented Nov 8, 2023

Doooooohhhhh if you add an existing source file to CMake project and CMake doesn't know what it is, it silently ignores it without any warnings. Very developer friendly behavior ☹️

@stefanb2 stefanb2 force-pushed the topic-add-scrypt-sources-for-windows branch 2 times, most recently from 03102b7 to 2ef7ba5 Compare November 8, 2023 09:50
This is the simple approach: we know that the code from scrypt-windows
repository compiles to a working static library on Windows.

- add git repository barrysteyn/scrypt-windows as submodule
- enable submodules checkout feature in Windows workflow
- convert the information from binding.gyp to a CMakeList.txt
- enable language C in project to enable CMake support for C modules
- add new directory src/3rdparty/scrypt to Windows build
- remove imported scrypt static library bits from Windows build
- remove scypt-windows steps from Windows workflow
- update build instructions accordingly
@stefanb2 stefanb2 force-pushed the topic-add-scrypt-sources-for-windows branch from 2ef7ba5 to b7dd93c Compare November 8, 2023 10:47
@stefanb2 stefanb2 changed the title WIP: add scrypt-windows as submodule build: add scrypt-windows as submodule Nov 8, 2023
@stefanb2 stefanb2 marked this pull request as ready for review November 8, 2023 10:47
Copy link
Owner

@bkueng bkueng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doooooohhhhh if you add an existing source file to CMake project and CMake doesn't know what it is, it silently ignores it without any warnings. Very developer friendly behavior ☹️

Wow, indeed.

@bkueng bkueng merged commit 689a390 into bkueng:main Nov 10, 2023
16 checks passed
@stefanb2 stefanb2 deleted the topic-add-scrypt-sources-for-windows branch November 10, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants