Open shermp opened 7 months ago
compiling: as it compiles fine with mingw, I just added
if(MSVC)
set_property(TARGET "nuked-sc55" APPEND_STRING PROPERTY LINK_FLAGS " /ENTRY:WinMainCRTStartup")
endif()
to CMakeList.txt for VS22 compilation in the pr
your vcpkg manifest is a good addition, I just like to ask if it's not preferred to just have the line vcpkg install sdl2
in instructions instead of adding a new file to the project?
I agree. I'll remove my changes to cmakelist and refer to your pr there
add_executable(nuked-sc55 WIN32 ${SC55_SRC} ${UTF8MAIN_SRCS})
This works but the log console of Nuked-SC55 (if anyone needs it) no longer starts.
It becomes a Windows /SUBSYSTEM:WINDOWS
project instead of Console /SUBSYSTEM:CONSOLE
.
The problem is that if set to Console
, there is this error:
LNK2019: unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
(unless you set the linker flag /ENTRY:WinMainCRTStartup
) because, apparently, Visual Studio does not find the int main()
function in utf8main_win32.cpp
(this is my guess, to be verified).
Also there are some warnings:
D:\Scaricati\Nuked-SC55\src\mcu.cpp(495,48): warning C4018: '<': errata corrispondenza tra signed e unsigned [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\mcu.cpp(688,29): warning C4018: '>=': errata corrispondenza tra signed e unsigned [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\mcu.cpp(688,58): warning C4018: '<': errata corrispondenza tra signed e unsigned [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\mcu.cpp(712,34): warning C4018: '>=': errata corrispondenza tra signed e unsigned [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\mcu.cpp(712,63): warning C4018: '<': errata corrispondenza tra signed e unsigned [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\mcu.cpp(1392,26): warning C4267: '=': conversione da 'size_t' a 'int'. Possibile perdita di dati. [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\mcu.cpp(1475,31): warning C4267: '=': conversione da 'size_t' a 'int'. Possibile perdita di dati. [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\mcu_opcodes.cpp(760,29): warning C4244: 'argomento': conversione da 'uint16_t' a 'uint8_t'. Possibile perdita di dati. [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\utils\files.cpp(309,15): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details. [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\utils\files.cpp(358,15): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details. [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\utils\files.cpp(367,15): warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details. [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
D:\Scaricati\Nuked-SC55\src\midi_win32.cpp(87,35): warning C4018: '<': errata corrispondenza tra signed e unsigned [D:\Scaricati\Nuked-SC55\build\nuked-sc55.vcxproj]
When I get home this evening, I'll remove the cmake change. That probably needs to be made in a separate PR by setting WIN32_CONSOLE
or something.
Ok, cmake change removed.
Why are you using the vcpkg-ce-catalog? SDL2 is in the main vcpkg repo.
Hi, this is the default configuration when invoking vcpkg new
.
Adds a vcpkg manifest to easily install SDL2 when compiling in a MSVC environment.
To build for MSVC, open the "x64 Native Tools Command Prompt for VS 2022" and use the following:
You can then copy
.\back.data
,.\Release\nuked-sc55.exe
.\Release\SDL2.dll
to a folder with the SC55 ROM's.This assumes you are using a newish version of VS 2022 with integrated vcpkg. You can also use it with the standalone release of vcpkg as well.
I had to addWIN32
toadd_executable
in CMakeLists.txt so it would link againstWinMain
. If there are any cmake experts out there, please let me know if this needs to be changed. I tested it under MSYS2 as well, and it compiled fine.