浏览代码

Merge remote-tracking branch 'refs/remotes/marcobambini/master'

Saša Barišić 8 年之前
父节点
当前提交
0ae7e57f20
共有 3 个文件被更改,包括 46 次插入0 次删除
  1. 39 0
      CMakeLists.txt
  2. 2 0
      CONTRIBUTING.md
  3. 5 0
      CONTRIBUTORS

+ 39 - 0
CMakeLists.txt

@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 3.0)
+
+SET(COMPILER_DIR src/compiler/)
+SET(RUNTIME_DIR src/runtime/)
+SET(SHARED_DIR src/shared/)
+SET(UTILS_DIR src/utils/)
+
+SET(UNITTEST_SRC src/cli/unittest.c)
+SET(GRAVITY_SRC src/cli/gravity.c)
+
+AUX_SOURCE_DIRECTORY(${COMPILER_DIR} COMPILER_FILES)
+AUX_SOURCE_DIRECTORY(${RUNTIME_DIR} RUNTIME_FILES)
+AUX_SOURCE_DIRECTORY(${SHARED_DIR} SHARED_FILES)
+AUX_SOURCE_DIRECTORY(${UTILS_DIR} UTILS_FILES)
+
+include_directories(${COMPILER_DIR} ${RUNTIME_DIR} ${SHARED_DIR} ${UTILS_DIR})
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -std=c11")
+
+SET(SRC_FILES ${COMPILER_FILES} ${RUNTIME_FILES} ${SHARED_FILES} ${UTILS_FILES})
+
+ADD_LIBRARY(libgravity OBJECT ${SRC_FILES})
+
+if(WIN32)
+    LIST(APPEND LIBS "m" "Shlwapi")
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    LIST(APPEND LIBS "m")
+elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+    LIST(APPEND LIBS "m" "rt")
+endif()
+
+ADD_EXECUTABLE(unittest ${UNITTEST_SRC} $<TARGET_OBJECTS:libgravity>)
+TARGET_LINK_LIBRARIES(unittest ${LIBS})
+
+
+ADD_EXECUTABLE(gravity ${GRAVITY_SRC} $<TARGET_OBJECTS:libgravity>)
+TARGET_LINK_LIBRARIES(gravity ${LIBS})
+
+

+ 2 - 0
CONTRIBUTING.md

@@ -16,3 +16,5 @@ Feel free to expand this section with a more formal description of the syntax ru
 If you fix a bug or if you add a new functionality then a unit-test is required.
 A unit-test is a single source code file that is able to run under the unittest executable file.
 You are free to test your functionalities/fixes into a single unit-test file or split the test in more files.
+
+Don't forget to add your name and your email address to the official **CONTRIBUTORS** file!

+ 5 - 0
CONTRIBUTORS

@@ -0,0 +1,5 @@
+# This is the official list of people who contributed to the Gravity repository in some way.
+# Please keep the list sorted.
+
+Marco Bambini <[email protected]>
+Saša Barišić  <[email protected]>