forked from ata4/angrylion-rdp-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
104 lines (76 loc) · 2.92 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
cmake_minimum_required(VERSION 2.8)
option(GLES "Set to ON to use OpenGL ES 3.0 renderer instead of OpenGL 3.3 core")
project(angrylion-plus)
set(OpenGL_GL_PREFERENCE GLVND)
if(GLES)
message("OpenGL ES 3.0 renderer enabled")
add_definitions(-DGLES)
endif(GLES)
# set policy CMP0042 for MacOS X
set(CMAKE_MACOSX_RPATH 1)
# check for INTERPROCEDURAL_OPTIMIZATION support
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT ENABLE_IPO)
if(ENABLE_IPO)
message("Interprocedural optimizations enabled")
endif(ENABLE_IPO)
endif()
# C++14 is required for the Parallel utility class
set(CMAKE_CXX_STANDARD 14)
# disable warnings to use unportable secure file IO
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif(MSVC)
# default to release build
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
find_package(Git REQUIRED)
find_package(PythonLibs)
find_package(PythonInterp 3.2 REQUIRED)
find_package(OpenGL REQUIRED)
set(PATH_SRC "src")
# RDP core library
set(PATH_CORE "${PATH_SRC}/core")
# run script to generate version.h
set(PATH_VERSION "${PATH_CORE}/version.h")
add_custom_command(
OUTPUT ${PATH_VERSION}
COMMAND
${PYTHON_EXECUTABLE}
"${CMAKE_SOURCE_DIR}/make_version.py"
COMMENT "Generate Git version"
)
file(GLOB SOURCES_CORE "${PATH_CORE}/*.c" "${PATH_CORE}/*.cpp")
add_library(alp-core STATIC ${SOURCES_CORE} ${PATH_VERSION})
if(MINGW)
# link libgcc/libstdc++ statically, fixes cryptic "_ZNSt13runtime_errorC1EPKc" error
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
else(MINGW)
# set PIC option for non-MinGW targets
set_target_properties(alp-core PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif(MINGW)
# set IPO option, if supported
if(ENABLE_IPO AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
endif()
include_directories(${PATH_SRC})
# Project64 GFX Plugin (Windows only)
if(WIN32)
set(NAME_PLUGIN_ZILMAR ${CMAKE_PROJECT_NAME})
set(PATH_PLUGIN_ZILMAR "${PATH_SRC}/plugin/zilmar")
enable_language(RC)
file(GLOB SOURCES_PLUGIN_ZILMAR "${PATH_PLUGIN_ZILMAR}/*.c" "${PATH_PLUGIN_ZILMAR}/*.rc")
add_library(${NAME_PLUGIN_ZILMAR} SHARED ${SOURCES_PLUGIN_ZILMAR})
set_target_properties(${NAME_PLUGIN_ZILMAR} PROPERTIES PREFIX "")
target_link_libraries(${NAME_PLUGIN_ZILMAR} alp-core shlwapi ${OPENGL_LIBRARIES})
endif(WIN32)
# Mupen64Plus GFX plugin
set(NAME_PLUGIN_M64P "mupen64plus-video-${CMAKE_PROJECT_NAME}")
set(PATH_PLUGIN_M64P "${PATH_SRC}/plugin/mupen64plus")
file(GLOB SOURCES_PLUGIN_M64P "${PATH_PLUGIN_M64P}/*.c")
add_library(${NAME_PLUGIN_M64P} SHARED ${SOURCES_PLUGIN_M64P})
set_target_properties(${NAME_PLUGIN_M64P} PROPERTIES PREFIX "")
target_link_libraries(${NAME_PLUGIN_M64P} alp-core ${OPENGL_LIBRARIES})