Add preliminary CMake build. Not replacing the makefile for now, will in the future.

This commit is contained in:
Godzil 2020-02-10 23:59:01 +00:00
parent 3e6f096191
commit 667f655d22
3 changed files with 41 additions and 0 deletions

26
CMakeLists.txt Normal file
View File

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.1)
# External cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/cmake ${CMAKE_MODULE_PATH})
project("NewOswan")
include(GetGitRevisionDescription)
git_describe(VERSION --tags --dirty=-dirty)
find_package(SDL 1.2 REQUIRED)
set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Wno-write-strings -Werror")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Wno-write-strings -Werror")
message("-- Building version ${VERSION}")
add_executable(wonderswan main.cpp)
target_compile_definitions(wonderswan PUBLIC VERSION="${VERSION}")
target_include_directories(wonderswan PUBLIC source)
target_include_directories(wonderswan PUBLIC ${SDL_INCLUDE_DIR})
add_subdirectory(source)
target_link_libraries(wonderswan wswan ${SDL_LIBRARY})

11
source/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
set(SOURCES audio.cpp emulate.cpp gpu.cpp io.cpp log.cpp memory.cpp rom.cpp ws.cpp)
set(HEADERS audio.h emulate.h gpu.h ieeprom.h initialIo.h io.h log.h memory.h rom.h SDLptc.h ws.h)
add_library(wswan ${SOURCES} ${HEADERS})
target_link_libraries(wswan nec_v30)
target_include_directories(wswan PUBLIC .)
target_include_directories(wswan PUBLIC ${SDL_INCLUDE_DIR})
add_subdirectory(nec)

View File

@ -0,0 +1,4 @@
set(SOURCES nec.cpp)
set(HEADERS nec.h necea.h necinstr.h necintrf.h necmodrm.h)
add_library(nec_v30 ${SOURCES} ${HEADERS})