CMake: add WITH_LINKER_LLD option for unix platforms
[blender-staging.git] / source / blender / makesdna / intern / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # The Original Code is Copyright (C) 2006, Blender Foundation
18 # All rights reserved.
19 # ***** END GPL LICENSE BLOCK *****
20
21 # message(STATUS "Configuring makesdna")
22
23 add_definitions(-DWITH_DNA_GHASH)
24
25 blender_include_dirs(
26   ../../../../intern/atomic
27   ../../../../intern/guardedalloc
28   ../../blenlib
29   ..
30 )
31
32
33 # -----------------------------------------------------------------------------
34 # Build makesdna executable
35 set(SRC
36   dna_utils.c
37   makesdna.c
38   ../../blenlib/intern/BLI_ghash.c
39   ../../blenlib/intern/BLI_ghash_utils.c
40   ../../blenlib/intern/BLI_memarena.c
41   ../../blenlib/intern/BLI_mempool.c
42   ../../blenlib/intern/hash_mm2a.c  # needed by 'BLI_ghash_utils.c', not used directly.
43   ../../../../intern/guardedalloc/intern/mallocn.c
44   ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
45   ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
46 )
47
48 if(WIN32 AND NOT UNIX)
49   list(APPEND SRC
50     ../../../../intern/guardedalloc/intern/mmap_win.c
51   )
52 endif()
53
54 # SRC_DNA_INC is defined in the parent dir
55
56 add_cc_flags_custom_test(makesdna)
57 setup_platform_linker_flags()
58
59 add_executable(makesdna ${SRC} ${SRC_DNA_INC})
60
61 # Output dna.c
62 add_custom_command(
63   OUTPUT
64     ${CMAKE_CURRENT_BINARY_DIR}/dna.c
65     ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
66     ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c
67   COMMAND
68     "$<TARGET_FILE:makesdna>"
69     ${CMAKE_CURRENT_BINARY_DIR}/dna.c
70     ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
71     ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c
72     ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
73   DEPENDS makesdna
74 )
75
76
77 # -----------------------------------------------------------------------------
78 # Build bf_dna library
79 set(INC
80   ${CMAKE_CURRENT_BINARY_DIR}
81 )
82
83 set(INC_SYS
84
85 )
86
87 set(SRC
88   dna_defaults.c
89   dna_genfile.c
90   dna_utils.c
91   ${CMAKE_CURRENT_BINARY_DIR}/dna.c
92   ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c
93   ${SRC_DNA_INC}
94
95   dna_rename_defs.h
96   dna_utils.h
97 )
98
99 set(LIB
100 )
101
102 set_source_files_properties(
103   ${CMAKE_CURRENT_BINARY_DIR}/dna.c
104   ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
105   ${CMAKE_CURRENT_BINARY_DIR}/dna_verify.c
106   PROPERTIES GENERATED TRUE
107 )
108
109 blender_add_lib(bf_dna "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
110
111
112 # -----------------------------------------------------------------------------
113 # Build bf_dna_blenlib library
114 set(INC
115
116 )
117
118 set(INC_SYS
119
120 )
121
122 set(SRC
123   ../../blenlib/intern/BLI_ghash.c
124   ../../blenlib/intern/BLI_ghash_utils.c
125   ../../blenlib/intern/BLI_linklist.c
126   ../../blenlib/intern/BLI_memarena.c
127   ../../blenlib/intern/BLI_mempool.c
128   ../../blenlib/intern/endian_switch.c
129   ../../blenlib/intern/hash_mm2a.c
130   ../../blenlib/intern/listbase.c
131
132   ../DNA_brush_defaults.h
133   ../DNA_cachefile_defaults.h
134   ../DNA_camera_defaults.h
135   ../DNA_curve_defaults.h
136   ../DNA_defaults.h
137   ../DNA_hair_defaults.h
138   ../DNA_image_defaults.h
139   ../DNA_lattice_defaults.h
140   ../DNA_light_defaults.h
141   ../DNA_lightprobe_defaults.h
142   ../DNA_linestyle_defaults.h
143   ../DNA_material_defaults.h
144   ../DNA_mesh_defaults.h
145   ../DNA_meta_defaults.h
146   ../DNA_object_defaults.h
147   ../DNA_pointcloud_defaults.h
148   ../DNA_scene_defaults.h
149   ../DNA_simulation_defaults.h
150   ../DNA_speaker_defaults.h
151   ../DNA_texture_defaults.h
152   ../DNA_vec_defaults.h
153   ../DNA_view3d_defaults.h
154   ../DNA_volume_defaults.h
155   ../DNA_world_defaults.h
156 )
157
158 set(LIB
159 )
160
161 blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")