Ongoing Project: ATS-CMake

Note: This is a short introduction of my ongoing project. It is copied from the Wikipage of GitHub repository. Welcome to check it out at HERE!

What is CMake-ATS Project

This is a project aiming at developing a build tool for ATS. It is based on CMake. Currently, it provides some very useful CMake modules for ATS users to simplify building processes. In the near future, it will support downloading artifacts from a server to help you utilize third party ATS libraries.

Quick Start

  • Install CMake. (2.8+ preferred)
  • Install ATS. (Setup environment variables ATSHOME and PATH properly)
  • Download this project
  • Copy FindATS.cmake and ATSCC.cmake into CMake module dir. (Normally /usr/share/cmake-x.x.x/Modules on Linux)
  • Start using it!

Quick Demo

  • Say you have a small project containing hello.sats, hello.dats and main.dats. Then, you need to write a CMakeLists.txt like this:
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)

#Specify project name as HELLOWORLD, and project language as C. Yes, it is C
PROJECT (HELLOWORLD C)

#Actually, this makes CMake to find ATSCC.cmake using FindATS.cmake
FIND_PACKAGE (ATS REQUIRED)

#The ATS_FOUND is automatically set by CMake
IF (NOT ATS_FOUND)
    MESSAGE (FATAL_ERROR ”ATS Not Found!”)
ENDIF ()

#ATS_COMIPLE is the core of this project. To put it simple,
#you just specify related SATS/DATS files hear, and use a variable like TEST_SRC
#to stored the output. ATS_COMPILE will analyze their dependencies,
#compile them into #C files, and store those C file names into TEST_SRC
#You can use ATS_INCLUDE to add search paths for the compiler to find proper SATS/HATS files.
ATS_COMPILE (TEST_SRC hello.sats hello.dats main.dats)

#It generate the final file "test" using all the C files in TEST_SRC
ADD_EXECUTABLE (test ${TEST_SRC})
  • Then, to do out-of-source build, you need to make a sub-dir, say ./build/. Then your project looks like this
ProjectParent/
+-- CMakeLists.txt
+-- hello.dats
+-- hello.sats
+-- main.dats
+-- /build
    +-- ...
  • Go to ./build/, type cmake ... It will generate a Makefile for you under ./build/
  • Type make to make. And the test will show up in ./build/

2 thoughts on “Ongoing Project: ATS-CMake”

Leave a Reply