-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
54 lines (40 loc) · 1.82 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
cmake_minimum_required(VERSION 3.19)
project(Grainflow)
set(CMAKE_OSX_ARCHITECTURES x86_64;arm64)
enable_testing()
string(REGEX REPLACE "(.*)/" "" THIS_PACKAGE_NAME "${CMAKE_CURRENT_SOURCE_DIR}")
if (APPLE)
if (${CMAKE_GENERATOR} MATCHES "Xcode")
if (${XCODE_VERSION} VERSION_LESS 10)
message(STATUS "Xcode 10 or higher is required. Please install from the Mac App Store.")
return ()
elseif(${XCODE_VERSION} VERSION_GREATER_EQUAL 12)
set(C74_BUILD_FAT YES)
endif ()
endif ()
if (NOT CMAKE_OSX_ARCHITECTURES)
if(C74_BUILD_FAT)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "macOS architecture" FORCE)
else()
set(CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} CACHE STRING "macOS architecture" FORCE)
endif()
message("CMAKE_OSX_ARCHITECTURES set to ${CMAKE_OSX_ARCHITECTURES}")
endif()
endif()
# Misc setup and subroutines
include(${CMAKE_CURRENT_SOURCE_DIR}/source/min-api/script/min-package.cmake)
# Add the Lib, if it exists
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/source/min-lib/CMakeLists.txt")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/source/min-lib)
endif ()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/source/GrainflowLib)
# Generate a project for every folder in the "source/projects" folder
SUBDIRLIST(PROJECT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/source/projects)
foreach (project_dir ${PROJECT_DIRS})
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/source/projects/${project_dir}/CMakeLists.txt")
message("Generating: ${project_dir}")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/source/projects/${project_dir})
endif ()
endforeach ()
# Comment the line below if you want automatic cmake regneration enabled
set(CMAKE_SUPPRESS_REGENERATION true)