1 cmake_minimum_required(VERSION 2.8)
4 set(PACKAGE_VERSION "0.6.2")
5 set(RELEASE "${PACKAGE_VERSION}")
7 set(DEFINE_HAS_ISL_LIB "")
8 set(top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
10 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
13 # User's settings - C Flags
20 set(CMAKE_C_FLAGS "-O3")
21 # Debug # valgrind --show-reachable=yes --leak-check=full -v exe
23 set(CMAKE_C_FLAGS "-O0 -g3")
26 # User's settings - General C Flags
27 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99")
33 configure_file("doc/Doxyfile.in" "Doxyfile")
36 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
37 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
38 COMMENT "Generating API documentation with Doxygen" VERBATIM
41 message (STATUS "Doxygen not found :( API documentation can not be built")
47 find_program(texi2pdf_exe texi2pdf)
51 ${texi2pdf_exe} ${CMAKE_CURRENT_SOURCE_DIR}/doc/candl.texi --output=${CMAKE_CURRENT_BINARY_DIR}/candl.pdf
52 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
53 COMMENT "Generating documentation (pdf) (with texi2pdf)" VERBATIM
56 message (STATUS "texi2pdf not found :( Documentation can not be built")
61 find_package(osl REQUIRED)
65 find_library(gmp_LIB gmp)
67 message (STATUS "Library gmp found =) ${gmp_LIB}")
70 find_package(piplibMP REQUIRED)
72 message(STATUS "Library gmp not found :(")
74 find_package(piplib64 REQUIRED)
77 # Include directories (to use #include <> instead of #include "")
79 # include/candl/macros.h
80 configure_file("include/candl/macros.h.in" "include/candl/macros.h")
81 include_directories("${CMAKE_CURRENT_BINARY_DIR}/include")
83 include_directories("./include")
88 message(STATUS "C compiler = ${CMAKE_C_COMPILER}")
90 message(STATUS "Mode Release")
92 message(STATUS "Mode Debug")
94 message(STATUS "C flags = ${CMAKE_C_FLAGS}")
107 string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/source/candl.c;" "" sources "${sources}") # with ;
108 string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/source/candl.c" "" sources "${sources}") # without ;
116 target_link_libraries(candl ${OSL_LIBRARY})
118 target_link_libraries(candl ${PIPLIBMP_LIBRARY})
120 target_link_libraries(candl ${PIPLIB64_LIBRARY})
122 get_property(candl_lib_location TARGET candl PROPERTY LOCATION)
123 message(STATUS "Add candl library (shared) ${candl_lib_location}")
131 set_target_properties(candl_static PROPERTIES OUTPUT_NAME candl)
133 target_link_libraries(candl_static ${PIPLIBMP_LIBRARY})
135 target_link_libraries(candl_static ${PIPLIB64_LIBRARY})
137 target_link_libraries(candl_static ${OSL_LIBRARY})
138 get_property(candl_static_lib_location TARGET candl_static PROPERTY LOCATION)
139 message(STATUS "Add candl library (static) ${candl_static_lib_location}")
142 # Executables & tests
144 message(STATUS "---") # candl
146 message(STATUS "Add executable candl")
147 add_executable(candl_exe "source/candl.c")
148 set_target_properties(candl_exe PROPERTIES OUTPUT_NAME "candl")
149 target_link_libraries(candl_exe candl_static ${OSL_LIBRARY})
151 target_link_libraries(candl_exe candl_static ${gmp_LIB})
155 find_program(bash_exe bash)
158 message(STATUS "---")
168 foreach(test ${tests_unitary})
169 message(STATUS "Add Unitary test ${test}")
171 "tests_unitary_${test}"
173 "${CMAKE_CURRENT_SOURCE_DIR}/tests/checker.sh"
182 tests_transformations_must_fail
183 tests/transformations/must_fail/*.c
186 foreach(test ${tests_transformations_must_fail})
187 message(STATUS "Add Transformation must fail test ${test}")
189 "tests_transformations_must_fail_${test}"
191 "${CMAKE_CURRENT_SOURCE_DIR}/tests/checker.sh"
200 tests_transformations_working
201 tests/transformations/working/*.c
204 foreach(test ${tests_transformations_working})
205 message(STATUS "Add Transformation working test ${test}")
207 "tests_transformations_working_${test}"
209 "${CMAKE_CURRENT_SOURCE_DIR}/tests/checker.sh"
221 install(TARGETS candl LIBRARY DESTINATION lib)
222 install(TARGETS candl_static ARCHIVE DESTINATION lib)
223 install(DIRECTORY include/ DESTINATION include FILES_MATCHING PATTERN "*.h")
224 install(DIRECTORY include/ DESTINATION include FILES_MATCHING PATTERN "*.hpp")
225 install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/" DESTINATION include FILES_MATCHING PATTERN "*.h")
226 install(FILES candl-config.cmake DESTINATION lib/candl)
227 install(TARGETS candl_exe RUNTIME DESTINATION bin)
232 message(STATUS "You can execute:")
233 message(STATUS " make # To compile candl library & candl")
235 message(STATUS " make test # To execute tests")
236 message(STATUS " (with the first candl in the $PATH (?))")
238 message(STATUS " make install # To install library, include and CMake module")
239 message(STATUS " # If you need root access:")
240 message(STATUS " # sudo make install")
241 message(STATUS " # su -c \"make install\"")
243 message(STATUS " make doxygen # To generate the Doxygen")
246 message(STATUS " make doc # To generate the documentation")
249 message(STATUS "---")