-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
51 lines (38 loc) · 1.2 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
cmake_minimum_required(VERSION 3.10)
# Global Settings
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE Debug)
project(core)
set(DRIVER "${CMAKE_CURRENT_LIST_DIR}/src/driver.c")
if (EMSCRIPTEN)
set(DRIVER "${CMAKE_CURRENT_LIST_DIR}/src/driver_web.c")
endif ()
add_executable(${PROJECT_NAME}
${DRIVER}
${CMAKE_CURRENT_LIST_DIR}/src/core/core.c
${CMAKE_CURRENT_LIST_DIR}/src/core/env/env.c
${CMAKE_CURRENT_LIST_DIR}/src/core/gll/gll.c
${CMAKE_CURRENT_LIST_DIR}/src/core/input/input.c
${CMAKE_CURRENT_LIST_DIR}/src/core/logger/logger.c
${CMAKE_CURRENT_LIST_DIR}/src/core/thread/thread.c
${CMAKE_CURRENT_LIST_DIR}/src/core/window/window.c
)
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/libs
# Windows include directory
C:/cpplib
)
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY bin
)
# Libraries
set(CORE_LIBS "")
if (EMSCRIPTEN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s OFFSCREEN_FRAMEBUFFER=1 -s USE_WEBGL2=1")
elseif (UNIX)
set(CORE_LIBS "-lX11 -lGL -pthread")
elseif (WIN32)
set(CORE_LIBS "opengl32")
endif ()
target_link_libraries(${PROJECT_NAME} PUBLIC ${CORE_LIBS})