all repos — mgba @ 7978a57128e32aa78245216fc0a173642685de1c

mGBA Game Boy Advance Emulator

CMakeLists.txt (view raw)

 1cmake_minimum_required(VERSION 2.6)
 2project(GBAc)
 3set(BINARY_NAME gbac CACHE INTERNAL "Name of output binaries")
 4set(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -Wno-error=type-limits --std=gnu99")
 5set(CMAKE_C_FLAGS_RELEASE "-O3 -Wall -Wextra --std=gnu99")
 6file(GLOB ARM_SRC ${CMAKE_SOURCE_DIR}/src/arm/*.c)
 7file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c)
 8file(GLOB RENDERER_SRC ${CMAKE_SOURCE_DIR}/src/gba/renderers/video-software.c)
 9file(GLOB DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/*.c)
10file(GLOB THIRD_PARTY ${CMAKE_SOURCE_DIR}/third-party/linenoise/linenoise.c)
11include_directories(${CMAKE_SOURCE_DIR}/src/arm)
12include_directories(${CMAKE_SOURCE_DIR}/src/gba)
13include_directories(${CMAKE_SOURCE_DIR}/src/debugger)
14include_directories(${CMAKE_SOURCE_DIR}/third-party/linenoise)
15
16find_package(SDL 1.2 REQUIRED)
17file(GLOB SDL_SRC ${CMAKE_SOURCE_DIR}/src/sdl/sdl-*.c)
18include_directories(${CMAKE_SOURCE_DIR}/src/sdl)
19
20if(BUILD_RASPI AND BUILD_EGL)
21	set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/egl-main.c)
22	set(OPENGL_LIBRARY "-lEGL -lGLESv2 -lbcm_host")
23	set(OPENGL_INCLUDE_DIR "")
24	add_definitions(-DBUILD_RASPI)
25elseif(BUILD_BBB OR BUILD_RASPI)
26	set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/sdl-main.c)
27else()
28	set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/gl-main.c)
29	find_package(OpenGL REQUIRED)
30	include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
31endif()
32include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
33
34add_executable(${BINARY_NAME} ${ARM_SRC} ${GBA_SRC} ${DEBUGGER_SRC} ${RENDERER_SRC} ${THIRD_PARTY} ${SDL_SRC} ${MAIN_SRC})
35target_link_libraries(${BINARY_NAME} m pthread ${SDL_LIBRARY} ${OPENGL_LIBRARY})