浏览代码

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 年前
父节点
当前提交
81ccada244
共有 2 个文件被更改,包括 32 次插入28 次删除
  1. 25
    14
      CMakeLists.txt
  2. 7
    14
      LemmaCore/CMakeLists.txt

+ 25
- 14
CMakeLists.txt 查看文件

32
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
32
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
33
     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
33
     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
34
 )
34
 )
35
+add_compile_options(-DHAVE_YAMLCPP) 
35
 
36
 
36
 # tinyxml2, this library is used for XML IO 
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
 if ( MATIO_SUPPORT )
52
 if ( MATIO_SUPPORT )
53
+	add_compile_options(-DHAVE_MATIO) 
49
 	# matio, this library is used for MATLAB file IO
54
 	# matio, this library is used for MATLAB file IO
50
 	ExternalProject_ADD(MATIO
55
 	ExternalProject_ADD(MATIO
51
 		GIT_REPOSITORY  "git://git.code.sf.net/p/matio/matio"
56
 		GIT_REPOSITORY  "git://git.code.sf.net/p/matio/matio"
65
 #####################
70
 #####################
66
 project(LEMMA_CXX)
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
 set(LEMMA_VERSION_MAJOR "0")
83
 set(LEMMA_VERSION_MAJOR "0")
73
 set(LEMMA_VERSION_MINOR "0")
84
 set(LEMMA_VERSION_MINOR "0")
87
 add_subdirectory (LemmaCore) 
98
 add_subdirectory (LemmaCore) 
88
 
99
 
89
 # TODO add compiler specific instructions
100
 # TODO add compiler specific instructions
90
-add_compile_options(-std=c++11) 
101
+
91
 
102
 
92
 include_directories(${CMAKE_INSTALL_PREFIX}/include)
103
 include_directories(${CMAKE_INSTALL_PREFIX}/include)
93
 add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")
104
 add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")

+ 7
- 14
LemmaCore/CMakeLists.txt 查看文件

1
 include_directories(${CMAKE_INSTALL_PREFIX}/include)
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
 add_subdirectory("src")
3
 add_subdirectory("src")
9
 
4
 
10
-# TODO fill all the files
11
 add_library( lemmacore ${SOURCE} )  
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
 add_dependencies(lemmacore YAML-CPP)
8
 add_dependencies(lemmacore YAML-CPP)
20
-add_dependencies(lemmacore TINYXML2)
9
+if (TINYXML_SUPPORT)
10
+	add_dependencies(lemmacore TINYXML2)
11
+endif()
21
 if (MATIO_SUPPORT)
12
 if (MATIO_SUPPORT)
22
 	add_dependencies(lemmacore MATIO)
13
 	add_dependencies(lemmacore MATIO)
23
 endif()
14
 endif()
24
-target_link_libraries(lemmacore ${VTK_LIBRARIES})
15
+if (VTK_SUPPORT) 
16
+	target_link_libraries(lemmacore ${VTK_LIBRARIES})
17
+endif()
25
 target_link_libraries(lemmacore "yaml-cpp")
18
 target_link_libraries(lemmacore "yaml-cpp")

正在加载...
取消
保存