CMCMakeModule/README.md

45 lines
1.1 KiB
Markdown
Raw Normal View History

2019-08-22 11:43:53 +08:00
# CMCMakeModule
2019-11-29 12:45:07 +08:00
CMake module files of CMGameEngine/ULRE
2019-08-22 11:43:53 +08:00
2019-08-22 15:55:56 +08:00
## use
2019-08-22 11:43:53 +08:00
2019-08-23 10:24:09 +08:00
- create a project
2019-08-23 11:36:27 +08:00
- switch to the project root directory using the console/bash/GIT Bash
- run the following command
```
git submodule add https://github.com/hyzboy/CMCMakeModule
git submodule add https://github.com/hyzboy/CMCore
git submodule add https://github.com/hyzboy/CMPlatform
2019-11-29 12:45:07 +08:00
git submodule add https://github.com/hyzboy/CMUtil
2019-08-23 11:36:27 +08:00
```
2019-08-22 15:55:56 +08:00
- add the following code to project CMakeLists.txt
2019-11-29 12:45:07 +08:00
```
2019-08-23 10:24:09 +08:00
cmake_minimum_required(VERSION 3.0)
2019-11-29 12:45:07 +08:00
2019-08-23 11:32:07 +08:00
project(YourProject)
2019-11-29 12:45:07 +08:00
2019-08-22 15:55:56 +08:00
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
2019-11-29 12:45:07 +08:00
2019-08-22 15:55:56 +08:00
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMCMakeModule)
2019-11-29 12:45:07 +08:00
2019-08-23 11:32:07 +08:00
#if you use Vulkan API
include(vulkan)
2019-08-23 10:22:48 +08:00
include(math)
use_mgl(${CMAKE_CURRENT_SOURCE_DIR}/3rdpty/MathGeoLib)
2019-11-29 12:45:07 +08:00
2019-08-22 15:55:56 +08:00
include(use_cm_module)
use_cm_module(Core)
2019-08-23 10:22:48 +08:00
use_cm_module(Platform)
2019-11-29 12:45:07 +08:00
use_cm_module(Util)
2019-08-23 11:32:07 +08:00
...
2019-11-29 12:45:07 +08:00
2019-08-23 11:32:07 +08:00
add_executable(YourProgram ...)
target_link_libraries(YourProgram CMCore CMPlatform)
2019-11-29 12:45:07 +08:00
2019-08-23 11:32:07 +08:00
#if you use vulkan render
target_link_libraried(YourProject ${RENDER_LIBRARY} ${Vulkan_LIBRARIES})
2019-11-29 12:45:07 +08:00
2019-08-22 15:55:56 +08:00
```