-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
89 lines (79 loc) · 2.04 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
cmake_minimum_required(VERSION 3.16)
project(nes)
set(CMAKE_C_STANDARD 11)
set(BUILD_DIR build)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
set(SDL_DIR ${CMAKE_SOURCE_DIR}/external/SDL)
set(SDL_ttf_DIR ${CMAKE_SOURCE_DIR}/external/SDL_ttf)
option(TTF_WITH_HARFBUZZ "use harfbuzz to improve text shaping" ON)
IF(ANDROID)
# This is the built in NDK logging library
find_library(log-lib log)
option(BUILD_STATIC_LIBS "Build shared libraries" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
ELSE()
option(BUILD_STATIC_LIBS "Build shared libraries" ON)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
ENDIF()
add_subdirectory(${SDL_DIR})
add_subdirectory(${SDL_ttf_DIR})
set (SRC
src/apu.c
src/controller.c
src/cpu6502.c
src/debugtools.c
src/emulator.c
src/gamepad.c
src/genie.c
src/gfx.c
src/mmu.c
src/ppu.c
src/timers.c
src/trace.c
src/touchpad.c
src/trace.c
src/utils.c
src/main.c
src/mappers/axrom.c
src/mappers/cnrom.c
src/mappers/gnrom.c
src/mappers/mapper.c
src/mappers/mmc1.c
src/mappers/uxrom.c
src/mappers/mmc3.c
src/mappers/colordreams.c
src/nsf.c
src/biquad.c
src/biquad.h
src/font.h
)
include_directories(src src/mappers vendor/include ${SDL_DIR}/include ${SDL_ttf_DIR})
IF(ANDROID)
add_library(
nes
SHARED
${SRC}
)
target_link_libraries(
nes
SDL2
SDL2_ttf
${log-lib}
)
ELSE()
IF(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Release")
enable_language("RC")
set (WIN32_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/app.rc)
add_executable(nes WIN32 ${SRC} ${WIN32_RESOURCES})
ELSE()
add_executable(nes ${SRC})
ENDIF ()
target_link_libraries(nes SDL2::SDL2main SDL2::SDL2-static SDL2_ttf::SDL2_ttf-static)
ENDIF()
IF (NOT WIN32)
target_link_libraries(nes m)
ELSE()
target_link_libraries(nes winmm.lib)
ENDIF()