The following guide will describe how to make a new project based on scythe™ framework.
Project configuration
Project initialization
- Initialize the project with git.
mkdir <project_name> cd <project_name> git init
- Add dependencies.
mkdir deps git submodule add https://github.com/Shtille/scythe-thirdparty.git deps/thirdparty git submodule add https://github.com/Shtille/scythe.git deps/scythe
- Add sources.
mkdir src cp deps/scythe/src/example/desktop.cpp src/
- Add dependent resources into data directory.
rsync -avz deps/scythe/data/ ./data
Project build
- Create CMakeLists.txt build file.
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
# Some settings
set(BINARY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(SCYTHE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps/scythe")
set(SCYTHE_THIRDPARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/thirdparty")
# Dependencies
add_subdirectory(deps/thirdparty)
add_subdirectory(deps/scythe)
# The project itself
project(Demo)
set(CMAKE_CXX_STANDARD 14)
set(SRC_DIRS
src
)
set(include_directories
${SCYTHE_PATH}/include
${SCYTHE_PATH}/src
)
#set(defines )
set(libraries
scythe
)
foreach(DIR ${SRC_DIRS})
file(GLOB DIR_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${DIR}/*.cpp)
set(SRC_FILES ${SRC_FILES} ${DIR_SOURCE})
endforeach(DIR)
if (WIN32)
add_executable(${PROJECT_NAME} WIN32 ${SRC_FILES})
else()
add_executable(${PROJECT_NAME} ${SRC_FILES})
endif()
target_include_directories(${PROJECT_NAME} PRIVATE ${include_directories})
#target_compile_definitions(${PROJECT_NAME} PRIVATE ${defines})
target_link_libraries(${PROJECT_NAME} PRIVATE ${libraries})
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${BINARY_PATH})
- Build and install project with CMake.
mkdir build
cd build
cmake ..
cd ..
cmake --build build
cmake --install build
- Run your application.
./bin/Demo
Debug of application
To be developed…