forked from kattkieru/nodesmith
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists_template.txt
122 lines (99 loc) · 3.06 KB
/
CMakeLists_template.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
111
112
113
114
115
116
117
118
119
120
121
cmake_minimum_required( VERSION 3.3 )
project( {project_name} )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${{CMAKE_CURRENT_SOURCE_DIR}}" )
set( SOURCE_FILES {source_files} )
add_library( {project_name} SHARED ${{SOURCE_FILES}} )
set_target_properties( {project_name} PROPERTIES PREFIX "" )
## override paths here
if(EXISTS "${{ROOT}}/user_config.cmake")
include_file( "${{ROOT}}/user_config.cmake" )
endif()
## default paths
if(NOT DEFINED ${{WIN_INCLUDE_PATH}} )
set( ${{WIN_INCLUDE_PATH}} "{win_include_path}" )
endif()
if(NOT DEFINED ${{WIN_LIB_PATH}} )
set( ${{WIN_LIB_PATH}} "{win_lib_path}" )
endif()
if(NOT DEFINED ${{MAC_INCLUDE_PATH}} )
set( ${{MAC_INCLUDE_PATH}} "{mac_include_path}" )
endif()
if(NOT DEFINED ${{MAC_LIB_PATH}} )
set( ${{MAC_LIB_PATH}} "{mac_lib_path}" )
endif()
add_definitions( -D_BOOL -DMAYA_PARALLEL -D_LANGUAGE_C_PLUS_PLUS )
if (MSVC)
set( MAYA_INCLUDE_LOCATION ${{WIN_INCLUDE_PATH}} )
set( MAYA_LIB_LOCATION ${{WIN_LIB_PATH}} )
target_compile_options(
{project_name} PUBLIC
/MT
/Zi
/Oi
/fp:fast
/Ob1
/O2
/EHsc
)
add_definitions( /DNT_PLUGIN /D_CRT_SECURE_NO_WARNINGS )
set_target_properties( {project_name} PROPERTIES SUFFIX ".mll" )
if( MSVC_VERSION GREATER 1800 )
## compatibility fix for VS 2017
set( PLATFORM_LINK ${{PLATFORM_LINK}} legacy_stdio_definitions.lib )
endif()
target_link_libraries(
{project_name}
${{MAYA_LIB_LOCATION}}/OpenMaya.lib
${{MAYA_LIB_LOCATION}}/OpenMayaAnim.lib
${{MAYA_LIB_LOCATION}}/Foundation.lib
${{MAYA_LIB_LOCATION}}/Image.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
${{PLATFORM_LINK}}
)
set_property(TARGET {project_name} APPEND PROPERTY LINK_FLAGS
"/INCREMENTAL:NO /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /DYNAMICBASE:NO /MACHINE:X64 /debug:full"
)
elseif( APPLE )
set( MAYA_INCLUDE_LOCATION "${{MAC_INCLUDE_PATH}}" )
set( MAYA_LIB_LOCATION "${{MAC_LIB_PATH}}" )
set( CMAKE_C_COMPILER "clang" )
set( CMAKE_CXX_COMPILER "clang++" )
target_compile_options(
{project_name} PUBLIC
-m64 -fPIC -O3 -g -mavx
-fvisibility=hidden
-std=c++14 -mmacosx-version-min=10.8
-fno-gnu-keywords -fpascal-strings
-Wc++11-extensions -Wc++11-long-long
-stdlib=libc++
)
add_definitions( -DMAC_PLUGIN -DOSMac_ -DCC_GNU_ -DOSMacOSX_ -DOSMac_MachO_ )
set_target_properties( {project_name} PROPERTIES SUFFIX ".bundle" )
target_link_libraries(
{project_name}
${{MAYA_LIB_LOCATION}}/libOpenMaya.dylib
${{MAYA_LIB_LOCATION}}/libOpenMayaAnim.dylib
${{MAYA_LIB_LOCATION}}/libFoundation.dylib
/System/Library/Frameworks/System.framework
/System/Library/Frameworks/SystemConfiguration.framework
/System/Library/Frameworks/CoreServices.framework
/System/Library/Frameworks/Cocoa.framework
/System/Library/Frameworks/ApplicationServices.framework
/System/Library/Frameworks/IOKit.framework
)
else()
message( FATAL_ERROR "Sorry, current platform is unsupported." )
endif()
include_directories( ${{MAYA_INCLUDE_LOCATION}} )
link_directories( ${{MAYA_LIB_LOCATION}} )