-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
44 lines (34 loc) · 1.18 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
cmake_minimum_required(VERSION 2.8.12)
project(Chip8)
add_executable(chip8 main.cpp chip8.cpp font_loader.cpp audio.cpp)
target_compile_options(chip8 PRIVATE "-std=c++11")
target_compile_options(chip8 PRIVATE "-Wall")
target_compile_options(chip8 PRIVATE "-pedantic")
target_compile_options(chip8 PRIVATE "-O3")
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
target_link_libraries(chip8 "-s USE_GLFW=3")
target_link_libraries(chip8 "-s EXPORTED_FUNCTIONS=\"['_main', '_set_instructions_per_step']\"")
target_compile_options(chip8 PRIVATE "-o chip8.html")
else()
find_package(OpenGL REQUIRED)
if (OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(chip8 ${OPENGL_LIBRARIES})
endif()
find_package(GLEW REQUIRED)
if (GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIRS})
target_link_libraries(chip8 ${GLEW_LIBRARIES})
endif()
find_package(PkgConfig REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
if (GLFW_FOUND)
include_directories(${GLFW_INCLUDE_DIRS})
target_link_libraries(chip8 ${GLFW_LIBRARIES})
endif()
find_package(OpenAL REQUIRED)
if (OPENAL_FOUND)
include_directories(${OPENAL_INCLUDE_DIR})
target_link_libraries(chip8 ${OPENAL_LIBRARY})
endif()
endif()