Skip to content

Commit

Permalink
Merge pull request #486 from dartsim/windows_build_issues
Browse files Browse the repository at this point in the history
Fix build issues on Windows
  • Loading branch information
jslee02 committed Aug 17, 2015
2 parents a139ad5 + a1a33fd commit b16e745
Show file tree
Hide file tree
Showing 18 changed files with 235 additions and 72 deletions.
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()

# Simplify variable reference and escape sequence evaluation. This was added in
# CMake 3.1. Explicitly setting this policy is necessary to suppress a warning
# in CMake 3.1 and above.
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif()

# Disables a warning about a change in Cygwin Cmake
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
set(CMAKE_CXX_WARNING_LEVEL 4)
Expand Down Expand Up @@ -53,7 +60,7 @@ message(STATUS "============================================")
option(ENABLE_OPENMP "Build with OpenMP parallaization enabled" ON)
option(BUILD_CORE_ONLY "Build only the core of DART" OFF)
if(MSVC)
set(DART_RUNTIME_LIBRARY "/MT" CACHE STRING "BaseName chosen by the user at CMake configure time")
set(DART_RUNTIME_LIBRARY "/MD" CACHE STRING "BaseName chosen by the user at CMake configure time")
set_property(CACHE DART_RUNTIME_LIBRARY PROPERTY STRINGS /MD /MT)
else()
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
Expand Down Expand Up @@ -332,7 +339,8 @@ endif()
#===============================================================================
# DART dependency variable settings
#===============================================================================
set(DART_CORE_DEPENDENCIES ${FCL_LIBRARIES}
set(DART_CORE_DEPENDENCIES ${CCD_LIBRARIES}
${FCL_LIBRARIES}
${ASSIMP_LIBRARIES}
${Boost_LIBRARIES}
${OPENGL_LIBRARIES}
Expand Down Expand Up @@ -364,6 +372,7 @@ endif()
#===============================================================================
include_directories(BEFORE ${PROJECT_SOURCE_DIR})
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS})
include_directories(SYSTEM ${CCD_INCLUDE_DIRS})
include_directories(SYSTEM ${FCL_INCLUDE_DIRS})
include_directories(SYSTEM ${ASSIMP_INCLUDE_DIRS})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
Expand Down
35 changes: 14 additions & 21 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
version: "{build}"

# Operating system (build VM template)
os: Previous Windows Server 2012 R2 # using previous worker images since default worker has problem installing DART-Prerequisites.msi
os: Visual Studio 2015

# build platform, i.e. Win32 (instead of x86), x64, Any CPU. This setting is optional.
platform:
- Win32
- x64
#- x64 Disable build for x64 machine until x64 version of dart-prerequisites is ready

# specify custom environment variables
environment:
BOOST_ROOT: c:\Libraries\boost
BOOST_LIBRARYDIR: c:\Libraries\boost\stage\lib
BOOST_ROOT: C:\Libraries\boost
BOOST_LIBRARYDIR: C:\Libraries\boost\stage\lib
BUILD_EXAMPLES: OFF # don't build examples to not exceed allowed build time (40 min)
matrix:
- BUILD_CORE_ONLY: ON
# Diabled since we don't have binaries of DART prerequisites build on Visual Studio 2013 (/MT) yet (See #270)
# - BUILD_CORE_ONLY: OFF
- BUILD_CORE_ONLY: OFF

# build Configuration, i.e. Debug, Release, etc.
# build configuration, i.e. Debug, Release, etc.
configuration:
- Debug
- Release
Expand All @@ -42,10 +42,8 @@ branches:

# scripts that run after cloning repository
install:
- cmd: cd C:\projects
- ps: Start-FileDownload 'http://www.prism.gatech.edu/~tkunz3/DART-Prerequisites.msi'
- cmd: C:\projects\DART-Prerequisites.msi
# - cmd: choco install doxygen.install
- ps: cd "C:\projects\dart\ci"
- ps: .\appveyor_install.ps1

# scripts to run before build
before_build:
Expand All @@ -55,17 +53,12 @@ before_build:
# We generate project files for Visual Studio 12 because the boost binaries installed on the test server are for Visual Studio 12.
- cmd: if "%platform%"=="Win32" set CMAKE_GENERATOR_NAME=Visual Studio 12
- cmd: if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=Visual Studio 12 Win64
- cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_CORE_ONLY="%BUILD_CORE_ONLY%" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBoost_USE_STATIC_LIBS="ON" -Durdfdom_DIR="%urdfdom_DIR%" -Durdfdom_headers_DIR="%urdfdom_headers_DIR%" ..
- cmd: cmake -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=%configuration% -DBUILD_CORE_ONLY="%BUILD_CORE_ONLY%" -DDART_BUILD_EXAMPLES="%BUILD_EXAMPLES%" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBoost_USE_STATIC_LIBS="ON" -Durdfdom_DIR="%urdfdom_DIR%" -Durdfdom_headers_DIR="%urdfdom_headers_DIR%" ..

