From 9418af21502645df4e1c922ce79556bbdc43ec0a Mon Sep 17 00:00:00 2001 From: Shital Shah Date: Wed, 19 Jul 2017 18:09:35 -0700 Subject: [PATCH] Fix CMakeLists for Utils.cpp, Semaphore ifdefs --- MavLinkCom/src/Semaphore.cpp | 12 ++++------- clean.sh | 1 + cmake/MavLinkCom/CMakeLists.txt | 1 - cmake/MavLinkCom/MavLinkTest/CMakeLists.txt | 24 +++++---------------- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/MavLinkCom/src/Semaphore.cpp b/MavLinkCom/src/Semaphore.cpp index c7030a365c..0cf68c994b 100644 --- a/MavLinkCom/src/Semaphore.cpp +++ b/MavLinkCom/src/Semaphore.cpp @@ -1,18 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#ifdef _WIN32 -#include - #include "Semaphore.hpp" #include "Utils.hpp" using namespace mavlink_utils; -#ifdef __APPLE__ -#include //SIGALRM -#include -#endif +#ifdef _WIN32 +#include class Semaphore::semaphore_impl { @@ -72,7 +67,8 @@ class Semaphore::semaphore_impl }; #elif defined(__APPLE__) - +#include //SIGALRM +#include #include #include #include diff --git a/clean.sh b/clean.sh index f487e38979..892d9a3dd6 100755 --- a/clean.sh +++ b/clean.sh @@ -5,6 +5,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" pushd "$SCRIPT_DIR" set -e +set +x rm -rf build_debug rm -rf build_release diff --git a/cmake/MavLinkCom/CMakeLists.txt b/cmake/MavLinkCom/CMakeLists.txt index 74f29cae61..45ff74e471 100644 --- a/cmake/MavLinkCom/CMakeLists.txt +++ b/cmake/MavLinkCom/CMakeLists.txt @@ -14,7 +14,6 @@ include_directories( ) -LIST(APPEND MAVLINK_SOURCES "${AIRSIM_ROOT}/MavLinkCom/common_utils/Utils.cpp") LIST(APPEND MAVLINK_SOURCES "${AIRSIM_ROOT}/MavLinkCom/common_utils/FileSystem.cpp") LIST(APPEND MAVLINK_SOURCES "${AIRSIM_ROOT}/MavLinkCom/common_utils/ThreadUtils.cpp") LIST(APPEND MAVLINK_SOURCES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkConnection.cpp") diff --git a/cmake/MavLinkCom/MavLinkTest/CMakeLists.txt b/cmake/MavLinkCom/MavLinkTest/CMakeLists.txt index 160fc06f24..35d3ed2f2a 100644 --- a/cmake/MavLinkCom/MavLinkTest/CMakeLists.txt +++ b/cmake/MavLinkCom/MavLinkTest/CMakeLists.txt @@ -1,34 +1,20 @@ cmake_minimum_required(VERSION 3.2.2) project(MavLinkTest) -LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../cmake-modules") +LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake-modules") INCLUDE("${CMAKE_CURRENT_LIST_DIR}/../../cmake-modules/CommonSetup.cmake") CommonSetup() -IF(UNIX) -ELSE() - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CONSOLE ") - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE ") -ENDIF() +SetupConsoleBuild() -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) include_directories( ${AIRSIM_ROOT}/MavLinkCom/MavLinkTest ${AIRSIM_ROOT}/MavLinkCom/include ${AIRSIM_ROOT}/MavLinkCom/common_utils ) -## Declare the executable -add_executable(MavLinkTest - ${AIRSIM_ROOT}/MavLinkCom/MavLinkTest/Commands.cpp - ${AIRSIM_ROOT}/MavLinkCom/MavLinkTest/UnitTests.cpp - ${AIRSIM_ROOT}/MavLinkCom/MavLinkTest/main.cpp - ) + set(PROJECT_CPP ${PROJECT_NAME}_sources) + file(GLOB_RECURSE PROJECT_CPP "${AIRSIM_ROOT}/MavLinkCom/${PROJECT_NAME}/*.cpp") + add_executable(${PROJECT_NAME} ${PROJECT_CPP}) target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} MavLinkCom c++abi ${CXX_EXP_LIB})