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 UTIL_SRC ${CMAKE_SOURCE_DIR}/src/util/*.c)
9file(GLOB RENDERER_SRC ${CMAKE_SOURCE_DIR}/src/gba/renderers/video-software.c)
10file(GLOB DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/*.c)
11file(GLOB THIRD_PARTY ${CMAKE_SOURCE_DIR}/third-party/linenoise/linenoise.c)
12include_directories(${CMAKE_SOURCE_DIR}/src/arm)
13include_directories(${CMAKE_SOURCE_DIR}/src/gba)
14include_directories(${CMAKE_SOURCE_DIR}/src/debugger)
15include_directories(${CMAKE_SOURCE_DIR}/src/util)
16include_directories(${CMAKE_SOURCE_DIR}/third-party/linenoise)
17
18find_package(SDL 1.2 REQUIRED)
19file(GLOB SDL_SRC ${CMAKE_SOURCE_DIR}/src/sdl/sdl-*.c)
20include_directories(${CMAKE_SOURCE_DIR}/src/sdl)
21
22if(BUILD_RASPI AND BUILD_EGL)
23 set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/egl-main.c)
24 set(OPENGL_LIBRARY "-lEGL -lGLESv2 -lbcm_host")
25 set(OPENGL_INCLUDE_DIR "")
26 add_definitions(-DBUILD_RASPI)
27elseif(BUILD_BBB OR BUILD_RASPI)
28 set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/sdl-main.c)
29else()
30 set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/gl-main.c)
31 find_package(OpenGL REQUIRED)
32 include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
33endif()
34include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
35
36add_executable(${BINARY_NAME} ${ARM_SRC} ${GBA_SRC} ${DEBUGGER_SRC} ${RENDERER_SRC} ${UTIL_SRC} ${THIRD_PARTY} ${SDL_SRC} ${MAIN_SRC})
37target_link_libraries(${BINARY_NAME} m pthread ${SDL_LIBRARY} ${OPENGL_LIBRARY})