From f09d416aa282f02cb66dbcccbfd16edbcf7a3d97 Mon Sep 17 00:00:00 2001 From: Martin Vladic Date: Tue, 12 Jul 2022 10:38:18 +0200 Subject: [PATCH] added template folder --- CMakeLists.txt | 61 +++++++++++++------------ README.md | 29 ++++++++---- cmake.bat | 6 +-- images/{eez-flow-template-sdl.ico => icon.ico} | Bin images/{eez-flow-template-sdl.png => icon.png} | Bin src/conf/eez/conf.h | 2 +- src/platform/simulator/emscripten/index.html | 2 +- src/platform/simulator/win32/icon.rc | Bin 1728 -> 1674 bytes image.png => template/image.png | Bin template/manifest.json | 3 ++ template/post.js | 50 ++++++++++++++++++++ 11 files changed, 110 insertions(+), 43 deletions(-) rename images/{eez-flow-template-sdl.ico => icon.ico} (100%) rename images/{eez-flow-template-sdl.png => icon.png} (100%) rename image.png => template/image.png (100%) create mode 100644 template/manifest.json create mode 100644 template/post.js diff --git a/CMakeLists.txt b/CMakeLists.txt index e599a77..7a5996c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.10) -project(eez-flow-template-sdl) +set (PROJECT_NAME eez-flow-template-sdl) + +project(${PROJECT_NAME}) set (CMAKE_CXX_STANDARD 17) @@ -138,62 +140,63 @@ if(WIN32) set(SOURCES src/platform/simulator/win32/icon.rc ${src_files}) endif() -add_executable(eez-flow-template-sdl ${src_files} ${header_files}) +add_executable(${PROJECT_NAME} ${src_files} ${header_files}) if(MSVC) - target_compile_options(eez-flow-template-sdl PRIVATE "/MP") + target_compile_options(${PROJECT_NAME} PRIVATE "/MP") endif() if (UNIX AND NOT(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) - target_link_libraries(eez-flow-template-sdl Threads::Threads bsd) + target_link_libraries(${PROJECT_NAME} Threads::Threads bsd) endif () -target_link_libraries(eez-flow-template-sdl ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES}) if(WIN32) - target_link_libraries(eez-flow-template-sdl wsock32 ws2_32) + target_link_libraries(${PROJECT_NAME} wsock32 ws2_32) - add_custom_command(TARGET eez-flow-template-sdl POST_BUILD + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/../../SDL2-2.0.14/lib/x86/SDL2.dll" - $) + "${PROJECT_SOURCE_DIR}/$ENV{SDL2DIR}/lib/x86/SDL2.dll" + $) - add_custom_command(TARGET eez-flow-template-sdl POST_BUILD + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/../../SDL2_image-2.0.4/lib/x86/libjpeg-9.dll" - $) + "${PROJECT_SOURCE_DIR}/$ENV{SDL2IMAGEDIR}/lib/x86/libjpeg-9.dll" + $) - add_custom_command(TARGET eez-flow-template-sdl POST_BUILD + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/../../SDL2_image-2.0.4/lib/x86/libpng16-16.dll" - $) + "${PROJECT_SOURCE_DIR}/$ENV{SDL2IMAGEDIR}/lib/x86/libpng16-16.dll" + $) - add_custom_command(TARGET eez-flow-template-sdl POST_BUILD + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/../../SDL2_image-2.0.4/lib/x86/libtiff-5.dll" - $) + "${PROJECT_SOURCE_DIR}/$ENV{SDL2IMAGEDIR}/lib/x86/libtiff-5.dll" + $) - add_custom_command(TARGET eez-flow-template-sdl POST_BUILD + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/../../SDL2_image-2.0.4/lib/x86/libwebp-7.dll" - $) + "${PROJECT_SOURCE_DIR}/$ENV{SDL2IMAGEDIR}/lib/x86/libwebp-7.dll" + $) - add_custom_command(TARGET eez-flow-template-sdl POST_BUILD + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/../../SDL2_image-2.0.4/lib/x86/SDL2_image.dll" - $) + "${PROJECT_SOURCE_DIR}/$ENV{SDL2IMAGEDIR}/lib/x86/SDL2_image.dll" + $) - add_custom_command(TARGET eez-flow-template-sdl POST_BUILD + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/../../SDL2_image-2.0.4/lib/x86/zlib1.dll" - $) + "${PROJECT_SOURCE_DIR}/$ENV{SDL2IMAGEDIR}/lib/x86/zlib1.dll" + $) endif() + if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") - add_custom_command(TARGET eez-flow-template-sdl POST_BUILD + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/src/platform/simulator/emscripten" - $) + $) endif() diff --git a/README.md b/README.md index 92aebeb..0dd7d51 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ The contributors are listed in CONTRIB.TXT. This project uses the GPL v3 license, see LICENSE.TXT. This project uses the [C4.1 (Collective Code Construction Contract)](http://rfc.zeromq.org/spec:22) process for contributions. -To report an issue, use the [issues page](https://github.com/eez-open/eez-flow-template-sdl/issues) tracker. ## Build @@ -11,9 +10,7 @@ To report an issue, use the [issues page](https://github.com/eez-open/eez-flow-t ``` sudo apt-get update sudo apt-get install -y git libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev cmake build-essential libbsd-dev -git clone https://github.com/eez-open/eez-flow-template-sdl -cd eez-flow-template-sdl -git submodule update --init --recursive +cd {{projectDirPath}} mkdir -p build/linux cd build/linux cmake ../.. @@ -23,17 +20,31 @@ make Start simulator with: ``` -./eez-flow-template-sdl +./{{projectName}} ``` #### Windows Install [Visual Studio Community 2017](https://visualstudio.microsoft.com/downloads/) and [CMake](https://cmake.org/install/). -Use git to clone https://github.com/eez-open/eez-flow-template-sdl. +Download and install SDL2 development libraries for Windows from https://www.libsdl.org/download-2.0.php. -Also, execute: `git submodule update --init --recursive` inside `eez-flow-template-sdl`. +Download and install SDL2_Image development libraries for Windows from https://github.com/libsdl-org/SDL_image/releases. -Execute `cmake.bat`. +Update these environment variables in `cmake.bat` according to the location (and version) where SDL2 and SDL2_Image has been installed: -Visual Studio solution is created in `\path\to\eez-flow-template-sdl\build\win32`. +``` +set SDL2DIR=..\SDL2-2.0.14 +set SDL2IMAGEDIR=..\SDL2_image-2.0.4 +``` + +Execute `cmake.bat`: + +``` +cd {{projectDirPath}} +.\cmake.bat +``` + +Visual Studio solution is created in `{{projectDirPath}}\build\win32`. + +Use Visual Studio to build the solution. diff --git a/cmake.bat b/cmake.bat index 53a0d63..63de6cd 100644 --- a/cmake.bat +++ b/cmake.bat @@ -1,11 +1,11 @@ -set SDL2DIR=..\..\SDL2-2.0.14 -set SDL2IMAGEDIR=..\..\SDL2_image-2.0.4 +set SDL2DIR=..\SDL2-2.0.14 +set SDL2IMAGEDIR=..\SDL2_image-2.0.4 if not exist "build" mkdir "build" if not exist "build\win32" mkdir "build\win32" cd build\win32 -cmake ..\.. +cmake -G "Visual Studio 15 2017" ..\.. cd ..\.. \ No newline at end of file diff --git a/images/eez-flow-template-sdl.ico b/images/icon.ico similarity index 100% rename from images/eez-flow-template-sdl.ico rename to images/icon.ico diff --git a/images/eez-flow-template-sdl.png b/images/icon.png similarity index 100% rename from images/eez-flow-template-sdl.png rename to images/icon.png diff --git a/src/conf/eez/conf.h b/src/conf/eez/conf.h index bb080b7..e46577b 100644 --- a/src/conf/eez/conf.h +++ b/src/conf/eez/conf.h @@ -7,7 +7,7 @@ extern uint32_t DISPLAY_HEIGHT; static const uint32_t DISPLAY_BPP = 32; // RGBA8888 static const char *TITLE = "EEZ Flow App"; -static const char *ICON = "eez-flow-template-sdl.png"; +static const char *ICON = "icon.png"; #define MAX_NUM_OF_Y_AXES 18 #define MAX_NUM_OF_Y_VALUES MAX_NUM_OF_Y_AXES diff --git a/src/platform/simulator/emscripten/index.html b/src/platform/simulator/emscripten/index.html index 98b3f4c..722df42 100644 --- a/src/platform/simulator/emscripten/index.html +++ b/src/platform/simulator/emscripten/index.html @@ -16,7 +16,7 @@