Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
QTL
spell-qtl
Commits
40d5b227
Commit
40d5b227
authored
May 31, 2017
by
Damien Leroux
Browse files
Now BUILD_FOR_DEPLOYMENT works. ish.
parent
5adc5cc5
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
.idea/workspace.xml
deleted
100644 → 0
View file @
5adc5cc5
This diff is collapsed.
Click to expand it.
CMakeLists.txt
View file @
40d5b227
...
...
@@ -21,10 +21,12 @@ project(spell_qtl)
#INCLUDE(pandocology)
find_package
(
Boost 1.55.0 REQUIRED
)
set
(
CMAKE_CONFIGURATION_TYPES Debug Release CACHE
TYPE
INTERNAL FORCE
)
#
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE INTERNAL FORCE)
set
(
CMAKE_VERBOSE_MAKEFILE ON
)
set
(
BUILD_FOR_DEPLOYMENT FALSE CACHE BOOL
"Link against static libc++ and use minimal symbol version where possible"
)
MESSAGE
(
STATUS
"CMAKE VERSION
${
CMAKE_VERSION
}
"
)
MESSAGE
(
STATUS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
...
...
@@ -70,6 +72,14 @@ include_directories(AFTER ${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/inclu
include_directories
(
SYSTEM /usr/include
${
Boost_INCLUDE_DIRS
}
${
EXPAT_INCLUDE_DIR
}
${
X2C_INCLUDE_DIR
}
)
include_directories
(
AFTER /usr/include
${
Boost_INCLUDE_DIRS
}
${
EXPAT_INCLUDE_DIR
}
${
X2C_INCLUDE_DIR
}
)
if
(
${
BUILD_FOR_DEPLOYMENT
}
)
set
(
libstdcpp
${
CMAKE_BINARY_DIR
}
/libstdc++.a
)
else
(
${
BUILD_FOR_DEPLOYMENT
}
)
set
(
libstdcpp
""
)
endif
(
${
BUILD_FOR_DEPLOYMENT
}
)
MESSAGE
(
STATUS
"libstdcpp =
${
libstdcpp
}
"
)
set
(
SPELL_PEDIGREE_SRC
src/static_data.cc
src/pedigree/main.cc
...
...
@@ -89,13 +99,66 @@ set(SPELL_QTL_SRC
src/computations/basic_data.cc src/computations/probabilities.cc src/computations/model.cc src/computations/frontends.cc
)
add_executable
(
spell-pedigree
${
SPELL_PEDIGREE_SRC
}
)
add_executable
(
spell-marker
${
SPELL_MARKER_SRC
}
)
add_executable
(
spell-qtl
${
SPELL_QTL_SRC
}
)
MESSAGE
(
STATUS
"spell-pedigree src =
${
SPELL_PEDIGREE_SRC
}
"
)
#get_cmake_property(_variableNames VARIABLES)
#foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
#endforeach()
if
(
${
BUILD_FOR_DEPLOYMENT
}
)
add_executable
(
spell-pedigree
${
SPELL_PEDIGREE_SRC
}
${
libstdcpp
}
)
add_executable
(
spell-marker
${
SPELL_MARKER_SRC
}
)
add_executable
(
spell-qtl
${
SPELL_QTL_SRC
}
${
libstdcpp
}
)
add_custom_command
(
OUTPUT glibc.h libstdc++.a COMMAND
${
CMAKE_SOURCE_DIR
}
/deploy/make_old_libc_header.sh WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_custom_command
(
OUTPUT libgmp.a COMMAND
${
CMAKE_SOURCE_DIR
}
/deploy/compile_gmp.sh
${
CMAKE_BINARY_DIR
}
/glibc.h
${
CMAKE_BINARY_DIR
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
/deploy
)
add_custom_target
(
glibc.h
)
#add_custom_target(stdc++ ${CMAKE_BINARY_DIR}/libstdc++.a)
#add_library(stdc++ INTERFACE IMPORTED)
#set_property(TARGET stdc++ PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/libstdc++.a)
add_library
(
gmp INTERFACE IMPORTED
)
add_custom_target
(
pouet ALL DEPENDS
${
CMAKE_BINARY_DIR
}
/libgmp.a
)
#set_property(TARGET gmp PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/libgmp.a)
#set_target_properties(stdc++ PROPERTIES LINKER_LANGUAGE CXX)
#set_target_properties(gmp PROPERTIES LINKER_LANGUAGE C)
#add_dependencies(gmp stdc++)
#set_source_files_properties(${CMAKE_BINARY_DIR}/libgmp.a PROPERTIES GENERATED TRUE)
#set_source_files_properties(${libstdcpp} PROPERTIES GENERATED TRUE)
#set_source_files_properties(${CMAKE_BINARY_DIR}/libstdc++.a PROPERTIES EXTERNAL_OBJECT TRUE GENERATED TRUE)
SET_SOURCE_FILES_PROPERTIES
(
${
SPELL_PEDIGREE_SRC
}
${
SPELL_MARKER_SRC
}
${
SPELL_QTL_SRC
}
PROPERTIES
OBJECT_DEPENDS glibc.h
COMPILE_FLAGS
"-include
${
CMAKE_BINARY_DIR
}
/glibc.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
)
#add_dependencies(stdc++ libstdc++.a)
#add_dependencies(gmp libgmp.a)
add_dependencies
(
spell-pedigree glibc.h
)
add_dependencies
(
spell-marker glibc.h pouet
)
add_dependencies
(
spell-qtl glibc.h
)
MESSAGE
(
STATUS
" PROUT
${
libstdcpp
}
"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-include
${
CMAKE_BINARY_DIR
}
/glibc.h -rdynamic -static-libgcc"
)
target_link_libraries
(
spell-marker
${
libstdcpp
}
${
CMAKE_BINARY_DIR
}
/libgmp.a
)
target_link_libraries
(
spell-qtl
${
libstdcpp
}
)
target_link_libraries
(
spell-pedigree
${
libstdcpp
}
)
#list(APPEND spell-pedigree_SRC "${CMAKE_BINARY_DIR}/libstdc++.a")
#list(APPEND spell-qtl_SRC "${CMAKE_BINARY_DIR}/libstdc++.a")
#list(APPEND spell-marker_SRC "${CMAKE_BINARY_DIR}/libstdc++.a")
else
()
add_executable
(
spell-pedigree
${
SPELL_PEDIGREE_SRC
}
)
add_executable
(
spell-marker
${
SPELL_MARKER_SRC
}
)
add_executable
(
spell-qtl
${
SPELL_QTL_SRC
}
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-rdynamic"
)
endif
()
target_link_libraries
(
spell-marker dl gmp
)
target_link_libraries
(
spell-qtl expat dl
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-rdynamic"
)
target_link_libraries
(
spell-qtl expat dl rt
)
SET
(
EXECUTABLE_OUTPUT_PATH
${
PROJECT_BINARY_DIR
}
/bin
)
...
...
deploy/compile_gmp.sh
0 → 100755
View file @
40d5b227
#!/bin/bash
PATH_TO_GLIBC_H
=
$1
OUTPUT_PATH
=
$2
cd
gmp
# fetch GMP
cd
gmp-6.1.2
||
(
curl https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
-o
- | xz
-d
|
tar
xf -
&&
cd
gmp-6.1.2
)
# cleanup and configure
[
-f
Makefile
]
&&
make clean
CFLAGS
=
"-include
$PATH_TO_GLIBC_H
"
./configure
--disable-shared
--enable-fake-cpuid
--enable-fat
# build
make
# deploy lib
cp
.libs/libgmp.a
$OUTPUT_PATH
deploy/make_old_libc_header.sh
0 → 100755
View file @
40d5b227
#!/bin/bash
LIBCPP
=
/usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.a
maxver
=
2.9
headerf
=
${
1
:-
glibc
.h
}
set
-e
for
lib
in
libc.so.6 libm.so.6 libpthread.so.0 libdl.so.2 libresolv.so.2 librt.so.1
;
do
objdump
-T
/lib/x86_64-linux-gnu/
$lib
done
|
awk
-v
maxver
=
${
maxver
}
-vheaderf
=
${
headerf
}
-vredeff
=
${
headerf
}
.redef
-f
<
(
cat
<<
'
EOF
'
BEGIN {
split(maxver, ver, /
\.
/)
limit_ver = ver[1] * 10000 + ver[2]*100 + ver[3]
}
/GLIBC_/ {
gsub(/
\(
|
\)
/, "",
$(
NF-1
)
)
split(
$(
NF-1
)
, ver, /GLIBC_|
\.
/)
vers = ver[2] * 10000 + ver[3]*100 + ver[4]
if (vers > 0) {
if (symvertext[
$(
NF
)
] !=
$(
NF-1
)
)
count[
$(
NF
)
]++
if (vers <= limit_ver && vers > symvers[
$(
NF
)
]) {
symvers[
$(
NF
)
] = vers
symvertext[
$(
NF
)
] =
$(
NF-1
)
}
}
}
END {
for (s in symvers) {
if (count[s] > 1) {
printf("__asm__(
\"
.symver %s,%s@%s
\"
);
\n
", s, s, symvertext[s]) > headerf
printf("%s %s@%s
\n
", s, s, symvertext[s]) > redeff
}
}
}
EOF
)
sort
${
headerf
}
-o
${
headerf
}
objcopy
--redefine-syms
=
${
headerf
}
.redef
$LIBCPP
libstdc++.a
rm
${
headerf
}
.redef
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