forked from shonumi/gbe-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
102 lines (83 loc) · 2.51 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
cmake_minimum_required(VERSION 2.8.11)
project(gbe_plus)
if (NOT MSVC)
add_definitions(-O3 -funroll-loops -Wno-error -Wno-narrowing -std=c++17)
endif()
if (MSVC AND WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
find_package(SDL2 REQUIRED)
if (SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIRS})
if (WIN32 AND MSVC)
SET(SDL2MAIN_LIBRARY CACHE STRING "SDL2main library")
else()
set(SDL2MAIN_LIBRARY "")
endif()
else()
message(STATUS "SDL2 not found.")
endif()
option(LINK_CABLE "Enable link cable emulation (requires SDL2_net)" ON)
if (LINK_CABLE)
find_package(SDL2NET REQUIRED)
if (SDL2NET_FOUND)
include_directories(${SDL2NET_INCLUDE_DIR})
add_definitions(-DGBE_NETPLAY)
else()
message(STATUS "SDL2_net not found.")
endif()
endif()
option(ADVANCED_DEBUG "Enable advanced debugging features (may affect performance)" OFF)
if (ADVANCED_DEBUG)
add_definitions(-DGBE_DEBUG)
endif()
option(USE_OGL "Enable OpenGL for drawing operations (requires OpenGL)" ON)
if (USE_OGL)
find_package(OpenGL REQUIRED)
if (OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR})
add_definitions(-DGBE_OGL)
else()
message(STATUS "OpenGL not found.")
endif()
endif()
if (WIN32 AND USE_OGL)
find_package(GLEW REQUIRED)
if (GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIRS})
add_definitions(-DGBE_GLEW)
else()
message(STATUS "GLEW not found.")
endif()
endif()
option(QT_GUI "Enable the Qt GUI" ON)
option(QT_VERSION_4 "Use Qt 4" ON)
option(QT_VERSION_5 "Use Qt 5" OFF)
if(QT_VERSION_4 OR QT_VERSION_5)
set(QT_GUI ON)
if(QT_VERSION_5)
add_definitions(-DGBE_QT_5)
elseif(QT_VERSION_4)
add_definitions(-DGBE_QT_4)
endif()
else()
set(QT_GUI OFF)
endif()
if(QT_GUI)
if(QT_VERSION_5)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Gui REQUIRED)
set(GBE_QT_LIBS Qt5::Gui Qt5::Widgets Qt5::OpenGL)
elseif(QT_VERSION_4)
find_package(Qt4 REQUIRED COMPONENTS QtGui QtOpenGL)
set(GBE_QT_LIBS Qt4::QtGui Qt4::QtOpenGL)
endif()
endif()
add_subdirectory(src)
SET(USER_HOME $ENV{HOME} CACHE STRING "Target User Home")
SET(USER $ENV{USER} CACHE STRING "Target User")
MESSAGE("-- Target User Home -> ${USER_HOME}")
MESSAGE("-- Target User -> ${USER}")