-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
109 lines (95 loc) · 3.38 KB
/
CMakeLists.txt
File metadata and controls
109 lines (95 loc) · 3.38 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Main
cmake_minimum_required (VERSION 2.8)
# --- Project name ---
project (SMS-Emu)
# --- Explicitly enable C
enable_language (C)
enable_language (CXX)
enable_testing()
# --- Tell build type
MESSAGE( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )
# --- Enable C99 on GCC
if (CMAKE_COMPILER_IS_GNUCC)
#Add code coverage on GNU debug builds
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE( STATUS "Activating coverage tooling")
MESSAGE( STATUS "Run `make cov` after build to create coverage report")
#Set flags
SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
#Add a targets for coverage reporting
add_custom_target(cov_clear
COMMAND lcov -q --zerocounters --directory "${CMAKE_BINARY_DIR}"
COMMENT "Clearing coverage logs"
)
add_custom_target(cov_report
COMMAND lcov -q --directory . --capture --output-file "coverage.info" --rc lcov_branch_coverage=1
COMMAND genhtml -q --output-directory "coverage"
--demangle-cpp --num-spaces 2 --sort
--title "${PROJECT_NAME} Test Coverage"
--function-coverage --branch-coverage --legend
"coverage.info" --rc lcov_branch_coverage=1
COMMENT "Making coverage report"
)
add_custom_target(cov
COMMAND make cov_clear
COMMAND make test
COMMAND make cov_report
)
endif()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing")
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif (CMAKE_COMPILER_IS_GNUCC)
# --- Setup C++
if (CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-variable")
endif (CMAKE_COMPILER_IS_GNUCXX)
# --- MSVC configs
if (MSVC)
#Tell MSVC to shut the fuck up about _CRT_SECURE_NO_WARNINGS.
add_definitions( -D_CRT_SECURE_NO_WARNINGS )
#Make it a little more verbose and set warnings-as-errors.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /WX")
endif (MSVC)
# --- Enable OpenMP if available
if(NOT MINGW)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif(OPENMP_FOUND)
endif(NOT MINGW)
# --- Find python3 (code generation) ---
find_package(PythonInterp 3 REQUIRED)
#set(PYTHON_EXECUTABLE "C:\\Python31\\python.exe")
# --- Dependencies ---
include_directories(${PROJECT_SOURCE_DIR})
link_directories(${PROJECT_SOURCE_DIR}/lib64) # These two ease building on
include_directories(${PROJECT_SOURCE_DIR}/include64) # a locked-down PC.
add_subdirectory (glue)
add_subdirectory (psg)
add_subdirectory (ram)
add_subdirectory (rom)
add_subdirectory (z80)
add_subdirectory (z80dasm)
add_subdirectory (peripheral)
add_subdirectory (io)
add_subdirectory (vdp)
add_subdirectory (sdsc)
add_subdirectory (test)
add_subdirectory (sms-ui)
add_subdirectory (savestate)
add_subdirectory (debug)
add_subdirectory (fat-sources)
# --- The project executables ---
SET(EXT_LIBS SDL2main SDL2)
if (MINGW)
ADD_DEFINITIONS(-DWIN32)
SET(EXT_LIBS mingw32 ${EXT_LIBS})
endif()
# --- psg-play
add_executable (psg-play psg-play.c)
target_link_libraries (psg-play psg ${EXT_LIBS})