Update Cmake build
This commit is contained in:
parent
a2a0d8f8ce
commit
4ddd1edf13
@ -7,7 +7,6 @@ before_install:
|
|||||||
- export CXXFLAGS="$CXXFLAGS -DTRAVIS"
|
- export CXXFLAGS="$CXXFLAGS -DTRAVIS"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- sudo apt-get install -qq libwxgtk3.0-dev libwxgtk3.0-0 libssh2-1-dev
|
|
||||||
- if [ "$CXX" = "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 98; fi
|
- if [ "$CXX" = "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 98; fi
|
||||||
|
|
||||||
# Build with both gcc and clang
|
# Build with both gcc and clang
|
||||||
@ -18,14 +17,11 @@ compiler:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- debian-sid
|
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
packages:
|
||||||
|
- cmake
|
||||||
- gcc-4.8
|
- gcc-4.8
|
||||||
- g++-4.8
|
- g++-4.8
|
||||||
- clang
|
- clang
|
||||||
- libwxgtk3.0-dev
|
|
||||||
- libwxgtk3.0-0
|
|
||||||
- libssh2-1-dev
|
|
||||||
|
|
||||||
script: make clean run-tests
|
script: make clean run-tests
|
||||||
|
@ -1,26 +1,17 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Setup
|
# Setup
|
||||||
################################################################################
|
################################################################################
|
||||||
cmake_minimum_required (VERSION 2.8)
|
cmake_minimum_required (VERSION 3.0)
|
||||||
|
|
||||||
################################################################################
|
|
||||||
set(IS_WINDOWS ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
||||||
set(IS_OSX ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
# Hunter for dependency management
|
# Hunter for dependency management
|
||||||
if(${IS_WINDOWS})
|
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
include("cmake/HunterGate.cmake")
|
include("cmake/HunterGate.cmake")
|
||||||
HunterGate(
|
HunterGate(
|
||||||
URL "https://github.com/ruslo/hunter/archive/v0.12.24.tar.gz"
|
URL "https://github.com/ruslo/hunter/archive/v0.12.24.tar.gz"
|
||||||
SHA1 "a25a7fa55c204a8126efd1f48593a662925b26da"
|
SHA1 "a25a7fa55c204a8126efd1f48593a662925b26da"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
|
||||||
set(IS_WINDOWS ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|
||||||
set(IS_OSX ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
||||||
|
|
||||||
project(Tyro)
|
project(Tyro)
|
||||||
include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
|
include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
|
||||||
|
|
||||||
@ -33,21 +24,25 @@ if(COMPILER_SUPPORTS_CXX11)
|
|||||||
elseif(COMPILER_SUPPORTS_CXX0X)
|
elseif(COMPILER_SUPPORTS_CXX0X)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
|
# Need this for Visual Studio compilers
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
|
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# wxwidgets stuff
|
# wxwidgets stuff
|
||||||
if(${IS_WINDOWS})
|
|
||||||
hunter_add_package(libssh2)
|
set(wxWidgets_CONFIG_OPTIONS --static)
|
||||||
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
hunter_add_package(wxWidgets)
|
hunter_add_package(wxWidgets)
|
||||||
endif()
|
endif()
|
||||||
find_package(wxWidgets COMPONENTS core base aui stc adv REQUIRED)
|
find_package(wxWidgets COMPONENTS core base aui stc adv REQUIRED)
|
||||||
include("${wxWidgets_USE_FILE}")
|
include("${wxWidgets_USE_FILE}")
|
||||||
set(wxWidgets_CONFIG_OPTIONS --static)
|
|
||||||
|
|
||||||
#libssh2
|
#libssh2
|
||||||
set(CMAKE_MODULE_PATH ${Tyro_SOURCE_DIR}/cmake)
|
set(CMAKE_MODULE_PATH ${Tyro_SOURCE_DIR}/cmake)
|
||||||
|
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
hunter_add_package(libssh2)
|
||||||
|
endif()
|
||||||
find_package(LibSSH2 REQUIRED)
|
find_package(LibSSH2 REQUIRED)
|
||||||
if (LIBSSH2_FOUND)
|
if (LIBSSH2_FOUND)
|
||||||
set (INCLUDE_DIRS ${INCLUDE_DIRS} ${LIBSSH2_INCLUDE_DIR})
|
set (INCLUDE_DIRS ${INCLUDE_DIRS} ${LIBSSH2_INCLUDE_DIR})
|
||||||
@ -58,8 +53,8 @@ endif (LIBSSH2_FOUND)
|
|||||||
include_directories(${INCLUDE_DIRS})
|
include_directories(${INCLUDE_DIRS})
|
||||||
|
|
||||||
# set some platform-specific flags
|
# set some platform-specific flags
|
||||||
if(${IS_OSX})
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++ -Wno-potentially-evaluated-expression")
|
||||||
add_definitions(-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ -D__WXMAC__)
|
add_definitions(-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ -D__WXMAC__)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -97,7 +92,7 @@ file(GLOB widget_SRC
|
|||||||
add_library(WidgetLib STATIC ${widget_SRC})
|
add_library(WidgetLib STATIC ${widget_SRC})
|
||||||
target_link_libraries(WidgetLib JsonLib)
|
target_link_libraries(WidgetLib JsonLib)
|
||||||
|
|
||||||
if(${IS_OSX})
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
set(MACOSX_icon_file ${CMAKE_CURRENT_SOURCE_DIR}/resources/platform/osx/tyro.icns)
|
set(MACOSX_icon_file ${CMAKE_CURRENT_SOURCE_DIR}/resources/platform/osx/tyro.icns)
|
||||||
set(MACOSX_BUNDLE_ICON_FILE tyro.icns)
|
set(MACOSX_BUNDLE_ICON_FILE tyro.icns)
|
||||||
set(MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/platform/osx/Info.plist)
|
set(MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/platform/osx/Info.plist)
|
||||||
@ -106,7 +101,7 @@ if(${IS_OSX})
|
|||||||
src/TyroApp.cpp
|
src/TyroApp.cpp
|
||||||
${MACOSX_icon_file}
|
${MACOSX_icon_file}
|
||||||
)
|
)
|
||||||
elseif(${IS_WINDOWS})
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
add_executable(Tyro WIN32
|
add_executable(Tyro WIN32
|
||||||
resources/platform/msw/resource.rc
|
resources/platform/msw/resource.rc
|
||||||
src/TyroApp.cpp)
|
src/TyroApp.cpp)
|
||||||
@ -115,14 +110,6 @@ else()
|
|||||||
src/TyroApp.cpp)
|
src/TyroApp.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Try to use nuget to install dependencies on Windows
|
|
||||||
#if (${IS_WINDOWS})
|
|
||||||
# add_custom_command(TARGET ${PROJECT_NAME}
|
|
||||||
# PRE_BUILD
|
|
||||||
# COMMAND nuget restore "${PROJECT_SOURCE_DIR}\\resources\\visual_studio\\packages.config" -PackagesDirectory "${CMAKE_BINARY_DIR}\\packages"
|
|
||||||
# )
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
#link it all
|
#link it all
|
||||||
target_link_libraries(Tyro JsonLib BaseLib WidgetLib ${wxWidgets_LIBRARIES} ${Libssh2_LIBRARIES})
|
target_link_libraries(Tyro JsonLib BaseLib WidgetLib ${wxWidgets_LIBRARIES} ${Libssh2_LIBRARIES})
|
||||||
|
|
||||||
@ -137,4 +124,4 @@ file(GLOB test_SRC
|
|||||||
)
|
)
|
||||||
add_executable(test_runner ${test_SRC})
|
add_executable(test_runner ${test_SRC})
|
||||||
|
|
||||||
target_link_libraries(test_runner ${wxWidgets_LIBRARIES} ${Libssh2_LIBRARIES} JsonLib BaseLib WidgetLib)
|
target_link_libraries(test_runner ${wxWidgets_LIBRARIES} ${Libssh2_LIBRARIES} JsonLib BaseLib WidgetLib)
|
Loading…
Reference in New Issue
Block a user