-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·160 lines (121 loc) · 5.4 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
# this line gets an env variable to add to the install dir so that we can batch build against multiple software packages
set(SelectedCompilePlugin $ENV{COMPILEPLUGIN} CACHE PATH "install suffix for the resolver")
message(STATUS "Selected Compile Plugin ${SelectedCompilePlugin}")
if (NOT DEFINED ENV{INSTALLNAME})
set(InstallName ${SelectedCompilePlugin})
else()
set(InstallName $ENV{INSTALLNAME} CACHE PATH "install suffix for the resolver")
endif()
add_compile_definitions(DEV=${DEV})
add_compile_definitions(MACRO_REMOVE_SDF_FORMAT_ARGS=1)
add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT) #we need to define this var here because ayon cpp api needs it to enable open sll support for https
set(AR_PROJECT_NAME UsdAssetResolver)
set(AR_RESOLVER_USD_PYTHON_MODULE_NAME usdAssetResolver)
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/Resolvers/${InstallName}" CACHE PATH "install dir")
set(BUILD_SHARED_LIBS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# ----------------------- Project Commands
set(AR_AYONUSDRESOLVER_USD_PLUGIN_NAME ayonUsdResolver)
set(AR_AYONUSDRESOLVER_USD_CXX_CLASS_NAME AyonUsdResolver)
set(AR_AYONUSDRESOLVER_USD_PYTHON_MODULE_NAME AyonUsdResolver)
set(AR_AYONUSDRESOLVER_USD_PYTHON_MODULE_FULLNAME ${AR_RESOLVER_USD_PYTHON_MODULE_NAME}.${AR_AYONUSDRESOLVER_USD_PYTHON_MODULE_NAME})
set(AR_AYONUSDRESOLVER_TARGET_LIB ayonUsdResolver)
set(AR_AYONUSDRESOLVER_TARGET_PYTHON _${AR_AYONUSDRESOLVER_TARGET_LIB})
set(AR_AYONUSDRESOLVER_INSTALL_PREFIX ${AR_PROJECT_NAME}/${AR_AYONUSDRESOLVER_USD_PLUGIN_NAME})
set(MACRO_REMOVE_SDF_FORMAT_ARGS 1)
# shared library setup commands
if (WIN32)
set(AR_ARCH_LIB_SUFFIX "dll")
message(STATUS "AR_ARCH_LIB_SUFFIX dll")
else()
set(AR_ARCH_LIB_SUFFIX "so")
message(STATUS "AR_ARCH_LIB_SUFFIX so")
endif()
if (WIN32)
add_compile_definitions(NOMINMAX)
add_compile_options(/Zc:inline- /w)
else()
add_compile_options(-fPIC -Wno-deprecated -Wno-deprecated-declarations)
endif()
if(WIN32)
set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/ayon-cpp-api/ext/opensslW")
else()
set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/ayon-cpp-api/ext/opensslL")
endif()
include_directories(${OPENSSL_ROOT_DIR}/include)
# setting default boost namespace
set(AR_BOOST_NAMESPACE boost)
add_compile_definitions(BOOST_ALL_NO_LIB)
if (WIN32)
set(AR_BOOST_EXTEND -mt-x64)
else()
set(AR_BOOST_EXTEND )
endif()
#-------------- Compile Plugin loading
include(BuildPlugins/${SelectedCompilePlugin}.cmake)
if(NOT DEFINED AR_PXR_INCLUDE_DIR)
message(FATAL_ERROR "AR_PXR_INCLUDE_DIR is not defined. Please set it before continuing.")
endif()
if(NOT DEFINED AR_PXR_LIB_DIR)
message(FATAL_ERROR "AR_PXR_LIB_DIR is not defined. Please set it before continuing.")
endif()
if(NOT DEFINED AR_PXR_LIB_PREFIX)
message(FATAL_ERROR "AR_PXR_LIB_PREFIX is not defined. Please set it before continuing.")
endif()
if(NOT DEFINED AR_PYTHON_LIB_NUMBER)
message(FATAL_ERROR "AR_PYTHON_LIB_NUMBER is not defined. Please set it before continuing.")
endif()
if(NOT DEFINED AR_PYTHON_LIB_DIR)
message(FATAL_ERROR "AR_PYTHON_LIB_DIR is not defined. Please set it before continuing.")
endif()
if(NOT DEFINED AR_PYTHON_INCLUDE_DIR)
message(FATAL_ERROR "AR_PYTHON_INCLUDE_DIR is not defined. Please set it before continuing.")
endif()
if(NOT DEFINED AR_BOOST_INCLUDE_DIR)
message(FATAL_ERROR "AR_BOOST_INCLUDE_DIR is not defined. Please set it before continuing.")
endif()
if(NOT DEFINED BOOST_LIB_DIR)
message(FATAL_ERROR "BOOST_LIB_DIR is not defined. Please set it before continuing.")
endif()
message(STATUS "AR_PXR_INCLUDE_DIR path: ${AR_PXR_INCLUDE_DIR}")
message(STATUS "AR_PXR_LIB_DIR path: ${AR_PXR_LIB_DIR}")
message(STATUS "AR_PXR_LIB_PREFIX path: ${AR_PXR_LIB_PREFIX}")
message(STATUS "AR_PYTHON_LIB_NUMBER path: ${AR_PYTHON_LIB_NUMBER}")
message(STATUS "AR_PYTHON_LIB_DIR path: ${AR_PYTHON_LIB_DIR}")
message(STATUS "AR_PYTHON_INCLUDE_DIR path: ${AR_PYTHON_INCLUDE_DIR}")
message(STATUS "AR_BOOST_INCLUDE_DIR path: ${AR_BOOST_INCLUDE_DIR}")
message(STATUS "BOOST_LIB_DIR path: ${BOOST_LIB_DIR}")
message(STATUS "SDF_FORMAT_ARGS = ${MACRO_REMOVE_SDF_FORMAT_ARGS}")
add_compile_definitions(MACRO_REMOVE_SDF_FORMAT_ARGS=${MACRO_REMOVE_SDF_FORMAT_ARGS})
# Include AyonDevTools
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/ayon-cpp-dev-tools")
# Include AyonCppApi
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/ayon-cpp-api")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ext/ayon-cpp-api")
# setting CXX11ABI infos
if(DEFINED GLIBCXX_USE_CXX11_ABI)
message(STATUS "Setting Up CXX11_ABI linking")
if (NOT WIN32)
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI})
target_compile_definitions(AyonCppApi PUBLIC _GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI})
endif()
endif()
# Boost
set(AR_BOOST_PYTHON_LIB ${AR_BOOST_NAMESPACE}_${AR_PYTHON_LIB_NUMBER}${AR_BOOST_EXTEND})
project(${AR_PROJECT_NAME} VERSION 1.0.0 LANGUAGES CXX)
# --------------------------- Includes / Linking
### Packages ###
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/defaults)
include(setBoostNamespace)
include_directories(${CMAKE_SOURCE_DIR}/src/utils)
# Boost
link_directories(${BOOST_LIB_DIR})
# Usd
link_directories(${AR_PXR_LIB_DIR})
# Python
link_directories(${AR_PYTHON_LIB_DIR})
# Resolver Code
add_subdirectory("src/AyonUsdResolver")