-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (52 loc) · 2.08 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
cmake_minimum_required(VERSION 3.10)
project(app CXX)
set(app "app")
message("statrt to build ${app} ...")
# for dll import use case
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set (CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl -lX11 -latomic")
set (CMAKE_CXX_FLAGS -pthread)
endif()
if(APPLE)
set (CMAKE_CXX_FLAGS "-std=c++14")
set (CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -framework Cocoa -framework IOKit -framework CoreVideo -framework OpenGL -framework CoreFoundation -framework CoreAudio -framework AudioToolbox")
message(STATUS "This macos ")
endif()
include_directories(purple/include)
include_directories(vender/glfw/include)
add_subdirectory(purple)
# add_subdirectory(vender/glfw)
aux_source_directory(sandbox SRCS)
if (WIN32)
message(STATUS "Using Win32 library")
link_directories(lib/win64)
elseif (APPLE)
message(STATUS "Using APPLE library")
link_directories(lib/mac)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
# 检查是否是树莓派桌面系统
execute_process(COMMAND uname -a OUTPUT_VARIABLE UNAME_RESULT)
string(FIND "${UNAME_RESULT}" "raspberrypi" RPI_FOUND)
if(RPI_FOUND GREATER -1)
message(STATUS "This is a Raspberry Pi system")
link_directories(lib/raspi)
else()
message(STATUS "This is a Linux system, but not a Raspberry Pi")
endif()
elseif (UNIX)
message(STATUS "Using Linux library")
link_directories(lib/linux)
elseif (UNIX AND NOT APPLE)
message(STATUS "Using RasPI library")
link_directories(lib/raspi)
else()
message(STATUS "This is not a Linux system with ARM architecture")
endif()
# link_libraries(glfw3)
add_executable(${PROJECT_NAME} ${SRCS})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-Wall")
# set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-mwindows")
target_link_libraries(${PROJECT_NAME} purple)
target_link_libraries(${PROJECT_NAME} glfw3)