Browse Source

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 9 years ago
parent
commit
8bfa5ebc8b
3 changed files with 39 additions and 17 deletions
  1. 16
    16
      CMakeLists.txt
  2. 7
    1
      LemmaCore/CMakeLists.txt
  3. 16
    0
      Modules/CMakeLists.txt

+ 16
- 16
CMakeLists.txt View File

2
 
2
 
3
 project (Lemma CXX)
3
 project (Lemma CXX)
4
 
4
 
5
-
6
 # required external programs (for runtime of nix, not buildtime)
5
 # required external programs (for runtime of nix, not buildtime)
7
 FIND_PROGRAM(HAVEGIT git
6
 FIND_PROGRAM(HAVEGIT git
8
   PATHS /usr/bin/ /bin ENV PATH NO_DEFAULT_PATH
7
   PATHS /usr/bin/ /bin ENV PATH NO_DEFAULT_PATH
45
 	UPDATE_COMMAND ""
44
 	UPDATE_COMMAND ""
46
 	PATCH_COMMAND ""
45
 	PATCH_COMMAND ""
47
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
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
 add_compile_options(-DHAVE_YAMLCPP) 
49
 add_compile_options(-DHAVE_YAMLCPP) 
51
 
50
 
80
 	)
79
 	)
81
 endif()
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
 option (VTK_SUPPORT "VTK library for visualisation and grids" OFF)
83
 option (VTK_SUPPORT "VTK library for visualisation and grids" OFF)
90
 if (VTK_SUPPORT) 
84
 if (VTK_SUPPORT) 
91
 	find_package(VTK 6 REQUIRED NO_MODULE)
85
 	find_package(VTK 6 REQUIRED NO_MODULE)
92
 	include(${VTK_USE_FILE})
86
 	include(${VTK_USE_FILE})
93
 	add_compile_options(-DLEMMAUSEVTK) 
87
 	add_compile_options(-DLEMMAUSEVTK) 
94
-
95
 	# Compile Matplot_vtk if VTK is present
88
 	# Compile Matplot_vtk if VTK is present
96
 	add_subdirectory(Matplot_vtk)	
89
 	add_subdirectory(Matplot_vtk)	
97
 	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
90
 	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
98
-
99
 endif()
91
 endif()
100
 
92
 
93
+#####################
94
+# Lemma Configuration
95
+#####################
96
+
97
+####################
101
 # Add the c++11 flag 
98
 # Add the c++11 flag 
99
+# TODO add compiler specific instructions
102
 include(CheckCXXCompilerFlag)
100
 include(CheckCXXCompilerFlag)
103
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
101
 CHECK_CXX_COMPILER_FLAG(-std=c++11 COMPILER_SUPPORTS_CXX11)
104
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
102
 CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_SUPPORTS_CXX0X)
107
 elseif(COMPILER_SUPPORTS_CXX0X)
105
 elseif(COMPILER_SUPPORTS_CXX0X)
108
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
106
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
109
 else()
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
 endif()
109
 endif()
112
-#add_compile_options(-std=c++11) 
113
 
110
 
114
 set(LEMMA_VERSION_MAJOR "0")
111
 set(LEMMA_VERSION_MAJOR "0")
115
 set(LEMMA_VERSION_MINOR "0")
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
 configure_file (
116
 configure_file (
120
   "${PROJECT_SOURCE_DIR}/include/LemmaConfig.h.in"
117
   "${PROJECT_SOURCE_DIR}/include/LemmaConfig.h.in"
128
 link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
125
 link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
129
 add_subdirectory (LemmaCore) 
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
 include_directories(${CMAKE_INSTALL_PREFIX}/include)
134
 include_directories(${CMAKE_INSTALL_PREFIX}/include)
135
 add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")
135
 add_executable(Hello "${PROJECT_SOURCE_DIR}/src/test.cpp")
136
 target_link_libraries(Hello lemmacore)
136
 target_link_libraries(Hello lemmacore)

+ 7
- 1
LemmaCore/CMakeLists.txt View File

2
 
2
 
3
 add_subdirectory("src")
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
 # Linking
10
 # Linking
8
 add_dependencies(lemmacore YAML-CPP)
11
 add_dependencies(lemmacore YAML-CPP)
18
 endif()
21
 endif()
19
 target_link_libraries(lemmacore "yaml-cpp")
22
 target_link_libraries(lemmacore "yaml-cpp")
20
 
23
 
24
+# Install
25
+install ( TARGETS lemmacore DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )
26
+
21
 option( BUILDEXAMPLES "Compile example Lemma applications" OFF )
27
 option( BUILDEXAMPLES "Compile example Lemma applications" OFF )
22
 if (BUILDEXAMPLES)
28
 if (BUILDEXAMPLES)
23
 	add_subdirectory(examples)
29
 	add_subdirectory(examples)

+ 16
- 0
Modules/CMakeLists.txt View File

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…
Cancel
Save