-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
52 lines (40 loc) · 1.55 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
cmake_minimum_required(VERSION 3.10)
project(YAJVSEmu LANGUAGES CXX)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Git)
# https://www.airspayce.com/mikem/bcm2835/
find_library(BCM2835_LIB bcm2835 REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
pkg_check_modules(XWII REQUIRED libxwiimote)
pkg_check_modules(SERIAL REQUIRED libserialport)
if(GIT_FOUND)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --always --tags --first-parent
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(GIT_VERSION "unknown")
endif()
configure_file("${PROJECT_SOURCE_DIR}/version.h.in" "${PROJECT_SOURCE_DIR}/version.h" @ONLY NEWLINE_STYLE LF)
include_directories(${THREAD_INLCUDE_DIRS} ${SDL2_INCLUDE_DIRS} ${XWII_INCLUDE_DIRS} ${SERIAL_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/Includes)
add_executable(${PROJECT_NAME}
main.cpp
Includes/Setup.cpp
Includes/JvsIo.cpp
Includes/SerIo.cpp
Includes/GpIo.cpp
Includes/SdlIo.cpp
Includes/WiiIo.cpp
)
if (CMAKE_BUILD_TYPE STREQUAL "Release")
include(CheckIPOSupported)
check_ipo_supported(RESULT supported OUTPUT error)
if (supported)
set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14)
target_compile_options(${PROJECT_NAME} PRIVATE -march=native -Wsign-conversion -Wall -Wextra -Wpedantic)
target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARIES} ${SERIAL_LIBRARIES} ${XWII_LIBRARIES} ${BCM2835_LIB})