-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
93 lines (67 loc) · 2.05 KB
/
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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#
# Build MIPSimu
#
# Copyright (C) 2018, Guillaume Gonnet
# License MIT
cmake_minimum_required(VERSION 3.3)
project(mipsimu)
# Unit tests
option(MIPSIMU_ENABLE_TESTS "Enable MIPSimu unit tests." OFF)
if(MIPSIMU_ENABLE_TESTS)
add_subdirectory(unittests)
endif()
# Build the native version
option(MIPSIMU_BUILD_NATIVE "Build MIPSimu native or JS version?" ON)
# Include source directory
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src")
# Use C++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)
# Source files
set(SOURCES
"src/core/bus.h"
"src/core/bus.cc"
"src/core/processor.h"
"src/core/processor.cc"
"src/peripherals/ram.h"
"src/peripherals/ram.cc"
"src/peripherals/timer.h"
"src/peripherals/timer.cc"
"src/peripherals/external.h"
"src/peripherals/external.cc"
"src/peripherals/vga.h"
"src/peripherals/vga.cc"
"src/debugger/asm/disassembler.h"
"src/debugger/asm/disassembler.cc"
"src/debugger/asm/inst_dump.h"
"src/debugger/asm/inst_dump.cc"
"src/debugger/peripheral.h"
"src/debugger/peripheral.cc"
"src/debugger/debugger.h"
"src/debugger/debugger.cc"
"src/utils/range.h"
)
# Select the right configuration.
if(MIPSIMU_BUILD_NATIVE)
# Build the native app.
add_definitions(-DMIPSIMU_NATIVE)
find_package(Qt5Widgets)
add_subdirectory("src/native-app")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/native-app")
set(SOURCES ${SOURCES} "src/native-app/main.cc")
link_libraries(mipsimu-native Qt5::Widgets)
else()
# Build the JS app using Emscripten.
if (NOT EMSCRIPTEN)
message(FATAL_ERROR "Emscripten toolschain not found. See README for more information.")
endif()
add_definitions(-DMIPSIMU_JS)
add_subdirectory("src/js-app")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/js-app")
set(SOURCES ${SOURCES} "src/js-app/main.cc")
link_libraries(mipsimu-js)
endif()
# Create the executable
add_executable(mipsimu ${SOURCES})