root/CMakeLists.txt @ 321

Revision 320, 3.0 kB (checked in by smidl, 15 years ago)

CMake compilation of mexes

  • Property svn:eol-style set to native
Line 
1# Compulsory line
2cmake_minimum_required(VERSION 2.6)
3
4# The name of our project is "BDM".  CMakeLists files in this project can
5# refer to the root source directory of the project as ${BDM_SOURCE_DIR} and
6# to the root binary directory of the project as ${BDM_BINARY_DIR}.
7project (BDM)
8
9# In order to be able to use the newly written FindXXX package, the
10# location of the FindXXX.cmake file must be added to the cmake modules
11# list from within a CMakeLists.txt file as follows:
12set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}\\CMake_modules\\")
13
14######################
15#Platform specific
16IF(WIN32)
17# IF YOU WANT TO USE YOUR OWN INSTALLATION OF THE NEXT EXTERNAL LIBRARIES,
18# THEN IT IS NECESSARY TO CREATE TEXT FILE "\system\WIN32\LOCAL_PATHS.TXT" WITH
19# COPIES OF THE TWO FOLLOWING LINES AND THEN CORECT ALL THE INVOLVED PATHS
20        SET(ITPP_DIR "${BDM_SOURCE_DIR}\\system\\\\win32\\itpp-4.0.6")
21        SET(ACML_DIR "${BDM_SOURCE_DIR}\\system\\win32\\acml3.6.0")
22        SET(XERCES_DIR "${BDM_SOURCE_DIR}\\system\\win32\\xerces-c_2_8_0-x86")
23
24        INCLUDE(\\system\\win32\\local_paths.txt OPTIONAL)     
25        ADD_DEFINITIONS(-DHAVE_ACML)
26ENDIF(WIN32)
27IF(APPLE)
28        SET(ITPP_DIR "${BDM_SOURCE_DIR}\\macosx\\itpp-4.0.6")
29        FIND_LIBRARY(FRAMEWORK_VECLIB vecLib)
30        ADD_DEFINITIONS(-DHAVE_XLOCALE_H)
31ENDIF(APPLE)
32IF(UNIX)
33        #This is for UNIX makefile which does only one release at a time.
34        SET(CMAKE_BUILD_TYPE Debug)
35        SET(CMAKE_CXX_FLAGS "-Wall -pipe  -Wno-unknown-pragmas -fPIC")
36        SET(CMAKE_C_FLAGS "-Wall -pipe  -Wno-unknown-pragmas -fPIC")
37        SET(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG -O2")
38        SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
39        #ADD_DEFINITIONS(-DNDEBUG)
40       
41        SET(MATLAB_ROOT ~/bin/matlab2008a)
42        # MATLAB_ROOT can be setup in Local
43ENDIF(UNIX)
44
45# Local ettings should be written to file called CMakeLists.local
46# Use this option for machine-specific options, such as prallel architectures
47INCLUDE(CMakeLists.local OPTIONAL)     
48
49FIND_PACKAGE(ITPP REQUIRED)
50FIND_PACKAGE(ACML COMPONENTS)
51FIND_PACKAGE(Matlab COMPONENTS)
52FIND_PROGRAM(MEX_COMPILER mex)
53
54IF(ITPP_FOUND)
55        INCLUDE_DIRECTORIES(${ITPP_INCLUDE_DIR})
56        LINK_DIRECTORIES(${NATIVE_ITPP_LIB_PATH})
57ENDIF(ITPP_FOUND)
58
59IF(ACML_FOUND)
60        INCLUDE_DIRECTORIES(${ACML_INCLUDE_DIR})
61        LINK_DIRECTORIES(${NATIVE_ACML_LIB_PATH})
62ENDIF(ACML_FOUND)
63
64##
65## PREPARE MACROS for building executables
66##
67
68MACRO(EXEC FN)
69        add_executable (${FN} ${FN}.cpp)
70        IF(WIN32)
71                target_link_libraries (${FN} debug itpp_debug)
72                target_link_libraries (${FN} optimized itpp)
73                target_link_libraries (${FN} libacml_dll)
74        ELSE(WIN32)
75                IF(APPLE)
76                        target_link_libraries (${FN} ${FRAMEWORK_VECLIB})
77                ENDIF(APPLE)
78                target_link_libraries (${FN} itpp)     
79        ENDIF(WIN32)
80        target_link_libraries (${FN} bdm)
81        target_link_libraries (${FN} ${ARGN}) ## Additional libraries can be added to a macro
82ENDMACRO(EXEC)
83       
84
85
86# Recurse into the "dbm" and "tests" subdirectories.  This does not actually
87# cause another cmake executable to run.  The same process will walk through
88# the project's entire directory structure.
89add_subdirectory (bdm)
90add_subdirectory (tests)
91add_subdirectory (applications)
92add_subdirectory (library)
Note: See TracBrowser for help on using the browser.