-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
110 lines (92 loc) · 3.22 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
CMAKE_MINIMUM_REQUIRED(VERSION 3.10.0)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
PROJECT(YOSEF_PT)
SET(EXE_NAME "YOSEF_PT")
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -DNOMINMAX=1")
IF(APPLE)
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE INTERNAL "" FORCE)
ENDIF(APPLE)
IF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_WINDOWS=1")
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ELSEIF(APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_MAC=1")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa -framework QuartzCore")
SET(CMAKE_XCODE_GENERATE_SCHEME ON)
SET(XCODE_SCHEME_ENVIRONMENT ON)
ELSEIF(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPLATFORM_LINUX=1")
ENDIF()
IF(APPLE)
SET(OIDN_LIBRARY ${CMAKE_SOURCE_DIR}/external/oidn/lib/MacOS/libOpenImageDenoise.1.4.3.dylib)
ENDIF(APPLE)
IF(WIN32)
SET(OIDN_LIBRARIES "OpenImageDenoise")
SET(OIDN_LIBRARY ${CMAKE_SOURCE_DIR}/external/oidn/lib/WIN/OpenImageDenoise.lib)
ENDIF(WIN32)
SET(OIDN_DLL ${CMAKE_SOURCE_DIR}/external/oidn/lib/WIN/OpenImageDenoise.dll)
SET(ALL_LIBS
${OPENGL_LIBRARY}
${OIDN_LIBRARY}
Core
glfw
glad
imgui
imguizmo
)
IF(NOT WIN32)
SET(ALL_LIBS
${ALL_LIBS}
pthread
)
ENDIF()
INCLUDE_DIRECTORIES(
src/
external/glfw/include/
external/glad/include/
external/imgui/
external/imguizmo/
external/oidn/include/
)
FIND_PACKAGE(OpenGL REQUIRED)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(external/glfw)
ADD_SUBDIRECTORY(external/glad)
ADD_SUBDIRECTORY(external/imgui)
ADD_SUBDIRECTORY(external/imguizmo)
# *.cpp *.h */*.h */*.cpp
FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/shaders/*.*" "${CMAKE_CURRENT_SOURCE_DIR}/shaders/*/*.*")
FOREACH(FILE ${files})
SET(ASSETS
${ASSETS}
${file}
)
ENDFOREACH()
SOURCE_GROUP(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Resources" FILES ${ASSETS})
ADD_EXECUTABLE(${PROJECT_NAME}
src/main.cpp
${ASSETS}
)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ALL_LIBS})
set_target_properties(${EXE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR} )
set_target_properties(${EXE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR} )
set_target_properties(${EXE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_BINARY_DIR} )
set_target_properties(${EXE_NAME} PROPERTIES DEBUG_POSTFIX "_d")
set_target_properties(${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "RelWithDebInfo")
set_target_properties(${EXE_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets $<TARGET_FILE_DIR:${PROJECT_NAME}>/assets/
)
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/shaders $<TARGET_FILE_DIR:${PROJECT_NAME}>/shaders/
)
if(WIN32)
add_custom_command(TARGET ${EXE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/external/oidn/lib/WIN/OpenImageDenoise.dll ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/external/oidn/lib/WIN/tbb.dll ${CMAKE_CURRENT_BINARY_DIR}
)
endif()