-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
79 lines (61 loc) · 2.22 KB
/
CMakeLists.txt
File metadata and controls
79 lines (61 loc) · 2.22 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 3.1)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "DEBUG")
#set(CMAKE_BUILD_TYPE "RELEASE")
#set(CMAKE_BUILD_TYPE "RELWITHDEBINFO")
#set(CMAKE_BUILD_TYPE "MINSIZEREL")
endif()
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_STANDARD 14)
add_compile_options("-O3" "-Wall")
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
add_compile_options("-ggdb")
endif()
# TODO make this less platform-specific, limit gperftools linking to
# debug build
set(GPERFTOOLS_LIBRARY_DIRS "/usr/local/lib")
set(GPERFTOOLS_PROFILER "profiler")
find_package(PkgConfig REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
find_library(Cocoa_FRAMEWORK Cocoa)
find_library(OpenGL_FRAMEWORK OpenGL)
find_library(IOKit_FRAMEWORK IOKit)
find_library(CoreFoundation_FRAMEWORK CoreFoundation)
find_library(CoreVideo_FRAMEWORK CoreVideo)
find_library(CoreAudio_FRAMEWORK CoreAudio)
find_library(CoreMIDI_FRAMEWORK CoreMIDI)
set(Portaudio_FIND_REQUIRED TRUE)
include(cmake_modules/FindPortAudio.cmake)
include_directories(SYSTEM ${GLFW_INCLUDE_DIRS} ${PORTAUDIO_INCLUDE_DIRS})
link_directories("${GLFW_LIBRARY_DIRS}" "${GPERFTOOLS_LIBRARY_DIRS}")
add_library(mem mem.cpp)
add_library(cpu cpu.cpp)
add_library(opcodes opcodes.cpp)
add_library(debugger debugger.cpp)
add_library(screen screen.cpp)
target_link_libraries(screen
${GLFW_LIBRARIES}
${Cocoa_FRAMEWORK} ${OpenGL_FRAMEWORK}
${IOKit_FRAMEWORK} ${CoreFoundation_FRAMEWORK}
${CoreVideo_FRAMEWORK}
)
add_library(pulseunit PulseUnit.cpp)
add_library(customwaveunit CustomWaveUnit.cpp)
add_library(audio audio.cpp pulseunit customwaveunit)
target_link_libraries(audio ${PORTAUDIO_LIBRARIES})
add_executable(cpu-test cpu-test.cpp cpu opcodes mem screen debugger audio pulseunit customwaveunit)
target_link_libraries(cpu-test
${GLFW_LIBRARIES}
${Cocoa_FRAMEWORK} ${OpenGL_FRAMEWORK}
${IOKit_FRAMEWORK} ${CoreFoundation_FRAMEWORK}
${CoreVideo_FRAMEWORK}
${PORTAUDIO_LIBRARIES}
)
add_executable(spearow spearow.cpp cpu opcodes mem debugger screen audio pulseunit customwaveunit)
target_link_libraries(spearow
${GLFW_LIBRARIES}
${Cocoa_FRAMEWORK} ${OpenGL_FRAMEWORK}
${IOKit_FRAMEWORK} ${CoreFoundation_FRAMEWORK}
${CoreVideo_FRAMEWORK} ${GPERFTOOLS_PROFILER}
${PORTAUDIO_LIBRARIES}
)