-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
73 lines (62 loc) · 2.29 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
cmake_minimum_required(VERSION 3.20)
set(PROJECT iagp)
enable_language(C CXX)
project(
${PROJECT}
LANGUAGES CXX
)
if(USE_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
set(LLVM_USE_CRT_DEBUG MDd CACHE STRING "" FORCE)
set(LLVM_USE_CRT_MINSIZEREL MD CACHE STRING "" FORCE)
set(LLVM_USE_CRT_RELEASE MD CACHE STRING "" FORCE)
set(LLVM_USE_CRT_RELWITHDEBINFO MD CACHE STRING "" FORCE)
else()
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(LLVM_USE_CRT_DEBUG MTd CACHE STRING "" FORCE)
set(LLVM_USE_CRT_MINSIZEREL MT CACHE STRING "" FORCE)
set(LLVM_USE_CRT_RELEASE MT CACHE STRING "" FORCE)
set(LLVM_USE_CRT_RELWITHDEBINFO MT CACHE STRING "" FORCE)
endif()
if(NOT CMAKE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX _debug)
endif()
if(NOT CMAKE_RELEASE_POSTFIX)
set(CMAKE_RELEASE_POSTFIX)
endif()
if(NOT CMAKE_MINSIZEREL_POSTFIX)
set(CMAKE_MINSIZEREL_POSTFIX _minsizerel)
endif()
if(NOT CMAKE_RELWITHDEBINFO_POSTFIX)
set(CMAKE_RELWITHDEBINFO_POSTFIX _reldeb)
endif()
if (BUILD_SHARED_LIBS)
set(USE_MSVC_RUNTIME_LIBRARY_DLL ON CACHE BOOL "" FORCE)
add_library(${PROJECT}
${CMAKE_CURRENT_SOURCE_DIR}/iagp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iagp.h
${CMAKE_CURRENT_SOURCE_DIR}/iagpConfig.h
)
target_compile_definitions(${PROJECT} INTERFACE BUILD_IN_APP_GPU_PROFILER_SHARED_LIBS)
set_target_properties(${PROJECT} PROPERTIES POSITION_INDEPENDENT_CODE ON)
else()
set(USE_MSVC_RUNTIME_LIBRARY_DLL OFF CACHE BOOL "" FORCE)
add_library(${PROJECT} STATIC
${CMAKE_CURRENT_SOURCE_DIR}/iagp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iagp.h
${CMAKE_CURRENT_SOURCE_DIR}/iagpConfig.h
)
endif()
target_include_directories(${PROJECT} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR})
if(UNIX)
target_compile_options(${PROJECT} PUBLIC "-Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter")
endif()
if(USE_DEBUG_SANITIZER)
target_compile_options(${PROJECT} PRIVATE $<$<CONFIG:Debug>:-fsanitize=address -static-libasan -static-libasan>)
target_link_options(${PROJECT} PRIVATE $<$<CONFIG:Debug>:-fsanitize=address -static-libasan>)
message("Address Sanitizer enabled for projet ${PROJECT}")
endif()
set_target_properties(${PROJECT} PROPERTIES OUTPUT_NAME "iagp")
set(IN_APP_GPU_PROFILER_INCLUDE_DIRS ${IN_APP_GPU_PROFILER_INCLUDE_DIRS} PARENT_SCOPE)
set(IN_APP_GPU_PROFILER_LIBRARIES ${PROJECT} PARENT_SCOPE)