-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
129 lines (90 loc) · 4.53 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
cmake_minimum_required(VERSION 3.19.1 FATAL_ERROR)
#-----------------------------------------------------
# really not using cmake for mac, but this was used in the past so leaving it in
# still building Win using Cmake. macOS uses avx2 and Win uses avx2.
set(BUILD_MAC FALSE)
set(BUILD_WIN FALSE)
if (APPLE)
message(STATUS "build for macOS")
set(BUILD_MAC TRUE)
elseif (WIN32)
message(STATUS "build for win x64")
set(BUILD_WIN TRUE)
endif()
#-----------------------------------------------------
# suppress ZERO_CHECK project
set(CMAKE_SUPPRESS_REGENERATION true)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_DEFAULT_STARTUP_PROJECT "kramc")
#-----------------------------------------------------
if (BUILD_WIN)
# cmake translates project to sln in Win, but to xcode projects on Mac.
# No way to make xcode workspaces, but could do manually.
set(myTargetWorkspace kramWorkspace)
project(${myTargetWorkspace} LANGUAGES C CXX)
# use clang-cl on Win, have to set both
# this is suggested way to set, but github already reports clang 17.0.3 with VS extensions
# as the default compiler
# set(CMAKE_C_COMPILER "clang-cl")
# set(CMAKE_CXX_COMPILER "clang-cl")
# want to only use clang across all platforms
message(STATUS "Using ${CMAKE_CXX_COMPILER_ID} compiler")
#-----------------------------------------------------
# the kram static library libkram which should build on iOS/Android/Mac/Win
# this doesn't set a project, but maybe it should
add_subdirectory(libkram)
# the CLI app for Mac/Win that can build content for other platforms, uses libkram
add_subdirectory(kramc)
# this is an Explorer thumbnail extension (run script to un/register), uses libkram
add_subdirectory(kram-thumb-win)
# hack hlslparser for win build into kram for now, does not use kram
# add_subdirectory(hlslparser)
#-----------------------------------------------------
# was considering platform-specific builds, but mac/win don't conflict
set(BIN_DIR ${PROJECT_SOURCE_DIR}/bin)
# install doesn't seem to do anything on WIN32, the build elements are not copied
install(TARGETS libkram ARCHIVE DESTINATION ${BIN_DIR})
install(TARGETS kram RUNTIME DESTINATION ${BIN_DIR})
install(TARGETS kram-thumb-win LIBRARY DESTINATION ${BIN_DIR})
# hlslparser is also now in the kram build. Keep executables up to date.
# I would use the sln file, but msbuild doesn't like to be called from cibuld.sh
# This builds but has a lot of warnings. When I resume work, will re-instate.
# install(TARGETS hlslparser RUNTIME DESTINATION ${BIN_DIR})
endif()
#-----------------------------------------------------
# This part is unmaintained. Couldn't build app extensions via CMake.
# So now just mapintain projects
if (BUILD_MAC)
# cmake translates project to sln in Win, but to xcode projects on Mac.
# No way to make xcode workspaces, but could do manually.
set(myTargetWorkspace kramWorkspace)
project(${myTargetWorkspace} LANGUAGES C CXX OBJCXX)
# CMAKE_OSX_DEPLOYMENT_TARGET must be set as a CACHE variable, or it will be stripped
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" CACHE STRING "Minimum macOS")
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" CACHE STRING "Architecture macOS")
#-----------------------------------------------------
# the kram static library libkram which should build on iOS/Android/Mac/Win
# this doesn't set a project, but maybe it should
add_subdirectory(libkram)
# the CLI app for Mac/Win that can build content for other platforms, uses libkram
add_subdirectory(kramc)
# the viewer is only written for macOS Intel/ARM currently, uses libkram
add_subdirectory(kramv)
# ps plugin that uses libkram
add_subdirectory(plugin)
# hlslparser needs some more work to modernize to a C++ style HLSL syntax
add_subdirectory(hlslparser)
#-----------------------------------------------------
# was considering platform-specific builds, but mac/win don't conflict
set(BIN_DIR ${PROJECT_SOURCE_DIR}/bin)
install(TARGETS libkram ARCHIVE DESTINATION ${BIN_DIR})
install(TARGETS kram RUNTIME DESTINATION ${BIN_DIR})
install(TARGETS kramv BUNDLE DESTINATION ${BIN_DIR})
install(TARGETS hlslparser RUNTIME DESTINATION ${BIN_DIR})
# photoshop plugin
# install(TARGETS kram-ps BUNDLE DESTINATION ${BIN_DIR})
endif()