summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-12-06 07:15:39 +0100
committerMatthias Braun <matze@braunis.de>2015-12-06 07:15:39 +0100
commitaabeb2edec0218a9fb9b04f1cb810921101a0616 (patch)
tree637c02cbb9883c0312da511f7c2e70d9536e6149 /CMakeLists.txt
parenta829e811872638c18df564918780865c7396fc92 (diff)
Add CMakeLists.txt for release
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt68
1 files changed, 68 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..accf182
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,68 @@
+cmake_minimum_required(VERSION 3.0)
+cmake_policy(SET CMP0042 NEW)
+cmake_policy(SET CMP0028 NEW)
+project(cparser)
+
+set(SOURCES
+ src/adt/pset_new.c
+ src/adt/strutil.c
+ src/ast/ast.c
+ src/ast/attribute.c
+ src/ast/constfold.c
+ src/ast/entity.c
+ src/ast/printer.c
+ src/ast/string_hash.c
+ src/ast/string_rep.c
+ src/ast/symbol_table.c
+ src/ast/type.c
+ src/ast/type_hash.c
+ src/ast/types.c
+ src/ast/walk.c
+ src/driver/actions.c
+ src/driver/c_driver.c
+ src/driver/diagnostic.c
+ src/driver/driver.c
+ src/driver/help.c
+ src/driver/machine_triple.c
+ src/driver/options.c
+ src/driver/predefs.c
+ src/driver/target.c
+ src/driver/tempfile.c
+ src/driver/timing.c
+ src/driver/warning.c
+ src/firm/ast2firm.c
+ src/firm/entitymap.c
+ src/firm/firm_opt.c
+ src/firm/jump_target.c
+ src/firm/mangle.c
+ src/main.c
+ src/parser/builtins.c
+ src/parser/format_check.c
+ src/parser/input.c
+ src/parser/parser.c
+ src/parser/preprocessor.c
+ src/parser/token.c
+ src/wrappergen/write_compoundsizes.c
+ src/wrappergen/write_fluffy.c
+ src/wrappergen/write_jna.c
+)
+include_directories(src)
+
+find_package(libfirm REQUIRED)
+include_directories(${libfirm_INCLUDE_DIRS})
+
+add_executable(cparser ${SOURCES})
+target_link_libraries(cparser LINK_PRIVATE libfirm::firm)
+
+# release tarballs have src/revision.h but git checkout need a new one created
+if(NOT EXISTS src/revision.h)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ set(REVISIONH "${CMAKE_CURRENT_BINARY_DIR}/revision.h")
+ set(REVGEN echo '\#define cparser_REVISION \"'`git describe --abbrev=40 --always --dirty --match ''`'\"')
+ add_custom_command(
+ OUTPUT ${REVISIONH}
+ COMMAND ${REVGEN} | cmp -s - "${REVISIONH}" 2> /dev/null || ${REVGEN} > "${REVISIONH}"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+ SET_SOURCE_FILES_PROPERTIES(src/driver/actions.c PROPERTIES OBJECT_DEPENDS ${REVISIONH})
+endif()