Initial Linux build.
This commit is contained in:
parent
382380d513
commit
af968dc8ea
22 changed files with 463 additions and 22 deletions
|
|
@ -5,3 +5,4 @@
|
||||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
add_subdirectory(external)
|
add_subdirectory(external)
|
||||||
|
add_subdirectory(linux_glibc_wraps)
|
||||||
|
|
|
||||||
1
external/CMakeLists.txt
vendored
1
external/CMakeLists.txt
vendored
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
add_subdirectory(auto_updates)
|
add_subdirectory(auto_updates)
|
||||||
add_subdirectory(crash_reports)
|
add_subdirectory(crash_reports)
|
||||||
|
add_subdirectory(ffmpeg)
|
||||||
add_subdirectory(gsl)
|
add_subdirectory(gsl)
|
||||||
add_subdirectory(iconv)
|
add_subdirectory(iconv)
|
||||||
add_subdirectory(lz4)
|
add_subdirectory(lz4)
|
||||||
|
|
|
||||||
9
external/auto_updates/xz/CMakeLists.txt
vendored
9
external/auto_updates/xz/CMakeLists.txt
vendored
|
|
@ -12,9 +12,14 @@ if (APPLE AND NOT build_osx)
|
||||||
INTERFACE
|
INTERFACE
|
||||||
/usr/local/macos/lib/liblzma.a
|
/usr/local/macos/lib/liblzma.a
|
||||||
)
|
)
|
||||||
else()
|
elseif (APPLE)
|
||||||
target_link_libraries(external_xz
|
target_link_libraries(external_xz
|
||||||
INTERFACE
|
INTERFACE
|
||||||
/usr/local/lib/liblzma.a
|
/usr/local/liblzma.a
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_link_static_libraries(external_xz
|
||||||
|
INTERFACE
|
||||||
|
lzma
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,9 @@ if (WIN32)
|
||||||
${breakpad_lib_loc}/windows/handler/exception_handler.lib
|
${breakpad_lib_loc}/windows/handler/exception_handler.lib
|
||||||
${breakpad_lib_loc}/windows/crash_generation/crash_generation_client.lib
|
${breakpad_lib_loc}/windows/crash_generation/crash_generation_client.lib
|
||||||
)
|
)
|
||||||
|
elseif (LINUX)
|
||||||
|
target_link_static_libraries(external_breakpad
|
||||||
|
INTERFACE
|
||||||
|
breakpad_client
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
38
external/ffmpeg/CMakeLists.txt
vendored
Normal file
38
external/ffmpeg/CMakeLists.txt
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
# This file is part of Desktop App Toolkit,
|
||||||
|
# a set of libraries for developing nice desktop applications.
|
||||||
|
#
|
||||||
|
# For license and copyright information please follow this link:
|
||||||
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
|
add_library(external_ffmpeg INTERFACE IMPORTED GLOBAL)
|
||||||
|
add_library(desktop-app::external_ffmpeg ALIAS external_ffmpeg)
|
||||||
|
|
||||||
|
target_include_directories(external_ffmpeg SYSTEM
|
||||||
|
INTERFACE
|
||||||
|
${libs_loc}/ffmpeg
|
||||||
|
)
|
||||||
|
|
||||||
|
set(ffmpeg_lib_loc ${libs_loc}/ffmpeg)
|
||||||
|
|
||||||
|
target_link_libraries(external_ffmpeg
|
||||||
|
INTERFACE
|
||||||
|
${ffmpeg_lib_loc}/libavformat/libavformat.a
|
||||||
|
${ffmpeg_lib_loc}/libavcodec/libavcodec.a
|
||||||
|
${ffmpeg_lib_loc}/libswresample/libswresample.a
|
||||||
|
${ffmpeg_lib_loc}/libswscale/libswscale.a
|
||||||
|
${ffmpeg_lib_loc}/libavutil/libavutil.a
|
||||||
|
)
|
||||||
|
if (LINUX)
|
||||||
|
target_link_static_libraries(external_ffmpeg
|
||||||
|
INTERFACE
|
||||||
|
va-x11
|
||||||
|
va-drm
|
||||||
|
va
|
||||||
|
vdpau
|
||||||
|
drm
|
||||||
|
Xi
|
||||||
|
Xext
|
||||||
|
Xfixes
|
||||||
|
Xrender
|
||||||
|
)
|
||||||
|
endif()
|
||||||
12
external/iconv/CMakeLists.txt
vendored
12
external/iconv/CMakeLists.txt
vendored
|
|
@ -7,14 +7,14 @@
|
||||||
add_library(external_iconv INTERFACE IMPORTED GLOBAL)
|
add_library(external_iconv INTERFACE IMPORTED GLOBAL)
|
||||||
add_library(desktop-app::external_iconv ALIAS external_iconv)
|
add_library(desktop-app::external_iconv ALIAS external_iconv)
|
||||||
|
|
||||||
if (build_osx)
|
if (APPLE AND NOT build_osx)
|
||||||
target_link_libraries(external_iconv
|
|
||||||
INTERFACE
|
|
||||||
/usr/local/lib/libiconv.a
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
target_link_libraries(external_iconv
|
target_link_libraries(external_iconv
|
||||||
INTERFACE
|
INTERFACE
|
||||||
/usr/local/macos/lib/libiconv.a
|
/usr/local/macos/lib/libiconv.a
|
||||||
)
|
)
|
||||||
|
elseif (APPLE)
|
||||||
|
target_link_libraries(external_iconv
|
||||||
|
INTERFACE
|
||||||
|
/usr/local/lib/libiconv.a
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
11
external/openal/CMakeLists.txt
vendored
11
external/openal/CMakeLists.txt
vendored
|
|
@ -16,7 +16,7 @@ if (WIN32)
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${libs_loc}/openal-soft/build/$<IF:$<CONFIG:Debug>,Debug,Release>/OpenAL32.lib
|
${libs_loc}/openal-soft/build/$<IF:$<CONFIG:Debug>,Debug,Release>/OpenAL32.lib
|
||||||
)
|
)
|
||||||
else()
|
elseif(APPLE AND NOT build_osx)
|
||||||
target_include_directories(external_openal SYSTEM
|
target_include_directories(external_openal SYSTEM
|
||||||
INTERFACE
|
INTERFACE
|
||||||
/usr/local/macos/include
|
/usr/local/macos/include
|
||||||
|
|
@ -25,6 +25,15 @@ else()
|
||||||
INTERFACE
|
INTERFACE
|
||||||
/usr/local/macos/lib/libopenal.a
|
/usr/local/macos/lib/libopenal.a
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
target_include_directories(external_openal SYSTEM
|
||||||
|
INTERFACE
|
||||||
|
/usr/local/include
|
||||||
|
)
|
||||||
|
target_link_static_libraries(external_openal
|
||||||
|
INTERFACE
|
||||||
|
openal
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(external_openal
|
target_compile_definitions(external_openal
|
||||||
|
|
|
||||||
19
external/openssl/CMakeLists.txt
vendored
19
external/openssl/CMakeLists.txt
vendored
|
|
@ -7,7 +7,12 @@
|
||||||
add_library(external_openssl INTERFACE IMPORTED GLOBAL)
|
add_library(external_openssl INTERFACE IMPORTED GLOBAL)
|
||||||
add_library(desktop-app::external_openssl ALIAS external_openssl)
|
add_library(desktop-app::external_openssl ALIAS external_openssl)
|
||||||
|
|
||||||
if (NOT APPLE OR NOT build_osx)
|
if (LINUX)
|
||||||
|
target_include_directories(external_openssl SYSTEM
|
||||||
|
INTERFACE
|
||||||
|
/usr/local/desktop-app/openssl-1.1.1/include
|
||||||
|
)
|
||||||
|
elseif (NOT APPLE OR NOT build_osx)
|
||||||
target_include_directories(external_openssl SYSTEM
|
target_include_directories(external_openssl SYSTEM
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${libs_loc}/openssl_1_1_1/include
|
${libs_loc}/openssl_1_1_1/include
|
||||||
|
|
@ -30,11 +35,21 @@ else()
|
||||||
else()
|
else()
|
||||||
set(openssl_lib_loc ${libs_loc}/openssl)
|
set(openssl_lib_loc ${libs_loc}/openssl)
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
set(openssl_lib_loc /usr/local/desktop-app/openssl-1.1.1/lib)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(external_openssl
|
target_link_libraries(external_openssl
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${openssl_lib_loc}/libcrypto.${openssl_lib_ext}
|
|
||||||
${openssl_lib_loc}/libssl.${openssl_lib_ext}
|
${openssl_lib_loc}/libssl.${openssl_lib_ext}
|
||||||
|
${openssl_lib_loc}/libcrypto.${openssl_lib_ext}
|
||||||
|
pthread
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (LINUX)
|
||||||
|
target_link_libraries(external_openssl
|
||||||
|
INTERFACE
|
||||||
|
desktop-app::linux_glibc_wraps
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
|
||||||
4
external/opus/CMakeLists.txt
vendored
4
external/opus/CMakeLists.txt
vendored
|
|
@ -25,8 +25,8 @@ elseif (APPLE AND NOT build_osx)
|
||||||
/usr/local/macos/lib/libopus.a
|
/usr/local/macos/lib/libopus.a
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(external_opus
|
target_link_static_libraries(external_opus
|
||||||
INTERFACE
|
INTERFACE
|
||||||
/usr/local/lib/libopus.a
|
opus
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
89
external/qt/CMakeLists.txt
vendored
89
external/qt/CMakeLists.txt
vendored
|
|
@ -8,7 +8,7 @@ add_library(external_qt INTERFACE IMPORTED GLOBAL)
|
||||||
add_library(desktop-app::external_qt ALIAS external_qt)
|
add_library(desktop-app::external_qt ALIAS external_qt)
|
||||||
|
|
||||||
if (LINUX)
|
if (LINUX)
|
||||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if (NOT build_linux32)
|
||||||
target_compile_definitions(external_qt INTERFACE Q_OS_LINUX64)
|
target_compile_definitions(external_qt INTERFACE Q_OS_LINUX64)
|
||||||
else()
|
else()
|
||||||
target_compile_definitions(external_qt INTERFACE Q_OS_LINUX32)
|
target_compile_definitions(external_qt INTERFACE Q_OS_LINUX32)
|
||||||
|
|
@ -43,7 +43,11 @@ if (WIN32)
|
||||||
set(qt_lib_suffix $<$<CONFIG:Debug>:d>.lib)
|
set(qt_lib_suffix $<$<CONFIG:Debug>:d>.lib)
|
||||||
else()
|
else()
|
||||||
set(qt_lib_prefix lib)
|
set(qt_lib_prefix lib)
|
||||||
set(qt_lib_suffix $<$<CONFIG:Debug>:_debug>.a)
|
if (APPLE)
|
||||||
|
set(qt_lib_suffix $<$<CONFIG:Debug>:_debug>.a)
|
||||||
|
else()
|
||||||
|
set(qt_lib_suffix .a)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(common_qt_libs
|
set(common_qt_libs
|
||||||
|
|
@ -112,9 +116,90 @@ elseif (APPLE)
|
||||||
desktop-app::external_zlib
|
desktop-app::external_zlib
|
||||||
cups
|
cups
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
set(qt_libs
|
||||||
|
plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin
|
||||||
|
plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin
|
||||||
|
plugins/platforminputcontexts/${qt_lib_prefix}fcitxplatforminputcontextplugin
|
||||||
|
plugins/platforminputcontexts/${qt_lib_prefix}himeplatforminputcontextplugin
|
||||||
|
plugins/platforminputcontexts/${qt_lib_prefix}nimfplatforminputcontextplugin
|
||||||
|
plugins/platforms/${qt_lib_prefix}qxcb
|
||||||
|
lib/${qt_lib_prefix}Qt5XcbQpa
|
||||||
|
lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport
|
||||||
|
lib/${qt_lib_prefix}Qt5ServiceSupport
|
||||||
|
lib/${qt_lib_prefix}Qt5EdidSupport
|
||||||
|
plugins/bearer/${qt_lib_prefix}qconnmanbearer
|
||||||
|
plugins/bearer/${qt_lib_prefix}qgenericbearer
|
||||||
|
plugins/bearer/${qt_lib_prefix}qnmbearer
|
||||||
|
${common_qt_libs}
|
||||||
|
lib/${qt_lib_prefix}Qt5DBus
|
||||||
|
lib/${qt_lib_prefix}Qt5Core
|
||||||
|
lib/${qt_lib_prefix}qtpcre2
|
||||||
|
lib/${qt_lib_prefix}xcb-static
|
||||||
|
)
|
||||||
|
foreach (lib ${qt_libs})
|
||||||
|
list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}")
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(external_qt
|
target_link_libraries(external_qt
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${qt_libs_list}
|
${qt_libs_list}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (LINUX)
|
||||||
|
target_include_directories(external_qt SYSTEM
|
||||||
|
INTERFACE
|
||||||
|
${qt_loc}/mkspecs/linux-g++
|
||||||
|
)
|
||||||
|
target_link_options(external_qt
|
||||||
|
INTERFACE
|
||||||
|
-static-libstdc++
|
||||||
|
-pthread
|
||||||
|
-rdynamic
|
||||||
|
-Wl,-wrap,aligned_alloc
|
||||||
|
-Wl,-wrap,secure_getenv
|
||||||
|
-Wl,-wrap,clock_gettime
|
||||||
|
-Wl,--no-as-needed,-lrt
|
||||||
|
)
|
||||||
|
if (NOT build_linux32)
|
||||||
|
target_link_options(external_qt
|
||||||
|
INTERFACE
|
||||||
|
-Wl,-wrap,__divmodti4
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
target_link_options(external_qt
|
||||||
|
INTERFACE
|
||||||
|
-Wl,-wrap,__divmoddi4
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
target_link_static_libraries(external_qt
|
||||||
|
INTERFACE
|
||||||
|
SM
|
||||||
|
ICE
|
||||||
|
fontconfig
|
||||||
|
freetype
|
||||||
|
expat
|
||||||
|
z
|
||||||
|
xcb-shm
|
||||||
|
xcb-xfixes
|
||||||
|
xcb-render
|
||||||
|
xkbcommon
|
||||||
|
xkbcommon-x11
|
||||||
|
icutu
|
||||||
|
icui18n
|
||||||
|
icuuc
|
||||||
|
icudata
|
||||||
|
)
|
||||||
|
target_link_libraries(external_qt
|
||||||
|
INTERFACE
|
||||||
|
desktop-app::linux_glibc_wraps
|
||||||
|
xcb
|
||||||
|
X11
|
||||||
|
X11-xcb
|
||||||
|
dbus-1
|
||||||
|
dl
|
||||||
|
glib-2.0
|
||||||
|
pthread
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
|
||||||
4
external/zlib/CMakeLists.txt
vendored
4
external/zlib/CMakeLists.txt
vendored
|
|
@ -44,6 +44,8 @@ if (WIN32)
|
||||||
set(zlib_lib_loc ${libs_loc}/zlib/contrib/vstudio/vc14/x86/ZlibStat$<IF:$<CONFIG:Debug>,Debug,ReleaseWithoutAsm>)
|
set(zlib_lib_loc ${libs_loc}/zlib/contrib/vstudio/vc14/x86/ZlibStat$<IF:$<CONFIG:Debug>,Debug,ReleaseWithoutAsm>)
|
||||||
|
|
||||||
target_link_libraries(external_zlib INTERFACE ${zlib_lib_loc}/zlibstat.lib)
|
target_link_libraries(external_zlib INTERFACE ${zlib_lib_loc}/zlibstat.lib)
|
||||||
else()
|
elseif (APPLE)
|
||||||
target_link_libraries(external_zlib INTERFACE /usr/local/lib/libz.a)
|
target_link_libraries(external_zlib INTERFACE /usr/local/lib/libz.a)
|
||||||
|
else()
|
||||||
|
target_link_static_libraries(external_zlib INTERFACE z)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
# For license and copyright information please follow this link:
|
# For license and copyright information please follow this link:
|
||||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
function(generate_target parent_name postfix generated_files gen_dst)
|
function(generate_target parent_name postfix generated_timestamp generated_files gen_dst)
|
||||||
add_custom_target(${parent_name}_${postfix} DEPENDS ${generated_files})
|
add_custom_target(${parent_name}_${postfix} DEPENDS ${generated_timestamp})
|
||||||
init_target_folder(${parent_name}_${postfix} "(gen)")
|
init_target_folder(${parent_name}_${postfix} "(gen)")
|
||||||
add_dependencies(${parent_name} ${parent_name}_${postfix})
|
add_dependencies(${parent_name} ${parent_name}_${postfix})
|
||||||
target_sources(${parent_name} PRIVATE ${generated_files})
|
target_sources(${parent_name} PRIVATE ${generated_files})
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,15 @@ function(init_target target_name) # init_target(my_target folder_name)
|
||||||
XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL $<IF:$<CONFIG:Debug>,0,fast>
|
XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL $<IF:$<CONFIG:Debug>,0,fast>
|
||||||
XCODE_ATTRIBUTE_LLVM_LTO $<IF:$<CONFIG:Debug>,NO,YES>
|
XCODE_ATTRIBUTE_LLVM_LTO $<IF:$<CONFIG:Debug>,NO,YES>
|
||||||
)
|
)
|
||||||
if (NOT APPLE)
|
if (LINUX)
|
||||||
|
target_compile_options(${target_name} PUBLIC $<IF:$<CONFIG:Debug>,,-g -Ofast -fno-strict-aliasing>)
|
||||||
|
target_link_options(${target_name} PUBLIC $<IF:$<CONFIG:Debug>,,-g -Ofast>)
|
||||||
|
if (NOT build_linux32)
|
||||||
|
target_compile_options(${target_name} PUBLIC $<IF:$<CONFIG:Debug>,,-flto>)
|
||||||
|
target_link_options(${target_name} PUBLIC $<IF:$<CONFIG:Debug>,,-flto -fuse-linker-plugin>)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if (WIN32)
|
||||||
set_target_properties(${target_name} PROPERTIES
|
set_target_properties(${target_name} PROPERTIES
|
||||||
INTERPROCEDURAL_OPTIMIZATION_RELEASE True
|
INTERPROCEDURAL_OPTIMIZATION_RELEASE True
|
||||||
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True
|
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True
|
||||||
|
|
|
||||||
24
linux_glibc_wraps/CMakeLists.txt
Normal file
24
linux_glibc_wraps/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# This file is part of Desktop App Toolkit,
|
||||||
|
# a set of libraries for developing nice desktop applications.
|
||||||
|
#
|
||||||
|
# For license and copyright information please follow this link:
|
||||||
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
|
if (LINUX)
|
||||||
|
add_library(linux_glibc_wraps STATIC)
|
||||||
|
add_library(desktop-app::linux_glibc_wraps ALIAS linux_glibc_wraps)
|
||||||
|
|
||||||
|
get_filename_component(src_loc . REALPATH)
|
||||||
|
|
||||||
|
nice_target_sources(linux_glibc_wraps ${src_loc}
|
||||||
|
PRIVATE
|
||||||
|
platform/linux/linux_glibc_wraps.c
|
||||||
|
platform/linux/linux_glibc_wraps_32.c
|
||||||
|
platform/linux/linux_glibc_wraps_64.c
|
||||||
|
)
|
||||||
|
if (NOT build_linux32)
|
||||||
|
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_32.c PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||||
|
else()
|
||||||
|
set_source_files_properties(${src_loc}/platform/linux/linux_glibc_wraps_64.c PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
29
linux_glibc_wraps/platform/linux/linux_glibc_wraps.c
Normal file
29
linux_glibc_wraps/platform/linux/linux_glibc_wraps.c
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
// This file is part of Desktop App Toolkit,
|
||||||
|
// a set of libraries for developing nice desktop applications.
|
||||||
|
//
|
||||||
|
// For license and copyright information please follow this link:
|
||||||
|
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
//
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
void *__wrap_aligned_alloc(size_t alignment, size_t size) {
|
||||||
|
void *result = NULL;
|
||||||
|
return (posix_memalign(&result, alignment, size) == 0)
|
||||||
|
? result
|
||||||
|
: NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int enable_secure_inited = 0;
|
||||||
|
int enable_secure = 1;
|
||||||
|
|
||||||
|
char *__wrap_secure_getenv(const char *name) {
|
||||||
|
if (enable_secure_inited == 0) {
|
||||||
|
enable_secure_inited = 1;
|
||||||
|
enable_secure = (geteuid() != getuid())
|
||||||
|
|| (getegid() != getgid());
|
||||||
|
}
|
||||||
|
return enable_secure ? NULL : getenv(name);
|
||||||
|
}
|
||||||
|
|
||||||
36
linux_glibc_wraps/platform/linux/linux_glibc_wraps.gyp
Normal file
36
linux_glibc_wraps/platform/linux/linux_glibc_wraps.gyp
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
# This file is part of Desktop App Toolkit,
|
||||||
|
# a set of libraries for developing nice desktop applications.
|
||||||
|
#
|
||||||
|
# For license and copyright information please follow this link:
|
||||||
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
|
{
|
||||||
|
'includes': [
|
||||||
|
'../../common/common.gypi',
|
||||||
|
],
|
||||||
|
'targets': [{
|
||||||
|
'target_name': 'linux_glibc_wraps',
|
||||||
|
'type': 'static_library',
|
||||||
|
'variables': {
|
||||||
|
'src_loc': '.',
|
||||||
|
},
|
||||||
|
'configurations': {
|
||||||
|
'Debug': {
|
||||||
|
},
|
||||||
|
'Release': {
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'sources': [
|
||||||
|
'<(src_loc)/linux_glibc_wraps.c',
|
||||||
|
],
|
||||||
|
'conditions': [[ '"<!(uname -m)" == "x86_64" or "<!(uname -m)" == "aarch64"', {
|
||||||
|
'sources': [
|
||||||
|
'<(src_loc)/linux_glibc_wraps_64.c',
|
||||||
|
],
|
||||||
|
}, {
|
||||||
|
'sources': [
|
||||||
|
'<(src_loc)/linux_glibc_wraps_32.c',
|
||||||
|
],
|
||||||
|
}]],
|
||||||
|
}],
|
||||||
|
}
|
||||||
49
linux_glibc_wraps/platform/linux/linux_glibc_wraps_32.c
Normal file
49
linux_glibc_wraps/platform/linux/linux_glibc_wraps_32.c
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
// This file is part of Desktop App Toolkit,
|
||||||
|
// a set of libraries for developing nice desktop applications.
|
||||||
|
//
|
||||||
|
// For license and copyright information please follow this link:
|
||||||
|
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
//
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(_M_IX86) || defined(__i386__)
|
||||||
|
#define GETTIME_GLIBC_VERSION "2.2"
|
||||||
|
#elif defined(_M_ARM) || defined(__arm__)
|
||||||
|
#define GETTIME_GLIBC_VERSION "2.4"
|
||||||
|
#else
|
||||||
|
#error Please add glibc wraps for your architecture
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int __clock_gettime_glibc_old(clockid_t clk_id, struct timespec *tp);
|
||||||
|
__asm__(".symver __clock_gettime_glibc_old,clock_gettime@GLIBC_" GETTIME_GLIBC_VERSION);
|
||||||
|
|
||||||
|
int __wrap_clock_gettime(clockid_t clk_id, struct timespec *tp) {
|
||||||
|
return __clock_gettime_glibc_old(clk_id, tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem_p);
|
||||||
|
|
||||||
|
int64_t __wrap___divmoddi4(int64_t num, int64_t den, int64_t *rem_p) {
|
||||||
|
int minus = 0;
|
||||||
|
int64_t v;
|
||||||
|
|
||||||
|
if (num < 0) {
|
||||||
|
num = -num;
|
||||||
|
minus = 1;
|
||||||
|
}
|
||||||
|
if (den < 0) {
|
||||||
|
den = -den;
|
||||||
|
minus ^= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
v = __udivmoddi4(num, den, (uint64_t *)rem_p);
|
||||||
|
if (minus) {
|
||||||
|
v = -v;
|
||||||
|
if (rem_p)
|
||||||
|
*rem_p = -(*rem_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
52
linux_glibc_wraps/platform/linux/linux_glibc_wraps_64.c
Normal file
52
linux_glibc_wraps/platform/linux/linux_glibc_wraps_64.c
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
// This file is part of Desktop App Toolkit,
|
||||||
|
// a set of libraries for developing nice desktop applications.
|
||||||
|
//
|
||||||
|
// For license and copyright information please follow this link:
|
||||||
|
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
//
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#if defined(_M_X64) || defined(__x86_64__)
|
||||||
|
#define GETTIME_GLIBC_VERSION "2.2.5"
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define GETTIME_GLIBC_VERSION "2.17"
|
||||||
|
#else
|
||||||
|
#error Please add glibc wraps for your architecture
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned int UTItype __attribute__ ((mode (TI)));
|
||||||
|
typedef int TItype __attribute__ ((mode (TI)));
|
||||||
|
|
||||||
|
int __clock_gettime_glibc_old(clockid_t clk_id, struct timespec *tp);
|
||||||
|
__asm__(".symver __clock_gettime_glibc_old,clock_gettime@GLIBC_" GETTIME_GLIBC_VERSION);
|
||||||
|
|
||||||
|
|
||||||
|
int __wrap_clock_gettime(clockid_t clk_id, struct timespec *tp) {
|
||||||
|
return __clock_gettime_glibc_old(clk_id, tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
UTItype __udivmodti4(UTItype num, UTItype den, UTItype *rem_p);
|
||||||
|
|
||||||
|
TItype __wrap___divmodti4(TItype num, TItype den, TItype *rem_p) {
|
||||||
|
int minus = 0;
|
||||||
|
TItype v;
|
||||||
|
|
||||||
|
if (num < 0) {
|
||||||
|
num = -num;
|
||||||
|
minus = 1;
|
||||||
|
}
|
||||||
|
if (den < 0) {
|
||||||
|
den = -den;
|
||||||
|
minus ^= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
v = __udivmodti4(num, den, (UTItype *)rem_p);
|
||||||
|
if (minus) {
|
||||||
|
v = -v;
|
||||||
|
if (rem_p)
|
||||||
|
*rem_p = -(*rem_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
# For license and copyright information please follow this link:
|
# For license and copyright information please follow this link:
|
||||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
function(nice_target_sources target_name src_loc list)
|
function(nice_target_sources target_name src_loc)
|
||||||
|
set(list ${ARGV})
|
||||||
|
list(REMOVE_AT list 0 1)
|
||||||
|
|
||||||
set(writing_now "")
|
set(writing_now "")
|
||||||
set(private_sources "")
|
set(private_sources "")
|
||||||
set(public_sources "")
|
set(public_sources "")
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,29 @@
|
||||||
#
|
#
|
||||||
# For license and copyright information please follow this link:
|
# For license and copyright information please follow this link:
|
||||||
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
|
target_compile_options(common_options
|
||||||
|
INTERFACE
|
||||||
|
-g
|
||||||
|
-pipe
|
||||||
|
-Wall
|
||||||
|
-Werror
|
||||||
|
-W
|
||||||
|
-fPIC
|
||||||
|
-Wno-unused-variable
|
||||||
|
-Wno-unused-parameter
|
||||||
|
-Wno-unused-function
|
||||||
|
-Wno-switch
|
||||||
|
-Wno-comment
|
||||||
|
-Wno-unused-but-set-variable
|
||||||
|
-Wno-missing-field-initializers
|
||||||
|
-Wno-sign-compare
|
||||||
|
-Wno-attributes
|
||||||
|
-Wno-parentheses
|
||||||
|
-Wno-stringop-overflow
|
||||||
|
-Wno-error=class-memaccess
|
||||||
|
)
|
||||||
|
target_link_options(common_options
|
||||||
|
INTERFACE
|
||||||
|
-g
|
||||||
|
)
|
||||||
|
|
|
||||||
45
target_link_static_libraries.cmake
Normal file
45
target_link_static_libraries.cmake
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
# This file is part of Desktop App Toolkit,
|
||||||
|
# a set of libraries for developing nice desktop applications.
|
||||||
|
#
|
||||||
|
# For license and copyright information please follow this link:
|
||||||
|
# https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||||
|
|
||||||
|
function(target_link_static_libraries target_name)
|
||||||
|
set(list ${ARGV})
|
||||||
|
list(REMOVE_AT list 0)
|
||||||
|
|
||||||
|
set(writing_now "")
|
||||||
|
set(private_libs "")
|
||||||
|
set(public_libs "")
|
||||||
|
set(interface_libs "")
|
||||||
|
foreach (entry ${list})
|
||||||
|
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
|
||||||
|
set(writing_now ${entry})
|
||||||
|
else()
|
||||||
|
find_library(static_lib_${entry} lib${entry}.a)
|
||||||
|
set(full_path "${static_lib_${entry}}")
|
||||||
|
if (${full_path} STREQUAL static_lib_${entry}-NOTFOUND)
|
||||||
|
message(FATAL_ERROR "Could not find static library lib${entry}.a")
|
||||||
|
endif()
|
||||||
|
if ("${writing_now}" STREQUAL "PRIVATE")
|
||||||
|
list(APPEND private_libs ${full_path})
|
||||||
|
elseif ("${writing_now}" STREQUAL "PUBLIC")
|
||||||
|
list(APPEND public_libs ${full_path})
|
||||||
|
elseif ("${writing_now}" STREQUAL "INTERFACE")
|
||||||
|
list(APPEND interface_libs ${full_path})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unknown frameworks scope for target ${target_name}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if (NOT "${public_libs}" STREQUAL "")
|
||||||
|
target_link_libraries(${target_name} PUBLIC ${public_libs})
|
||||||
|
endif()
|
||||||
|
if (NOT "${private_libs}" STREQUAL "")
|
||||||
|
target_link_libraries(${target_name} PRIVATE ${private_libs})
|
||||||
|
endif()
|
||||||
|
if (NOT "${interface_libs}" STREQUAL "")
|
||||||
|
target_link_libraries(${target_name} INTERFACE ${interface_libs})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
@ -29,6 +29,7 @@ endif()
|
||||||
set(build_osx 0)
|
set(build_osx 0)
|
||||||
set(build_macstore 0)
|
set(build_macstore 0)
|
||||||
set(build_winstore 0)
|
set(build_winstore 0)
|
||||||
|
set(build_linux32 0)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp")
|
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp")
|
||||||
|
|
@ -49,17 +50,24 @@ elseif (APPLE)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(LINUX 1)
|
set(LINUX 1)
|
||||||
|
execute_process(COMMAND uname -m OUTPUT_VARIABLE machine_uname)
|
||||||
|
if (NOT ${machine_uname} MATCHES "x86_64" AND NOT ${machine_uname} MATCHES "aarch64")
|
||||||
|
set(build_linux32 1)
|
||||||
|
endif()
|
||||||
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux")
|
if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux")
|
||||||
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if (build_linux32)
|
||||||
report_bad_special_target()
|
report_bad_special_target()
|
||||||
endif()
|
endif()
|
||||||
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux32")
|
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux32")
|
||||||
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
|
if (NOT build_linux32)
|
||||||
report_bad_special_target()
|
report_bad_special_target()
|
||||||
endif()
|
endif()
|
||||||
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
|
elseif (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
|
||||||
report_bad_special_target()
|
report_bad_special_target()
|
||||||
endif()
|
endif()
|
||||||
|
set(CMAKE_AR /usr/bin/gcc-ar)
|
||||||
|
set(CMAKE_RANLIB /usr/bin/gcc-ranlib)
|
||||||
|
set(CMAKE_NM /usr/bin/gcc-nm)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT APPLE OR build_osx)
|
if (NOT APPLE OR build_osx)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue