-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
62 lines (43 loc) · 2.14 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
cmake_minimum_required(VERSION 3.15)
project(ProjectMCodes)
set(CMAKE_CXX_COMPILER ${PROJECT_SOURCE_DIR}\\BuildSystem\\Compiler\\bin\\powerpc-eabi-g++.exe)
set(CMAKE_LINKER ${PROJECT_SOURCE_DIR}\\BuildSystem\\Compiler\\bin\\powerpc-eabi-ld.exe)
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR ppc)
set(CMAKE_CROSSCOMPILING 1)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
include(CMake/DebugSettings.cmake)
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
include(CMake/Paths.cmake)
include(CMake/Functions.cmake)
create_folder(${PROJECT_BINARY_DIR}/TempCodes)
add_custom_target(resetIncludedCodes ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_BINARY_DIR}/IncludedCodes && ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/IncludedCodes
BYPRODUCTS ${PROJECT_BINARY_DIR}/IncludedCodes/*
OUTPUT ${PROJECT_BINARY_DIR}/IncludedCodes/*)
#Used to wait until everything is built
add_custom_target(codeBarrier DEPENDS resetIncludedCodes)
#Build individual codes
#Every individual library runs this function
function(add_code codeName)
#Create static library for each code group
add_library(${codeName} STATIC "${ARGN}")
add_custom_target(MOVE_${codeName} ALL
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${codeName}> ${PROJECT_BINARY_DIR}/IncludedCodes
DEPENDS ${codeName})
set_target_properties(${codeName} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/TempCodes)
SET_TARGET_PROPERTIES(${codeName} PROPERTIES SUFFIX "")
SET_TARGET_PROPERTIES(${codeName} PROPERTIES PREFIX "")
add_dependencies(codeBarrier MOVE_${codeName})
endfunction()
include_directories(${librariesDirectory})
include_directories(${globalsDirectory})
#code subdirectories
add_subdirectory(Codes)
add_subdirectory(Libraries)
add_subdirectory(Globals)
add_custom_target(build ALL
COMMAND python ${builder} ${PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}/IncludedCodes ${PPC_BIN_DIRECTORY} ${functionMapDirectory} ${settingsPath}
DEPENDS codeBarrier)