-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
94 lines (75 loc) · 2.98 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
cmake_minimum_required(VERSION 3.10)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_C_FLAGS "-DDEBUG -DLUA_USE_POSIX")
set(CMAKE_CXX_FLAGS "-DDEBUG")
set(CMAKE_BUILD_TYPE Debug)
enable_testing()
#add_test(cpu6502 build/vistella [cpu6502])
if (UNIX)
set(CMAKE_LIBRARY_PREFIXES lib)
set(CMAKE_LIBRARY_SUFFIXES a)
set(CMAKE_FIND_LIBRARY_PREFIXES lib)
set(CMAKE_FIND_LIBRARY_SUFFIXES a)
#Start GoogleTest Section
include(FetchContent)
FetchContent_Declare(
googletest
# Specify the commit you depend on and update it regularly.
URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
# End GoogleTest Section
#set(SDL2_DIR /usr/lib/x86_64-linux-gnu/cmake/SDL2/)
#set(OPENGL_opengl_LIBRARY /usr/lib/x86_64-linux-gnu/libOpenGL.so)
#set(OPENGL_glx_LIBRARY /usr/lib/x86_64-linux-gnu/)
# libraries - I'm probably doing this a rubbish way
# SDL2
if(EXISTS /usr/lib/arm-linux-gnueabihf/cmake/SDL2/)
set(SDL2_DIR /usr/lib/arm-linux-gnueabihf/cmake/SDL2/)
elseif(EXISTS /usr/lib/x86_64-linux-gnu/cmake/SDL2/)
set(SDL2_DIR /usr/lib/x86_64-linux-gnu/cmake/SDL2/)
endif()
if(EXISTS /usr/lib/arm-linux-gnueabihf/libOpenGL.so)
set(OPENGL_opengl_LIBRARY /usr/lib/arm-linux-gnueabihf/libOpenGL.so)
elseif(EXISTS /usr/lib/x86_64-linux-gnu/libOpenGL.so)
set(OPENGL_opengl_LIBRARY /usr/lib/x86_64-linux-gnu/libOpenGL.so)
endif()
if(EXISTS /usr/lib/arm-linux-gnueabihf/)
set(OPENGL_glx_LIBRARY /usr/lib/arm-linux-gnueabihf/)
elseif(EXISTS /usr/lib/x86_64-linux-gnu/)
set(OPENGL_glx_LIBRARY /usr/lib/x86_64-linux-gnu/)
endif()
# headers
set(OPENGL_INCLUDE_DIR /usr/include/GL/)
find_package(SDL2 REQUIRED)
find_package(OpenGL)
include_directories(${SDL2_INCLUDE_DIRS})
include_directories("3rdparty")
include_directories(".")
endif (UNIX)
set(SOURCE_FILES main.cpp)
set(TESTRUNNER_FILES test/testcommon.cpp)
add_subdirectory("3rdparty/imgui")
add_subdirectory("3rdparty/lua-5.4.4/src")
add_subdirectory("components")
add_subdirectory("utils")
add_subdirectory("windows")
add_subdirectory("test")
add_subdirectory("system")
add_subdirectory("resources")
add_subdirectory("machines")
add_subdirectory("3rdparty/perfect6502")
project (retrotools VERSION 0.1 HOMEPAGE_URL https://github.com/mslinklater)
configure_file(version.h.in version.h)
add_executable(retrotools ${SOURCE_FILES})
target_include_directories(retrotools PUBLIC "${PROJECT_BINARY_DIR}" ".")
target_link_libraries(retrotools ${SDL2_LIBRARIES} ${OPENGL_opengl_LIBRARY})
target_compile_options(retrotools PRIVATE -Wall -Werror -Wno-psabi -g)
add_executable(TestRunner ${TESTRUNNER_FILES})
target_include_directories(TestRunner PUBLIC "${PROJECT_BINARY_DIR}" ".")
target_link_libraries(TestRunner ${SDL2_LIBRARIES} ${OPENGL_opengl_LIBRARY} gtest_main)
target_compile_options(TestRunner PRIVATE -Wall -Werror -Wno-psabi -g)