swissChili | 6c61a79 | 2020-07-28 16:29:20 -0700 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.0) |
| 2 | |
| 3 | project(6502 VERSION 0.1.0 LANGUAGES C) |
| 4 | |
| 5 | option(GEN_INSTRUCTIONS_HEADER ON) |
swissChili | 97b5d8b | 2020-08-15 20:00:54 -0700 | [diff] [blame] | 6 | option(BUILD_ASSEMBLER ON) |
swissChili | 6c61a79 | 2020-07-28 16:29:20 -0700 | [diff] [blame] | 7 | |
swissChili | dbbd540 | 2020-08-07 15:07:39 -0700 | [diff] [blame] | 8 | include_directories(nuklear) |
| 9 | |
swissChili | dab15a6 | 2020-08-17 15:41:27 -0700 | [diff] [blame] | 10 | include(TestBigEndian) |
| 11 | test_big_endian(BIG_ENDIAN) |
| 12 | |
| 13 | if (${BIG_ENDIAN}) |
| 14 | add_compile_definitions(BIG_ENDIAN) |
| 15 | else() |
| 16 | add_compile_definitions(LITTLE_ENDIAN) |
| 17 | endif() |
| 18 | |
swissChili | 97b5d8b | 2020-08-15 20:00:54 -0700 | [diff] [blame] | 19 | subdirs(as) |
| 20 | |
swissChili | 6c61a79 | 2020-07-28 16:29:20 -0700 | [diff] [blame] | 21 | if (${GEN_INSTRUCTIONS_HEADER}) |
| 22 | add_custom_command( |
| 23 | OUTPUT instructions.h |
| 24 | DEPENDS csv2h.awk 6502.csv |
| 25 | COMMAND awk -f csv2h.awk 6502.csv > instructions.h |
| 26 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) |
| 27 | endif() |
| 28 | |
swissChili | 6a92301 | 2020-08-18 17:47:27 -0700 | [diff] [blame] | 29 | find_library(readline SDL2 GL GLU GLEW m rt pthread) |
| 30 | |
swissChili | b71e027 | 2020-08-08 15:56:14 -0700 | [diff] [blame] | 31 | add_executable(6502 main.c cpu.c cpu.h dbg.c dbg.h |
| 32 | instructions.h gui.h gui.c screen.h screen.c common.h common.c) |
swissChili | c6b4f7e | 2020-08-09 16:36:36 -0700 | [diff] [blame] | 33 | target_link_libraries(6502 readline SDL2 GL GLU GLEW m rt pthread) |
swissChili | 6a92301 | 2020-08-18 17:47:27 -0700 | [diff] [blame] | 34 | |
| 35 | install(TARGETS 6502) |
| 36 | |
| 37 | set(CPACK_GENERATOR "DEB") |
| 38 | set(CPACK_DEBIAN_PACKAGE_MAINTAINER "swissChili") |
| 39 | set(CPACK_DEBIAN_PACKAGE_DEPENDS "libsdl2-dev, libreadline-dev, libglew-dev") |
| 40 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "6502 emulator, debugger, and assembler") |
| 41 | set(CPACK_PACKAGE_VERSION_MAJOR 0) |
| 42 | set(CPACK_PACKAGE_VERSION_MINOR 1) |
| 43 | set(CPACK_PACKAGE_VERSION_PATCH 0) |
| 44 | set(CPACK_PACKAGE_FILE_NAME "6502") |
| 45 | |
| 46 | include(CPack) |