This repository was archived by the owner on Feb 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
36 lines (31 loc) · 1.57 KB
/
Copy pathCMakeLists.txt
File metadata and controls
36 lines (31 loc) · 1.57 KB
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
cmake_minimum_required(VERSION 3.15)
project(Game)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_C_COMPILER "/Library/Developer/CommandLineTools/usr/bin/cc")
set(CMAKE_CXX_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -Wl,-ld_classic")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
file(GLOB SOURCE_FILES CONFIGURE_DEPENDS src/*.cpp)
add_executable(game ${SOURCE_FILES})
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_include_directories(game PRIVATE ${CMAKE_SOURCE_DIR}/lib/linux/include)
target_link_directories(game PRIVATE ${CMAKE_SOURCE_DIR}/lib/linux/lib)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_library(SDL2_LIBRARY NAME SDL2)
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
target_include_directories(game PRIVATE ${CMAKE_SOURCE_DIR}/lib/macosx/include)
target_include_directories(game PRIVATE ${OPENGL_INCLUDE_DIR})
target_include_directories(game PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_directories(game PRIVATE ${CMAKE_SOURCE_DIR}/lib/macosx/lib)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(game sgg GL GLEW SDL2 SDL2_mixer freetype)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(game sgg OpenGL::GL GLEW::GLEW SDL2::SDL2 /opt/homebrew/lib/libSDL2_mixer.dylib /opt/homebrew/lib/libfreetype.dylib)
endif()
set_target_properties(game PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)