Pārlūkot izejas kodu

More changes towards CMake port. Some issues with VTK still on Mac. Other than that, the main library seems to be building. Still need to add modules and install!

enhancement_3
Trevor Irons 8 gadus atpakaļ
vecāks
revīzija
81ccada244
2 mainītis faili ar 32 papildinājumiem un 28 dzēšanām
  1. 25
    14
      CMakeLists.txt
  2. 7
    14
      LemmaCore/CMakeLists.txt

+ 25
- 14
CMakeLists.txt Parādīt failu

@@ -32,20 +32,25 @@ ExternalProject_Add(YAML-CPP
32 32
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
33 33
     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
34 34
 )
35
+add_compile_options(-DHAVE_YAMLCPP) 
35 36
 
36 37
 # tinyxml2, this library is used for XML IO 
37
-ExternalProject_Add(TINYXML2
38
-	GIT_REPOSITORY "https://github.com/leethomason/tinyxml2.git"
39
-	GIT_TAG  "master"
40
-	UPDATE_COMMAND ""
41
-	PATCH_COMMAND ""
42
-    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/tinyxml2
43
-    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
44
-)
45
-
46
-option(MATIO_SUPPORT  "MATIO library support for MATLAB .mat files" ON)
38
+option(TINYXML_SUPPORT  "MATIO library support for MATLAB .mat files" OFF)
39
+if ( TINYXML_SUPPORT )
40
+	ExternalProject_Add(TINYXML2
41
+		GIT_REPOSITORY "https://github.com/leethomason/tinyxml2.git"
42
+		GIT_TAG  "master"
43
+		UPDATE_COMMAND ""
44
+		PATCH_COMMAND ""
45
+    	PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/tinyxml2
46
+    	CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
47
+	)
48
+	add_compile_options(-DTINYXMLSUPPORT) 
49
+endif()
47 50
 
51
+option(MATIO_SUPPORT  "MATIO library support for MATLAB .mat files" OFF)
48 52
 if ( MATIO_SUPPORT )
53
+	add_compile_options(-DHAVE_MATIO) 
49 54
 	# matio, this library is used for MATLAB file IO
50 55
 	ExternalProject_ADD(MATIO
51 56
 		GIT_REPOSITORY  "git://git.code.sf.net/p/matio/matio"
@@ -65,9 +70,15 @@ endif()
65 70
 #####################
66 71
 project(LEMMA_CXX)
67 72
 
68
-# We don't Build VTK, it is too much. 
69
-find_package(VTK 6 REQUIRED NO_MODULE)
70
-include(${VTK_USE_FILE})
73
+# We don't Build VTK, it is too much.
74
+option (VTK_SUPPORT "VTK library for visualisation and grids" OFF)
75
+if (VTK_SUPPORT) 
76
+	find_package(VTK 6 REQUIRED NO_MODULE)
77
+	include(${VTK_USE_FILE})
78
+	add_compile_options(-DLEMMAUSEVTK) 
79
+endif()
80
+
81
+add_compile_options(-std=c++11) 
71 82
 
72 83
 set(LEMMA_VERSION_MAJOR "0")
73 84
 set(LEMMA_VERSION_MINOR "0")
@@ -87,7 +98,7 @@ link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
87 98
 add_subdirectory (LemmaCore) 
88 99
 
89 100
 # TODO add compiler specific instructions
90
-add_compile_options(-std=c++11) 
101
+
91 102
 
92 103
 include_directories(${CMAKE_INSTALL_PREFIX}/include)
93 104
 add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")

+ 7
- 14
LemmaCore/CMakeLists.txt Parādīt failu

@@ -1,25 +1,18 @@
1 1
 include_directories(${CMAKE_INSTALL_PREFIX}/include)
2 2
 
3
-add_compile_options(-std=c++11 -DHAVE_YAMLCPP) 
4
-
5
-#file(GLOB LemmaCore_SRC
6
-#    "${CMAKE_CURRENT_DIR}/src/*.cpp"
7
-#)
8 3
 add_subdirectory("src")
9 4
 
10
-# TODO fill all the files
11 5
 add_library( lemmacore ${SOURCE} )  
12
-#		"src/lemma.cpp" 
13
-#		"src/dipolesource.cpp" 
14
-#		"src/GroundedElectricDipole.cpp" 
15
-#		"src/UngroundedElectricDipole.cpp"
16
-#)
17
-
18 6
 
7
+# Linking
19 8
 add_dependencies(lemmacore YAML-CPP)
20
-add_dependencies(lemmacore TINYXML2)
9
+if (TINYXML_SUPPORT)
10
+	add_dependencies(lemmacore TINYXML2)
11
+endif()
21 12
 if (MATIO_SUPPORT)
22 13
 	add_dependencies(lemmacore MATIO)
23 14
 endif()
24
-target_link_libraries(lemmacore ${VTK_LIBRARIES})
15
+if (VTK_SUPPORT) 
16
+	target_link_libraries(lemmacore ${VTK_LIBRARIES})
17
+endif()
25 18
 target_link_libraries(lemmacore "yaml-cpp")

Notiek ielāde…
Atcelt
Saglabāt