Merge branch 'blender2.7'
[blender.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/guardedalloc
27         ../../../../intern/atomic
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         COMMAND
67                 "$<TARGET_FILE:makesdna>"
68                 ${CMAKE_CURRENT_BINARY_DIR}/dna.c
69                 ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
70                 ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
71         DEPENDS makesdna
72 )
73
74
75 # -----------------------------------------------------------------------------
76 # Build bf_dna library
77 set(INC
78
79 )
80
81 set(INC_SYS
82
83 )
84
85 set(SRC
86         dna_utils.c
87         dna_genfile.c
88         ${CMAKE_CURRENT_BINARY_DIR}/dna.c
89         ${SRC_DNA_INC}
90
91         dna_utils.h
92 )
93
94 set_source_files_properties(
95         ${CMAKE_CURRENT_BINARY_DIR}/dna.c
96         ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
97         PROPERTIES GENERATED TRUE
98 )
99
100 blender_add_lib(bf_dna "${SRC}" "${INC}" "${INC_SYS}")
101
102
103 # -----------------------------------------------------------------------------
104 # Build bf_dna_blenlib library
105 set(INC
106
107 )
108
109 set(INC_SYS
110
111 )
112
113 set(SRC
114         ../../blenlib/intern/BLI_ghash.c
115         ../../blenlib/intern/BLI_ghash_utils.c
116         ../../blenlib/intern/BLI_linklist.c
117         ../../blenlib/intern/BLI_memarena.c
118         ../../blenlib/intern/BLI_mempool.c
119         ../../blenlib/intern/endian_switch.c
120         ../../blenlib/intern/hash_mm2a.c
121         ../../blenlib/intern/listbase.c
122 )
123
124 blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}")