瀏覽代碼

Testing CMake build, just getting going.

enhancement_3
Trevor Irons 9 年之前
父節點
當前提交
b2b0c802cc
共有 6 個檔案被更改,包括 153 行新增0 行删除
  1. 43
    0
      CMakeLists.txt
  2. 11
    0
      LemmaCore/CMakeLists.txt
  3. 24
    0
      LemmaCore/lemma.cpp
  4. 21
    0
      LemmaCore/lemma.h
  5. 26
    0
      include/LemmaConfig.h.in
  6. 28
    0
      src/test.cpp

+ 43
- 0
CMakeLists.txt 查看文件

@@ -0,0 +1,43 @@
1
+cmake_minimum_required (VERSION 2.6)
2
+
3
+project (Lemma)
4
+
5
+###################
6
+# External Projects
7
+###################
8
+include(ExternalProject)
9
+# Yaml-cpp
10
+
11
+ExternalProject_Add(YAML_CPP
12
+	GIT_REPOSITORY  "https://github.com/jbeder/yaml-cpp.git"
13
+	GIT_TAG  "master"
14
+	UPDATE_COMMAND ""
15
+	PATCH_COMMAND ""
16
+)
17
+
18
+#####################
19
+# Lemma Configuration
20
+#####################
21
+project(LEMMA_CXX)
22
+
23
+set(LEMMA_VERSION_MAJOR "0")
24
+set(LEMMA_VERSION_MINOR "0")
25
+set(LEMMA_VERSION_PATCH "0")
26
+#set(LEMMA_VERSION "${LEMMA_CPP_VERSION_MAJOR}_${LEMMA_CPP_VERSION_MINOR}_${LEMMA_CPP_VERSION_PATCH}")
27
+
28
+configure_file (
29
+  "${PROJECT_SOURCE_DIR}/include/LemmaConfig.h.in"
30
+  "${PROJECT_BINARY_DIR}/include/LemmaConfig.h"
31
+)
32
+include_directories("${PROJECT_BINARY_DIR}/include")
33
+
34
+
35
+include_directories ("${PROJECT_SOURCE_DIR}/LemmaCore")
36
+add_subdirectory (LemmaCore) 
37
+
38
+
39
+add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")
40
+target_link_libraries(Hello lemmacore)
41
+#enable_testing()
42
+
43
+

+ 11
- 0
LemmaCore/CMakeLists.txt 查看文件

@@ -0,0 +1,11 @@
1
+#add_library(lemmacore  "${PROJECT_SOURCE_DIR}/LemmaCore/lemma.cpp" )
2
+
3
+
4
+#include_directories ("${PROJECT_SOURCE_DIR}/LemmaCore")
5
+add_library(lemmacore  "lemma.cpp" )
6
+#e) 
7
+#include_directories(LemmaCore)
8
+# "${PROJECT_BINARY_DIR}/LemmaCore")
9
+#  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/mylib>
10
+#  $<INSTALL_INTERFACE:include/mylib>  # <prefix>/include/mylib
11
+#)

+ 24
- 0
LemmaCore/lemma.cpp 查看文件

@@ -0,0 +1,24 @@
1
+/* This file is part of Lemma, a geophysical modelling and inversion API.
2
+ * More information is available at http://lemmasoftware.org
3
+ */
4
+
5
+/* This Source Code Form is subject to the terms of the Mozilla Public
6
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
7
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
+ */
9
+
10
+/**
11
+ * @file
12
+ * @date      01/15/2016 10:29:46 PM
13
+ * @version   $Id$
14
+ * @author    Trevor Irons (ti)
15
+ * @email     tirons@egi.utah.edu
16
+ * @copyright Copyright (c) 2016, University of Utah
17
+ * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC
18
+ */
19
+#include "lemma.h"
20
+
21
+float thingy() {
22
+    return 3.23f;
23
+}
24
+

+ 21
- 0
LemmaCore/lemma.h 查看文件

@@ -0,0 +1,21 @@
1
+/* This file is part of Lemma, a geophysical modelling and inversion API.
2
+ * More information is available at http://lemmasoftware.org
3
+ */
4
+
5
+/* This Source Code Form is subject to the terms of the Mozilla Public
6
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
7
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
+ */
9
+
10
+/**
11
+ * @file
12
+ * @date      01/16/2016 04:40:33 PM
13
+ * @version   $Id$
14
+ * @author    Trevor Irons (ti)
15
+ * @email     tirons@egi.utah.edu
16
+ * @copyright Copyright (c) 2016, University of Utah
17
+ * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC
18
+ */
19
+
20
+float thingy();
21
+

+ 26
- 0
include/LemmaConfig.h.in 查看文件

@@ -0,0 +1,26 @@
1
+/* This file is part of Lemma, a geophysical modelling and inversion API.
2
+ * More information is available at http://lemmasoftware.org
3
+ */
4
+
5
+/* This Source Code Form is subject to the terms of the Mozilla Public
6
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
7
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
+ */
9
+
10
+/**
11
+ * @file
12
+ * @date      01/15/2016 09:52:10 PM
13
+ * @version   $Id$
14
+ * @author    Trevor Irons (ti)
15
+ * @email     tirons@egi.utah.edu
16
+ * @copyright Copyright (c) 2016, University of Utah
17
+ * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC
18
+ */
19
+
20
+// the configured options and settings for Tutorial
21
+#define LEMMA_VERSION_MAJOR @LEMMA_VERSION_MAJOR@
22
+#define LEMMA_VERSION_MINOR @LEMMA_VERSION_MINOR@
23
+#define LEMMA_VERSION_PATCH @LEMMA_VERSION_PATCH@
24
+//#define LEMMA_VERSION @LEMMA_VERSION@
25
+
26
+

+ 28
- 0
src/test.cpp 查看文件

@@ -0,0 +1,28 @@
1
+/* This file is part of Lemma, a geophysical modelling and inversion API.
2
+ * More information is available at http://lemmasoftware.org
3
+ */
4
+
5
+/* This Source Code Form is subject to the terms of the Mozilla Public
6
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
7
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
+ */
9
+
10
+/**
11
+ * @file
12
+ * @date      01/15/2016 09:54:13 PM
13
+ * @version   $Id$
14
+ * @author    Trevor Irons (ti)
15
+ * @email     tirons@egi.utah.edu
16
+ * @copyright Copyright (c) 2016, University of Utah
17
+ * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC
18
+ */
19
+
20
+#include <iostream>
21
+#include "LemmaConfig.h"
22
+#include "lemma.h"
23
+
24
+int main() {
25
+    std::cout << "Hello Lemma " << LEMMA_VERSION_MAJOR << "\t" << LEMMA_VERSION_MINOR << std::endl;
26
+    std::cout << "thingy()\t" << thingy() << std::endl;
27
+}
28
+

Loading…
取消
儲存