@@ -31,14 +31,20 @@ endif()
31
31
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
32
32
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "" )
33
33
34
+ # Turn on SIMD by default, can be turned off by setting WAMR_BUILD_SIMD to 0
35
+ if (WAMR_BUILD_SIMD EQUAL 0)
36
+ add_definitions (-DWASM_ENABLE_SIMD=0)
37
+ else ()
38
+ add_definitions (-DWASM_ENABLE_SIMD=1)
39
+ endif ()
40
+
34
41
add_definitions (-DWASM_ENABLE_INTERP=1)
35
42
add_definitions (-DWASM_ENABLE_WAMR_COMPILER=1)
36
43
add_definitions (-DWASM_ENABLE_BULK_MEMORY=1)
37
44
add_definitions (-DWASM_DISABLE_HW_BOUND_CHECK=1)
38
45
add_definitions (-DWASM_ENABLE_SHARED_MEMORY=1)
39
46
add_definitions (-DWASM_ENABLE_THREAD_MGR=1)
40
47
add_definitions (-DWASM_ENABLE_TAIL_CALL=1)
41
- add_definitions (-DWASM_ENABLE_SIMD=1)
42
48
add_definitions (-DWASM_ENABLE_REF_TYPES=1)
43
49
add_definitions (-DWASM_ENABLE_CUSTOM_NAME_SECTION=1)
44
50
add_definitions (-DWASM_ENABLE_AOT_STACK_FRAME=1)
@@ -132,21 +138,11 @@ endif ()
132
138
133
139
message ("-- Build as target ${WAMR_BUILD_TARGET} " )
134
140
135
- if (CMAKE_SIZEOF_VOID_P EQUAL 8)
136
- if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64"
137
- OR WAMR_BUILD_TARGET MATCHES "AARCH64.*" OR WAMR_BUILD_TARGET MATCHES "RISCV64.*" )
138
- if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows" )
139
- # Add -fPIC flag if build as 64-bit
140
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
141
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
142
- set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC" )
143
- set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -fPIC" )
144
- endif ()
145
- else ()
146
- add_definitions (-m32)
147
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32" )
148
- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32" )
149
- endif ()
141
+ # Add -m32 flag if compiling on 64-bit system for 32-bit x86 target
142
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND WAMR_BUILD_TARGET STREQUAL "X86_32" )
143
+ add_definitions (-m32)
144
+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32" )
145
+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32" )
150
146
endif ()
151
147
152
148
if (NOT CMAKE_BUILD_TYPE )
@@ -275,6 +271,8 @@ else ()
275
271
message ("-- Lib wasi-threads disabled" )
276
272
endif ()
277
273
274
+ set (WAMR_BUILD_WAMR_COMPILER 1)
275
+
278
276
include (${SHARED_DIR} /platform/${WAMR_BUILD_PLATFORM} /shared_platform.cmake)
279
277
include (${SHARED_DIR} /mem-alloc/mem_alloc.cmake)
280
278
include (${SHARED_DIR} /utils/shared_utils.cmake)
@@ -376,7 +374,7 @@ add_library (aotclib ${IWASM_COMPL_SOURCE})
376
374
377
375
add_executable (wamrc main.c)
378
376
check_pie_supported()
379
- set_target_properties (wamrc PROPERTIES POSITION_INDEPENDENT_CODE ON )
377
+ set_target_properties (wamrc vmlib aotclib PROPERTIES POSITION_INDEPENDENT_CODE ON )
380
378
set_version_info (wamrc)
381
379
382
380
if (LLVM_LINK_LLVM_DYLIB)
@@ -398,4 +396,5 @@ else()
398
396
${UV_A_LIBS} )
399
397
endif ()
400
398
401
- install (TARGETS wamrc DESTINATION bin)
399
+ include (GNUInstallDirs)
400
+ install (TARGETS wamrc)
0 commit comments