diff --git a/.gitmodules b/.gitmodules index 7b9f0db..305873c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,15 @@ [submodule "lib/cpp-feather-ini-parser"] path = lib/cpp-feather-ini-parser url = https://github.com/Turbine1991/cpp-feather-ini-parser.git +[submodule "lib/boost-filesystem"] + path = lib/boost-filesystem + url = https://github.com/boostorg/filesystem.git +[submodule "lib/lib/boost-regex"] + path = lib/lib/boost-regex + url = https://github.com/boostorg/regex.git +[submodule "lib/boost-regex"] + path = lib/boost-regex + url = https://github.com/boostorg/regex.git +[submodule "lib/boost-system"] + path = lib/boost-system + url = https://github.com/boostorg/system.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 86d9fd9..04ad536 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ add_definitions(-DLINUXDEPLOY_VERSION="${LINUXDEPLOY_VERSION}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/") +set(USE_SYSTEM_BOOST OFF CACHE BOOL "Set to ON to use system boost libraries instead of building up to date boost libraries from source") + add_subdirectory(lib) add_subdirectory(src) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 202ebe3..f92a74a 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -13,3 +13,17 @@ target_include_directories(cpp-feather-ini-parser INTERFACE cpp-feather-ini-pars add_executable(test_cpp_feather_ini_parser EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/cpp-feather-ini-parser/example/example.cpp) target_link_libraries(test_cpp_feather_ini_parser PRIVATE cpp-feather-ini-parser) add_test(test_cpp_feather_ini_parser test_cpp_feather_ini_parser) + +if(NOT USE_SYSTEM_BOOST) + file(GLOB boost_system_srcs ${CMAKE_CURRENT_SOURCE_DIR}/boost-system/src/*.cpp) + add_library(Boost_system STATIC ${boost_system_srcs}) + target_include_directories(Boost_system PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/boost-system/include) + + file(GLOB boost_filesystem_srcs ${CMAKE_CURRENT_SOURCE_DIR}/boost-filesystem/src/*.cpp) + add_library(Boost_filesystem STATIC ${boost_filesystem_srcs}) + target_include_directories(Boost_filesystem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/boost-filesystem/include) + + file(GLOB boost_regex_srcs ${CMAKE_CURRENT_SOURCE_DIR}/boost-regex/src/*.cpp) + add_library(Boost_regex STATIC ${boost_regex_srcs}) + target_include_directories(Boost_regex PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/boost-regex/include) +endif() diff --git a/lib/boost-filesystem b/lib/boost-filesystem new file mode 160000 index 0000000..d8a6730 --- /dev/null +++ b/lib/boost-filesystem @@ -0,0 +1 @@ +Subproject commit d8a6730d6ebab6da39c5f774e7c7ce966507901a diff --git a/lib/boost-regex b/lib/boost-regex new file mode 160000 index 0000000..5d990fd --- /dev/null +++ b/lib/boost-regex @@ -0,0 +1 @@ +Subproject commit 5d990fd751a8c149dd47fbaf24eaaffd1bde3bd5 diff --git a/lib/boost-system b/lib/boost-system new file mode 160000 index 0000000..6a71483 --- /dev/null +++ b/lib/boost-system @@ -0,0 +1 @@ +Subproject commit 6a71483984aaa651f0d2c199b5465df961154cff diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 762b40d..ed8074f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -5,8 +5,14 @@ cmake_minimum_required(VERSION 3.6) # include headers to make CLion happy file(GLOB HEADERS ${PROJECT_SOURCE_DIR}/include/linuxdeploy/core/*.h) -set(Boost_USE_STATIC_LIBS ON) -find_package(Boost REQUIRED COMPONENTS filesystem regex) +if(USE_SYSTEM_BOOST) + set(Boost_USE_STATIC_LIBS ON) + find_package(Boost REQUIRED COMPONENTS filesystem regex) + set(BOOST_LIBS Boost::filesystem Boost::regex) +else() + # use custom built libs + set(BOOST_LIBS Boost_system Boost_filesystem Boost_regex) +endif() find_package(Threads) @@ -22,12 +28,11 @@ execute_process( ) add_library(linuxdeploy_core STATIC elf.cpp log.cpp appdir.cpp desktopfile.cpp ${HEADERS}) -target_link_libraries(linuxdeploy_core PUBLIC linuxdeploy_util Boost::filesystem Boost::regex subprocess cpp-feather-ini-parser PkgConfig::magick++ libmagic_static ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(linuxdeploy_core PUBLIC linuxdeploy_util ${BOOST_LIBS} subprocess cpp-feather-ini-parser PkgConfig::magick++ libmagic_static ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(linuxdeploy_core PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(linuxdeploy_core PUBLIC ${PROJECT_SOURCE_DIR}/include) target_compile_definitions(linuxdeploy_core PUBLIC -DBOOST_NO_CXX11_SCOPED_ENUMS) add_executable(linuxdeploy main.cpp) target_link_libraries(linuxdeploy linuxdeploy_core args) - set_target_properties(linuxdeploy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")