CMake: per-target CFLAG & CXXFLAG support
[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 #
20 # The Original Code is: all of this file.
21 #
22 # Contributor(s): Jacques Beaurain.
23 #
24 # ***** END GPL LICENSE BLOCK *****
25
26 # message(STATUS "Configuring makesdna")
27
28 add_definitions(-DWITH_DNA_GHASH)
29
30 blender_include_dirs(
31         ../../../../intern/guardedalloc
32         ../../../../intern/atomic
33         ../../blenlib
34         ..
35 )
36
37
38 # -----------------------------------------------------------------------------
39 # Build makesdna executable
40 set(SRC
41         makesdna.c
42         ../../../../intern/guardedalloc/intern/mallocn.c
43         ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
44         ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
45 )
46
47 if(WIN32 AND NOT UNIX)
48         list(APPEND SRC
49                 ../../../../intern/guardedalloc/intern/mmap_win.c
50         )
51 endif()
52
53 # SRC_DNA_INC is defined in the parent dir
54
55 add_cc_flags_custom_test(makesdna)
56
57 add_executable(makesdna ${SRC} ${SRC_DNA_INC})
58
59 # Output dna.c
60 add_custom_command(
61         OUTPUT
62                 ${CMAKE_CURRENT_BINARY_DIR}/dna.c
63                 ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
64         COMMAND
65                 "$<TARGET_FILE:makesdna>"
66                 ${CMAKE_CURRENT_BINARY_DIR}/dna.c
67                 ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
68                 ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
69         DEPENDS makesdna
70 )
71
72
73 # -----------------------------------------------------------------------------
74 # Build bf_dna library
75 set(INC
76
77 )
78
79 set(INC_SYS
80
81 )
82
83 set(SRC
84         dna_genfile.c
85         ${CMAKE_CURRENT_BINARY_DIR}/dna.c
86         ${SRC_DNA_INC}
87 )
88
89 set_source_files_properties(
90         ${CMAKE_CURRENT_BINARY_DIR}/dna.c
91         ${CMAKE_CURRENT_BINARY_DIR}/dna_type_offsets.h
92         PROPERTIES GENERATED TRUE
93 )
94
95 blender_add_lib(bf_dna "${SRC}" "${INC}" "${INC_SYS}")
96
97
98 # -----------------------------------------------------------------------------
99 # Build bf_dna_blenlib library
100 set(INC
101
102 )
103
104 set(INC_SYS
105
106 )
107
108 set(SRC
109         ../../blenlib/intern/BLI_ghash.c
110         ../../blenlib/intern/BLI_mempool.c
111         ../../blenlib/intern/endian_switch.c
112         ../../blenlib/intern/hash_mm2a.c
113         ../../blenlib/intern/listbase.c
114 )
115
116 blender_add_lib(bf_dna_blenlib "${SRC}" "${INC}" "${INC_SYS}")