-
Notifications
You must be signed in to change notification settings - Fork 25
/
CMakeLists.txt
159 lines (139 loc) · 4.98 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
cmake_minimum_required(VERSION 3.10)
set (CMAKE_C_STANDARD 99)
project(Oricutron)
option(USE_SDL2 "Use SDL2 instead of SDL1" OFF)
set(ORICUTRON_APPNAME Oricutron)
set(ORICUTRON_APPYEAR 2015)
SET(ORICUTRON_VERSION_MAJOR 1)
SET(ORICUTRON_VERSION_MINOR 2)
SET(ORICUTRON_VERSION_PATCH 0)
set(ORICUTRON_COMPANYNAME "pete-gordon/oricutron")
set(ORICUTRON_LINK "https://github.com/pete-gordon/oricutron/")
set(ORICUTRON_VERSION_NUMBER "${ORICUTRON_VERSION_MAJOR}.${ORICUTRON_VERSION_MINOR}")
set(ORICUTRON_VERSION_NUMBER_FULL "${ORICUTRON_VERSION_MAJOR}.${ORICUTRON_VERSION_MINOR}.${ORICUTRON_VERSION_PATCH}")
set(ORICUTRON_APPNAME_FULL "${ORICUTRON_APPNAME} ${ORICUTRON_VERSION_MAJOR}.${ORICUTRON_VERSION_MINOR}")
set(ORICUTRON_VERSION_COPYRIGHTS "${ORICUTRON_APPNAME} ${ORICUTRON_VERSION_MAJOR}.${ORICUTRON_VERSION_MINOR}.${ORICUTRON_VERSION_PATCH} (c)${ORICUTRON_APPYEAR} Peter Gordon ([email protected])")
if (WIN32)
set(OPENGL_LIBRARY "opengl32.lib")
if (USE_SDL2)
add_library(SDL2 STATIC IMPORTED)
set_target_properties(SDL2
PROPERTIES
IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/msvc/vcpkg/installed/x64-windows/lib/SDL2.lib"
INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/msvc/vcpkg/installed/x64-windows/include/SDL2"
)
add_definitions(-DSDL_MAJOR_VERSION=2 -DSDL_MAIN_HANDLED=1 -D__OPENGL_AVAILABLE__ -D_MBCS -DWIN32 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D__CBCOPY__ -D__CBPASTE__ -DAPP_NAME_FULL="${ORICUTRON_APPNAME_FULL}" -DAPP_YEAR="${ORICUTRON_APPYEAR}" -DVERSION_COPYRIGHTS="${ORICUTRON_VERSION_COPYRIGHTS}")
else()
add_library(SDL STATIC IMPORTED)
set_target_properties(SDL
PROPERTIES
IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/msvc/vcpkg/installed/x64-windows/lib/SDL.lib"
INTERFACE_INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/msvc/vcpkg/installed/x64-windows/include/SDL"
)
add_definitions(-DSDL_MAJOR_VERSION=1 -DSDL_MAIN_HANDLED=1 -D__OPENGL_AVAILABLE__ -D_MBCS -DWIN32 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D__CBCOPY__ -D__CBPASTE__ -DAPP_NAME_FULL="${ORICUTRON_APPNAME_FULL}" -DAPP_YEAR="${ORICUTRON_APPYEAR}" -DVERSION_COPYRIGHTS="${ORICUTRON_VERSION_COPYRIGHTS}")
endif (USE_SDL2)
endif (WIN32)
if (UNIX)
if (USE_SDL2)
find_package(SDL2 REQUIRED)
find_package(OpenGL)
# Setup CMake to use GTK+ and SDL2, tell the compiler where to look for headers
# and to the linker where to look for libraries
include_directories(${GTK3_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS})
if (OPENGL_FOUND)
add_definitions(-D__OPENGL_AVAILABLE__)
endif(OPENGL_FOUND)
add_definitions(${GTK3_CFLAGS_OTHER} -DSDL_MAJOR_VERSION=2 -D__SPECIFY_SDL_DIR__=1 -DAPP_NAME_FULL="${ORICUTRON_APPNAME_FULL}" -DAPP_YEAR="${ORICUTRON_APPYEAR}" -DVERSION_COPYRIGHTS="${ORICUTRON_VERSION_COPYRIGHTS}")
else()
# Use the package PkgConfig to detect GTK+ headers/library files
find_package(PkgConfig REQUIRED)
PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
find_package(SDL REQUIRED)
# Setup CMake to use GTK+ and SDL, tell the compiler where to look for headers
# and to the linker where to look for libraries
include_directories(${GTK3_INCLUDE_DIRS} ${SDL_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
add_definitions(${GTK3_CFLAGS_OTHER} -DSDL_MAJOR_VERSION=1 -D__SPECIFY_SDL_DIR__=1 -DAPP_NAME_FULL="${ORICUTRON_APPNAME_FULL}" -DAPP_YEAR="${ORICUTRON_APPYEAR}" -DVERSION_COPYRIGHTS="${ORICUTRON_VERSION_COPYRIGHTS}")
endif (USE_SDL2)
endif (UNIX)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
if (WIN32)
include_directories(
"${PROJECT_SOURCE_DIR}/msvc"
)
endif (WIN32)
SET (SRCAMIGA
filereq_amiga.c
msgbox_os4.c
)
SET (SRCBEOS
filereq_beos.cpp
gui_beos.cpp
msgbox_beos.cpp
)
SET (SRCGTK
filereq_gtk.c
gui_x11.c
msgbox_gtk.c
)
SET (SRCSDL
filereq_sdl.c
gui_x11.c
msgbox_sdl.c
)
SET (SRCSWIN
filereq_win32.c
gui_win.c
msgbox_win32.c
)
SET (SRCS
6551.c
6551_com.c
6551_loopback.c
6551_modem.c
gui.c
render_gl.c
render_null.c
render_sw.c
render_sw8.c
6502.c
8912.c
avi.c
plugins/ch376/ch376.c
disk.c
disk_pravetz.c
font.c
joystick.c
keyboard.c
machine.c
main.c
monitor.c
plugins/ch376/oric_ch376_plugin.c
plugins/twilighte_board/oric_twilighte_board_plugin.c
snapshot.c
system_sdl.c
tape.c
ula.c
via.c
)
set(ORICUTRON_RC ${PROJECT_SOURCE_DIR}/msvc/Oricutron.rc)
if (WIN32)
if (USE_SDL2)
add_executable(Oricutron-sdl2 ${SRCS} ${SRCSWIN} ${ORICUTRON_RC})
target_link_libraries(Oricutron-sdl2 SDL2 ${OPENGL_LIBRARY})
else()
add_executable(Oricutron ${SRCS} ${SRCSWIN} ${ORICUTRON_RC})
target_link_libraries(Oricutron SDL ${OPENGL_LIBRARY})
endif (USE_SDL2)
endif (WIN32)
if (UNIX)
if (USE_SDL2)
add_executable(Oricutron-sdl2 ${SRCS} ${SRCSDL})
target_link_libraries(Oricutron-sdl2 ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES})
else()
add_executable(Oricutron ${SRCS} ${SRCGTK})
target_link_libraries(Oricutron ${GTK3_LIBRARIES} SDL GL X11)
endif (USE_SDL2)
endif (UNIX)