mirror of
https://github.com/eez-open/eez-flow-template-sdl.git
synced 2026-11-17 05:28:55 +01:00
added template folder
This commit is contained in:
parent
e5ffe101c0
commit
f09d416aa2
@ -1,6 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
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)
|
set (CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
@ -138,62 +140,63 @@ if(WIN32)
|
|||||||
set(SOURCES src/platform/simulator/win32/icon.rc ${src_files})
|
set(SOURCES src/platform/simulator/win32/icon.rc ${src_files})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(eez-flow-template-sdl ${src_files} ${header_files})
|
add_executable(${PROJECT_NAME} ${src_files} ${header_files})
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(eez-flow-template-sdl PRIVATE "/MP")
|
target_compile_options(${PROJECT_NAME} PRIVATE "/MP")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UNIX AND NOT(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten"))
|
if (UNIX AND NOT(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten"))
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(eez-flow-template-sdl Threads::Threads bsd)
|
target_link_libraries(${PROJECT_NAME} Threads::Threads bsd)
|
||||||
endif ()
|
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)
|
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
|
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"
|
||||||
$<TARGET_FILE_DIR:eez-flow-template-sdl>)
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||||
|
|
||||||
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
|
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"
|
||||||
$<TARGET_FILE_DIR:eez-flow-template-sdl>)
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||||
|
|
||||||
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
|
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"
|
||||||
$<TARGET_FILE_DIR:eez-flow-template-sdl>)
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||||
|
|
||||||
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
|
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"
|
||||||
$<TARGET_FILE_DIR:eez-flow-template-sdl>)
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||||
|
|
||||||
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
|
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"
|
||||||
$<TARGET_FILE_DIR:eez-flow-template-sdl>)
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||||
|
|
||||||
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
|
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"
|
||||||
$<TARGET_FILE_DIR:eez-flow-template-sdl>)
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||||
|
|
||||||
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
|
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"
|
||||||
$<TARGET_FILE_DIR:eez-flow-template-sdl>)
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
|
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
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
"${PROJECT_SOURCE_DIR}/src/platform/simulator/emscripten"
|
"${PROJECT_SOURCE_DIR}/src/platform/simulator/emscripten"
|
||||||
$<TARGET_FILE_DIR:eez-flow-template-sdl>)
|
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
29
README.md
29
README.md
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
The contributors are listed in CONTRIB.TXT. This project uses the GPL v3 license, see LICENSE.TXT.
|
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.
|
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
|
## 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 update
|
||||||
sudo apt-get install -y git libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev cmake build-essential libbsd-dev
|
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 {{projectDirPath}}
|
||||||
cd eez-flow-template-sdl
|
|
||||||
git submodule update --init --recursive
|
|
||||||
mkdir -p build/linux
|
mkdir -p build/linux
|
||||||
cd build/linux
|
cd build/linux
|
||||||
cmake ../..
|
cmake ../..
|
||||||
@ -23,17 +20,31 @@ make
|
|||||||
Start simulator with:
|
Start simulator with:
|
||||||
|
|
||||||
```
|
```
|
||||||
./eez-flow-template-sdl
|
./{{projectName}}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Windows
|
#### Windows
|
||||||
|
|
||||||
Install [Visual Studio Community 2017](https://visualstudio.microsoft.com/downloads/) and [CMake](https://cmake.org/install/).
|
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.
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
set SDL2DIR=..\..\SDL2-2.0.14
|
set SDL2DIR=..\SDL2-2.0.14
|
||||||
set SDL2IMAGEDIR=..\..\SDL2_image-2.0.4
|
set SDL2IMAGEDIR=..\SDL2_image-2.0.4
|
||||||
|
|
||||||
if not exist "build" mkdir "build"
|
if not exist "build" mkdir "build"
|
||||||
if not exist "build\win32" mkdir "build\win32"
|
if not exist "build\win32" mkdir "build\win32"
|
||||||
|
|
||||||
cd build\win32
|
cd build\win32
|
||||||
|
|
||||||
cmake ..\..
|
cmake -G "Visual Studio 15 2017" ..\..
|
||||||
|
|
||||||
cd ..\..
|
cd ..\..
|
||||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
@ -7,7 +7,7 @@ extern uint32_t DISPLAY_HEIGHT;
|
|||||||
static const uint32_t DISPLAY_BPP = 32; // RGBA8888
|
static const uint32_t DISPLAY_BPP = 32; // RGBA8888
|
||||||
|
|
||||||
static const char *TITLE = "EEZ Flow App";
|
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_AXES 18
|
||||||
#define MAX_NUM_OF_Y_VALUES MAX_NUM_OF_Y_AXES
|
#define MAX_NUM_OF_Y_VALUES MAX_NUM_OF_Y_AXES
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var worker = new Worker("eez-flow-template-sdl.js");
|
var worker = new Worker("{{projectName}}.js");
|
||||||
|
|
||||||
const WIDTH = 480;
|
const WIDTH = 480;
|
||||||
const HEIGHT = 272;
|
const HEIGHT = 272;
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
3
template/manifest.json
Normal file
3
template/manifest.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"eez-project-path": "{{projectName}}.eez-project"
|
||||||
|
}
|
||||||
50
template/post.js
Normal file
50
template/post.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* @callback RenameFile
|
||||||
|
* @param {string} fileSrcRelativePath
|
||||||
|
* @param {string} fileDstRelativePath
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @callback ReplaceInFile
|
||||||
|
* @param {string} fileRelativePath
|
||||||
|
* @param {string} searchValue
|
||||||
|
* @param {string} newValue
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} WizardContext
|
||||||
|
* @property {string} projectDirPath
|
||||||
|
* @property {string} projectName
|
||||||
|
* @property {RenameFile} renameFile
|
||||||
|
* @property {ReplaceInFile} replaceInFile
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {WizardContext} context
|
||||||
|
*/
|
||||||
|
async function postProcessing(context) {
|
||||||
|
await context.replaceInFile("CMakeLists.txt", "eez-flow-template-sdl", context.projectName);
|
||||||
|
|
||||||
|
await context.replaceInFile("README.md", "{{projectDirPath}}", context.projectDirPath);
|
||||||
|
await context.replaceInFile("README.md", "{{projectName}}", context.projectName);
|
||||||
|
|
||||||
|
await context.replaceInFile("src/platform/simulator/win32/icon.rc", "{{projectName}}", context.projectName);
|
||||||
|
|
||||||
|
await context.replaceInFile("src/platform/simulator/emscripten/index.html", "{{projectName}}", context.projectName);
|
||||||
|
|
||||||
|
await context.replaceInFile("src/main.cpp", "eez-flow-template-sdl", context.projectName);
|
||||||
|
|
||||||
|
await context.replaceInFile("src/gui/app_context.cpp", "eez-flow-template-sdl", context.projectName);
|
||||||
|
|
||||||
|
await context.renameFile("app.eez-project", context.projectName + ".eez-project");
|
||||||
|
await context.renameFile("gui.eez-project", context.projectName + "-gui.eez-project");
|
||||||
|
|
||||||
|
await context.replaceInFile(context.projectName + ".eez-project", "gui.eez-project", context.projectName + "-gui.eez-project");
|
||||||
|
await context.replaceInFile(context.projectName + "-gui.eez-project", "app.eez-project", context.projectName + ".eez-project");
|
||||||
|
|
||||||
|
await context.replaceInFile("template/manifest.json", "{{projectName}}", context.projectName);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = postProcessing;
|
||||||
Loading…
Reference in New Issue
Block a user