-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
39 lines (27 loc) · 978 Bytes
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.12)
project(riscv_sim)
file(GLOB_RECURSE SOURCES "src/*.c" "src/*.h")
add_executable(riscv_sim ${SOURCES})
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
add_definitions(-D_CRT_SECURE_NO_WARNINGS ) # for visual studio
include_directories(
${CMAKE_SOURCE_DIR}/win/SDL2/include
${CMAKE_SOURCE_DIR}/src # 因为 CMake 是以 src 作为根路径所以新建的 pkg 比如 device 之类的文件 include 需要声明包名
)
target_link_directories(
riscv_sim PRIVATE
${CMAKE_SOURCE_DIR}/win/SDL2/lib/x64
)
message(${CMAKE_SOURCE_DIR}/win/SDL2/lib/x64)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
target_link_libraries(riscv_sim PRIVATE SDL2 SDL2main Ws2_32)
else()
add_compile_options(-g)
find_package(SDL2 REQUIRED)
include_directories(
${SDL2_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/src
)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
target_link_libraries(riscv_sim PRIVATE pthread SDL2)
endif()