Permalink
Browse files

updated build scripts

  • Loading branch information...
inlife committed May 3, 2018
1 parent 2e55509 commit cd14e15b61256e5fab3fc0061b8bc74d6884548f
Showing with 41 additions and 94 deletions.
  1. +26 −18 .travis.yml
  2. +2 −57 CMakeLists.txt
  3. +13 −19 appveyor.yml
View
@@ -1,25 +1,33 @@
os:
- linux
- osx
language: c
compiler:
- clang
before_install:
- curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
- sudo apt-get install -y nodejs
script:
- npm install
- cmake . -DCMAKE_BUILD_TYPE=Release -DLIBRG_TEST=1 -DLIBRG_SHARED=1
- cmake --build .
- ./librg_test
- ./librg_test_cpp
after_failure:
- curl -v -H User-Agent:bot -H Content-Type:application/json -d '{"content":"**librg** Latest build has FAILED!"}' https://discordapp.com/api/webhooks/$DISCORD_WEBHOOK_CHANNEL_ID/$DISCORD_WEBHOOK_TOKEN
- curl -v -H User-Agent:bot -H Content-Type:application/json -d '{"content":"**librg** build has failed! :no_entry:"}' https://discordapp.com/api/webhooks/$DISCORD_WEBHOOK_CHANNEL_ID/$DISCORD_WEBHOOK_TOKEN
after_success:
- curl -v -H User-Agent:bot -H Content-Type:application/json -d '{"content":"**librg** Latest build has SUCCEEDED!"}' https://discordapp.com/api/webhooks/$DISCORD_WEBHOOK_CHANNEL_ID/$DISCORD_WEBHOOK_TOKEN
- curl -v -H User-Agent:bot -H Content-Type:application/json -d '{"content":"**librg** build has succeeded! :white_check_mark:"}' https://discordapp.com/api/webhooks/$DISCORD_WEBHOOK_CHANNEL_ID/$DISCORD_WEBHOOK_TOKEN
script:
- npm install
- mkdir -p build
- export INCLUDES="-I include -I node_modules/zpl.c/code -I node_modules/enet.c/include -DHAS_SOCKLEN_T=1"
- export LINKER="-pthread -lm -ldl"
- gcc -g -std=c99 $INCLUDES test/build-test.c $LINKER -o build/test-gcc-c.o && build/test-gcc-c.o
- clang -g -std=c99 $INCLUDES test/build-test.c $LINKER -o build/test-clang-c.o && build/test-clang-c.o
- g++ -g -std=c++11 $INCLUDES test/build-test.cpp $LINKER -o build/test-gpp-cpp.o && build/test-gpp-cpp.o
- clang++ -g -std=c++11 $INCLUDES test/build-test.cpp $LINKER -o build/test-clang-cpp.o && build/test-clang-cpp.o
- gcc -O3 -std=c99 $INCLUDES test/build-test.c $LINKER -o build/test-gcc-c.o && build/test-gcc-c.o
- clang -O3 -std=c99 $INCLUDES test/build-test.c $LINKER -o build/test-clang-c.o && build/test-clang-c.o
- g++ -O3 -std=c++11 $INCLUDES test/build-test.cpp $LINKER -o build/test-gpp-cpp.o && build/test-gpp-cpp.o
- clang++ -O3 -std=c++11 $INCLUDES test/build-test.cpp $LINKER -o build/test-clang-cpp.o && build/test-clang-cpp.o
before_deploy:
- export FILE_TO_UPLOAD=$(ls *.dylib *.so)
deploy:
provider: releases
api_key:
- secure: "VZPCmJqX/MOBJv/k498MIrpKC7SBx+ZYqpOxo1Vp2dO3W8PzChCMePsuCdYL5ZvxLqNv9iClQ778HHQ8X976C7lIBv01p6jf/BBrvp8WguagYRIqQ+6Ehe3l1/I+6Yxx7MnzMZTTCO/EOUbVlfwF4Gql5ybvgH9Vs0CKr00jUaDPCI8pc0rV2WW97qFQ5irfFcvJx7XxuT7V48Ur27y+gkqV+L4YZthjwqN9fC5jULl2ha/WY5tRjv5gjpLpLPvBW94x3L8qET7/izP0g1MrjlPODwh6pr7o6I2SAlURREadgHdovLDm7K7N+DBVT0hZCWXlJ/Sh7Q9gs3CCAxtMyLDSoGjpWHBvRvJw702OtRxyIWriESq80kB8KUQ/piHB4DPMfDpkuWUaSNElX85NyW3fh5aXxlOvQf+CtABNACIuLC/oBshFguFgEu4kuqpFtmUG7EBssrEwnCiw2H3xpMC3G+ALEA03UKYJEZcyrmFo9PwIfaNf9ziJLzqq3haAN1/4pNyvl62MMPtNDyzXzVTWyL/Yi22tDIDgMGwCYpAyNoKHiyPpVGbOkL4561SN947g2TpIfxi6LlxzdLV6fPoPlLBsaha6LXV+YLNWsgpOJYK0zk8dxKNDzGxniSiPAaeEWhbc11UGJYgpk21ySus/lQfsQobEK/EqwOM5mpU="
file_glob: true
file: "${FILE_TO_UPLOAD}"
skip_cleanup: true
on:
tags: true
View
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(librg)
find_package(Threads)
@@ -23,61 +23,6 @@ else()
target_compile_options(librg INTERFACE -std=c99)
endif()
### ENET STUFF
# The "configure" step.
include(CheckFunctionExists)
include(CheckStructHasMember)
include(CheckTypeSize)
check_function_exists("fcntl" HAS_FCNTL)
check_function_exists("poll" HAS_POLL)
check_function_exists("getaddrinfo" HAS_GETADDRINFO)
check_function_exists("getnameinfo" HAS_GETNAMEINFO)
check_function_exists("gethostbyname_r" HAS_GETHOSTBYNAME_R)
check_function_exists("gethostbyaddr_r" HAS_GETHOSTBYADDR_R)
check_function_exists("inet_pton" HAS_INET_PTON)
check_function_exists("inet_ntop" HAS_INET_NTOP)
check_struct_has_member("struct msghdr" "msg_flags" "sys/types.h;sys/socket.h" HAS_MSGHDR_FLAGS)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h" "sys/socket.h")
check_type_size("socklen_t" HAS_SOCKLEN_T BUILTIN_TYPES_ONLY)
unset(CMAKE_EXTRA_INCLUDE_FILES)
if(MSVC)
add_definitions(-W3)
else()
add_definitions(-Wno-error)
endif()
if(HAS_FCNTL)
add_definitions(-DHAS_FCNTL=1)
endif()
if(HAS_POLL)
add_definitions(-DHAS_POLL=1)
endif()
if(HAS_GETNAMEINFO)
add_definitions(-DHAS_GETNAMEINFO=1)
endif()
if(HAS_GETADDRINFO)
add_definitions(-DHAS_GETADDRINFO=1)
endif()
if(HAS_GETHOSTBYNAME_R)
add_definitions(-DHAS_GETHOSTBYNAME_R=1)
endif()
if(HAS_GETHOSTBYADDR_R)
add_definitions(-DHAS_GETHOSTBYADDR_R=1)
endif()
if(HAS_INET_PTON)
add_definitions(-DHAS_INET_PTON=1)
endif()
if(HAS_INET_NTOP)
add_definitions(-DHAS_INET_NTOP=1)
endif()
if(HAS_MSGHDR_FLAGS)
add_definitions(-DHAS_MSGHDR_FLAGS=1)
endif()
if(HAS_SOCKLEN_T)
add_definitions(-DHAS_SOCKLEN_T=1)
endif()
### END ENET STUFF
# proxy our includes to outside world
target_include_directories(librg INTERFACE include
${LIBRG_VENDOR_FOLDER}/zpl${LIBRG_POSTFIX}/code
@@ -88,7 +33,7 @@ target_link_libraries(librg INTERFACE ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
if (WIN32)
# windows libraries for enet
target_link_libraries(librg INTERFACE Ws2_32 Winmm)
target_link_libraries(librg INTERFACE ws2_32 winmm)
elseif (UNIX)
# unix math library for us
target_link_libraries(librg INTERFACE m)
View
@@ -1,17 +1,10 @@
version: '3.2.0-{build}'
image: Visual Studio 2017
platform:
- x64
configuration:
- Release
- Debug
install:
- ps: $env:package_version = (Get-Content -Raw -Path package.json | ConvertFrom-Json).version
- ps: Update-AppveyorBuild -Version "$env:package_version-$env:APPVEYOR_BUILD_NUMBER"
before_build:
- npm install
@@ -24,15 +17,16 @@ test_script:
- '%APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\librg_test.exe'
- '%APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\librg_test_cpp.exe'
# deploy:
# release: librg-v$(appveyor_build_version)
# description: 'librg dll compiled for windows'
# provider: GitHub
# auth_token:
# secure: tYm5oXMHHaO3oR5xd93zvnG95eqNZWw065Z9Qo6CAN3+2G7IlWbcmbsYlsl2XDFc
# artifact: /%APPVEYOR_BUILD_FOLDER%\%CONFIGURATION%\*\.dll/
# draft: false
# prerelease: false
# on:
# branch: master
# appveyor_repo_tag: true
artifacts:
- path: 'Release\*.dll'
name: Releases
deploy:
provider: GitHub
auth_token:
secure: "tYm5oXMHHaO3oR5xd93zvnG95eqNZWw065Z9Qo6CAN3+2G7IlWbcmbsYlsl2XDFc"
artifact: /.*\.dll/
draft: false
prerelease: false
on:
appveyor_repo_tag: true

0 comments on commit cd14e15

Please sign in to comment.