Commit fa3b0d11 authored by rafaelatc3sl's avatar rafaelatc3sl

Issue #14: Add crosscompile into gitlab-ci

Signed-off-by: 's avatarrafaelatc3sl <rpd17@c3sl>
parent 3e99cfb3
Pipeline #20477 passed with stages
in 28 minutes and 45 seconds
......@@ -7,4 +7,4 @@ styleguide/*
Documentation/*
.vs/
bootstrap.log
.vscode
......@@ -42,25 +42,54 @@ compileUnix:
- ./generate_agent.sh -idp=1234 -ws=www.C3Sl.ufpr.br -pch=mumm -pcp=6666 -pcu=ninguem -pcpasswd=123mudar -prj=simmc
- chmod +x agent-1234.run
# compileWin:
# stage: build
# artifacts:
# paths:
# - agent-1234.exe
# tags:
# - windows
# script:
# - set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
# - call vcvarsall.bat x86
# - git submodule init
# - git submodule update --init --recursive
# - rd /s /q build
# - call mkdir build
# - cd build
# - cmake .. -G "NMake Makefiles"
# - nmake
# - cd ..
# - iscc generate_agent.iss /Didp=1234 /Dws=www.C3Sl.ufpr.br /Dpch=mumm /Dpcp=6666 /Dpcu=ninguem /Dpcpasswd=123mudar /Dprj=simmc /Dversion=1.0.0
compileWin32:
stage: build
artifacts:
paths:
- agent-32.exe
tags:
- inno
script:
- echo "Estágio 'build'"
- dpkg --add-architecture i386
- apt-get update && apt-get install -y build-essential cmake git makeself
libudev-dev g++-mingw-w64-i686
- git submodule init
- git submodule update --init --recursive
- mkdir -p build
- cd build
- cmake -D CMAKE_TOOLCHAIN_FILE=mingw_cross_toolchain_32-bit.cmake ..
- make
- su inno
- Xvfb :98 &
- export DISPLAY=:98
- cd /
- wine /home/inno/iscc ./builds/simmctic/agent/generate_agent.iss /Didp=1234 /Dws=www.C3Sl.ufpr.br /Dpch=mumm /Dpcp=6666 /Dpcu=ninguem /Dpcpasswd=123mudar /Dprj=simmc /Dversion=1.0.0
- mv ./builds/simmctic/agent/agent-1234.exe ./builds/simmctic/agent/agent-32.exe
compileWin64:
stage: build
artifacts:
paths:
- agent-64.exe
tags:
- inno
script:
- echo "Estágio 'build'"
- apt-get update && apt-get install -y build-essential cmake git makeself
libudev-dev g++-mingw-w64-x86-64
- git submodule init
- git submodule update --init --recursive
- mkdir -p build
- cd build
- cmake -D CMAKE_TOOLCHAIN_FILE=mingw_cross_toolchain_64-bit.cmake ..
- make
- su inno
- Xvfb :98 &
- export DISPLAY=:98
- cd /
- wine /home/inno/iscc ./builds/simmctic/agent/generate_agent.iss /Didp=1234 /Dws=www.C3Sl.ufpr.br /Dpch=mumm /Dpcp=6666 /Dpcu=ninguem /Dpcpasswd=123mudar /Dprj=simmc /Dversion=1.0.0
- mv ./builds/simmctic/agent/agent-1234.exe ./builds/simmctic/agent/agent-64.exe
testDebian:
stage: test
......@@ -113,21 +142,7 @@ testOpensuse:
dependencies:
- compileUnix
# testWin7:
# stage: test
# tags:
# - windows
# script:
# - if exist C:\agentC3SL rmdir C:\agentC3SL /s /q
# - agent-1234.exe /SILENT /VERYSILENT
# - if not exist C:\agentC3SL exit 1;
# - copy C:\jq-win32.exe .\test
# - cd .\test
# - C:\agentC3SL\bin\agent-v0.0.exe --once --print > test.json
# - testWin.bat
# - C:\agentC3SL\uninstall_agent.exe /SILENT /VERYSILENT
# - dir /b /a "C:\agentC3SL\*" | >nul findstr "^" && (echo Agent has been uninstalled) || (exit 1);
# dependencies:
# - compileWin
# Optamos por remover os testes do windows, pois não conseguimos criar o runner, visto que sua
# criação iriam ter um impacto negativo em todos os demais runners.
# Caso se deseje testar o programa pelo windows existe o script test/testWin.bat, que ira realizar os testes,
# no ambiente windows.
......@@ -11,14 +11,20 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# cpr requires c++11
#
if(WIN32)
add_definitions( -DBOOST_ALL_NO_LIB )
set(Boost_USE_STATIC_LIBS ON)
add_definitions(-DCURL_STATICLIB)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_WIN32_WINNT=0x0501)
# add_compile_options("/std:c++11")
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11)
add_definitions(-D_WIN32_WINNT=0x0501)
set(CMAKE_USE_WIN32_THREADS_INIT 1)
set(Threads_FOUND TRUE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -lwinpthread -static-libstdc++ -static-libgcc")
else()
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
......@@ -27,6 +33,7 @@ endif()
# src : main, collect functions + jsoncpp library
file ( GLOB SOURCES src/agent/*.cpp )
# src : curl requests
# options for cpr
......@@ -58,11 +65,14 @@ include ( "modules/boost.cmake" )
# compile
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY "../bin" )
add_executable ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} ${SOURCES} )
target_link_libraries ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} ${CURL_LIBRARIES} ${FILESYSTEM_LIB} ${SYSTEM_LIB} ${REGEX_LIB} ${PROGRAM_OPTIONS_LIB} ${CROSS_STATIC} ${CMAKE_THREAD_LIBS_INIT} )
target_link_libraries ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} ${CURL_LIBRARIES} ${FILESYSTEM_LIB} ${SYSTEM_LIB} ${REGEX_LIB} ${PROGRAM_OPTIONS_LIB} ${CROSS_STATIC} ${CMAKE_THREAD_LIBS_INIT})
add_dependencies ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} Boost )
add_dependencies ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} Boost)
if ( UNIX )
# libudev
target_link_libraries ( agent-v${VERSION_MAJOR}.${VERSION_MINOR} udev )
endif ()
......@@ -159,7 +159,7 @@ procedure change_config_file();
var
key, value : string;
begin
key := '{#idp},conf/proxy-conf.json,{#ws},{#version},{#prj}';
key := '{#idp},{#prj},conf/proxy-conf.json,{#version},{#ws}';
value := '%d,%s,%s,%s,%s';
read_file(WizardDirValue() + '\conf\datasid-conf.json', key, value);
end;
......
......@@ -37,7 +37,7 @@ namespace fs = boost::filesystem;
std::string path_to_agent_tmp = "C:\\agentC3SL\\tmp\\";
std::string path_to_agent = "C:\\agentC3SL\\";
std::string path_to_agent_conf = // NOLINT(runtime/string)
"C:\\agentC3SL\\teste\\"; // NOLINT(runtime/string)
"C:\\agentC3SL\\conf\\"; // NOLINT(runtime/string)
#endif
bool agent_send_inventory = false;
......
......@@ -6,7 +6,6 @@ SET ( CMAKE_C_COMPILER i686-w64-mingw32-gcc-posix )
SET ( CMAKE_CXX_COMPILER i686-w64-mingw32-g++-posix )
SET ( CMAKE_RC_COMPILER i686-w64-mingw32-windres )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32" )
SET ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -lwinpthread" )
SET ( CROSS_STATIC "iphlpapi" )
# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 )
......
......@@ -6,9 +6,7 @@ SET ( CMAKE_C_COMPILER x86_64-w64-mingw32-gcc-posix )
SET ( CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix )
SET ( CMAKE_RC_COMPILER x86_64-w64-mingw32-windres )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32" )
SET ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -lwinpthread" )
SET ( CROSS_STATIC "iphlpapi" )
# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 )
# adjust the default behaviour of the FIND_XXX() commands:
......
......@@ -40,8 +40,6 @@ if (NOT Boost)
PREFIX Boost
GIT_REPOSITORY ${BOOST_URL}
GIT_SUBMODULES libs/asio libs/config libs/core libs/date_time libs/detail libs/io libs/iterator libs/predef libs/preprocessor libs/smart_ptr libs/throw_exception libs/system libs/filesystem libs/integer tools/build tools/bcp libs/serialization libs/interprocess libs/tokenizer libs/algorithm libs/program_options libs/regex libs/static_assert libs/thread libs/utility libs/numeric libs/range libs/array libs/bind libs/concept_check libs/lexical_cast libs/math libs/functional libs/assert libs/type_traits libs/mpl libs/move libs/container libs/any libs/type_index libs/function libs/chrono libs/ratio libs/intrusive libs/spirit libs/winapi libs/tuple libs/exception libs/optional
UPDATE_COMMAND ./bootstrap.sh --without-icu --with-libraries=filesystem,system,regex,program_options --includedir=${CMAKE_BINARY_DIR}/include/ && ${CMAKE_BINARY_DIR}/../configure_boost_crosscompile.sh ${CMAKE_CXX_COMPILER}
CONFIGURE_COMMAND ./b2 headers
......@@ -55,8 +53,6 @@ if (NOT Boost)
PREFIX Boost
GIT_REPOSITORY ${BOOST_URL}
GIT_SUBMODULES libs/asio libs/config libs/core libs/date_time libs/detail libs/io libs/iterator libs/predef libs/preprocessor libs/smart_ptr libs/throw_exception libs/system libs/filesystem libs/integer tools/build tools/bcp libs/serialization libs/interprocess libs/tokenizer libs/algorithm libs/program_options libs/regex libs/static_assert libs/thread libs/utility libs/numeric libs/range libs/array libs/bind libs/concept_check libs/lexical_cast libs/math libs/functional libs/assert libs/type_traits libs/mpl libs/move libs/container libs/any libs/type_index libs/function libs/chrono libs/ratio libs/intrusive libs/spirit libs/winapi libs/tuple libs/exception libs/optional
UPDATE_COMMAND ./bootstrap.bat --with-toolset=msvc-14.1 --with-libraries=filesystem,system,regex,program_options,chrono
CONFIGURE_COMMAND ./b2 headers
......
This diff is collapsed.
if exist C:\agentC3SL rmdir C:\agentC3SL /s /q
agent-32.exe /SILENT /VERYSILENT
if not exist C:\agentC3SL exit 1;
copy C:\jq-win32.exe .\test
cd .\test
C:\agentC3SL\bin\agent-v0.0.exe --once --print > test.json
testWin.bat
C:\agentC3SL\uninstall_agent.exe /SILENT /VERYSILENT
dir /b /a "C:\agentC3SL\*" | >nul findstr "^" && (echo Agent has been uninstalled) || (exit 1);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment