-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
51 lines (41 loc) · 1.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# A minimal example on how to combine Qt3D and Bullet physics
# Copyright (C) 2017 Jens Jacob Støren
# Permission is granted to anyone to use this software for any purpose,
cmake_minimum_required(VERSION 3.8.1)
project(Qt5BulletExample)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Find Qt5 with modules.
# Needs to set CMAKE variable Qt5_DIR = path-to-your-qt-innstallation/5.9/msvcxxx/lib/cmake/Qt5
set(Qt5_DIR "" CACHE PATH "Path to Qt5 cmake stuff: ..Qt/5.9/msvcxxx/lib/cmake/Qt5" )
find_package(Qt5 REQUIRED COMPONENTS 3DCore 3DExtras 3DRender 3DInput)
# Find Bullet
# Needs to set CMAKE variable BULLET_ROOT
set(BULLET_ROOT "" CACHE PATH "Path to installation of Bullet" )
find_package(Bullet REQUIRED )
include_directories(${BULLET_INCLUDE_DIR})
add_executable(Qt5BulletExample WIN32
main.cpp
)
target_link_libraries(Qt5BulletExample
Qt5::3DCore
Qt5::3DRender
Qt5::3DInput
Qt5::3DExtras
debug ${BULLET_DYNAMICS_LIBRARY_DEBUG}
debug ${BULLET_COLLISION_LIBRARY_DEBUG}
debug ${BULLET_MATH_LIBRARY_DEBUG}
optimized ${BULLET_DYNAMICS_LIBRARY}
optimized ${BULLET_COLLISION_LIBRARY}
optimized ${BULLET_MATH_LIBRARY}
)
# Deploing Qt Dlls
if(WIN32)
get_target_property(QT5_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_filename_component(QT5_WINDEPLOYQT_EXECUTABLE ${QT5_QMAKE_EXECUTABLE} PATH)
set(QT5_WINDEPLOYQT_EXECUTABLE "${QT5_WINDEPLOYQT_EXECUTABLE}/windeployqt.exe")
add_custom_command(TARGET Qt5BulletExample POST_BUILD
COMMAND ${QT5_WINDEPLOYQT_EXECUTABLE} --qmldir ${CMAKE_SOURCE_DIR} $<TARGET_FILE_DIR:Qt5BulletExample>)
endif(WIN32)