asmjit 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/asmjit.gemspec +1 -1
- data/ext/asmjit/asmjit/.editorconfig +10 -0
- data/ext/asmjit/asmjit/.github/FUNDING.yml +1 -0
- data/ext/asmjit/asmjit/.github/workflows/build-config.json +47 -0
- data/ext/asmjit/asmjit/.github/workflows/build.yml +156 -0
- data/ext/asmjit/asmjit/.gitignore +6 -0
- data/ext/asmjit/asmjit/CMakeLists.txt +611 -0
- data/ext/asmjit/asmjit/LICENSE.md +17 -0
- data/ext/asmjit/asmjit/README.md +69 -0
- data/ext/asmjit/asmjit/src/asmjit/a64.h +62 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64archtraits_p.h +81 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.cpp +5115 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64assembler.h +72 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.cpp +51 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64builder.h +57 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.cpp +60 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64compiler.h +247 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper.cpp +464 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emithelper_p.h +50 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64emitter.h +1228 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter.cpp +298 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64formatter_p.h +59 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64func.cpp +189 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64func_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64globals.h +1894 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi.cpp +278 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instapi_p.h +41 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.cpp +1957 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb.h +74 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64instdb_p.h +876 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.cpp +85 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64operand.h +312 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass.cpp +852 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64rapass_p.h +105 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/a64utils.h +179 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armformatter.cpp +143 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armformatter_p.h +44 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armglobals.h +21 -0
- data/ext/asmjit/asmjit/src/asmjit/arm/armoperand.h +621 -0
- data/ext/asmjit/asmjit/src/asmjit/arm.h +62 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-begin.h +17 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit-scope-end.h +9 -0
- data/ext/asmjit/asmjit/src/asmjit/asmjit.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/core/api-build_p.h +55 -0
- data/ext/asmjit/asmjit/src/asmjit/core/api-config.h +613 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archcommons.h +229 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archtraits.cpp +160 -0
- data/ext/asmjit/asmjit/src/asmjit/core/archtraits.h +290 -0
- data/ext/asmjit/asmjit/src/asmjit/core/assembler.cpp +406 -0
- data/ext/asmjit/asmjit/src/asmjit/core/assembler.h +129 -0
- data/ext/asmjit/asmjit/src/asmjit/core/builder.cpp +889 -0
- data/ext/asmjit/asmjit/src/asmjit/core/builder.h +1391 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codebuffer.h +113 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codeholder.cpp +1149 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codeholder.h +1035 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codewriter.cpp +175 -0
- data/ext/asmjit/asmjit/src/asmjit/core/codewriter_p.h +179 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compiler.cpp +582 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compiler.h +737 -0
- data/ext/asmjit/asmjit/src/asmjit/core/compilerdefs.h +173 -0
- data/ext/asmjit/asmjit/src/asmjit/core/constpool.cpp +363 -0
- data/ext/asmjit/asmjit/src/asmjit/core/constpool.h +250 -0
- data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.cpp +1162 -0
- data/ext/asmjit/asmjit/src/asmjit/core/cpuinfo.h +813 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emithelper.cpp +323 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emithelper_p.h +58 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitter.cpp +333 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitter.h +741 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitterutils.cpp +129 -0
- data/ext/asmjit/asmjit/src/asmjit/core/emitterutils_p.h +89 -0
- data/ext/asmjit/asmjit/src/asmjit/core/environment.cpp +46 -0
- data/ext/asmjit/asmjit/src/asmjit/core/environment.h +508 -0
- data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.cpp +14 -0
- data/ext/asmjit/asmjit/src/asmjit/core/errorhandler.h +228 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter.cpp +584 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter.h +247 -0
- data/ext/asmjit/asmjit/src/asmjit/core/formatter_p.h +34 -0
- data/ext/asmjit/asmjit/src/asmjit/core/func.cpp +286 -0
- data/ext/asmjit/asmjit/src/asmjit/core/func.h +1445 -0
- data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext.cpp +293 -0
- data/ext/asmjit/asmjit/src/asmjit/core/funcargscontext_p.h +199 -0
- data/ext/asmjit/asmjit/src/asmjit/core/globals.cpp +133 -0
- data/ext/asmjit/asmjit/src/asmjit/core/globals.h +393 -0
- data/ext/asmjit/asmjit/src/asmjit/core/inst.cpp +113 -0
- data/ext/asmjit/asmjit/src/asmjit/core/inst.h +772 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.cpp +1242 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitallocator.h +261 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.cpp +80 -0
- data/ext/asmjit/asmjit/src/asmjit/core/jitruntime.h +89 -0
- data/ext/asmjit/asmjit/src/asmjit/core/logger.cpp +69 -0
- data/ext/asmjit/asmjit/src/asmjit/core/logger.h +198 -0
- data/ext/asmjit/asmjit/src/asmjit/core/misc_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/core/operand.cpp +132 -0
- data/ext/asmjit/asmjit/src/asmjit/core/operand.h +1611 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils.cpp +84 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils.h +61 -0
- data/ext/asmjit/asmjit/src/asmjit/core/osutils_p.h +68 -0
- data/ext/asmjit/asmjit/src/asmjit/core/raassignment_p.h +418 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rabuilders_p.h +612 -0
- data/ext/asmjit/asmjit/src/asmjit/core/radefs_p.h +1204 -0
- data/ext/asmjit/asmjit/src/asmjit/core/ralocal.cpp +1166 -0
- data/ext/asmjit/asmjit/src/asmjit/core/ralocal_p.h +254 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rapass.cpp +1969 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rapass_p.h +1183 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rastack.cpp +184 -0
- data/ext/asmjit/asmjit/src/asmjit/core/rastack_p.h +171 -0
- data/ext/asmjit/asmjit/src/asmjit/core/string.cpp +559 -0
- data/ext/asmjit/asmjit/src/asmjit/core/string.h +372 -0
- data/ext/asmjit/asmjit/src/asmjit/core/support.cpp +494 -0
- data/ext/asmjit/asmjit/src/asmjit/core/support.h +1773 -0
- data/ext/asmjit/asmjit/src/asmjit/core/target.cpp +14 -0
- data/ext/asmjit/asmjit/src/asmjit/core/target.h +53 -0
- data/ext/asmjit/asmjit/src/asmjit/core/type.cpp +74 -0
- data/ext/asmjit/asmjit/src/asmjit/core/type.h +419 -0
- data/ext/asmjit/asmjit/src/asmjit/core/virtmem.cpp +722 -0
- data/ext/asmjit/asmjit/src/asmjit/core/virtmem.h +242 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zone.cpp +353 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zone.h +615 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonehash.cpp +309 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonehash.h +186 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonelist.cpp +163 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonelist.h +209 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestack.cpp +176 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestack.h +239 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonestring.h +120 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonetree.cpp +99 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonetree.h +380 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonevector.cpp +356 -0
- data/ext/asmjit/asmjit/src/asmjit/core/zonevector.h +690 -0
- data/ext/asmjit/asmjit/src/asmjit/core.h +1861 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86archtraits_p.h +148 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.cpp +5110 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86assembler.h +685 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.cpp +52 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86builder.h +351 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.cpp +61 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86compiler.h +721 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper.cpp +619 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emithelper_p.h +60 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86emitter.h +4315 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter.cpp +944 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86formatter_p.h +58 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86func.cpp +503 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86func_p.h +33 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86globals.h +2169 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi.cpp +1732 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instapi_p.h +41 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.cpp +4427 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb.h +563 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86instdb_p.h +311 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86opcode_p.h +436 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.cpp +231 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86operand.h +1085 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass.cpp +1509 -0
- data/ext/asmjit/asmjit/src/asmjit/x86/x86rapass_p.h +94 -0
- data/ext/asmjit/asmjit/src/asmjit/x86.h +93 -0
- data/ext/asmjit/asmjit/src/asmjit.natvis +245 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler.cpp +84 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler.h +85 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_a64.cpp +4006 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_x64.cpp +17833 -0
- data/ext/asmjit/asmjit/test/asmjit_test_assembler_x86.cpp +8300 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler.cpp +253 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler.h +73 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler_a64.cpp +690 -0
- data/ext/asmjit/asmjit/test/asmjit_test_compiler_x86.cpp +4317 -0
- data/ext/asmjit/asmjit/test/asmjit_test_emitters.cpp +197 -0
- data/ext/asmjit/asmjit/test/asmjit_test_instinfo.cpp +181 -0
- data/ext/asmjit/asmjit/test/asmjit_test_misc.h +257 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf.cpp +62 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf.h +61 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf_a64.cpp +699 -0
- data/ext/asmjit/asmjit/test/asmjit_test_perf_x86.cpp +5032 -0
- data/ext/asmjit/asmjit/test/asmjit_test_unit.cpp +172 -0
- data/ext/asmjit/asmjit/test/asmjit_test_x86_sections.cpp +172 -0
- data/ext/asmjit/asmjit/test/asmjitutils.h +38 -0
- data/ext/asmjit/asmjit/test/broken.cpp +312 -0
- data/ext/asmjit/asmjit/test/broken.h +148 -0
- data/ext/asmjit/asmjit/test/cmdline.h +61 -0
- data/ext/asmjit/asmjit/test/performancetimer.h +41 -0
- data/ext/asmjit/asmjit/tools/configure-makefiles.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-ninja.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-sanitizers.sh +13 -0
- data/ext/asmjit/asmjit/tools/configure-vs2019-x64.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2019-x86.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2022-x64.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-vs2022-x86.bat +2 -0
- data/ext/asmjit/asmjit/tools/configure-xcode.sh +8 -0
- data/ext/asmjit/asmjit/tools/enumgen.js +417 -0
- data/ext/asmjit/asmjit/tools/enumgen.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen-arm.js +365 -0
- data/ext/asmjit/asmjit/tools/tablegen-arm.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen-x86.js +2638 -0
- data/ext/asmjit/asmjit/tools/tablegen-x86.sh +3 -0
- data/ext/asmjit/asmjit/tools/tablegen.js +947 -0
- data/ext/asmjit/asmjit/tools/tablegen.sh +4 -0
- data/ext/asmjit/asmjit.cc +18 -0
- data/lib/asmjit/version.rb +1 -1
- metadata +197 -2
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
|
2
|
+
|
|
3
|
+
cmake_policy(PUSH)
|
|
4
|
+
|
|
5
|
+
if(POLICY CMP0063)
|
|
6
|
+
cmake_policy(SET CMP0063 NEW) # Honor visibility properties.
|
|
7
|
+
endif()
|
|
8
|
+
|
|
9
|
+
if(POLICY CMP0092)
|
|
10
|
+
cmake_policy(SET CMP0092 NEW) # Don't add -W3 warning level by default.
|
|
11
|
+
endif()
|
|
12
|
+
|
|
13
|
+
# Don't create a project if it was already created by another CMakeLists.txt.
|
|
14
|
+
# This allows one library to embed another library without making a collision.
|
|
15
|
+
if (NOT CMAKE_PROJECT_NAME OR "${CMAKE_PROJECT_NAME}" STREQUAL "asmjit")
|
|
16
|
+
project(asmjit CXX)
|
|
17
|
+
endif()
|
|
18
|
+
|
|
19
|
+
include(CheckCXXCompilerFlag)
|
|
20
|
+
include(GNUInstallDirs)
|
|
21
|
+
|
|
22
|
+
# AsmJit - Deprecated
|
|
23
|
+
# ===================
|
|
24
|
+
|
|
25
|
+
if (DEFINED ASMJIT_BUILD_EMBED)
|
|
26
|
+
message(DEPRECATION "ASMJIT_BUILD_EMBED is deprecated, use ASMJIT_EMBED")
|
|
27
|
+
set(ASMJIT_EMBED "${ASMJIT_BUILD_EMBED}")
|
|
28
|
+
endif()
|
|
29
|
+
|
|
30
|
+
if (DEFINED ASMJIT_BUILD_STATIC)
|
|
31
|
+
message(DEPRECATION "ASMJIT_BUILD_STATIC is deprecated, use ASMJIT_STATIC")
|
|
32
|
+
set(ASMJIT_STATIC "${ASMJIT_BUILD_STATIC}")
|
|
33
|
+
endif()
|
|
34
|
+
|
|
35
|
+
# AsmJit - Configuration
|
|
36
|
+
# ======================
|
|
37
|
+
|
|
38
|
+
if (NOT DEFINED ASMJIT_TEST)
|
|
39
|
+
set(ASMJIT_TEST FALSE)
|
|
40
|
+
endif()
|
|
41
|
+
|
|
42
|
+
if (NOT DEFINED ASMJIT_EMBED)
|
|
43
|
+
set(ASMJIT_EMBED FALSE)
|
|
44
|
+
endif()
|
|
45
|
+
|
|
46
|
+
if (NOT DEFINED ASMJIT_STATIC)
|
|
47
|
+
set(ASMJIT_STATIC ${ASMJIT_EMBED})
|
|
48
|
+
endif()
|
|
49
|
+
|
|
50
|
+
if (NOT DEFINED ASMJIT_SANITIZE)
|
|
51
|
+
set(ASMJIT_SANITIZE FALSE)
|
|
52
|
+
endif()
|
|
53
|
+
|
|
54
|
+
if (NOT DEFINED ASMJIT_NO_X86)
|
|
55
|
+
set(ASMJIT_NO_X86 FALSE)
|
|
56
|
+
endif()
|
|
57
|
+
|
|
58
|
+
if (NOT DEFINED ASMJIT_NO_AARCH32)
|
|
59
|
+
set(ASMJIT_NO_AARCH32 FALSE)
|
|
60
|
+
endif()
|
|
61
|
+
|
|
62
|
+
if (NOT DEFINED ASMJIT_NO_AARCH64)
|
|
63
|
+
set(ASMJIT_NO_AARCH64 FALSE)
|
|
64
|
+
endif()
|
|
65
|
+
|
|
66
|
+
if (NOT DEFINED ASMJIT_NO_FOREIGN)
|
|
67
|
+
set(ASMJIT_NO_FOREIGN FALSE)
|
|
68
|
+
endif()
|
|
69
|
+
|
|
70
|
+
if (NOT DEFINED ASMJIT_NO_NATVIS)
|
|
71
|
+
set(ASMJIT_NO_NATVIS FALSE)
|
|
72
|
+
endif()
|
|
73
|
+
|
|
74
|
+
if (NOT DEFINED ASMJIT_NO_CUSTOM_FLAGS)
|
|
75
|
+
set(ASMJIT_NO_CUSTOM_FLAGS FALSE)
|
|
76
|
+
endif()
|
|
77
|
+
|
|
78
|
+
# EMBED implies STATIC.
|
|
79
|
+
if (ASMJIT_EMBED AND NOT ASMJIT_STATIC)
|
|
80
|
+
set(ASMJIT_STATIC TRUE)
|
|
81
|
+
endif()
|
|
82
|
+
|
|
83
|
+
set(ASMJIT_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Location of 'asmjit'")
|
|
84
|
+
set(ASMJIT_TEST "${ASMJIT_TEST}" CACHE BOOL "Build 'asmjit' test applications")
|
|
85
|
+
set(ASMJIT_EMBED "${ASMJIT_EMBED}" CACHE BOOL "Embed 'asmjit' library (no targets)")
|
|
86
|
+
set(ASMJIT_STATIC "${ASMJIT_STATIC}" CACHE BOOL "Build 'asmjit' library as static")
|
|
87
|
+
set(ASMJIT_SANITIZE "${ASMJIT_SANITIZE}" CACHE STRING "Build with sanitizers: 'address', 'undefined', etc...")
|
|
88
|
+
set(ASMJIT_NO_X86 "${ASMJIT_NO_X86}" CACHE BOOL "Disable X86/X64 backend")
|
|
89
|
+
set(ASMJIT_NO_AARCH32 "${ASMJIT_NO_AARCH32}" CACHE BOOL "Disable AArch32 backend (ARM and THUMB)")
|
|
90
|
+
set(ASMJIT_NO_AARCH64 "${ASMJIT_NO_AARCH64}" CACHE BOOL "Disable AArch64 backend")
|
|
91
|
+
set(ASMJIT_NO_FOREIGN "${ASMJIT_NO_FOREIGN}" CACHE BOOL "Disable all foreign architectures (enables only a native architecture)")
|
|
92
|
+
set(ASMJIT_NO_NATVIS "${ASMJIT_NO_NATVIS}" CACHE BOOL "Disable natvis support (embedding asmjit.natvis in PDB)")
|
|
93
|
+
set(ASMJIT_NO_CUSTOM_FLAGS "${ASMJIT_NO_CUSTOM_FLAGS}" CACHE BOOL "Disable extra compilation flags added by AsmJit to its targets")
|
|
94
|
+
|
|
95
|
+
# AsmJit - Project
|
|
96
|
+
# ================
|
|
97
|
+
|
|
98
|
+
set(ASMJIT_INCLUDE_DIRS "${ASMJIT_DIR}/src") # Include directory is the same as source dir.
|
|
99
|
+
set(ASMJIT_DEPS "") # AsmJit dependencies (libraries) for the linker.
|
|
100
|
+
set(ASMJIT_LIBS "") # Dependencies of libs/apps that want to use AsmJit.
|
|
101
|
+
set(ASMJIT_CFLAGS "") # Public compiler flags.
|
|
102
|
+
set(ASMJIT_PRIVATE_CFLAGS "") # Private compiler flags independent of build type.
|
|
103
|
+
set(ASMJIT_PRIVATE_CFLAGS_DBG "") # Private compiler flags used by debug builds.
|
|
104
|
+
set(ASMJIT_PRIVATE_CFLAGS_REL "") # Private compiler flags used by release builds.
|
|
105
|
+
set(ASMJIT_SANITIZE_CFLAGS "") # Compiler flags required by currently enabled sanitizers.
|
|
106
|
+
set(ASMJIT_SANITIZE_LFLAGS "") # Linker flags required by currently enabled sanitizers.
|
|
107
|
+
|
|
108
|
+
# AsmJit - Utilities
|
|
109
|
+
# ==================
|
|
110
|
+
|
|
111
|
+
function(asmjit_detect_cflags out)
|
|
112
|
+
set(out_array ${${out}})
|
|
113
|
+
foreach(flag ${ARGN})
|
|
114
|
+
string(REGEX REPLACE "[+]" "x" flag_signature "${flag}")
|
|
115
|
+
string(REGEX REPLACE "[-=:;/.\]" "_" flag_signature "${flag_signature}")
|
|
116
|
+
check_cxx_compiler_flag(${flag} "__CxxFlag_${flag_signature}")
|
|
117
|
+
if (${__CxxFlag_${flag_signature}})
|
|
118
|
+
list(APPEND out_array "${flag}")
|
|
119
|
+
endif()
|
|
120
|
+
endforeach()
|
|
121
|
+
set(${out} "${out_array}" PARENT_SCOPE)
|
|
122
|
+
endfunction()
|
|
123
|
+
|
|
124
|
+
# Support for various sanitizers provided by C/C++ compilers.
|
|
125
|
+
function(asmjit_detect_sanitizers out)
|
|
126
|
+
set(_out_array ${${out}})
|
|
127
|
+
set(_flags "")
|
|
128
|
+
|
|
129
|
+
foreach(_arg ${ARGN})
|
|
130
|
+
string(REPLACE "," ";" _arg "${_arg}")
|
|
131
|
+
list(APPEND _flags ${_arg})
|
|
132
|
+
endforeach()
|
|
133
|
+
|
|
134
|
+
foreach(_flag ${_flags})
|
|
135
|
+
if (NOT "${_flag}" MATCHES "^-fsanitize=")
|
|
136
|
+
SET(_flag "-fsanitize=${_flag}")
|
|
137
|
+
endif()
|
|
138
|
+
|
|
139
|
+
# Sanitizers also require link flags, see CMAKE_REQUIRED_FLAGS.
|
|
140
|
+
set(CMAKE_REQUIRED_FLAGS "${_flag}")
|
|
141
|
+
asmjit_detect_cflags(_out_array ${_flag})
|
|
142
|
+
unset(CMAKE_REQUIRED_FLAGS)
|
|
143
|
+
endforeach()
|
|
144
|
+
|
|
145
|
+
set(${out} "${_out_array}" PARENT_SCOPE)
|
|
146
|
+
endfunction()
|
|
147
|
+
|
|
148
|
+
function(asmjit_add_target target target_type)
|
|
149
|
+
set(single_val "")
|
|
150
|
+
set(multi_val SOURCES LIBRARIES CFLAGS CFLAGS_DBG CFLAGS_REL)
|
|
151
|
+
cmake_parse_arguments("X" "" "${single_val}" "${multi_val}" ${ARGN})
|
|
152
|
+
|
|
153
|
+
if ("${target_type}" MATCHES "^(EXECUTABLE|TEST)$")
|
|
154
|
+
add_executable(${target} ${X_SOURCES})
|
|
155
|
+
else()
|
|
156
|
+
add_library(${target} ${target_type} ${X_SOURCES})
|
|
157
|
+
endif()
|
|
158
|
+
|
|
159
|
+
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL "")
|
|
160
|
+
target_link_libraries(${target} PRIVATE ${X_LIBRARIES})
|
|
161
|
+
|
|
162
|
+
# target_link_options was added in cmake v3.13, don't use it for now...
|
|
163
|
+
foreach(link_flag ${ASMJIT_SANITIZE_LFLAGS})
|
|
164
|
+
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${link_flag}")
|
|
165
|
+
endforeach()
|
|
166
|
+
|
|
167
|
+
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
|
168
|
+
set_property(TARGET ${target} PROPERTY CXX_STANDARD 11)
|
|
169
|
+
else()
|
|
170
|
+
target_compile_features(${target} PUBLIC cxx_std_11)
|
|
171
|
+
endif()
|
|
172
|
+
set_property(TARGET ${target} PROPERTY CXX_EXTENSIONS NO)
|
|
173
|
+
set_property(TARGET ${target} PROPERTY CXX_VISIBILITY_PRESET hidden)
|
|
174
|
+
target_compile_options(${target} PRIVATE ${X_CFLAGS} ${ASMJIT_SANITIZE_CFLAGS} $<$<CONFIG:Debug>:${X_CFLAGS_DBG}> $<$<NOT:$<CONFIG:Debug>>:${X_CFLAGS_REL}>)
|
|
175
|
+
|
|
176
|
+
if ("${target_type}" STREQUAL "TEST")
|
|
177
|
+
add_test(NAME ${target} COMMAND ${target})
|
|
178
|
+
endif()
|
|
179
|
+
endfunction()
|
|
180
|
+
|
|
181
|
+
# AsmJit - Compiler Support
|
|
182
|
+
# =========================
|
|
183
|
+
|
|
184
|
+
set(ASMJIT_INCLUDE_DIRS "${ASMJIT_DIR}/src") # Include directory is the same as source dir.
|
|
185
|
+
set(ASMJIT_DEPS "") # AsmJit dependencies (libraries) for the linker.
|
|
186
|
+
set(ASMJIT_LIBS "") # Dependencies of libs/apps that want to use AsmJit.
|
|
187
|
+
set(ASMJIT_CFLAGS "") # Public compiler flags.
|
|
188
|
+
set(ASMJIT_PRIVATE_CFLAGS "") # Private compiler flags independent of build type.
|
|
189
|
+
set(ASMJIT_PRIVATE_CFLAGS_DBG "") # Private compiler flags used by debug builds.
|
|
190
|
+
set(ASMJIT_PRIVATE_CFLAGS_REL "") # Private compiler flags used by release builds.
|
|
191
|
+
set(ASMJIT_SANITIZE_CFLAGS "") # Compiler flags required by currently enabled sanitizers.
|
|
192
|
+
set(ASMJIT_SANITIZE_LFLAGS "") # Linker flags required by currently enabled sanitizers.
|
|
193
|
+
|
|
194
|
+
# We will have to keep this most likely forever as some users may still be using it.
|
|
195
|
+
set(ASMJIT_INCLUDE_DIR "${ASMJIT_INCLUDE_DIRS}")
|
|
196
|
+
|
|
197
|
+
if (NOT ASMJIT_NO_CUSTOM_FLAGS)
|
|
198
|
+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
|
|
199
|
+
list(APPEND ASMJIT_PRIVATE_CFLAGS
|
|
200
|
+
-MP # [+] Multi-Process Compilation.
|
|
201
|
+
-GF # [+] Eliminate duplicate strings.
|
|
202
|
+
-Zc:__cplusplus # [+] Conforming __cplusplus definition.
|
|
203
|
+
-Zc:inline # [+] Remove unreferenced COMDAT.
|
|
204
|
+
-Zc:strictStrings # [+] Strict const qualification of string literals.
|
|
205
|
+
-Zc:threadSafeInit- # [-] Thread-safe statics.
|
|
206
|
+
-W4) # [+] Warning level 4.
|
|
207
|
+
|
|
208
|
+
list(APPEND ASMJIT_PRIVATE_CFLAGS_DBG
|
|
209
|
+
-GS) # [+] Buffer security-check.
|
|
210
|
+
|
|
211
|
+
list(APPEND ASMJIT_PRIVATE_CFLAGS_REL
|
|
212
|
+
-GS- # [-] Buffer security-check.
|
|
213
|
+
-O2 # [+] Favor speed over size.
|
|
214
|
+
-Oi) # [+] Generate intrinsic functions.
|
|
215
|
+
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(GNU|Clang|AppleClang)$")
|
|
216
|
+
list(APPEND ASMJIT_PRIVATE_CFLAGS -Wall -Wextra -Wconversion)
|
|
217
|
+
list(APPEND ASMJIT_PRIVATE_CFLAGS -fno-math-errno)
|
|
218
|
+
list(APPEND ASMJIT_PRIVATE_CFLAGS_REL -O2)
|
|
219
|
+
|
|
220
|
+
asmjit_detect_cflags(ASMJIT_PRIVATE_CFLAGS
|
|
221
|
+
-fno-threadsafe-statics
|
|
222
|
+
-fno-semantic-interposition)
|
|
223
|
+
|
|
224
|
+
# The following flags can save few bytes in the resulting binary.
|
|
225
|
+
asmjit_detect_cflags(ASMJIT_PRIVATE_CFLAGS_REL
|
|
226
|
+
-fmerge-all-constants # Merge all constants even if it violates ISO C++.
|
|
227
|
+
-fno-enforce-eh-specs) # Don't enforce termination if noexcept function throws.
|
|
228
|
+
endif()
|
|
229
|
+
endif()
|
|
230
|
+
|
|
231
|
+
# Support for sanitizers.
|
|
232
|
+
if (ASMJIT_SANITIZE)
|
|
233
|
+
ASMJIT_detect_sanitizers(ASMJIT_SANITIZE_CFLAGS ${ASMJIT_SANITIZE})
|
|
234
|
+
if (ASMJIT_SANITIZE_CFLAGS)
|
|
235
|
+
message("-- Enabling sanitizers: '${ASMJIT_SANITIZE_CFLAGS}'")
|
|
236
|
+
|
|
237
|
+
# Linker must receive the same flags as the compiler when it comes to sanitizers.
|
|
238
|
+
set(ASMJIT_SANITIZE_LFLAGS ${ASMJIT_SANITIZE_CFLAGS})
|
|
239
|
+
|
|
240
|
+
# Don't omit frame pointer if sanitizers are enabled.
|
|
241
|
+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
|
|
242
|
+
list(APPEND ASMJIT_SANITIZE_CFLAGS -Oy-)
|
|
243
|
+
else()
|
|
244
|
+
list(APPEND ASMJIT_SANITIZE_CFLAGS -fno-omit-frame-pointer -g)
|
|
245
|
+
endif()
|
|
246
|
+
|
|
247
|
+
list(APPEND ASMJIT_PRIVATE_CFLAGS ${ASMJIT_SANITIZE_CFLAGS})
|
|
248
|
+
list(APPEND ASMJIT_PRIVATE_LFLAGS ${ASMJIT_SANITIZE_LFLAGS})
|
|
249
|
+
endif()
|
|
250
|
+
endif()
|
|
251
|
+
|
|
252
|
+
# Do not link to pthread on Android as it's part of C runtime.
|
|
253
|
+
if (NOT WIN32 AND NOT ANDROID)
|
|
254
|
+
list(APPEND ASMJIT_DEPS pthread)
|
|
255
|
+
endif()
|
|
256
|
+
|
|
257
|
+
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" OR "${CMAKE_SYSTEM_NAME}" MATCHES "NetBSD")
|
|
258
|
+
list(APPEND ASMJIT_DEPS rt)
|
|
259
|
+
endif()
|
|
260
|
+
|
|
261
|
+
set(ASMJIT_LIBS ${ASMJIT_DEPS})
|
|
262
|
+
if (NOT ASMJIT_EMBED)
|
|
263
|
+
list(INSERT ASMJIT_LIBS 0 asmjit)
|
|
264
|
+
endif()
|
|
265
|
+
|
|
266
|
+
if (ASMJIT_EMBED)
|
|
267
|
+
set(ASMJIT_TARGET_TYPE "EMBED")
|
|
268
|
+
elseif (ASMJIT_STATIC)
|
|
269
|
+
set(ASMJIT_TARGET_TYPE "STATIC")
|
|
270
|
+
else()
|
|
271
|
+
set(ASMJIT_TARGET_TYPE "SHARED")
|
|
272
|
+
endif()
|
|
273
|
+
|
|
274
|
+
foreach(build_option ASMJIT_STATIC
|
|
275
|
+
# AsmJit backends selection.
|
|
276
|
+
ASMJIT_NO_X86
|
|
277
|
+
ASMJIT_NO_AARCH32
|
|
278
|
+
ASMJIT_NO_AARCH64
|
|
279
|
+
ASMJIT_NO_FOREIGN
|
|
280
|
+
# AsmJit features selection.
|
|
281
|
+
ASMJIT_NO_DEPRECATED
|
|
282
|
+
ASMJIT_NO_JIT
|
|
283
|
+
ASMJIT_NO_LOGGING
|
|
284
|
+
ASMJIT_NO_BUILDER
|
|
285
|
+
ASMJIT_NO_COMPILER
|
|
286
|
+
ASMJIT_NO_TEXT
|
|
287
|
+
ASMJIT_NO_VALIDATION
|
|
288
|
+
ASMJIT_NO_INTROSPECTION)
|
|
289
|
+
if (${build_option})
|
|
290
|
+
List(APPEND ASMJIT_CFLAGS "-D${build_option}")
|
|
291
|
+
List(APPEND ASMJIT_PRIVATE_CFLAGS "-D${build_option}")
|
|
292
|
+
endif()
|
|
293
|
+
endforeach()
|
|
294
|
+
|
|
295
|
+
# AsmJit - Linker Support
|
|
296
|
+
# =======================
|
|
297
|
+
|
|
298
|
+
if (WIN32)
|
|
299
|
+
if(CMAKE_LINKER MATCHES "link\\.exe" OR CMAKE_LINKER MATCHES "lld-link\\.exe")
|
|
300
|
+
set(ASMJIT_LINKER_SUPPORTS_NATVIS TRUE)
|
|
301
|
+
endif()
|
|
302
|
+
endif()
|
|
303
|
+
|
|
304
|
+
# AsmJit - Source
|
|
305
|
+
# ===============
|
|
306
|
+
|
|
307
|
+
set(ASMJIT_SRC_LIST
|
|
308
|
+
asmjit/asmjit.h
|
|
309
|
+
asmjit/asmjit-scope-begin.h
|
|
310
|
+
asmjit/asmjit-scope-end.h
|
|
311
|
+
|
|
312
|
+
asmjit/core.h
|
|
313
|
+
asmjit/core/api-build_p.h
|
|
314
|
+
asmjit/core/api-config.h
|
|
315
|
+
asmjit/core/archtraits.cpp
|
|
316
|
+
asmjit/core/archtraits.h
|
|
317
|
+
asmjit/core/archcommons.h
|
|
318
|
+
asmjit/core/assembler.cpp
|
|
319
|
+
asmjit/core/assembler.h
|
|
320
|
+
asmjit/core/builder.cpp
|
|
321
|
+
asmjit/core/builder.h
|
|
322
|
+
asmjit/core/codebuffer.h
|
|
323
|
+
asmjit/core/codeholder.cpp
|
|
324
|
+
asmjit/core/codeholder.h
|
|
325
|
+
asmjit/core/codewriter.cpp
|
|
326
|
+
asmjit/core/codewriter_p.h
|
|
327
|
+
asmjit/core/compiler.cpp
|
|
328
|
+
asmjit/core/compiler.h
|
|
329
|
+
asmjit/core/compilerdefs.h
|
|
330
|
+
asmjit/core/constpool.cpp
|
|
331
|
+
asmjit/core/constpool.h
|
|
332
|
+
asmjit/core/cpuinfo.cpp
|
|
333
|
+
asmjit/core/cpuinfo.h
|
|
334
|
+
asmjit/core/emithelper.cpp
|
|
335
|
+
asmjit/core/emithelper_p.h
|
|
336
|
+
asmjit/core/emitter.cpp
|
|
337
|
+
asmjit/core/emitter.h
|
|
338
|
+
asmjit/core/emitterutils.cpp
|
|
339
|
+
asmjit/core/emitterutils_p.h
|
|
340
|
+
asmjit/core/environment.cpp
|
|
341
|
+
asmjit/core/environment.h
|
|
342
|
+
asmjit/core/errorhandler.cpp
|
|
343
|
+
asmjit/core/errorhandler.h
|
|
344
|
+
asmjit/core/formatter.cpp
|
|
345
|
+
asmjit/core/formatter.h
|
|
346
|
+
asmjit/core/func.cpp
|
|
347
|
+
asmjit/core/func.h
|
|
348
|
+
asmjit/core/funcargscontext.cpp
|
|
349
|
+
asmjit/core/funcargscontext_p.h
|
|
350
|
+
asmjit/core/globals.cpp
|
|
351
|
+
asmjit/core/globals.h
|
|
352
|
+
asmjit/core/inst.cpp
|
|
353
|
+
asmjit/core/inst.h
|
|
354
|
+
asmjit/core/jitallocator.cpp
|
|
355
|
+
asmjit/core/jitallocator.h
|
|
356
|
+
asmjit/core/jitruntime.cpp
|
|
357
|
+
asmjit/core/jitruntime.h
|
|
358
|
+
asmjit/core/logger.cpp
|
|
359
|
+
asmjit/core/logger.h
|
|
360
|
+
asmjit/core/misc_p.h
|
|
361
|
+
asmjit/core/operand.cpp
|
|
362
|
+
asmjit/core/operand.h
|
|
363
|
+
asmjit/core/osutils.cpp
|
|
364
|
+
asmjit/core/osutils.h
|
|
365
|
+
asmjit/core/raassignment_p.h
|
|
366
|
+
asmjit/core/rabuilders_p.h
|
|
367
|
+
asmjit/core/radefs_p.h
|
|
368
|
+
asmjit/core/ralocal.cpp
|
|
369
|
+
asmjit/core/ralocal_p.h
|
|
370
|
+
asmjit/core/rapass.cpp
|
|
371
|
+
asmjit/core/rapass_p.h
|
|
372
|
+
asmjit/core/rastack.cpp
|
|
373
|
+
asmjit/core/rastack_p.h
|
|
374
|
+
asmjit/core/string.cpp
|
|
375
|
+
asmjit/core/string.h
|
|
376
|
+
asmjit/core/support.cpp
|
|
377
|
+
asmjit/core/support.h
|
|
378
|
+
asmjit/core/target.cpp
|
|
379
|
+
asmjit/core/target.h
|
|
380
|
+
asmjit/core/type.cpp
|
|
381
|
+
asmjit/core/type.h
|
|
382
|
+
asmjit/core/virtmem.cpp
|
|
383
|
+
asmjit/core/virtmem.h
|
|
384
|
+
asmjit/core/zone.cpp
|
|
385
|
+
asmjit/core/zone.h
|
|
386
|
+
asmjit/core/zonehash.cpp
|
|
387
|
+
asmjit/core/zonehash.h
|
|
388
|
+
asmjit/core/zonelist.cpp
|
|
389
|
+
asmjit/core/zonelist.h
|
|
390
|
+
asmjit/core/zonestack.cpp
|
|
391
|
+
asmjit/core/zonestack.h
|
|
392
|
+
asmjit/core/zonestring.h
|
|
393
|
+
asmjit/core/zonetree.cpp
|
|
394
|
+
asmjit/core/zonetree.h
|
|
395
|
+
asmjit/core/zonevector.cpp
|
|
396
|
+
asmjit/core/zonevector.h
|
|
397
|
+
|
|
398
|
+
asmjit/arm.h
|
|
399
|
+
asmjit/arm/armformatter.cpp
|
|
400
|
+
asmjit/arm/armformatter_p.h
|
|
401
|
+
asmjit/arm/armglobals.h
|
|
402
|
+
asmjit/arm/armoperand.h
|
|
403
|
+
asmjit/arm/a64archtraits_p.h
|
|
404
|
+
asmjit/arm/a64assembler.cpp
|
|
405
|
+
asmjit/arm/a64assembler.h
|
|
406
|
+
asmjit/arm/a64builder.cpp
|
|
407
|
+
asmjit/arm/a64builder.h
|
|
408
|
+
asmjit/arm/a64compiler.cpp
|
|
409
|
+
asmjit/arm/a64compiler.h
|
|
410
|
+
asmjit/arm/a64emithelper.cpp
|
|
411
|
+
asmjit/arm/a64emithelper_p.h
|
|
412
|
+
asmjit/arm/a64emitter.h
|
|
413
|
+
asmjit/arm/a64formatter.cpp
|
|
414
|
+
asmjit/arm/a64formatter_p.h
|
|
415
|
+
asmjit/arm/a64func.cpp
|
|
416
|
+
asmjit/arm/a64func_p.h
|
|
417
|
+
asmjit/arm/a64globals.h
|
|
418
|
+
asmjit/arm/a64instapi.cpp
|
|
419
|
+
asmjit/arm/a64instapi_p.h
|
|
420
|
+
asmjit/arm/a64instdb.cpp
|
|
421
|
+
asmjit/arm/a64instdb.h
|
|
422
|
+
asmjit/arm/a64operand.cpp
|
|
423
|
+
asmjit/arm/a64operand.h
|
|
424
|
+
asmjit/arm/a64rapass.cpp
|
|
425
|
+
asmjit/arm/a64rapass_p.h
|
|
426
|
+
asmjit/arm/a64utils.h
|
|
427
|
+
|
|
428
|
+
asmjit/x86.h
|
|
429
|
+
asmjit/x86/x86archtraits_p.h
|
|
430
|
+
asmjit/x86/x86assembler.cpp
|
|
431
|
+
asmjit/x86/x86assembler.h
|
|
432
|
+
asmjit/x86/x86builder.cpp
|
|
433
|
+
asmjit/x86/x86builder.h
|
|
434
|
+
asmjit/x86/x86compiler.cpp
|
|
435
|
+
asmjit/x86/x86compiler.h
|
|
436
|
+
asmjit/x86/x86emithelper.cpp
|
|
437
|
+
asmjit/x86/x86emithelper_p.h
|
|
438
|
+
asmjit/x86/x86emitter.h
|
|
439
|
+
asmjit/x86/x86formatter.cpp
|
|
440
|
+
asmjit/x86/x86formatter_p.h
|
|
441
|
+
asmjit/x86/x86func.cpp
|
|
442
|
+
asmjit/x86/x86func_p.h
|
|
443
|
+
asmjit/x86/x86globals.h
|
|
444
|
+
asmjit/x86/x86instdb.cpp
|
|
445
|
+
asmjit/x86/x86instdb.h
|
|
446
|
+
asmjit/x86/x86instdb_p.h
|
|
447
|
+
asmjit/x86/x86instapi.cpp
|
|
448
|
+
asmjit/x86/x86instapi_p.h
|
|
449
|
+
asmjit/x86/x86operand.cpp
|
|
450
|
+
asmjit/x86/x86operand.h
|
|
451
|
+
asmjit/x86/x86rapass.cpp
|
|
452
|
+
asmjit/x86/x86rapass_p.h
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
if (MSVC AND NOT ASMJIT_NO_NATVIS)
|
|
456
|
+
list(APPEND ASMJIT_SRC_LIST asmjit.natvis)
|
|
457
|
+
endif()
|
|
458
|
+
|
|
459
|
+
set(ASMJIT_SRC "")
|
|
460
|
+
foreach(src_file ${ASMJIT_SRC_LIST})
|
|
461
|
+
set(src_file "${ASMJIT_DIR}/src/${src_file}")
|
|
462
|
+
list(APPEND ASMJIT_SRC ${src_file})
|
|
463
|
+
|
|
464
|
+
if ("${src_file}" MATCHES "\\.natvis")
|
|
465
|
+
if (ASMJIT_LINKER_SUPPORTS_NATVIS)
|
|
466
|
+
list(APPEND ASMJIT_PRIVATE_LFLAGS "-natvis:${src_file}")
|
|
467
|
+
endif()
|
|
468
|
+
endif()
|
|
469
|
+
endforeach()
|
|
470
|
+
|
|
471
|
+
if (NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
|
472
|
+
source_group(TREE "${ASMJIT_DIR}" FILES ${ASMJIT_SRC})
|
|
473
|
+
endif()
|
|
474
|
+
|
|
475
|
+
# AsmJit - Summary
|
|
476
|
+
# ================
|
|
477
|
+
|
|
478
|
+
message("** AsmJit Summary **")
|
|
479
|
+
message(" ASMJIT_DIR=${ASMJIT_DIR}")
|
|
480
|
+
message(" ASMJIT_TEST=${ASMJIT_TEST}")
|
|
481
|
+
message(" ASMJIT_TARGET_TYPE=${ASMJIT_TARGET_TYPE}")
|
|
482
|
+
message(" ASMJIT_DEPS=${ASMJIT_DEPS}")
|
|
483
|
+
message(" ASMJIT_LIBS=${ASMJIT_LIBS}")
|
|
484
|
+
message(" ASMJIT_CFLAGS=${ASMJIT_CFLAGS}")
|
|
485
|
+
message(" ASMJIT_PRIVATE_CFLAGS=${ASMJIT_PRIVATE_CFLAGS}")
|
|
486
|
+
message(" ASMJIT_PRIVATE_CFLAGS_DBG=${ASMJIT_PRIVATE_CFLAGS_DBG}")
|
|
487
|
+
message(" ASMJIT_PRIVATE_CFLAGS_REL=${ASMJIT_PRIVATE_CFLAGS_REL}")
|
|
488
|
+
|
|
489
|
+
# AsmJit - Targets
|
|
490
|
+
# ================
|
|
491
|
+
|
|
492
|
+
if (NOT ASMJIT_EMBED)
|
|
493
|
+
# Add AsmJit target.
|
|
494
|
+
asmjit_add_target(asmjit "${ASMJIT_TARGET_TYPE}"
|
|
495
|
+
SOURCES ${ASMJIT_SRC}
|
|
496
|
+
LIBRARIES ${ASMJIT_DEPS}
|
|
497
|
+
CFLAGS ${ASMJIT_PRIVATE_CFLAGS}
|
|
498
|
+
CFLAGS_DBG ${ASMJIT_PRIVATE_CFLAGS_DBG}
|
|
499
|
+
CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL})
|
|
500
|
+
|
|
501
|
+
target_compile_options(asmjit INTERFACE ${ASMJIT_CFLAGS})
|
|
502
|
+
target_include_directories(asmjit BEFORE INTERFACE
|
|
503
|
+
$<BUILD_INTERFACE:${ASMJIT_INCLUDE_DIRS}>
|
|
504
|
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
505
|
+
|
|
506
|
+
# Add blend2d::blend2d alias.
|
|
507
|
+
add_library(asmjit::asmjit ALIAS asmjit)
|
|
508
|
+
# TODO: [CMAKE] Deprecated alias - we use projectname::libraryname convention now.
|
|
509
|
+
add_library(AsmJit::AsmJit ALIAS asmjit)
|
|
510
|
+
|
|
511
|
+
# Add AsmJit install instructions (library and public headers).
|
|
512
|
+
if (NOT ASMJIT_NO_INSTALL)
|
|
513
|
+
install(TARGETS asmjit
|
|
514
|
+
EXPORT asmjit-config
|
|
515
|
+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
516
|
+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
517
|
+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
518
|
+
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
519
|
+
install(EXPORT asmjit-config
|
|
520
|
+
NAMESPACE asmjit::
|
|
521
|
+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/asmjit")
|
|
522
|
+
|
|
523
|
+
foreach(_src_file ${ASMJIT_SRC_LIST})
|
|
524
|
+
if ("${_src_file}" MATCHES "\\.h$" AND NOT "${_src_file}" MATCHES "_p\\.h$")
|
|
525
|
+
get_filename_component(_src_dir ${_src_file} PATH)
|
|
526
|
+
install(FILES "${ASMJIT_DIR}/src/${_src_file}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_src_dir}")
|
|
527
|
+
endif()
|
|
528
|
+
endforeach()
|
|
529
|
+
endif()
|
|
530
|
+
|
|
531
|
+
# Add AsmJit tests.
|
|
532
|
+
if (ASMJIT_TEST)
|
|
533
|
+
enable_testing()
|
|
534
|
+
|
|
535
|
+
# Special target that always uses embedded AsmJit.
|
|
536
|
+
asmjit_add_target(asmjit_test_unit TEST
|
|
537
|
+
SOURCES ${ASMJIT_SRC}
|
|
538
|
+
test/asmjit_test_unit.cpp
|
|
539
|
+
test/broken.cpp
|
|
540
|
+
test/broken.h
|
|
541
|
+
LIBRARIES ${ASMJIT_DEPS}
|
|
542
|
+
CFLAGS ${ASMJIT_PRIVATE_CFLAGS}
|
|
543
|
+
-DASMJIT_TEST
|
|
544
|
+
-DASMJIT_STATIC
|
|
545
|
+
CFLAGS_DBG ${ASMJIT_PRIVATE_CFLAGS_DBG}
|
|
546
|
+
CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL})
|
|
547
|
+
target_include_directories(asmjit_test_unit BEFORE PRIVATE ${ASMJIT_INCLUDE_DIRS})
|
|
548
|
+
|
|
549
|
+
asmjit_add_target(asmjit_test_assembler TEST
|
|
550
|
+
SOURCES test/asmjit_test_assembler.cpp
|
|
551
|
+
test/asmjit_test_assembler.h
|
|
552
|
+
test/asmjit_test_assembler_a64.cpp
|
|
553
|
+
test/asmjit_test_assembler_x64.cpp
|
|
554
|
+
test/asmjit_test_assembler_x86.cpp
|
|
555
|
+
LIBRARIES asmjit::asmjit
|
|
556
|
+
CFLAGS ${ASMJIT_PRIVATE_CFLAGS}
|
|
557
|
+
CFLAGS_DBG ${ASMJIT_PRIVATE_CFLAGS_DBG}
|
|
558
|
+
CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL})
|
|
559
|
+
|
|
560
|
+
asmjit_add_target(asmjit_test_perf EXECUTABLE
|
|
561
|
+
SOURCES test/asmjit_test_perf.cpp
|
|
562
|
+
test/asmjit_test_perf_a64.cpp
|
|
563
|
+
test/asmjit_test_perf_x86.cpp
|
|
564
|
+
SOURCES test/asmjit_test_perf.h
|
|
565
|
+
LIBRARIES asmjit::asmjit
|
|
566
|
+
CFLAGS ${ASMJIT_PRIVATE_CFLAGS}
|
|
567
|
+
CFLAGS_DBG ${ASMJIT_PRIVATE_CFLAGS_DBG}
|
|
568
|
+
CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL})
|
|
569
|
+
|
|
570
|
+
foreach(_target asmjit_test_emitters
|
|
571
|
+
asmjit_test_x86_sections)
|
|
572
|
+
asmjit_add_target(${_target} TEST
|
|
573
|
+
SOURCES test/${_target}.cpp
|
|
574
|
+
LIBRARIES asmjit::asmjit
|
|
575
|
+
CFLAGS ${ASMJIT_PRIVATE_CFLAGS}
|
|
576
|
+
CFLAGS_DBG ${ASMJIT_PRIVATE_CFLAGS_DBG}
|
|
577
|
+
CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL})
|
|
578
|
+
endforeach()
|
|
579
|
+
|
|
580
|
+
if (NOT ASMJIT_NO_INTROSPECTION)
|
|
581
|
+
asmjit_add_target(asmjit_test_instinfo TEST
|
|
582
|
+
SOURCES test/asmjit_test_instinfo.cpp
|
|
583
|
+
LIBRARIES asmjit::asmjit
|
|
584
|
+
CFLAGS ${ASMJIT_PRIVATE_CFLAGS}
|
|
585
|
+
CFLAGS_DBG ${ASMJIT_PRIVATE_CFLAGS_DBG}
|
|
586
|
+
CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL})
|
|
587
|
+
endif()
|
|
588
|
+
|
|
589
|
+
if (NOT (ASMJIT_NO_BUILDER OR ASMJIT_NO_COMPILER))
|
|
590
|
+
# Vectorcall tests and XMM tests require at least SSE2 in 32-bit mode (in 64-bit mode it's implicit).
|
|
591
|
+
set(sse2_flags "")
|
|
592
|
+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
|
|
593
|
+
asmjit_detect_cflags(sse2_flags "-arch:SSE2")
|
|
594
|
+
else()
|
|
595
|
+
asmjit_detect_cflags(sse2_flags "-msse2")
|
|
596
|
+
endif()
|
|
597
|
+
asmjit_add_target(asmjit_test_compiler TEST
|
|
598
|
+
SOURCES test/asmjit_test_compiler.cpp
|
|
599
|
+
test/asmjit_test_compiler.h
|
|
600
|
+
test/asmjit_test_compiler_a64.cpp
|
|
601
|
+
test/asmjit_test_compiler_x86.cpp
|
|
602
|
+
LIBRARIES asmjit::asmjit
|
|
603
|
+
CFLAGS ${ASMJIT_PRIVATE_CFLAGS} ${sse2_flags}
|
|
604
|
+
CFLAGS_DBG ${ASMJIT_PRIVATE_CFLAGS_DBG}
|
|
605
|
+
CFLAGS_REL ${ASMJIT_PRIVATE_CFLAGS_REL})
|
|
606
|
+
endif()
|
|
607
|
+
|
|
608
|
+
endif()
|
|
609
|
+
endif()
|
|
610
|
+
|
|
611
|
+
cmake_policy(POP)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Copyright (c) 2008-2020 The AsmJit Authors
|
|
2
|
+
|
|
3
|
+
This software is provided 'as-is', without any express or implied
|
|
4
|
+
warranty. In no event will the authors be held liable for any damages
|
|
5
|
+
arising from the use of this software.
|
|
6
|
+
|
|
7
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
8
|
+
including commercial applications, and to alter it and redistribute it
|
|
9
|
+
freely, subject to the following restrictions:
|
|
10
|
+
|
|
11
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
12
|
+
claim that you wrote the original software. If you use this software
|
|
13
|
+
in a product, an acknowledgment in the product documentation would be
|
|
14
|
+
appreciated but is not required.
|
|
15
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
16
|
+
misrepresented as being the original software.
|
|
17
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
AsmJit
|
|
2
|
+
------
|
|
3
|
+
|
|
4
|
+
AsmJit is a lightweight library for machine code generation written in C++ language.
|
|
5
|
+
|
|
6
|
+
* [Official Home Page (asmjit.com)](https://asmjit.com)
|
|
7
|
+
* [Official Repository (asmjit/asmjit)](https://github.com/asmjit/asmjit)
|
|
8
|
+
* [Public Chat Channel](https://gitter.im/asmjit/asmjit)
|
|
9
|
+
* [Zlib License](./LICENSE.md)
|
|
10
|
+
|
|
11
|
+
See [asmjit.com](https://asmjit.com) page for more details, examples, and documentation.
|
|
12
|
+
|
|
13
|
+
Documentation
|
|
14
|
+
-------------
|
|
15
|
+
|
|
16
|
+
* [Documentation Index](https://asmjit.com/doc/index.html)
|
|
17
|
+
* [Build Instructions](https://asmjit.com/doc/group__asmjit__build.html)
|
|
18
|
+
|
|
19
|
+
Breaking Changes
|
|
20
|
+
----------------
|
|
21
|
+
|
|
22
|
+
Breaking the API is sometimes inevitable, what to do?
|
|
23
|
+
|
|
24
|
+
* See [Breaking Changes Guide](https://asmjit.com/doc/group__asmjit__breaking__changes.html), which is now part of AsmJit documentation.
|
|
25
|
+
* See asmjit tests, they always compile and provide implementation of many use-cases:
|
|
26
|
+
* [asmjit_test_emitters.cpp](./test/asmjit_test_emitters.cpp) - Tests that demonstrate the purpose of emitters.
|
|
27
|
+
* [asmjit_test_assembler_x86.cpp](./test/asmjit_test_assembler_x86.cpp) - Tests targeting AsmJit's Assembler (x86/x64).
|
|
28
|
+
* [asmjit_test_compiler_x86.cpp](./test/asmjit_test_compiler_x86.cpp) - Tests targeting AsmJit's Compiler (x86/x64).
|
|
29
|
+
* [asmjit_test_instinfo.cpp](./test/asmjit_test_instinfo.cpp) - Tests that query instruction information.
|
|
30
|
+
* [asmjit_test_x86_sections.cpp](./test/asmjit_test_x86_sections.cpp) - Multiple sections test.
|
|
31
|
+
* Visit our [Official Chat](https://gitter.im/asmjit/asmjit) if you need a quick help.
|
|
32
|
+
|
|
33
|
+
Project Organization
|
|
34
|
+
--------------------
|
|
35
|
+
|
|
36
|
+
* **`/`** - Project root.
|
|
37
|
+
* **src** - Source code.
|
|
38
|
+
* **asmjit** - Source code and headers (always point include path in here).
|
|
39
|
+
* **core** - Core API, backend independent except relocations.
|
|
40
|
+
* **arm** - ARM specific API, used only by ARM and AArch64 backends.
|
|
41
|
+
* **x86** - X86 specific API, used only by X86 and X64 backends.
|
|
42
|
+
* **test** - Unit and integration tests (don't embed in your project).
|
|
43
|
+
* **tools** - Tools used for configuring, documenting, and generating files.
|
|
44
|
+
|
|
45
|
+
TODO
|
|
46
|
+
----
|
|
47
|
+
|
|
48
|
+
* [ ] Core:
|
|
49
|
+
* [ ] Add support for user external buffers in CodeBuffer / CodeHolder.
|
|
50
|
+
* [ ] Ports:
|
|
51
|
+
* [ ] 32-bit ARM/Thumb port.
|
|
52
|
+
* [ ] 64-bit ARM (AArch64) port.
|
|
53
|
+
* [ ] RISC-V port.
|
|
54
|
+
|
|
55
|
+
Support
|
|
56
|
+
-------
|
|
57
|
+
|
|
58
|
+
* AsmJit project has both community and commercial support, see [AsmJit's Support Page](https://asmjit.com/support.html)
|
|
59
|
+
* You can help the development and maintenance through Petr Kobalicek's [GitHub sponsors Profile](https://github.com/sponsors/kobalicek)
|
|
60
|
+
|
|
61
|
+
Notable Donors List:
|
|
62
|
+
|
|
63
|
+
* [ZehMatt](https://github.com/ZehMatt)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
Authors & Maintainers
|
|
67
|
+
---------------------
|
|
68
|
+
|
|
69
|
+
* Petr Kobalicek <kobalicek.petr@gmail.com>
|