![]() You also need to inform the Urho3D library that you have non-conventional resource directory paths. The define_source_files() macro is a shorthand to glob all the source files in the current directory. The define_source_files() and setup_main_executable() are Urho3D-specific macros. That is, use the URHO3D_HOME to hint the build system to locate the library. When searching in a non-default SDK installation or when searching in any Urho3D project build tree then the actual location need to be provided via URHO3D_HOME environment variable (set in the host system) or URHO3D_HOME build option (set using -D at command line or in cmake-gui). ![]() When searching in Urho3D SDK installed in a system-wide default location then no additional variable need to be set. The FindUrho3D.cmake module is designed not only able to find Urho3D library from the Urho3D SDK installation, but also from any Urho3D project build tree directly. However, there is really no difference between the two approaches from your project's point of view. Thus, there are two approaches for your project to link against Urho3D library as external library. When you build Urho3D library, you have an option to install the library to a installation location in your file system as if Urho3D is an SDK or you can just leave the library where it is in its build tree. In such cases the FindUrho3D.cmake module would automatically utilize both of Release and Debug versions as appropriate in your project for Release and Debug build configuration, respectively, without user intervention. ![]() However, for MSVC, it is possible to have both Release and Debug versions of either static or shared library type built/installed at a same location. When using MSVC compiler, both static and shared libraries could not be built/installed at a same location because both the static library and import library have a same file extension. ![]() However, you can use URHO3D_LIB_TYPE build option to override this precedence. In such cases the FindUrho3D.cmake module, the module responsible to find Urho3D software library component and is invoked automatically by the UrhoCommon.cmake module, has precedence to first find the static library type over over shared library type. When using GCC/Clang or one of its derivatives, both Urho3D static and shared libraries could be potentially built/installed at a same location and coexist. The Urho3D library needs to be built first so that it can be found later by your own project. Your own project naturally depends on Urho3D project, or to be more precise it depends on Urho3D library. So, it is important to get the CMAKE_MODULE_PATH setup correctly in your project early on. It utilizes CMake-provided as well as Urho3D custom-made FindXXX modules to get the work done. It does this by automatically finding the required software library components specific for your target platform and configuring your project to use them together with the platform-specific compiler flags and definitions. It also gives your project cross-platform build capability similar to Urho3D project. The UrhoCommon.cmake is the module where all the reusable commands and macros are defined. The CMAKE_MODULE_PATH is setup so that CMake can find the Urho3D-specific CMake modules provided by Urho3D project inside your own project. ![]() In your own project root directory, create a main CMakeLists.txt file and add the following lines: (replace MyProjectName and MyExecutableName with the actual names you want) Be mindful that conflicting build options would be ignored. Note that when you configure your project (either via one of the build script or via cmake-gui), you can only pass the Build options that are applicable to downstream projects. Both out-of-source build tree (recommended) and non out-of-source build tree are supported. The build scripts work together with the Urho3D CMake modules and toolchains to configure and generate your initial project build tree. Alternatively, you can add the Urho3D project root directory into the PATH environment variable in your host system in order to make the build scripts available everywhere. You may also want to copy (or symlink) the build scripts from Urho3D project root directory (or from Urho3D SDK installation, which can be found in the 'share/Urho3D/Scripts') to your project root directory, unless you just want to use cmake-gui for your own project configuration and generation. You must copy (or symlink) the 'CMake' subdir from Urho3D project root directory (or from Urho3D SDK installation, which can be found in the 'share/Urho3D/CMake') to your project root directory. The 'bin' directory should contain the 'Data' and 'CoreData' resource subdirs for your own assets. The physical project root directory is also the logical project source tree in CMake terminology where your project main CMakeLists.txt should reside. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |