-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
80 lines (62 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 3.21)
project(M1kanN_OpenGL_Renderer_Engine)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# 版本分歧部分
if(APPLE)
set(CMAKE_PREFIX_PATH "/Users/m1kann/Qt/5.15.2/clang_64")
set(CMAKE_OSX_ARCHITECTURES "x86_64")
set(ASSIMP_LIBRARIES "${CMAKE_SOURCE_DIR}/3rdParty/lib/clang64/libassimpd.5.dylib")
set(ASSIMP_DLL_SRC "${CMAKE_SOURCE_DIR}/3rdParty/lib/clang64/libassimpd.5.dylib")
set(ASSIMP_DLL_DST "${CMAKE_CURRENT_BINARY_DIR}/libassimpd.5.dylib")
elseif(WIN32)
set(CMAKE_PREFIX_PATH "C:/Applications/Qt/5.15.2/mingw81_64")
set(ASSIMP_LIBRARIES "${CMAKE_SOURCE_DIR}/3rdParty/lib/mingw64/libassimp.dll.a")
set(ASSIMP_DLL_SRC "${CMAKE_SOURCE_DIR}/3rdParty/lib/mingw64/libassimp-5.dll")
set(ASSIMP_DLL_DST "${CMAKE_CURRENT_BINARY_DIR}/libassimp-5.dll")
endif()
include_directories(
src/include
src/include/object
src/include/ui
src/include/utils
3rdParty/include
)
find_package(Qt5 COMPONENTS
Core
Gui
Widgets
REQUIRED)
set(QRC_SOURCE_FILES res.qrc)
qt_add_resources(${QRC_SOURCE_FILES})
file(GLOB_RECURSE SOURCE_FILES
src/*.cpp
src/*.hpp
src/*.ui
)
add_executable(${PROJECT_NAME}
${QRC_SOURCE_FILES}
${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::Gui
Qt5::Widgets
${ASSIMP_LIBRARIES}
)
# 创建一个自定义命令来复制DLL
add_custom_command(
OUTPUT ${ASSIMP_DLL_DST}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${ASSIMP_DLL_SRC}
${ASSIMP_DLL_DST}
DEPENDS ${ASSIMP_DLL_SRC}
COMMENT "Copying libassimp library to target directory"
)
# 创建一个自定义目标来执行上面的复制命令
add_custom_target(
CopyAssimpDLL ALL
DEPENDS ${ASSIMP_DLL_DST}
)
add_dependencies(${PROJECT_NAME} CopyAssimpDLL)