diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 00000000..4b323f13 --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,160 @@ +# **building instructions for Nuked-SC55** + +## CMake + +**generic instructions for CMake** + +### Ninja + +#### **install prerequisites:** + +`git cmake pkg-config ninja SDL2` and a c-compiler capable of C++11 + +#### **build:** + +``` +git clone --recurse-submodules https://github.com/nukeykt/Nuked-SC55.git +cd .\Nuked-SC55 +cmake . -DCMAKE_BUILD_TYPE=Release -GNinja +cmake --build . +``` + +## Linux + +T.B.D. + +## MacOS + +### Xcode + + +#### **install prerequisites (brew/macports - untested):** +``` +git +cmake +SDL2 +``` +#### **build:** + +open terminal.app + +`git clone --recurse-submodules https://github.com/nukeykt/Nuked-SC55.git` + +create an Xcode project: + +``` +$ cd Nuked-SC55 +$ cmake -G Xcode . +``` + +- open created Xcode project +- Product -> Scheme -> Edit Scheme -> Build Configuration set to Release +- build +- copy data/back.data the same directory as built binary + + + +## Windows + +### VisualStudio 2022 + +#### **install prerequisites:** +- ##### Visual Studio with Windows SDK and [CMake](https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170) + +- ##### git: +in cmd: +``` +winget install Git.Git +``` + +**[manual handling of SDL2 dependency](#underlined-text)** + +#### **build:** + +note: example msvc-build-release64.cmd uses hardcoded urls for SDL2-download and thus might fail +use VCPKG-version described [below](https://github.com/000MDK/Nuked-SC55/edit/building.md/BUILDING.md#vcpkg-handling-of-sdl2-dependency) instead. + +#### **use `msvc-build-release64.cmd`** + +in new cmd: + +``` +git clone --recurse-submodules https://github.com/nukeykt/Nuked-SC55.git +cd .\Nuked-SC55 +.\msvc-build-release64.cmd +``` + +**[VCPKG handling of SDL2 dependency](#underlined-text)** + +#### **install prerequisites:** + +- ##### [vcpkg](https://github.com/microsoft/vcpkg): + +in new cmd: +``` +c: +cd %ProgramData% +git clone https://github.com/microsoft/vcpkg +cd vcpkg +setx VCPKG_PATH %cd% +setx PATH "%PATH%;%cd%" +.\bootstrap-vcpkg.bat -disableMetrics +``` + +in new admin-cmd: + +`C:\ProgramData\vcpkg\vcpkg integrate install` + +- ##### pkgconf: + +in new cmd: +``` +vcpkg install pkgconf +``` + +- ##### [SDL2](https://github.com/libsdl-org) + +in new cmd: +``` +vcpkg install SDL2 SDL2-image +``` + +#### **build:** + +#### **use `msvc-vcpkg-build-release64.cmd`** + +in new cmd: + +``` +git clone --recurse-submodules https://github.com/nukeykt/Nuked-SC55.git +cd .\Nuked-SC55 +.\msvc-vcpkg-build-release64.cmd +``` + +###### note: if SDL2 can't be found use + +`setx SDL2_DIR %VCPKG_PATH%\installed\x64-windows\share\sdl2` (permanent, must reopen cmd to use) or + +`set SDL2_DIR=%VCPKG_PATH%\installed\x64-windows\share\sdl2` (temporary, only for currently open cmd) + + + +### MSYS2 + +[MSYS2](https://www.msys2.org/wiki/MSYS2-installation/)-**MSYS2 MinGW32** shell + +#### **install prerequisites:** +``` +pacman -S base-devel libtool pkg-config make gettext gcc git cmake mingw-w64-i686-gcc mingw-w64-x86_64-gcc mingw-w64-i686-cmake mingw-w64-x86_64-cmake mingw-w64-i686-pkg-config mingw-w64-x86_64-pkg-config mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain mingw-w64-i686-SDL2 mingw-w64-x86_64-SDL2 +``` +note: you are asked twice to make a selection - just press "Return"/"Enter" to select all + +#### **build:** + +#### **use `msys2mingw32-build-release.sh`** + +``` +git clone --recurse-submodules https://github.com/nukeykt/Nuked-SC55.git +cd ./Nuked-SC55 +sh ./msys2mingw32-build-release.sh +``` diff --git a/CMakeLists.txt b/CMakeLists.txt index 34a53bf6..bd228077 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,6 +217,11 @@ else() target_link_libraries(nuked-sc55 PRIVATE ${SDL2_LIBRARIES}) endif() +# Add linker flag MSVC +if(MSVC) + set_property(TARGET "nuked-sc55" APPEND_STRING PROPERTY LINK_FLAGS " /ENTRY:WinMainCRTStartup") +endif() + if(USE_RTMIDI) if(USE_SYSTEM_RTMIDI) target_compile_options(nuked-sc55 PRIVATE ${SYSTEM_RTMIDI_CFLAGS}) diff --git a/README.md b/README.md index 66f5e861..9d5cb1be 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Nuked SC-55 -Roland SC-55 emulator, by nukeykt. +Roland SC-55 emulator, by [nukeykt](https://github.com/nukeykt). Supported models: - SC-55mk2 (v1.01 firmware is confirmed to work) diff --git a/msvc-build-release64.cmd b/msvc-build-release64.cmd new file mode 100644 index 00000000..d0750fa7 --- /dev/null +++ b/msvc-build-release64.cmd @@ -0,0 +1,11 @@ +@ECHO OFF +wget https://github.com/libsdl-org/SDL/releases/download/release-2.30.2/SDL2-devel-2.30.2-VC.zip +tar -xf SDL2-devel-2.30.2-VC.zip +del SDL2-devel-2.30.2-VC.zip +set SDL2_DIR %cd%\SDL2-2.30.2\cmake +cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -G"Visual Studio 17 2022" +cmake --build . --config Release +copy .\data\back.data .\Release +copy %SDL2_DIR%\..\lib\x64\SDL2.dll .\Release +move .\Release\nuked-sc55.exe .\Release\sc55emu.exe +start .\Release diff --git a/msvc-vcpkg-build-release64.cmd b/msvc-vcpkg-build-release64.cmd new file mode 100644 index 00000000..d2a37c56 --- /dev/null +++ b/msvc-vcpkg-build-release64.cmd @@ -0,0 +1,5 @@ +cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -G"Visual Studio 17 2022" +cmake --build . --config Release +copy .\data\back.data .\Release +move .\Release\nuked-sc55.exe .\Release\sc55emu.exe +explorer .\Release \ No newline at end of file diff --git a/msys2mingw32-build-release.sh b/msys2mingw32-build-release.sh new file mode 100644 index 00000000..82ff1b1b --- /dev/null +++ b/msys2mingw32-build-release.sh @@ -0,0 +1,12 @@ +#/bin/sh +cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -G "MinGW Makefiles" +mingw32-make +mkdir ./release +cp ./nuked-sc55.exe ./release/sc55emu.exe +cp ./back.data ./release/back.data +cp ./README.md ./release/README.md +cp /mingw32/bin/libgcc_s_dw2-1.dll ./release/libgcc_s_dw2-1.dll +cp /mingw32/bin/libstdc++-6.dll ./release/libstdc++-6.dll +cp /mingw32/bin/SDL2.dll ./release/SDL2.dll +start release +cd ..