From 972498c561286dc154582f3439f5dbbbcbe43660 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Fri, 8 Jan 2021 11:57:31 +0000 Subject: [PATCH 1/3] Mention adding other configs in VS docs --- docs/Windows-VisualStudio.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/Windows-VisualStudio.md b/docs/Windows-VisualStudio.md index 7e93372b4..8e301ed53 100644 --- a/docs/Windows-VisualStudio.md +++ b/docs/Windows-VisualStudio.md @@ -62,9 +62,11 @@ To find the built files use `Project` > `CMake Cache` > `Open in Explorer`. 6. Browse to the folder containing the 32blit repo. -7. Save. It should configure successfully. +7. To add a release configuration, press "Add a new configuration..." (the plus button under "Configurations"), select "x64-Release" and repeat steps 4-6 on the new configuration. -8. Build! +8. Save. It should configure successfully. + +9. Build! [More info about using CMake with Visual Studio](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019) From 973b491d842824cd4b5c4f1ebabf02f6bea20e29 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Fri, 8 Jan 2021 12:24:24 +0000 Subject: [PATCH 2/3] VS ARM cross-build docs --- docs/Windows-VisualStudio.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/Windows-VisualStudio.md b/docs/Windows-VisualStudio.md index 8e301ed53..c3847e448 100644 --- a/docs/Windows-VisualStudio.md +++ b/docs/Windows-VisualStudio.md @@ -8,7 +8,8 @@ See [Building & Running On 32Blit](32blit.md) if you want to compile examples/pr - [Option 1: Use the solution file](#option-1-use-the-solution-file) - [Get started with your own game](#get-started-with-your-own-game) - [Option 2: Use Visual Studio's built-in CMake support](#option-2-use-visual-studios-built-in-cmake-support) - - [Building your own game](#building-with-your-own-game) + - [Building your own game](#building-your-own-game) + - [Building for 32Blit](#building-for-32blit) - [Troubleshooting](#troubleshooting) ## Requirements @@ -70,6 +71,22 @@ To find the built files use `Project` > `CMake Cache` > `Open in Explorer`. [More info about using CMake with Visual Studio](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019) +### Building for 32Blit + +1. Make sure the "Embedded and IoT development tools" component is installed. + +2. Open the CMake Settings (see above). + +3. Press "Add a new configuration..." and select "IoT-Release". + +4. Scroll down to "CMake toolchain file" and browse to `32blit.toolchain` + +5. (Optional) Change configuration name to something like "32Blit-Release" + +6. Save. + +7. Select the new config and build! + ## Troubleshooting If you see errors such as `Cannot open include file: 'SDL.h': No such file or directory` and `cannot open file 'SDL2.lib'` you've probably extracted the SDL development libraries wrong. Inside your sdl folder you should have the folders docs, include and lib not SDL2-2.0.10. From d35a5dceb7d74e8802dadff63516e2ee3f47a535 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Fri, 8 Jan 2021 12:28:05 +0000 Subject: [PATCH 3/3] Use file(ARCHIVE_EXTRACT) in the toolchain if possible Windows does not have `unzip`, but VS includes CMake 3.18. --- 32blit.toolchain | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/32blit.toolchain b/32blit.toolchain index fe27cd9e4..a14b95788 100644 --- a/32blit.toolchain +++ b/32blit.toolchain @@ -51,9 +51,11 @@ set(STDLIB_PATH ${CMAKE_CURRENT_LIST_DIR}/stdlib) set(STDLIB_URL https://github.com/32blit/stdlibs/releases/download/newlib-3.3.0-gcc-9.2.0/stdlibs.zip) set(STDLIB_HASH "${STDLIB_HASHTYPE}=0431fa7b3fe5e463424078546560b06490890abf4967745ac85b8b6b430d1941") -find_program(UNZIP NAMES unzip) -if(NOT UNZIP) - message(FATAL_ERROR "Failed to find required program: \"unzip\"\n(maybe you need to \"apt install unzip\")\n") +if(${CMAKE_VERSION} VERSION_LESS "3.18") + find_program(UNZIP NAMES unzip) + if(NOT UNZIP) + message(FATAL_ERROR "Failed to find required program: \"unzip\"\n(maybe you need to \"apt install unzip\")\n") + endif() endif() # file() is great, but it doesn't tell the user what it's downloading @@ -77,10 +79,12 @@ endif() if(NOT EXISTS ${STDLIB_PATH}/pic) message("Extracting stdlibs...") - # CMake 3.18 - #file(ARCHIVE_EXTRACT INPUT ${STDLIB_PATH}/stdlibs.zip DESTINATION ${STDLIB_PATH}) - - execute_process(COMMAND ${UNZIP} -u ${STDLIB_PATH}/stdlibs.zip -d ${STDLIB_PATH} RESULT_VARIABLE UNZIP_STATUS) + if(${CMAKE_VERSION} VERSION_LESS "3.18") + execute_process(COMMAND ${UNZIP} -u ${STDLIB_PATH}/stdlibs.zip -d ${STDLIB_PATH} RESULT_VARIABLE UNZIP_STATUS) + else() + file(ARCHIVE_EXTRACT INPUT ${STDLIB_PATH}/stdlibs.zip DESTINATION ${STDLIB_PATH}) + set(UNZIP_STATUS 0) + endif() if(NOT ${UNZIP_STATUS} EQUAL 0) message(FATAL_ERROR "Failed to extract stdlibs: ${UNZIP_STATUS}\n")