File: Emscripten.cmake

package info (click to toggle)
swi-prolog 9.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 82,408 kB
  • sloc: ansic: 387,503; perl: 359,326; cpp: 6,613; lisp: 6,247; java: 5,540; sh: 3,147; javascript: 2,668; python: 1,900; ruby: 1,594; yacc: 845; makefile: 428; xml: 317; sed: 12; sql: 6
file content (35 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (2)
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
# AlignOf.cmake doesn't work for Emscripten
set(ALIGNOF_INT64_T 8 CACHE STRING "Alignment for int64_t")
set(ALIGNOF_VOIDP   ${SIZEOF_VOIDP} CACHE STRING "Alignment for pointers")
set(ALIGNOF_DOUBLE  8 CACHE STRING "Alignment for double")

set(PLHOME     "/swipl")
set(SWIPL_ARCH "wasm-emscripten")
set(USE_TCMALLOC OFF)
set(USE_SIGNALS OFF)
set(MULTI_THREADED OFF)
set(STATIC_EXTENSIONS ON)
set(BUILD_SWIPL_LD OFF)

set(SRC_OS_SPECIFIC wasm/pl-wasm.c)

if(MULTI_THREADED)
  add_compile_options(-pthread)
endif()

set(WASM_PRELOAD_DIR "${CMAKE_BINARY_DIR}/src/wasm-preload")
add_custom_target(wasm_preload)

# Install a file from the binary directory of a package in a specific
# directory of the wasm-preload directory

function(install_in_wasm_preload dir file)
  string(REPLACE "/" "-" depname ${dir}${file})
  add_custom_command(
      OUTPUT ${WASM_PRELOAD_DIR}/${dir}/${file}
      COMMAND ${CMAKE_COMMAND} -E copy ${file} ${WASM_PRELOAD_DIR}/${dir}
      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${file})
  add_custom_target(wasm_preload${depname}
		    DEPENDS ${WASM_PRELOAD_DIR}/${dir}/${file})
  add_dependencies(wasm_preload wasm_preload${depname})
endfunction()