Docker - use ppa for gcc11 (#1291)
[dyninst.git] / instructionAPI / CMakeLists.txt
1 # CMake configuration for instructionAPI directory
2
3 include_directories(
4     ${PROJECT_SOURCE_DIR}/instructionAPI/src
5     ${PROJECT_SOURCE_DIR}/instructionAPI/src/AMDGPU/cdna2
6     ${PROJECT_SOURCE_DIR}/instructionAPI/src/AMDGPU/vega)
7
8 set(SRC_LIST
9     src/Instruction.C
10     src/InstructionAST.C
11     src/Operation.C
12     src/Operand.C
13     src/Register.C
14     src/Ternary.C
15     src/Expression.C
16     src/BinaryFunction.C
17     src/InstructionCategories.C
18     src/ArchSpecificFormatters.C
19     src/Immediate.C
20     src/InstructionDecoder.C
21     src/InstructionDecoder-x86.C
22     src/InstructionDecoder-power.C
23     src/InstructionDecoder-aarch64.C
24     src/AMDGPU/vega/InstructionDecoder-amdgpu-vega.C
25     src/AMDGPU/cdna2/InstructionDecoder-amdgpu-cdna2.C
26     src/InstructionDecoderImpl.C)
27 set_source_files_properties(${SRC_LIST} PROPERTIES LANGUAGE CXX)
28
29 set(instructionDecoderPowerExtraFlags "")
30 if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
31     if(${CMAKE_CXX_COMPILER_VERSION} MATCHES "^([1-9]|1[01])(\.|$)")
32         # Disable var-tracking-assignments for InstructionDecoder-power.C for all known
33         # versions of gcc..  The default max size is too small so it fails, and adjusting
34         # it using
35         #
36         # PROPERTIES COMPILE_FLAGS "--param=max-vartrack-size=900000000"
37         #
38         # succeeds, but the object file produced is >1GB, so disable it.
39         string(APPEND instructionDecoderPowerExtraFlags "-fno-var-tracking-assignments")
40     endif()
41 endif()
42
43 # adjust warning threshold if set in cmake/warnings.cmake
44 if(debugMaxFrameSizeOverridePowerOpcodeTable)
45     string(
46         APPEND
47         instructionDecoderPowerExtraFlags
48         " $<$<CONFIG:DEBUG>:-Wframe-larger-than=${debugMaxFrameSizeOverridePowerOpcodeTable}>"
49         )
50 endif()
51 if(nonDebugMaxFrameSizeOverridePowerOpcodeTable)
52     string(
53         APPEND
54         instructionDecoderPowerExtraFlags
55         " $<$<NOT:$<CONFIG:DEBUG>>:-Wframe-larger-than=${nonDebugMaxFrameSizeOverridePowerOpcodeTable}>"
56         )
57 endif()
58
59 if(NOT instructionDecoderPowerExtraFlags STREQUAL "")
60     set_source_files_properties(
61         src/InstructionDecoder-power.C PROPERTIES COMPILE_FLAGS
62                                                   "${instructionDecoderPowerExtraFlags}")
63 endif()
64
65 set(finalizeOperandsExtraFlags "")
66 if(debugMaxFrameSizeOverrideFinalizeOperands)
67     string(
68         APPEND
69         finalizeOperandsExtraFlags
70         " $<$<CONFIG:DEBUG>:-Wframe-larger-than=${debugMaxFrameSizeOverrideFinalizeOperands}>"
71         )
72 endif()
73 if(nonDebugMaxFrameSizeOverrideFinalizeOperands)
74     string(
75         APPEND
76         finalizeOperandsExtraFlags
77         " $<$<NOT:$<CONFIG:DEBUG>>:-Wframe-larger-than=${nonDebugMaxFrameSizeOverrideFinalizeOperands}>"
78         )
79 endif()
80
81 if(NOT finalizeOperandsExtraFlags STREQUAL "")
82     set_source_files_properties(src/AMDGPU/cdna2/InstructionDecoder-amdgpu-cdna2.C
83                                 PROPERTIES COMPILE_FLAGS "${finalizeOperandsExtraFlags}")
84 endif()
85
86 add_definitions(-DINSTRUCTION_LIB)
87
88 dyninst_library(instructionAPI common)
89
90 target_link_private_libraries(instructionAPI ${Boost_LIBRARIES} ${TBB_LIBRARIES}
91                               tbbmalloc)