Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
83de7e3e
authored
Jul 31, 2015
by
Sachin Basil John
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
making cmakelist cleaner
parent
6c998fa8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
56 deletions
+54
-56
doc/tutorial/CMakeLists.txt
+54
-56
No files found.
doc/tutorial/CMakeLists.txt
View file @
83de7e3e
#CMakeLists for using EMBB as an external library in a project.
project
(
EMBB_USER_PROJECT
)
set
(
EXECUTABLE_NAME exec
)
set
(
BUILD_STATIC 1
)
cmake_minimum_required
(
VERSION 2.8.9
)
# Version number
...
...
@@ -7,6 +11,24 @@ set (EMBB_USER_PROJECT_BASE_VERSION_MAJOR 0)
set
(
EMBB_USER_PROJECT_BASE_VERSION_MINOR 0
)
set
(
EMBB_USER_PROJECT_BASE_VERSION_PATCH 1
)
#############################################
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"MSVC"
)
if
(
BUILD_STATIC
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
/MT"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
/MTd"
)
else
()
set
(
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
/MT"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
/MTd"
)
endif
()
set
(
INT_DIR
"/
${
CMAKE_CFG_INTDIR
}
/"
)
set
(
ADDITIONAL_LIBS
""
)
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
OR
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"Clang"
)
set
(
INT_DIR
"/"
)
set
(
ADDITIONAL_LIBS
"pthread"
"rt"
)
else
()
message
(
FATAL_ERROR
"Unsupported compiler
${
CMAKE_CXX_COMPILER_ID
}
"
)
endif
()
### begin external project
include
(
ExternalProject
)
file
(
GLOB EMBB_LIB_FILE
${
CMAKE_SOURCE_DIR
}
/external/embb*.tar.gz
)
...
...
@@ -16,34 +38,20 @@ ExternalProject_Add(EMBB
INSTALL_COMMAND
""
)
ExternalProject_Get_Property
(
EMBB source_dir
)
ExternalProject_Get_Property
(
EMBB binary_dir
)
set
(
EMBB_BINARY_DIR
${
binary_dir
}
)
set
(
EMBB_SOURCE_DIR
${
source_dir
}
)
set
(
EMBB_DIRS containers_cpp algorithms_cpp dataflow_cpp tasks_cpp mtapi_cpp base_cpp mtapi_c base_c
)
set
(
EMBB_GENERATED_INCLUDE base_c base_cpp tasks_cpp
)
### end external project
set
(
CMAKE_MODULE_PATH
${
CMAKE_SOURCE_DIR
}
/cmake/
)
#Find other modules if any
include_directories
(
"
${
EMBB_SOURCE_DIR
}
/algorithms_cpp/include"
"
${
EMBB_SOURCE_DIR
}
/base_c/include"
"
${
EMBB_SOURCE_DIR
}
/base_cpp/include"
"
${
EMBB_SOURCE_DIR
}
/containers_cpp/include"
"
${
EMBB_SOURCE_DIR
}
/dataflow_cpp/include"
"
${
EMBB_SOURCE_DIR
}
/mtapi_c/include"
"
${
EMBB_SOURCE_DIR
}
/mtapi_cpp/include"
"
${
EMBB_SOURCE_DIR
}
/mtapi_cpp/include"
"
${
EMBB_SOURCE_DIR
}
/tasks_cpp/include"
"
${
EMBB_BINARY_DIR
}
/base_c/include"
"
${
EMBB_BINARY_DIR
}
/base_cpp/include"
"
${
EMBB_BINARY_DIR
}
/tasks_cpp/include"
)
####################################################
file
(
GLOB_RECURSE EMBB_USER_PROJECT_SOURCES
"src/*.cpp"
"src/*.h"
)
file
(
GLOB_RECURSE EMBB_USER_PROJECT_HEADERS
"src/*.h"
)
...
...
@@ -51,55 +59,45 @@ file(GLOB_RECURSE EMBB_USER_PROJECT_HEADERS "src/*.h")
add_executable
(
${
EXECUTABLE_NAME
}
${
EMBB_USER_PROJECT_SOURCES
}
${
EMBB_USER_PROJECT_HEADERS
}
)
add_dependencies
(
${
EXECUTABLE_NAME
}
EMBB
)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"MSVC"
)
#############################################
## Visual Studio Project Adaptations
#
# Make a browsable file hierarchy when opening
# the generated visual c++ solution project in visual studio
function
(
GroupSourcesMSVC directory
)
# Make a browsable file hierarchy when opening in IDE
function
(
GroupSources directory
)
file
(
GLOB children RELATIVE
${
PROJECT_SOURCE_DIR
}
/
${
directory
}
${
PROJECT_SOURCE_DIR
}
/
${
directory
}
/*
)
foreach
(
child
${
children
}
)
if
(
IS_DIRECTORY
${
PROJECT_SOURCE_DIR
}
/
${
directory
}
/
${
child
}
)
GroupSources
MSVC
(
${
directory
}
/
${
child
}
)
GroupSources
(
${
directory
}
/
${
child
}
)
else
()
string
(
REPLACE
"/"
"
\\
"
groupname
${
directory
}
)
if
(
WIN32
)
string
(
REPLACE
"/"
"
\\
"
groupname
${
directory
}
)
endif
()
string
(
REPLACE
"src"
"Sources"
groupname
${
groupname
}
)
string
(
REPLACE
"include"
"Includes"
groupname
${
groupname
}
)
source_group
(
${
groupname
}
FILES
${
PROJECT_SOURCE_DIR
}
/
${
directory
}
/
${
child
}
)
source_group
(
${
groupname
}
FILES
${
PROJECT_SOURCE_DIR
}
/
${
directory
}
/
${
child
}
)
endif
()
endforeach
()
endfunction
()
GroupSourcesMSVC
(
src
)
target_link_libraries
(
${
EXECUTABLE_NAME
}
${
EMBB_BINARY_DIR
}
/algorithms_cpp/
${
CMAKE_CFG_INTDIR
}
/embb_algorithms_cpp.lib
${
EMBB_BINARY_DIR
}
/base_c/
${
CMAKE_CFG_INTDIR
}
/embb_base_c.lib
${
EMBB_BINARY_DIR
}
/base_cpp/
${
CMAKE_CFG_INTDIR
}
/embb_base_cpp.lib
${
EMBB_BINARY_DIR
}
/containers_cpp/
${
CMAKE_CFG_INTDIR
}
/embb_containers_cpp.lib
${
EMBB_BINARY_DIR
}
/dataflow_cpp/
${
CMAKE_CFG_INTDIR
}
/embb_dataflow_cpp.lib
${
EMBB_BINARY_DIR
}
/mtapi_c/
${
CMAKE_CFG_INTDIR
}
/embb_mtapi_c.lib
${
EMBB_BINARY_DIR
}
/mtapi_cpp/
${
CMAKE_CFG_INTDIR
}
/embb_mtapi_cpp.lib
${
EMBB_BINARY_DIR
}
/tasks_cpp/
${
CMAKE_CFG_INTDIR
}
/embb_tasks_cpp.lib
)
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
OR
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"Clang"
)
target_link_libraries
(
${
EXECUTABLE_NAME
}
${
EMBB_BINARY_DIR
}
/containers_cpp/libembb_containers_cpp.a
${
EMBB_BINARY_DIR
}
/algorithms_cpp/libembb_algorithms_cpp.a
${
EMBB_BINARY_DIR
}
/dataflow_cpp/libembb_dataflow_cpp.a
${
EMBB_BINARY_DIR
}
/tasks_cpp/libembb_tasks_cpp.a
${
EMBB_BINARY_DIR
}
/mtapi_cpp/libembb_mtapi_cpp.a
${
EMBB_BINARY_DIR
}
/base_cpp/libembb_base_cpp.a
${
EMBB_BINARY_DIR
}
/mtapi_c/libembb_mtapi_c.a
${
EMBB_BINARY_DIR
}
/base_c/libembb_base_c.a
pthread
rt
)
else
()
message
(
FATAL_ERROR
"Unsupported compiler
${
CMAKE_CXX_COMPILER_ID
}
"
)
endif
()
GroupSources
(
src
)
####################################################
if
(
BUILD_STATIC
)
set
(
pref
${
CMAKE_STATIC_LIBRARY_PREFIX
}
)
set
(
suf
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
)
else
()
set
(
pref
${
CMAKE_SHARED_LIBRARY_PREFIX
}
)
set
(
suf
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
)
endif
()
###########################################
foreach
(
dir
${
EMBB_DIRS
}
)
include_directories
(
"
${
EMBB_SOURCE_DIR
}
/
${
dir
}
/include"
)
list
(
APPEND LIBS
"
${
EMBB_BINARY_DIR
}
/
${
dir
}${
INT_DIR
}${
pref
}${
dir
}${
suf
}
"
)
endforeach
()
foreach
(
dir
${
EMBB_GENERATED_INCLUDE
}
)
include_directories
(
"
${
EMBB_BINARY_DIR
}
/
${
dir
}
/include"
)
endforeach
()
target_link_libraries
(
${
EXECUTABLE_NAME
}
${
LIBS
}
${
ADDITIONAL_LIBS
}
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment