-
Notifications
You must be signed in to change notification settings - Fork 29
/
CMakeLists.txt
executable file
·72 lines (57 loc) · 1.94 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
cmake_minimum_required(VERSION 3.5.0)
project (retro8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/projects/cmake")
option(FUNKEY_S "Building for FunKey-S" OFF)
option(OPENDINGUX "Build on opendingux toolchain" OFF)
option(RETROFW "Build for retrofw" OFF)
# RETROFW is an OPENDINGUX variant
if (RETROFW)
set(OPENDINGUX ON)
endif()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE "Debug")
endif()
if(OPENDINGUX)
set(CMAKE_CXX_COMPILER "$ENV{CROSS}g++" CACHE PATH "" FORCE)
set(CMAKE_C_COMPILER "$ENV{CROSS}gcc" CACHE PATH "" FORCE)
if(RETROFW)
set(CMAKE_SYSROOT "/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot")
else()
set(CMAKE_SYSROOT "/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot")
endif()
elseif(FUNKEY_S)
add_definitions(-DFUNKEY_S)
endif()
if (FUNKEY_S OR RETROFW)
find_package(SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
else()
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR})
endif()
add_compile_options(-Wno-unused-parameter -Wno-missing-field-initializers
-Wno-sign-compare -Wno-parentheses -Wno-unused-variable -Wno-char-subscripts
)
add_compile_options(-g -O2 -W -Wall -Wextra)
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wno-reorder>
)
if(APPLE)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++14>)
else()
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++11>)
endif()
include_directories(src)
set(SRC_ROOT "${CMAKE_SOURCE_DIR}/src")
file(GLOB SOURCES_ROOT "${SRC_ROOT}/*.cpp")
file(GLOB SOURCES_VIEWS "${SRC_ROOT}/views/*.cpp")
file(GLOB SOURCES_IO "${SRC_ROOT}/io/*.cpp")
file(GLOB SOURCES_VM "${SRC_ROOT}/vm/*.cpp")
file(GLOB SOURCES_LUA "${SRC_ROOT}/lua/*.c")
set(SOURCES ${SOURCES_ROOT} ${SOURCES_VIEWS} ${SOURCES_IO} ${SOURCES_VM} ${SOURCES_LUA})
add_executable(retro8 ${SOURCES})
if (SDL_FOUND)
target_link_libraries(retro8 ${SDL_LIBRARY})
else()
target_link_libraries(retro8 ${SDL2_LIBRARY})
endif()