Start of changes to build on Windows w/ Visual Studio

This commit is contained in:
Timothy Warren 2015-10-23 15:49:29 -04:00
parent b92b67835b
commit 09d99c8a1f
3 changed files with 33 additions and 43 deletions

View File

@ -1,7 +1,7 @@
################################################################################
# Setup
################################################################################
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)
project(Tyro)
include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
@ -11,12 +11,12 @@ include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
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")
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()
# wxwidgets stuff
@ -25,13 +25,13 @@ include("${wxWidgets_USE_FILE}")
set(wxWidgets_CONFIG_OPTIONS --static)
#libssh2
#set(CMAKE_MODULE_PATH ${Tyro_SOURCE_DIR}/cmake)
#find_package(LibSSH2 REQUIRED)
#if (LIBSSH2_FOUND)
# set (INCLUDE_DIRS ${INCLUDE_DIRS} ${LIBSSH2_INCLUDE_DIR})
#else (LIBSSH2_FOUND)
# message ( FATAL_ERROR "Could not find LibSSH2" )
#endif (LIBSSH2_FOUND)
set(CMAKE_MODULE_PATH ${Tyro_SOURCE_DIR}/cmake)
find_package(LibSSH2 REQUIRED)
if (LIBSSH2_FOUND)
set (INCLUDE_DIRS ${INCLUDE_DIRS} ${LIBSSH2_INCLUDE_DIR})
else (LIBSSH2_FOUND)
message ( FATAL_ERROR "Could not find LibSSH2" )
endif (LIBSSH2_FOUND)
include_directories(${INCLUDE_DIRS})
@ -64,8 +64,8 @@ add_custom_command(
)
# base library
add_library(BaseLib STATIC
# src/base/SFTP.cpp
add_library(BaseLib STATIC
src/base/SFTP.cpp
src/settings/Config.cpp)
# widget library
@ -81,7 +81,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX_BUNDLE_ICON_FILE tyro.icns)
set(MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/resources/platform/osx/Info.plist)
set_source_files_properties(${MACOSX_icon_file} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable(Tyro MACOSX_BUNDLE
add_executable(Tyro MACOSX_BUNDLE
src/TyroApp.cpp
${MACOSX_icon_file}
)
@ -94,9 +94,16 @@ else()
src/TyroApp.cpp)
endif()
# Try to use nuget to install dependencies on Windows
if (${CMAKE_SYSTEM_NAME} MATCHES "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
target_link_libraries(Tyro JsonLib BaseLib WidgetLib ${wxWidgets_LIBRARIES})
#target_link_libraries(Tyro JsonLib BaseLib WidgetLib ${wxWidgets_LIBRARIES} ${Libssh2_LIBRARIES})
target_link_libraries(Tyro JsonLib BaseLib WidgetLib ${wxWidgets_LIBRARIES} ${Libssh2_LIBRARIES})
################################################################################
# Tests
@ -109,6 +116,4 @@ file(GLOB test_SRC
)
add_executable(test_runner ${test_SRC})
target_link_libraries(test_runner ${wxWidgets_LIBRARIES} JsonLib BaseLib WidgetLib)
#target_link_libraries(test_runner ${wxWidgets_LIBRARIES} ${Libssh2_LIBRARIES} JsonLib BaseLib WidgetLib)
target_link_libraries(test_runner ${wxWidgets_LIBRARIES} ${Libssh2_LIBRARIES} JsonLib BaseLib WidgetLib)

View File

@ -4,35 +4,14 @@ In order to keep a consistent build system, Tyro is built with MinGW and Msys. T
## Build Environment Setup:
1. Download MinGW [installer](http://www.mingw.org/download/installer)
2. Install MinGW & MSyS (at least the following packages)
* mingw-developer-toolkit
* mingw32-base
* mingw32-gcc-g++
* msys-base
3. Add `{MinGW Path}\bin` and `{MinGW Path}\msys\1.0\bin` to the system Path environment variable
4. Open the Msys prompt at `{MinGW Path}\msys\1.0\msys.bat`. You'll probably want a shortcut to this, as it is what will be used for compiling everything from here on.
5. Install [Git](http://git-scm.com/download/win)
1. Install [Visual Studio 2015](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx) (Community or Express should work)
2. Install [Git](http://git-scm.com/download/win)
3. Install [CMake](https://cmake.org/download/)
## Build wxWidgets
1. Download the windows [installer](https://www.wxwidgets.org/downloads/) for version 3
2. Use the MSyS prompt to navigate to the wxWidgets directory
3. Make a new folder, eg. msw-debug, and cd into it.
4. Run `export CXXFLAGS="-std=gnu++11 $CXXFLAGS"` to allow usage of C++11 features
5. Run `../configure --disable-shared --enable-debug --disable-compat28` in that new directory.
5. After configure finishes, run `make && make install` in the same folder.
## Build SFTP Dependencies
1. Run `git clone https://github.com/timw4mail/Tyro-depends.git` in the folder of your choice.
2. Run `sh ./buildssh2.sh` to build the dependencies.
3. Now you can build Tyro
## Build Tyro
In the source folder, run `make dev run` to build the develop version and run it immediately

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="rmt_libssh2" version="1.6.0.1" targetFramework="native" />
<package id="rmt_openssl" version="1.0.2.4" targetFramework="native" />
<package id="rmt_zlib" version="1.2.8.3" targetFramework="native" />
</packages>