[This page is currently conflicting with the First project page. They both have a first project example. I'll be restructuring that to have one really minimal testing sample here, and one a bit more complex example in the First Project page that explains basic Urho ideas. This page should be more about setting the project up and less about how to use Urho.]

This tries to be a shorter and easier version of

(There's an old guide for Urho 1.32 here: Creating a new Urho3D 1.32 Project.

1. Urho3D Environment Variable

Create a new environment variable (user or system variable) called "URHO3D_HOME" and set the value to the path where you build Urho into:

Urho sv.jpg

How this is done in Windows is explained in more details here: Building Urho 1.5 (Windows 10, MinGW/GCC)#3._Set_up_MinGW_for_CMake

2. Create and Fill Project Folder

You can use this quite minimal Urho Sample Project to skip copying and filling the folder manually:

2. 1. Copy those files and folders from Urho


2.2. Copy one or more of the "cmake_*.bat" files depending on the build system you want to use. If you are using codeblocks, copy "cmake_codeblocks.bat". If you are not on Windows, get the files ending on ".sh" instead of ".bat".

2.3. Create a "bin" folder with a "CoreData" and a "Data" folder inside. You may want to copy "CoreData" from Urho to get same basic materials.

2.4. Create a "CMakeLists.txt" and fill it with:

# Set project name
project (SampleProject)
# Define target name
set (TARGET_NAME SampleProject)
# Set minimum version
cmake_minimum_required (VERSION 2.8.6)
if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW)
# INTERFACE_LINK_LIBRARIES defines the link interface
cmake_policy (SET CMP0022 NEW)
endif ()
# Disallow use of the LOCATION target property - therefore we set to OLD as we still need it
cmake_policy (SET CMP0026 OLD)
# MACOSX_RPATH is enabled by default
cmake_policy (SET CMP0042 NEW)
endif ()
endif ()
# Set CMake modules search path
# Include Urho3D Cmake common module
include (Urho3D-CMake-common)
# Find Urho3D library
find_package (Urho3D REQUIRED)
include_directories (${URHO3D_INCLUDE_DIRS})
# Define source files
define_source_files ()
# Setup target with resource copying
setup_main_executable ()

Replace SampleProject with your project name.

2.5. Create source files. CMake needs at least one .cpp file to set the linker correctly.

Your folder could now look like:

Urho new project.JPG

3. Prepare Build and Build

Like in Building Urho 1.5 (Windows 10, MinGW/GCC)#4._Run_CMake_to_create_the_project_files_for_Urho open a terminal and use the cmake script to generate the project build files:

Urho new project prepare.JPG
You have to use the same options you used to build Urho.

You can also use the CMake GUI:

Urho new project cmake gui.JPG
Note for Mac OS X: There is an issue with the default STL not fully supporting C++11. You need to switch the STL to libc++ with "-stdlib=libc++" like

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")

4. Build

Open the created project file and build it:

Urho new project build.JPG
Community content is available under CC-BY-SA unless otherwise noted.