[build] Fix CMake build.
[ginac.git] / ginac / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 set(ginaclib_sources
4     add.cpp
5     archive.cpp
6     basic.cpp
7     clifford.cpp
8     color.cpp
9     constant.cpp
10     excompiler.cpp
11     ex.cpp
12     expair.cpp
13     expairseq.cpp
14     exprseq.cpp
15     factor.cpp
16     fail.cpp
17     fderivative.cpp
18     function.cpp
19     idx.cpp
20     indexed.cpp
21     inifcns.cpp
22     inifcns_gamma.cpp
23     inifcns_nstdsums.cpp
24     inifcns_trans.cpp
25     integral.cpp
26     lst.cpp
27     matrix.cpp
28     mul.cpp
29     ncmul.cpp
30     normal.cpp
31     numeric.cpp
32     operators.cpp
33     parser/default_reader.cpp
34     parser/lexer.cpp
35     parser/parse_binop_rhs.cpp
36     parser/parse_context.cpp
37     parser/parser_compat.cpp
38     parser/parser.cpp
39     polynomial/chinrem_gcd.cpp
40     polynomial/collect_vargs.cpp
41     polynomial/cra_garner.cpp
42     polynomial/divide_in_z_p.cpp
43     polynomial/gcd_uvar.cpp
44     polynomial/mgcd.cpp
45     polynomial/mod_gcd.cpp
46     polynomial/normalize.cpp
47     polynomial/optimal_vars_finder.cpp
48     polynomial/pgcd.cpp
49     polynomial/primpart_content.cpp
50     polynomial/remainder.cpp
51     polynomial/upoly_io.cpp
52     power.cpp
53     print.cpp
54     pseries.cpp
55     registrar.cpp
56     relational.cpp
57     remember.cpp
58     symbol.cpp
59     symmetry.cpp
60     tensor.cpp
61     utils.cpp
62     wildcard.cpp
63 )
64
65 set(ginaclib_public_headers
66     ginac.h
67     add.h
68     archive.h
69     assertion.h
70     basic.h
71     class_info.h
72     clifford.h
73     color.h
74     constant.h
75     container.h
76     ex.h
77     excompiler.h
78     expair.h
79     expairseq.h 
80     exprseq.h
81     fail.h
82     factor.h
83     fderivative.h
84     flags.h
85     ${CMAKE_CURRENT_BINARY_DIR}/function.h
86     hash_map.h
87     idx.h
88     indexed.h 
89     inifcns.h
90     integral.h
91     lst.h
92     matrix.h
93     mul.h
94     ncmul.h
95     normal.h
96     numeric.h
97     operators.h 
98     power.h
99     print.h
100     pseries.h
101     ptr.h
102     registrar.h
103     relational.h
104     structure.h 
105     symbol.h
106     symmetry.h
107     tensor.h
108     version.h
109     wildcard.h 
110     parser/parser.h 
111     parser/parse_context.h
112 )
113
114 set(ginaclib_private_headers
115     remember.h
116     utils.h
117     crc32.h
118     hash_seed.h
119     compiler.h
120     parser/lexer.h
121     parser/debug.h
122     polynomial/gcd_euclid.h
123     polynomial/remainder.h
124     polynomial/normalize.h
125     polynomial/upoly.h
126     polynomial/ring_traits.h
127     polynomial/mod_gcd.h
128     polynomial/cra_garner.h
129     polynomial/upoly_io.h
130     polynomial/prem_uvar.h
131     polynomial/eval_uvar.h
132     polynomial/interpolate_padic_uvar.h
133     polynomial/sr_gcd_uvar.h
134     polynomial/heur_gcd_uvar.h
135     polynomial/chinrem_gcd.h
136     polynomial/collect_vargs.h
137     polynomial/divide_in_z_p.h
138     polynomial/euclid_gcd_wrap.h
139     polynomial/eval_point_finder.h
140     polynomial/newton_interpolate.h
141     polynomial/optimal_vars_finder.h
142     polynomial/pgcd.h
143     polynomial/poly_cra.h
144     polynomial/primes_factory.h
145     polynomial/smod_helpers.h
146     polynomial/debug.h
147 )
148
149 add_library(ginac ${ginaclib_sources})
150 set_target_properties(ginac PROPERTIES
151         SOVERSION ${ginaclib_soversion}
152         VERSION ${ginaclib_version})
153 target_link_libraries(ginac ${CLN_LIBRARIES})
154 include_directories(${CMAKE_SOURCE_DIR}/ginac)
155
156 if (NOT BUILD_SHARED_LIBS)
157         set_target_properties(ginac PROPERTIES OUTPUT_NAME "ginac")
158         # Avoid the static library vs import library conflict (necessary for
159         # m$ toolchain).
160         set_target_properties(ginac PROPERTIES PREFIX "lib")
161 endif()
162
163 install(TARGETS ginac LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
164                       RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
165                       ARCHIVE DESTINATION "${LIB_INSTALL_DIR}")
166 install(FILES ${ginaclib_public_headers} DESTINATION "${INCLUDE_INSTALL_DIR}/ginac")
167
168 add_custom_command(
169         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.h
170         COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy
171         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy ${CMAKE_CURRENT_SOURCE_DIR}/function.py)
172
173 add_custom_command(
174         OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.cpp
175         COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.cpp ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy
176         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy ${CMAKE_CURRENT_SOURCE_DIR}/function.py)
177