Skip to content

Commit

Permalink
Removed msvc solution/projects. Added support for CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
visrealm committed Sep 3, 2023
1 parent 2e97273 commit f8dc38c
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 327 deletions.
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.22)


set(CMAKE_C_STANDARD 11)

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

project(vrEmu6502)

if (WIN32)
if (NOT BUILD_SHARED_LIBS)
add_definitions(-DVR_6502_EMU_STATIC)
endif()
endif()

include(CTest)

add_subdirectory(src)
add_subdirectory(test)
Binary file removed bin/vrEmu6502.dll
Binary file not shown.
Binary file removed bin/vrEmu6502Test.exe
Binary file not shown.
31 changes: 0 additions & 31 deletions msvc/vrEmu6502.sln

This file was deleted.

107 changes: 0 additions & 107 deletions msvc/vrEmu6502/vrEmu6502.vcxproj

This file was deleted.

19 changes: 0 additions & 19 deletions msvc/vrEmu6502/vrEmu6502.vcxproj.filters

This file was deleted.

96 changes: 0 additions & 96 deletions msvc/vrEmu6502Test/vrEmu6502Test.vcxproj

This file was deleted.

14 changes: 0 additions & 14 deletions msvc/vrEmu6502Test/vrEmu6502Test.vcxproj.filters

This file was deleted.

13 changes: 13 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


add_library(vrEmu6502 vrEmu6502.c)

if (WIN32)
if (BUILD_SHARED_LIBS)
add_definitions(-DVR_6502_EMU_COMPILING_DLL)
else()
add_definitions(-DVR_6502_EMU_STATIC)
endif()
endif()

target_include_directories (vrEmu6502 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
9 changes: 6 additions & 3 deletions src/vrEmu6502.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@
* VR_6502_EMU_COMPILING_DLL: When compiling vrEmuTms9918 as a DLL
* VR_6502_EMU_STATIC: When linking vrEmu6502 statically in your executable
*/
#ifndef WIN32
#define VR_6502_EMU_STATIC 1
#endif

#if VR_6502_EMU_COMPILING_DLL
#define VR_EMU_6502_DLLEXPORT __declspec(dllexport)
#elif __EMSCRIPTEN__
#include <emscripten.h>
#define VR_EMU_6502_DLLEXPORT EMSCRIPTEN_KEEPALIVE
#elif VR_6502_EMU_STATIC
#ifdef __cplusplus
#define VR_EMU_6502_DLLEXPORT extern "C"
#else
#define VR_EMU_6502_DLLEXPORT extern
#endif
#elif __EMSCRIPTEN__
#include <emscripten.h>
#define VR_EMU_6502_DLLEXPORT EMSCRIPTEN_KEEPALIVE
#else
#define VR_EMU_6502_DLLEXPORT __declspec(dllimport)
#endif
Expand Down
22 changes: 22 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
enable_testing()

add_executable (vrEmu6502Test vrEmu6502Test.c)

target_link_libraries(vrEmu6502Test vrEmu6502)

set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/programs/)

add_test(6502_functional_test vrEmu6502Test -quiet -cpu 6502 ${TESTS_DIR}6502_functional_test.hex)
add_test(65c02_functional_test vrEmu6502Test -quiet -cpu 65c02 ${TESTS_DIR}6502_functional_test.hex)
add_test(w65c02_functional_test vrEmu6502Test -quiet -cpu w65c02 ${TESTS_DIR}6502_functional_test.hex)
add_test(r65c02_functional_test vrEmu6502Test -quiet -cpu r65c02 ${TESTS_DIR}6502_functional_test.hex)

add_test(6502_decimal_test vrEmu6502Test -quiet -cpu 6502 ${TESTS_DIR}6502_decimal_test.hex)
add_test(65c02_decimal_test vrEmu6502Test -quiet -cpu 65c02 ${TESTS_DIR}6502_decimal_test.hex)
add_test(w65c02_decimal_test vrEmu6502Test -quiet -cpu w65c02 ${TESTS_DIR}6502_decimal_test.hex)
add_test(r65c02_decimal_test vrEmu6502Test -quiet -cpu r65c02 ${TESTS_DIR}6502_decimal_test.hex)

add_test(65c02_extended_test vrEmu6502Test -quiet -cpu 65c02 ${TESTS_DIR}65C02_extended_opcodes_test.hex)
add_test(w65c02_extended_test vrEmu6502Test -quiet -cpu w65c02 ${TESTS_DIR}W65C02_extended_opcodes_test.hex)
add_test(r65c02_extended_test vrEmu6502Test -quiet -cpu r65c02 ${TESTS_DIR}R65C02_extended_opcodes_test.hex)

3 changes: 0 additions & 3 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
* It can be built using the solution in the [msvc](../msvc) folder.
* The test runner binary (Windows) is included in the [bin](../bin) directory.

[test.bat](test.bat)
* All included tests can be run using `test.bat`.


### Options:

Expand Down
Loading

0 comments on commit f8dc38c

Please sign in to comment.