add xp support and fix static build

This commit is contained in:
Alexander Skovpen 2018-09-07 22:43:45 +03:00 committed by dukelsky
parent dbea29951d
commit bf7f3c9b2f
4 changed files with 73 additions and 15 deletions

View File

@ -3,12 +3,14 @@ project(golded-plus C CXX)
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckIncludeFile) include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckSymbolExists)
check_function_exists(snprintf HAVE_SNPRINTF) CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
if (${HAVE_SNPRINTF}) if (${HAVE_SNPRINTF})
add_definitions(-DHAVE_SNPRINTF=1) add_definitions(-DHAVE_SNPRINTF=1)
endif() endif()
check_function_exists(vsnprintf HAVE_VSNPRINTF) CHECK_SYMBOL_EXISTS(vsnprintf stdio.h HAVE_VSNPRINTF)
if (${HAVE_VSNPRINTF}) if (${HAVE_VSNPRINTF})
add_definitions(-DHAVE_VSNPRINTF=1) add_definitions(-DHAVE_VSNPRINTF=1)
endif() endif()
@ -16,14 +18,61 @@ CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H)
if (${HAVE_STDARG_H}) if (${HAVE_STDARG_H})
add_definitions(-DHAVE_STDARG_H=1) add_definitions(-DHAVE_STDARG_H=1)
endif() endif()
CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
if (${HAVE_STRING_H})
add_definitions(-DHAVE_STRING_H=1)
endif()
CHECK_INCLUDE_FILE("malloc.h" HAVE_MALLOC_H)
if (${HAVE_MALLOC_H})
add_definitions(-DHAVE_MALLOC_H=1)
endif()
CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H)
if (${HAVE_TIME_H})
add_definitions(-DHAVE_TIME_H=1)
endif()
CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
if (${HAVE_ERRNO_H})
add_definitions(-DHAVE_ERRNO_H=1)
endif()
CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
if (${HAVE_FCNTL_H})
add_definitions(-DHAVE_FCNTL_H=1)
endif()
CHECK_INCLUDE_FILE("io.h" HAVE_IO_H)
if (${HAVE_IO_H})
add_definitions(-DHAVE_IO_H=1)
endif()
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
if (${HAVE_UNISTD_H})
add_definitions(-DHAVE_UNISTD_H=1)
endif()
CHECK_INCLUDE_FILES("stdarg.h;stdlib.h;stddef.h;string.h" HAVE_STDC_HEADERS)
if (${HAVE_STDC_HEADERS})
add_definitions(-DSTDC_HEADERS=1)
endif()
check_include_files("time.h;sys/time.h" TIME_WITH_SYS_TIME)
if (${TIME_WITH_SYS_TIME})
add_definitions(-DTIME_WITH_SYS_TIME=1)
endif()
include(FindCurses) include(FindCurses)
if (CURSES_NCURSES_LIBRARY) if (CURSES_NCURSES_LIBRARY)
add_definitions(-D__USE_NCURSES__) add_definitions(-D__USE_NCURSES__)
endif() endif()
if (MSVC) if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J /MP")
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_SNPRINTF -DHAVE_VSNPRINTF -D_CRT_SECURE_NO_WARNINGS -D_ALLOW_RTCc_IN_STL -D_CONSOLE -DHAVE_CONFIG_H -D__INCLUDE_NEW_KEYWORDS__) add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_ALLOW_RTCc_IN_STL -D_CONSOLE -D__INCLUDE_NEW_KEYWORDS__)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
else() else()
add_definitions(-funsigned-char -D__INCLUDE_NEW_KEYWORDS__ -DPRAGMA_PACK -Wno-sign-compare -pedantic -Wno-write-strings) add_definitions(-funsigned-char -D__INCLUDE_NEW_KEYWORDS__ -DPRAGMA_PACK -Wno-sign-compare -pedantic -Wno-write-strings)
endif() endif()

View File

@ -3,20 +3,30 @@ branches:
only: only:
- master - master
- /^golded-.*/ - /^golded-.*/
image:
- Visual Studio 2017
environment: environment:
matrix: matrix:
- generator: Visual Studio 10 2010
pf: "msvc2010"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- generator: Visual Studio 10 2010 Win64
pf: "msvc2010"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- generator: Visual Studio 15 2017 - generator: Visual Studio 15 2017
pf: "msvc2017"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- generator: Visual Studio 15 2017 Win64 - generator: Visual Studio 15 2017 Win64
pf: "msvc2017"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
install: install:
- cmd: copy golded3\mygolded.__h golded3\mygolded.h - cmd: copy golded3\mygolded.__h golded3\mygolded.h
build_script: build_script:
- if ["%GENERATOR%"]==["Visual Studio 10 2010 Win64"] if not ["%APPVEYOR_REPO_TAG%"]==["true"] (appveyor exit)
- if ["%GENERATOR%"]==["Visual Studio 15 2017 Win64"] if not ["%APPVEYOR_REPO_TAG%"]==["true"] (appveyor exit)
- cmd: mkdir build && cd build && cmake --version - cmd: mkdir build && cd build && cmake --version
- cmd: cmake .. -G "%GENERATOR%" - cmd: cmake .. -G "%GENERATOR%"
- cmd: cmake --build . -- /P:Configuration=Release - cmd: cmake --build . -- /P:Configuration=Release
- cmd: cpack - cmd: cpack
- ps: gci *.7z | %{ rename-item path $_.Fullname Newname ( $_.basename +"-"+$Env:pf+$_.extension) }
artifacts: artifacts:
- path: build\*.7z - path: build\*.7z
name: dist name: dist

View File

@ -2,6 +2,5 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(glibc_SOURCES set(glibc_SOURCES
regex.cpp regex.cpp
) )
add_definitions(-DHAVE_CONFIG_H)
include_directories(../gall) include_directories(../gall)
ADD_LIBRARY(glibc STATIC ${glibc_SOURCES}) ADD_LIBRARY(glibc STATIC ${glibc_SOURCES})

View File

@ -9,6 +9,6 @@ set(uulib_SOURCES
uustring.cpp uustring.cpp
uuutil.cpp uuutil.cpp
) )
add_definitions(-DHAVE_CONFIG_H)
include_directories(../gall ../glibc) include_directories(../gall ../glibc)
ADD_LIBRARY(uulib STATIC ${uulib_SOURCES}) ADD_LIBRARY(uulib STATIC ${uulib_SOURCES})
target_compile_definitions(uulib PRIVATE -DVERSION="15" -DPATCH="0.5")