aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 3156c0d938137ff1daa64c370cd9a723e62a5a43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
cmake_minimum_required(VERSION 2.8.11)
project(ecgen)

set(CMAKE_LIBRARY_PATH ${CMAKE_SOURCE_DIR}/lib)

SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -Wall -Werror -pedantic")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -Wall")

add_custom_command(
        OUTPUT gp.c gp.h
        COMMAND gp2c -g -i4 gp/gp.gp | clang-format | awk "BEGIN{print \"#ifndef GP_H\" > \"gp.h\"; print \"#define GP_H\" >> \"gp.h\";} { if\(found\) print >> \"gp.c\"; else print >> \"gp.h\"} /End of prototype/{found=1; print \"\#include \\\"gp.h\\\"\" > \"gp.c\"; print \"#endif //GP_H\" >> \"gp.h\"}"
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
        COMMENT "gp2c gp.gp"
        VERBATIM
)

add_custom_target(gp2c ALL DEPENDS gp.c gp.h)

include_directories(src)
include_directories(lib)

file(GLOB ECGEN_SRC "src/ecgen.c" "src/math/*.c" "src/cm/*.c" "src/invalid/*.c" "src/io/*.c" "src/exhaustive/*.c" )

add_executable(ecgen ${ECGEN_SRC})

find_library(parson parson/libparson.a)

target_link_libraries(ecgen pari rt ${parson})