build:
project: C:\projects\dart\build\dart.sln

# enable MSBuild parallel builds
parallel: true

# MSBuild verbosity level (quiet|minimal|normal|detailed)
verbosity: detailed
project: C:\projects\dart\build\dart.sln # path to Visual Studio solution or project
parallel: true # enable MSBuild parallel builds
verbosity: minimal # MSBuild verbosity level (quiet|minimal|normal|detailed)

test_script:
- cmd: ctest -C Release -VV
- cmd: ctest -C Debug -VV
- cmd: ctest --build-config %configuration% --extra-verbose --output-on-failure
35 changes: 35 additions & 0 deletions ci/appveyor_install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function ExecuteCommand($command, $command_args)
{
Write-Host $command $command_args
Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru
}

function InstallPrerequisites($work_dir, $install_dir)
{
$old_dir = $pwd
cd $work_dir

$msi = "dart-prerequisites.msi"
$uri = "https://github.com/dartsim/dart-prerequisites-windows/raw/bfb42e9e8271bc99f8b070715bd407cb5988c322/DART%205.0-prerequisites-msvc12-md-32bit.msi"
Invoke-WebRequest $uri -OutFile $msi

$install_command = "msiexec.exe"
$install_args = "/qn /log log.txt /i $msi TARGETDIR=$install_dir"
ExecuteCommand $install_command $install_args

cd $old_dir
}

function main()
{
try
{
InstallPrerequisites "C:/projects" "C:/Golems"
}
catch
{
throw
}
}

main
12 changes: 6 additions & 6 deletions dart/common/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Timer::Timer(const std::string& _name)
mName(_name),
mIsStarted(false)
{
#if WIN32
#ifdef _WIN32
mTimer.start.QuadPart = 0;
mTimer.stop.QuadPart = 0;
QueryPerformanceFrequency(&mFrequency);
Expand All @@ -71,7 +71,7 @@ Timer::~Timer()
}

//==============================================================================
#if WIN32
#ifdef _WIN32
double Timer::_convLIToSecs(const LARGE_INTEGER& _L)
{
return (static_cast<double>(_L.QuadPart)
Expand All @@ -84,7 +84,7 @@ void Timer::start()
{
mIsStarted = true;
mCount++;
#if WIN32
#ifdef _WIN32
QueryPerformanceCounter(&mTimer.start);
#else
gettimeofday(&mTimeVal, nullptr);
Expand All @@ -96,7 +96,7 @@ void Timer::start()
void Timer::stop()
{
mIsStarted = false;
#if WIN32
#ifdef _WIN32
QueryPerformanceCounter(&mTimer.stop);
LARGE_INTEGER time;
time.QuadPart = mTimer.stop.QuadPart - mTimer.start.QuadPart;
Expand All @@ -112,7 +112,7 @@ void Timer::stop()
//==============================================================================
double Timer::getElapsedTime()
{
#if WIN32
#ifdef _WIN32
LARGE_INTEGER timenow;
QueryPerformanceCounter(&timenow);
LARGE_INTEGER time;
Expand Down Expand Up @@ -166,7 +166,7 @@ void Timer::print()
//==============================================================================
double Timer::getWallTime()
{
#if WIN32
#ifdef _WIN32
LARGE_INTEGER ticksPerSecond;
LARGE_INTEGER ticks;
QueryPerformanceFrequency(&ticksPerSecond);
Expand Down
6 changes: 3 additions & 3 deletions dart/common/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include <string>

#if WIN32
#ifdef _WIN32
#ifdef NOMINMAX
#include <windows.h>
#else
Expand Down Expand Up @@ -100,7 +100,7 @@ class Timer
private:
int mCount;

#if WIN32
#ifdef _WIN32
stopWatch mTimer;
#else
timeval mTimeVal;
Expand All @@ -113,7 +113,7 @@ class Timer
std::string mName;
bool mIsStarted;

#if WIN32
#ifdef _WIN32
LARGE_INTEGER mFrequency;
double _convLIToSecs(const LARGE_INTEGER& _L);
#endif
Expand Down
Loading

0 comments on commit b16e745

Please sign in to comment.