Skip to content

Commit

Permalink
Seperate CMake files for libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Meyer committed Jul 14, 2019
1 parent b504a46 commit 22c8871
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 42 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(NanoboyAdvance C CXX)
cmake_minimum_required(VERSION 2.8)
project(NanoboyAdvance C CXX)

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeTests)

SET(PLATFORM "sdl" CACHE STRING "Build Target (sdl, ...)")
set(PLATFORM "sdl" CACHE STRING "Build Target (sdl, ...)")

SET(COMPILE_FLAGS "${COMPILE_FLAGS} -Ofast")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILE_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS} -std=c++1z")
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Ofast")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS} -std=c++1z")

ADD_SUBDIRECTORY(src)
add_subdirectory(src)
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
INCLUDE_DIRECTORIES(.)
ADD_SUBDIRECTORY(core)
ADD_SUBDIRECTORY("platform/${PLATFORM}")
include_directories(.)
add_subdirectory(core)
add_subdirectory("platform/${PLATFORM}")
31 changes: 2 additions & 29 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,2 @@
SET(SOURCES
arm/arm7tdmi/armv4/emit.cpp
gba/apu/apu.cpp
gba/apu/regs.cpp
gba/bios.cpp
gba/mmio.cpp
gba/ppu/regs.cpp
gba/ppu/ppu.cpp
gba/ppu/render/text.cpp
gba/ppu/render/oam.cpp
gba/cpu.cpp
gba/dma.cpp
gba/timer.cpp
)

SET(HEADERS
arm/core/arm.hpp
arm/core/interface.hpp
gba/apu/apu.hpp
gba/apu/regs.hpp
gba/ppu/ppu.hpp
gba/ppu/regs.hpp
gba/cpu.hpp
gba/event_device.hpp
gba/mmio.hpp
)

ADD_LIBRARY(core STATIC ${SOURCES} ${HEADERS})
TARGET_LINK_LIBRARIES(core stdc++fs)
add_subdirectory(arm)
add_subdirectory(gba)
11 changes: 11 additions & 0 deletions src/core/arm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set(SOURCES
arm7tdmi/armv4/emit.cpp
)

set(HEADERS
arm7tdmi/arm7tdmi.hpp
core/arm.hpp
core/interface.hpp
)

add_library(arm STATIC ${SOURCES} ${HEADERS})
26 changes: 26 additions & 0 deletions src/core/gba/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
set(SOURCES
apu/apu.cpp
apu/regs.cpp
bios.cpp
mmio.cpp
ppu/regs.cpp
ppu/ppu.cpp
ppu/render/text.cpp
ppu/render/oam.cpp
cpu.cpp
dma.cpp
timer.cpp
)

set(HEADERS
apu/apu.hpp
apu/regs.hpp
ppu/ppu.hpp
ppu/regs.hpp
cpu.hpp
event_device.hpp
mmio.hpp
)

add_library(gba STATIC ${SOURCES} ${HEADERS})
target_link_libraries(gba arm stdc++fs)
3 changes: 2 additions & 1 deletion src/core/gba/cpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

#pragma once

#include <core/arm/arm7tdmi/arm7tdmi.hpp>

#include "apu/apu.hpp"
#include "../arm/arm7tdmi/arm7tdmi.hpp"
#include "config.hpp"
#include "dma.hpp"
#include "event_device.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/platform/sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ INCLUDE(FindSDL2 REQUIRED)
FIND_PACKAGE(SDL2 REQUIRED)

ADD_EXECUTABLE(NanoboyAdvance-SDL ${SOURCES} ${HEADERS})
TARGET_LINK_LIBRARIES(NanoboyAdvance-SDL core)
TARGET_LINK_LIBRARIES(NanoboyAdvance-SDL gba)
TARGET_LINK_LIBRARIES(NanoboyAdvance-SDL ${SDL2_LIBRARY})

0 comments on commit 22c8871

Please sign in to comment.