Skip to content

Commit

Permalink
Implement a simple hierarchial cmake setup that completely separates the
Browse files Browse the repository at this point in the history
frontend from libwashdc.
  • Loading branch information
snickerbockers committed Apr 10, 2019
1 parent 0738ed9 commit 768f2e6
Show file tree
Hide file tree
Showing 7 changed files with 518 additions and 415 deletions.
427 changes: 14 additions & 413 deletions CMakeLists.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion regression_tests/sh4div_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
$FLASH_PATH="./dc_flash.bin";
$SYSCALL_PATH="./syscalls.bin";
$SH4DIV_TEST_PATH="./sh4div_test.bin";
$WASH_PATH="./washingtondc";
$WASH_PATH="./src/washingtondc/washingtondc";
$WASH_ARGS="-b $FIRMWARE_PATH -f $FLASH_PATH -s $SYSCALL_PATH -u $SH4DIV_TEST_PATH -tc";

# path to where the serial port output from WashingtonDC gets logged
Expand Down
2 changes: 1 addition & 1 deletion regression_tests/sh4tmu_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
$FLASH_PATH="./dc_flash.bin";
$SYSCALL_PATH="./syscalls.bin";
$SH4TMU_TEST_PATH="./sh4tmu_test.bin";
$WASH_PATH="./washingtondc";
$WASH_PATH="./src/washingtondc/washingtondc";
$WASH_ARGS="-b $FIRMWARE_PATH -f $FLASH_PATH -s $SYSCALL_PATH -u $SH4TMU_TEST_PATH -tc";

# path to where the serial port output from WashingtonDC gets logged
Expand Down
77 changes: 77 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
################################################################################
#
#
# WashingtonDC Dreamcast Emulator
# Copyright (C) 2016-2019 snickerbockers
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
################################################################################

set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
cmake_minimum_required(VERSION 2.6)
include(ExternalProject)

set (LIBEVENT_LIB_PATH ${CMAKE_CURRENT_BINARY_DIR})

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message("Setting CMAKE_BUILD_TYPE to Release by default")
endif()

set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)

# i need this for strdup and clock_gettime on Debian for some unknown reason
add_definitions(-D_POSIX_C_SOURCE=200809L)

# While I prefer to avoid using GNU-specific stuff when possible, in general
# I don't give a damn about portability to Windows
add_definitions(-D_GNU_SOURCE)

find_package(OpenGL REQUIRED)

# turn on strict warnings - i have no idea how to do this in windows
if(UNIX)
# the -Wno-format-trunction is there to prevent gcc from raising frivolous
# warnings whenever there's a chance that snprintf might do the one thing
# it exists to do.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wno-format-truncation")
endif()

if (USE_LIBEVENT)
add_definitions(-DUSE_LIBEVENT)
ExternalProject_Add(libevent
PREFIX washingtondc-libevent
GIT_REPOSITORY https://github.com/libevent/libevent
GIT_TAG release-2.1.8-stable
INSTALL_DIR ${LIBEVENT_LIB_PATH}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBEVENT_LIB_PATH} -DEVENT__DISABLE_TESTS=On -DEVENT__DISABLE_REGRESS=On -DEVENT__DISABLE_BENCHMARK=On -DEVENT__DISABLE_OPENSSL=On -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
BUILD_IN_SOURCE 1)
endif()

if (USE_LIBEVENT)
set(include_dirs "${include_dirs}"
"${CMAKE_BINARY_DIR}/washingtondc-libevent/src/libevent/include")
endif()

add_subdirectory(washdc)
add_subdirectory(washingtondc)

if (USE_LIBEVENT)
add_dependencies(washingtondc libevent washdc)
add_dependencies(washdc libevent)
endif()
Loading

0 comments on commit 768f2e6

Please sign in to comment.