-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
77 lines (66 loc) · 2.8 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cmake_minimum_required(VERSION 2.6)
project(mU CXX)
if ("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
set(MinGW TRUE)
else()
set(MinGW FALSE)
endif()
if (MinGW)
set(POSSIBLE_LIBRARY_DIRS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{AC2C1BDB-1E91-4F94-B99C-E716FE2E9C75}_is1;InstallLocation]/lib"
c:/MinGW/lib /MinGW/lib)
else()
set(POSSIBLE_LIBRARY_DIRS "")
endif()
if(UNIX OR MinGW)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} "-E" "-P" "-v" "-dD"
"${CMAKE_ROOT}/Modules/DummyCXXFile.cxx"
OUTPUT_VARIABLE DISCOVERED_CONFIGURATION
ERROR_VARIABLE DISCOVERED_CONFIGURATION)
string(REGEX REPLACE ".*> search starts here:(.*)End of search list.*"
"\\1" DISCOVERED_INCLUDE_DIRS ${DISCOVERED_CONFIGURATION})
string(STRIP ${DISCOVERED_INCLUDE_DIRS} DISCOVERED_INCLUDE_DIRS)
# string(REGEX REPLACE ".*End of search list.(.*)COMPILER_PATH.*" "\\1"
# DISCOVERED_DEFINES ${DISCOVERED_CONFIGURATION})
# string(REGEX REPLACE "^#define [^ ]+\\([^$]*$" ""
# DISCOVERED_DEFINES ${DISCOVERED_DEFINES})
# string(REGEX REPLACE "^#define ([^ ]+) (.+)$" "^\\1=\\2$"
# DISCOVERED_DEFINES ${DISCOVERED_DEFINES})
# string(REGEX REPLACE "^#define ([^ ]+)$" "^\\1$"
# DISCOVERED_DEFINESS ${DISCOVERED_DEFINES})
endif()
find_library(GMP gmp PATHS ${POSSIBLE_LIBRARY_DIRS})
find_library(MPFR mpfr PATHS ${POSSIBLE_LIBRARY_DIRS})
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
elseif(UNIX)
set(Boost_USE_STATIC_LIBS OFF)
else()
message(FATAL_ERROR "building on an unsupported operating system")
endif()
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package( Boost 1.42.0 COMPONENTS system )
if(NOT Boost_FOUND)
message(SEND_ERROR "boost library not found")
# TODO: reference to "developer getting started" page
endif()
set(mU_HEADER_DIR ${DISCOVERED_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${mU_SOURCE_DIR}/Include)
set(CMAKE_CXX_FLAGS "-Wno-deprecated")
set(EXECUTABLE_OUTPUT_PATH ..)
set(LIBRARY_OUTPUT_PATH ..)
# FIXME: can we simply set the library type to SHARED?
# issue 1: what's the difference between SHARED and MODULE on UNIX gcc
# and MinGW gcc?
# issue 2: MODULEs can't be linked to other MODULEs, but we need to link
# Function.dll into Matrix.dll
if(WIN32)
set(PACKAGE_LIB_TYPE SHARED)
elseif(UNIX)
set(PACKAGE_LIB_TYPE SHARED)
else()
message(FATAL_ERROR "building on an unsupported operating system")
endif()
add_subdirectory(Kernel)
add_subdirectory(Package)