-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
64 lines (53 loc) · 1.88 KB
/
Copy pathCMakeLists.txt
File metadata and controls
64 lines (53 loc) · 1.88 KB
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
cmake_minimum_required(VERSION 3.16)
# set any CMAKE_ variables here
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_C_STANDARD 11)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(HAVE_FLAG_SEARCH_PATHS_FIRST 0)
set(CMAKE_C_COMPILER clang-18)
set(CMAKE_CXX_COMPILER clang++-18)
set(CMAKE_M_COMPILER ${CMAKE_SOURCE_DIR}/dep/m)
project(m, VERSION 0.0.9 LANGUAGES CXX C)
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/test/unity
${CMAKE_SOURCE_DIR}/test
)
set(CMAKE_AR "llvm-ar-18")
set(CMAKE_RANLIB "llvm-ranlib-18")
add_library(wasm_options INTERFACE)
target_compile_definitions(wasm_options INTERFACE
__wasi__=1
__wasm32__=1
WASM=1
UNITY_EXCLUDE_SETJMP_H=1)
target_compile_options(wasm_options INTERFACE
--target=wasm32
--sysroot=${CMAKE_SOURCE_DIR}/extern/wasi-sdk-20.0/share/wasi-sysroot
-nostdlib
-msign-ext
-mbulk-memory
# -o3 # aggressive optimization
# -flto # add meta data for link time optimization
-fvisibility=hidden
-g
)
if (MSVC)
# warning level 4 and all warnings as errors
# add_compile_options(/W4 /WX /Wv:18)
# add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else()
# lots of warnings and all warnings as errors
add_compile_options(-Wall -Wextra -pedantic -Werror -Wno-unused-parameter # -Wno-error=unused-command-line-argument
-Wno-missing-braces -Wno-enum-conversion -g)
endif()
if (APPLE)
string(REPLACE "-headerpad_max_install_names" "" CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS})
string(REPLACE "-headerpad_max_install_names" "" CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS})
endif()
add_subdirectory(extern/googletest)
add_subdirectory(src)
add_subdirectory(lib)
add_subdirectory(apps)
add_subdirectory(test)
add_subdirectory(samples)