-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakelists.txt
105 lines (102 loc) · 4.25 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
95
96
97
98
99
100
101
102
103
104
105
# Change version of the cmake accorting of your <REQUIRED>
cmake_minimum_required(VERSION 3.21.3 FATAL_ERROR)
# Do not forget update the compiler path <REQUIRED>
# set(CMAKE_C_COMPILER "/usr/bin/gcc")
# set(CMAKE_CXX_COMPILER "/usr/bin/g++")
# set(CMAKE_C_COMPILER "D:/apps/msys64/mingw64/bin/gcc.exe")
# set(CMAKE_CXX_COMPILER "D:/apps/msys64/mingw64/bin/g++.exe")
# add_definitions(-std=c++11)
# SOME SETTINGS
# Specify C++ standards
# C++ standards declerations must be above the call to add_executable
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
cmake_minimum_required(VERSION 3.20.2)
project(ehe)
#
#--------------------------------------------------------------------
add_executable(sdlTest src/sdlTest.cpp)
add_executable(simulatorEHE src/main.cpp)
add_executable(colorAnimator src/colorAnimator.cpp)
add_executable(particleExample src/particleExample.cpp)
add_executable(particleExample2 src/particleExample2.cpp)
add_executable(particleMotionBasic src/particleMotionBasic.cpp)
add_executable(singlePixel src/singlePixel.cpp)
#
#
#--------------------------------------------------------------------
add_subdirectory (src)
#
target_link_libraries(simulatorEHE PUBLIC screen)
target_link_libraries(simulatorEHE PUBLIC particle)
target_link_libraries(simulatorEHE PUBLIC swarm)
#
target_link_libraries(sdlTest PUBLIC screen )
target_link_libraries(sdlTest PUBLIC ehe-lib )
#
target_link_libraries(colorAnimator PUBLIC screen)
target_link_libraries(colorAnimator PUBLIC particle)
target_link_libraries(colorAnimator PUBLIC swarm)
#
target_link_libraries(particleExample PUBLIC screen)
target_link_libraries(particleExample PUBLIC particle)
target_link_libraries(particleExample PUBLIC swarm)
#
target_link_libraries(particleExample2 PUBLIC screen)
target_link_libraries(particleExample2 PUBLIC particle)
target_link_libraries(particleExample2 PUBLIC swarm)
#
target_link_libraries(particleMotionBasic PUBLIC screen)
target_link_libraries(particleMotionBasic PUBLIC particle)
target_link_libraries(particleMotionBasic PUBLIC swarm)
#
target_link_libraries(singlePixel PUBLIC screen)
target_link_libraries(singlePixel PUBLIC particle)
target_link_libraries(singlePixel PUBLIC swarm)
#
# target_link_libraries(eheApp )
#
#
#--------------------------------------------------------------------
#-------------- DOWNLOAD ALL THE SUBMODULES
# first open terminal and type :
# git submodule add https://github.com/libsdl-org/SDL.git libs/sdl
# git submodule add -f https://github.com/libsdl-org/SDL.git libs/sdl
# second add changes to staged area (we have to stage it)
#
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
#
#--------------------------------------------------------------------
#-------------- CHECK ALL THE SUBMODULES
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/libs/sdl/CMakeLists.txt")
message(FATAL_ERROR "The sdl submodules was not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()
#
#--------------------------------------------------------------------
add_subdirectory(libs/sdl)
#after adding sdl as a subdirectory
#we have toconfigure and build
#
# target_include_directories(simulatorEHE PUBLIC libs/sdl/include)
# target_link_directories(simulatorEHE PUBLIC libs/sdl)
# target_link_libraries(simulatorEHE PUBLIC mingw32 SDL2main SDL2) # 'mingw32 SDL2main SDL2' order important
# #
# target_include_directories(sdlTest PUBLIC libs/sdl/include)
# target_link_directories(sdlTest PUBLIC libs/sdl)
# target_link_libraries(sdlTest PUBLIC mingw32 SDL2main SDL2) # 'mingw32 SDL2main SDL2' order important
#--------------------------------------------------------------------
#
#--------------------------------------------------------------------