Selaa lähdekoodia

CMake build is more or less functional. Testing not yet implimented or all of the examples. But the main skeleton is there and seems to be working.

enhancement_3
Trevor Irons 8 vuotta sitten
vanhempi
commit
8bfa5ebc8b
3 muutettua tiedostoa jossa 39 lisäystä ja 17 poistoa
  1. 16
    16
      CMakeLists.txt
  2. 7
    1
      LemmaCore/CMakeLists.txt
  3. 16
    0
      Modules/CMakeLists.txt

+ 16
- 16
CMakeLists.txt Näytä tiedosto

@@ -2,7 +2,6 @@ cmake_minimum_required (VERSION 2.8.7)
2 2
 
3 3
 project (Lemma CXX)
4 4
 
5
-
6 5
 # required external programs (for runtime of nix, not buildtime)
7 6
 FIND_PROGRAM(HAVEGIT git
8 7
   PATHS /usr/bin/ /bin ENV PATH NO_DEFAULT_PATH
@@ -45,7 +44,7 @@ ExternalProject_Add(YAML-CPP
45 44
 	UPDATE_COMMAND ""
46 45
 	PATCH_COMMAND ""
47 46
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
48
-    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
47
+    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=ON
49 48
 )
50 49
 add_compile_options(-DHAVE_YAMLCPP) 
51 50
 
@@ -80,25 +79,24 @@ if ( MATIO_SUPPORT )
80 79
 	)
81 80
 endif()
82 81
 
83
-#####################
84
-# Lemma Configuration
85
-#####################
86
-project(LEMMA_CXX)
87
-
88
-# We don't Build VTK, it is too much.
82
+# We don't build VTK, it is too heavy.
89 83
 option (VTK_SUPPORT "VTK library for visualisation and grids" OFF)
90 84
 if (VTK_SUPPORT) 
91 85
 	find_package(VTK 6 REQUIRED NO_MODULE)
92 86
 	include(${VTK_USE_FILE})
93 87
 	add_compile_options(-DLEMMAUSEVTK) 
94
-
95 88
 	# Compile Matplot_vtk if VTK is present
96 89
 	add_subdirectory(Matplot_vtk)	
97 90
 	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
98
-
99 91
 endif()
100 92
 
93
+#####################
94
+# Lemma Configuration
95
+#####################
96
+
97
+####################
101 98
 # Add the c++11 flag 
99
+# TODO add compiler specific instructions
102 100
 include(CheckCXXCompilerFlag)
103 101
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
104 102
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
@@ -107,14 +105,13 @@ if(COMPILER_SUPPORTS_CXX11)
107 105
 elseif(COMPILER_SUPPORTS_CXX0X)
108 106
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
109 107
 else()
110
-  message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
108
+  message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
111 109
 endif()
112
-#add_compile_options(-std=c++11) 
113 110
 
114 111
 set(LEMMA_VERSION_MAJOR "0")
115 112
 set(LEMMA_VERSION_MINOR "0")
116
-set(LEMMA_VERSION_PATCH "0")
117
-#set(LEMMA_VERSION "${LEMMA_CPP_VERSION_MAJOR}_${LEMMA_CPP_VERSION_MINOR}_${LEMMA_CPP_VERSION_PATCH}")
113
+set(LEMMA_VERSION_PATCH "1")
114
+set(LEMMA_VERSION "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}")
118 115
 
119 116
 configure_file (
120 117
   "${PROJECT_SOURCE_DIR}/include/LemmaConfig.h.in"
@@ -128,9 +125,12 @@ include_directories ("${CMAKE_INSTALL_PREFIX}/include/")
128 125
 link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
129 126
 add_subdirectory (LemmaCore) 
130 127
 
131
-# TODO add compiler specific instructions
132
-
128
+########################################################################
129
+# Build Modules
130
+add_subdirectory (Modules) 
133 131
 
132
+########################################################################
133
+# 
134 134
 include_directories(${CMAKE_INSTALL_PREFIX}/include)
135 135
 add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")
136 136
 target_link_libraries(Hello lemmacore)

+ 7
- 1
LemmaCore/CMakeLists.txt Näytä tiedosto

@@ -2,7 +2,10 @@ include_directories(${CMAKE_INSTALL_PREFIX}/include)
2 2
 
3 3
 add_subdirectory("src")
4 4
 
5
-add_library( lemmacore ${SOURCE} )  
5
+add_library( lemmacore SHARED ${SOURCE} )  
6
+set_target_properties(lemmacore PROPERTIES 
7
+	VERSION ${LEMMA_VERSION_MAJOR}
8
+	SOVERSION ${LEMMA_VERSION})
6 9
 
7 10
 # Linking
8 11
 add_dependencies(lemmacore YAML-CPP)
@@ -18,6 +21,9 @@ if (VTK_SUPPORT)
18 21
 endif()
19 22
 target_link_libraries(lemmacore "yaml-cpp")
20 23
 
24
+# Install
25
+install ( TARGETS lemmacore DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )
26
+
21 27
 option( BUILDEXAMPLES "Compile example Lemma applications" OFF )
22 28
 if (BUILDEXAMPLES)
23 29
 	add_subdirectory(examples)

+ 16
- 0
Modules/CMakeLists.txt Näytä tiedosto

@@ -0,0 +1,16 @@
1
+MACRO(SUBDIRLIST  result  curdir)
2
+  FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
3
+  SET(dirlist "")
4
+  FOREACH(child ${children})
5
+    IF(IS_DIRECTORY ${curdir}/${child})
6
+        LIST(APPEND dirlist ${child})
7
+    ENDIF()
8
+  ENDFOREACH()
9
+  SET(${result} ${dirlist})
10
+ENDMACRO()
11
+
12
+SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
13
+
14
+FOREACH(subdir ${SUBDIRS})
15
+    ADD_SUBDIRECTORY(${subdir})
16
+ENDFOREACH()

Loading…
Peruuta
Tallenna