Modify installation on Windows (#366)
This commit is contained in:
parent
d5cd882248
commit
e171874524
|
@ -0,0 +1,41 @@
|
|||
version: 1.0.0.{build}
|
||||
configuration:
|
||||
- Release
|
||||
- Debug
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- GENERATOR: Visual Studio 15 2017
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: Win32
|
||||
|
||||
- GENERATOR: Visual Studio 15 2017
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ARCH: x64
|
||||
|
||||
init:
|
||||
- cmake --version
|
||||
install:
|
||||
- cd C:\Tools\vcpkg
|
||||
- git pull
|
||||
- .\bootstrap-vcpkg.bat
|
||||
- vcpkg install jsoncpp:x86-windows
|
||||
- vcpkg install jsoncpp:x64-windows
|
||||
- vcpkg install zlib:x86-windows
|
||||
- vcpkg install zlib:x64-windows
|
||||
- vcpkg install libpq:x86-windows
|
||||
- vcpkg install libpq:x64-windows
|
||||
- vcpkg integrate install
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
before_build:
|
||||
- git submodule update --init
|
||||
- md build
|
||||
- cd build
|
||||
- cmake --config "%CONFIGURATION%" -G "%GENERATOR%" -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake ..
|
||||
build_script:
|
||||
- cmake --build . --config "%CONFIGURATION%"
|
||||
build:
|
||||
project: build\ALL_BUILD.vcxproj
|
||||
verbosity: minimal
|
||||
cache:
|
||||
- c:\tools\vcpkg\installed\
|
|
@ -3,7 +3,7 @@ matrix:
|
|||
- os: linux
|
||||
dist: xenial
|
||||
- os: osx
|
||||
osx_image: xcode11.3
|
||||
osx_image: xcode11.2
|
||||
|
||||
sudo: required
|
||||
|
||||
|
|
107
CMakeLists.txt
107
CMakeLists.txt
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(drogon CXX)
|
||||
project(drogon)
|
||||
message(STATUS "compiler: " ${CMAKE_CXX_COMPILER_ID})
|
||||
option(BUILD_CTL "Build drogon_ctl" ON)
|
||||
option(BUILD_EXAMPLES "Build examples" ON)
|
||||
|
@ -21,11 +21,7 @@ set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
|||
set(INSTALL_INCLUDE_DIR
|
||||
include
|
||||
CACHE PATH "Installation directory for header files")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(DEF_INSTALL_DROGON_CMAKE_DIR cmake)
|
||||
else()
|
||||
set(DEF_INSTALL_DROGON_CMAKE_DIR lib/cmake/Drogon)
|
||||
endif()
|
||||
set(DEF_INSTALL_DROGON_CMAKE_DIR lib/cmake/Drogon)
|
||||
set(INSTALL_DROGON_CMAKE_DIR
|
||||
${DEF_INSTALL_DROGON_CMAKE_DIR}
|
||||
CACHE PATH "Installation directory for cmake files")
|
||||
|
@ -49,9 +45,9 @@ if(BUILD_DROGON_SHARED)
|
|||
set(CMAKE_INSTALL_RPATH "${INSTALL_LIB_DIR}")
|
||||
endif("${isSystemDir}" STREQUAL "-1")
|
||||
add_library(${PROJECT_NAME} SHARED)
|
||||
else()
|
||||
else(BUILD_DROGON_SHARED)
|
||||
add_library(${PROJECT_NAME} STATIC)
|
||||
endif()
|
||||
endif(BUILD_DROGON_SHARED)
|
||||
|
||||
include(CheckIncludeFileCXX)
|
||||
|
||||
|
@ -59,9 +55,9 @@ check_include_file_cxx(any HAS_ANY)
|
|||
check_include_file_cxx(string_view HAS_STRING_VIEW)
|
||||
if(HAS_ANY AND HAS_STRING_VIEW)
|
||||
set(DROGON_CXX_STANDARD 17)
|
||||
else()
|
||||
else(HAS_ANY AND HAS_STRING_VIEW)
|
||||
set(DROGON_CXX_STANDARD 14)
|
||||
endif()
|
||||
endif(HAS_ANY AND HAS_STRING_VIEW)
|
||||
|
||||
target_include_directories(
|
||||
${PROJECT_NAME}
|
||||
|
@ -83,18 +79,13 @@ list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW
|
|||
${PROJECT_SOURCE_DIR}/orm_lib/inc
|
||||
${PROJECT_SOURCE_DIR}/trantor)
|
||||
|
||||
if(WIN32)
|
||||
add_subdirectory(third_party/mman-win32)
|
||||
endif(WIN32)
|
||||
add_subdirectory(trantor)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC trantor)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE mman)
|
||||
else()
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE dl)
|
||||
endif(WIN32)
|
||||
endif(NOT WIN32)
|
||||
|
||||
if(DROGON_CXX_STANDARD LESS 17)
|
||||
# With C++14, use boost to support any and string_view
|
||||
|
@ -102,9 +93,9 @@ if(DROGON_CXX_STANDARD LESS 17)
|
|||
find_package(Boost 1.61.0 REQUIRED)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${Boost_INCLUDE_DIRS})
|
||||
list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW ${Boost_INCLUDE_DIRS})
|
||||
else()
|
||||
else(DROGON_CXX_STANDARD LESS 17)
|
||||
message(STATUS "use c++17")
|
||||
endif()
|
||||
endif(DROGON_CXX_STANDARD LESS 17)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/)
|
||||
|
||||
|
@ -133,7 +124,7 @@ if(NOT WIN32)
|
|||
FATAL_ERROR
|
||||
"jsoncpp lib is too old,please get new version from https://github.com/open-source-parsers/jsoncpp"
|
||||
)
|
||||
endif()
|
||||
endif(jsoncpp_ver LESS 1.7)
|
||||
|
||||
find_package(UUID REQUIRED)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${UUID_INCLUDE_DIR})
|
||||
|
@ -155,11 +146,6 @@ if(NOT WIN32)
|
|||
message(FATAL_ERROR "uuid lib error")
|
||||
endif()
|
||||
endif(NOT WIN32)
|
||||
if(NOT MSVC OR NOT BUILD_ORM)
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${ZLIB_INCLUDE_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${ZLIB_LIBRARIES})
|
||||
endif(NOT MSVC OR NOT BUILD_ORM)
|
||||
|
||||
set(DROGON_SOURCES
|
||||
lib/src/AOPAdvice.cc
|
||||
|
@ -197,17 +183,10 @@ set(DROGON_SOURCES
|
|||
|
||||
if(NOT WIN32)
|
||||
set(DROGON_SOURCES ${DROGON_SOURCES} lib/src/SharedLibManager.cc)
|
||||
else(NOT WIN32)
|
||||
set(DROGON_SOURCES ${DROGON_SOURCES} third_party/mman-win32/mman.c)
|
||||
endif(NOT WIN32)
|
||||
|
||||
find_package(OpenSSL)
|
||||
if(OpenSSL_FOUND)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENSSL_LIBRARIES})
|
||||
else()
|
||||
set(DROGON_SOURCES ${DROGON_SOURCES} lib/src/ssl_funcs/Md5.cc
|
||||
lib/src/ssl_funcs/Sha1.cc)
|
||||
endif()
|
||||
|
||||
if(BUILD_ORM)
|
||||
# find postgres
|
||||
find_package(PostgreSQL)
|
||||
|
@ -224,18 +203,18 @@ if(BUILD_ORM)
|
|||
${PROJECT_SOURCE_DIR}/cmake/tests/test_libpq_batch_mode.cc
|
||||
LINK_LIBRARIES ${PostgreSQL_LIBRARIES}
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${PostgreSQL_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif(LIBPQ_BATCH_MODE)
|
||||
if(libpq_supports_batch)
|
||||
message(STATUS "The libpq supports batch mode")
|
||||
option(LIBPQ_SUPPORTS_BATCH_MODE "libpq batch mode" ON)
|
||||
set(DROGON_SOURCES ${DROGON_SOURCES}
|
||||
orm_lib/src/postgresql_impl/PgBatchConnection.cc)
|
||||
else()
|
||||
else(libpq_supports_batch)
|
||||
option(LIBPQ_SUPPORTS_BATCH_MODE "libpq batch mode" OFF)
|
||||
set(DROGON_SOURCES ${DROGON_SOURCES}
|
||||
orm_lib/src/postgresql_impl/PgConnection.cc)
|
||||
endif()
|
||||
endif()
|
||||
endif(libpq_supports_batch)
|
||||
endif(PostgreSQL_FOUND)
|
||||
|
||||
# Find mysql, only mariadb client liberary is supported
|
||||
find_package(MySQL)
|
||||
|
@ -266,8 +245,24 @@ if(BUILD_ORM)
|
|||
set(DROGON_SOURCES ${DROGON_SOURCES}
|
||||
orm_lib/src/sqlite3_impl/Sqlite3Connection.cc
|
||||
orm_lib/src/sqlite3_impl/Sqlite3ResultImpl.cc)
|
||||
endif()
|
||||
endif()
|
||||
endif(SQLITE3_FOUND)
|
||||
endif(BUILD_ORM)
|
||||
|
||||
if((NOT MSVC) OR (NOT BUILD_ORM))
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${ZLIB_INCLUDE_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${ZLIB_LIBRARIES})
|
||||
message(STATUS "zlib:" ${ZLIB_LIBRARIES})
|
||||
endif((NOT MSVC) OR (NOT BUILD_ORM))
|
||||
|
||||
find_package(OpenSSL)
|
||||
if(OpenSSL_FOUND)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENSSL_LIBRARIES})
|
||||
else(OpenSSL_FOUND)
|
||||
set(DROGON_SOURCES ${DROGON_SOURCES} lib/src/ssl_funcs/Md5.cc
|
||||
lib/src/ssl_funcs/Sha1.cc)
|
||||
endif(OpenSSL_FOUND)
|
||||
|
||||
execute_process(COMMAND "git" rev-parse HEAD
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
|
@ -278,11 +273,11 @@ configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/version.h.in"
|
|||
|
||||
if(BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
endif(BUILD_EXAMPLES)
|
||||
|
||||
if(BUILD_CTL)
|
||||
add_subdirectory(drogon_ctl)
|
||||
endif()
|
||||
endif(BUILD_CTL)
|
||||
|
||||
if(PostgreSQL_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
|
||||
set(DROGON_SOURCES
|
||||
|
@ -300,9 +295,9 @@ if(PostgreSQL_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
|
|||
orm_lib/src/SqlBinder.cc
|
||||
orm_lib/src/TransactionImpl.cc
|
||||
orm_lib/src/RestfulController.cc)
|
||||
else()
|
||||
else(PostgreSQL_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
|
||||
set(DROGON_SOURCES ${DROGON_SOURCES} lib/src/DbClientManagerSkipped.cc)
|
||||
endif()
|
||||
endif(PostgreSQL_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
|
||||
|
||||
target_sources(${PROJECT_NAME} PRIVATE ${DROGON_SOURCES})
|
||||
|
||||
|
@ -315,22 +310,22 @@ set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME Drogon)
|
|||
if(PostgreSQL_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
|
||||
if(PostgreSQL_FOUND)
|
||||
option(USE_POSTGRESQL "Enable PostgreSQL" ON)
|
||||
else()
|
||||
else(PostgreSQL_FOUND)
|
||||
option(USE_POSTGRESQL "Disable PostgreSQL" OFF)
|
||||
endif()
|
||||
endif(PostgreSQL_FOUND)
|
||||
|
||||
if(MYSQL_FOUND)
|
||||
option(USE_MYSQL "Enable Mysql" ON)
|
||||
else()
|
||||
else(MYSQL_FOUND)
|
||||
option(USE_MYSQL "DisableMysql" OFF)
|
||||
endif()
|
||||
endif(MYSQL_FOUND)
|
||||
|
||||
if(SQLITE3_FOUND)
|
||||
option(USE_SQLITE3 "Enable Sqlite3" ON)
|
||||
else()
|
||||
else(SQLITE3_FOUND)
|
||||
option(USE_SQLITE3 "Disable Sqlite3" OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif(SQLITE3_FOUND)
|
||||
endif(PostgreSQL_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
|
||||
|
||||
set(COMPILER_COMMAND ${CMAKE_CXX_COMPILER})
|
||||
set(COMPILER_ID ${CMAKE_CXX_COMPILER_ID})
|
||||
|
@ -344,9 +339,9 @@ if(CMAKE_BUILD_TYPE)
|
|||
else()
|
||||
set(COMPILATION_FLAGS "-std=c++")
|
||||
endif()
|
||||
else()
|
||||
else(CMAKE_BUILD_TYPE)
|
||||
set(COMPILATION_FLAGS "-std=c++")
|
||||
endif()
|
||||
endif(CMAKE_BUILD_TYPE)
|
||||
|
||||
list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW "${INSTALL_INCLUDE_DIR}")
|
||||
list(REMOVE_DUPLICATES INCLUDE_DIRS_FOR_DYNAMIC_VIEW)
|
||||
|
@ -365,13 +360,13 @@ if(BUILD_TESTING)
|
|||
if(PostgreSQL_FOUND)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/orm_lib/src/postgresql_impl/test)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/orm_lib/tests)
|
||||
endif()
|
||||
endif(PostgreSQL_FOUND)
|
||||
if(MYSQL_FOUND)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/orm_lib/src/mysql_impl/test)
|
||||
endif()
|
||||
endif(MYSQL_FOUND)
|
||||
if(SQLITE3_FOUND)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/orm_lib/src/sqlite3_impl/test)
|
||||
endif()
|
||||
endif(SQLITE3_FOUND)
|
||||
find_package(GTest)
|
||||
if(GTest_FOUND)
|
||||
message(STATUS "gtest found")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
![](https://github.com/an-tao/drogon/wiki/images/drogon-white.jpg)
|
||||
|
||||
[![Build Status](https://travis-ci.com/an-tao/drogon.svg?branch=master)](https://travis-ci.com/an-tao/drogon)
|
||||
[![Build status](https://ci.appveyor.com/api/projects/status/12ffuf6j5vankgyb/branch/master?svg=true)](https://ci.appveyor.com/project/an-tao/drogon/branch/master)
|
||||
[![Total alerts](https://img.shields.io/lgtm/alerts/g/an-tao/drogon.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/an-tao/drogon/alerts/)
|
||||
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/an-tao/drogon.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/an-tao/drogon/context:cpp)
|
||||
[![Join the chat at https://gitter.im/drogon-web/community](https://badges.gitter.im/drogon-web/community.svg)](https://gitter.im/drogon-web/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
|
|
@ -9,10 +9,9 @@
|
|||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
if(NOT Trantor_FOUND)
|
||||
# find trantor
|
||||
find_package(Trantor CONFIG REQUIRED)
|
||||
endif()
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Trantor)
|
||||
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
|
||||
|
|
|
@ -98,6 +98,9 @@ if(MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
|
|||
if(MSVC)
|
||||
set(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} shlwapi)
|
||||
endif(MSVC)
|
||||
if(WIN32)
|
||||
set(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ws2_32)
|
||||
endif(WIN32)
|
||||
|
||||
message(
|
||||
STATUS
|
||||
|
|
|
@ -43,11 +43,21 @@ if(WIN32)
|
|||
endif(WIN32)
|
||||
message(STATUS "bin:" ${INSTALL_BIN_DIR})
|
||||
install(TARGETS drogon_ctl RUNTIME DESTINATION ${INSTALL_BIN_DIR})
|
||||
install(CODE "execute_process( \
|
||||
if(WIN32)
|
||||
set(CTL_FILE $<TARGET_FILE:drogon_ctl>)
|
||||
add_custom_command(TARGET drogon_ctl POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DCTL_FILE=${CTL_FILE}
|
||||
-DINSTALL_BIN_DIR=${INSTALL_BIN_DIR}
|
||||
-P
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CopyDlls.cmake)
|
||||
else(WIN32)
|
||||
install(CODE "execute_process( \
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink \
|
||||
${INSTALL_BIN_DIR}/drogon_ctl \
|
||||
${INSTALL_BIN_DIR}/dg_ctl \
|
||||
)")
|
||||
endif(WIN32)
|
||||
set(ctl_targets _drogon_ctl drogon_ctl)
|
||||
set_property(TARGET ${ctl_targets} PROPERTY CXX_STANDARD ${DROGON_CXX_STANDARD})
|
||||
set_property(TARGET ${ctl_targets} PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
make_directory("${INSTALL_BIN_DIR}")
|
||||
get_filename_component(CTL_PATH ${CTL_FILE} DIRECTORY)
|
||||
file(GLOB DLL_FILES ${CTL_PATH}/*.dll)
|
||||
file(COPY ${DLL_FILES} DESTINATION ${INSTALL_BIN_DIR})
|
||||
file(COPY ${CTL_FILE} DESTINATION ${INSTALL_BIN_DIR})
|
||||
file(RENAME ${INSTALL_BIN_DIR}/drogon_ctl.exe ${INSTALL_BIN_DIR}/dg_ctl.exe)
|
|
@ -48,17 +48,6 @@ add_executable(pipelining_test simple_example_test/HttpPipeliningTest.cc)
|
|||
add_executable(websocket_test simple_example_test/WebSocketTest.cc)
|
||||
add_executable(multiple_ws_test simple_example_test/MultipleWsTest.cc)
|
||||
|
||||
if(NOT WIN32)
|
||||
add_custom_command(
|
||||
TARGET webapp POST_BUILD
|
||||
COMMAND gzip
|
||||
ARGS
|
||||
-c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simple_example/index.html
|
||||
>
|
||||
${CMAKE_CURRENT_BINARY_DIR}/index.html.gz
|
||||
VERBATIM)
|
||||
endif(NOT WIN32)
|
||||
add_custom_command(
|
||||
TARGET webapp POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
|
@ -67,6 +56,7 @@ add_custom_command(
|
|||
${PROJECT_SOURCE_DIR}/config.example.json
|
||||
${PROJECT_SOURCE_DIR}/drogon.jpg
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simple_example/index.html
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simple_example/index.html.gz
|
||||
${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.pem
|
||||
$<TARGET_FILE_DIR:webapp>)
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,2 +0,0 @@
|
|||
x64
|
||||
mman.VC.db
|
|
@ -1,33 +0,0 @@
|
|||
project (mman-win32 C)
|
||||
|
||||
cmake_minimum_required (VERSION 3.5)
|
||||
|
||||
option (BUILD_TESTS "tests?" OFF)
|
||||
|
||||
set (headers mman.h)
|
||||
set (sources mman.c)
|
||||
|
||||
add_library (mman STATIC ${sources})
|
||||
|
||||
set_target_properties(mman PROPERTIES EXPORT_NAME MMAN)
|
||||
|
||||
install (TARGETS mman
|
||||
EXPORT MMANTargets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX})
|
||||
|
||||
install(EXPORT MMANTargets
|
||||
DESTINATION "${INSTALL_DROGON_CMAKE_DIR}"
|
||||
COMPONENT dev)
|
||||
|
||||
install (FILES ${headers} DESTINATION include/sys)
|
||||
|
||||
if (BUILD_TESTS)
|
||||
enable_testing ()
|
||||
add_executable (t_mman test.c)
|
||||
target_link_libraries (t_mman mman)
|
||||
add_test (NAME t_mman COMMAND t_mman${CMAKE_EXECUTABLE_SUFFIX})
|
||||
endif ()
|
||||
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
#
|
||||
# mman-win32 (mingw32) Makefile
|
||||
#
|
||||
include config.mak
|
||||
|
||||
CFLAGS=-Wall -O3 -fomit-frame-pointer
|
||||
|
||||
ifeq ($(BUILD_STATIC),yes)
|
||||
TARGETS+=libmman.a
|
||||
INSTALL+=static-install
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_SHARED),yes)
|
||||
TARGETS+=libmman.dll
|
||||
INSTALL+=shared-install
|
||||
CFLAGS+=-DMMAN_LIBRARY_DLL -DMMAN_LIBRARY
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_MSVC),yes)
|
||||
SHFLAGS+=-Wl,--output-def,libmman.def
|
||||
INSTALL+=lib-install
|
||||
endif
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
mman.o: mman.c mman.h
|
||||
$(CC) -o mman.o -c mman.c $(CFLAGS)
|
||||
|
||||
libmman.a: mman.o
|
||||
$(AR) cru libmman.a mman.o
|
||||
$(RANLIB) libmman.a
|
||||
|
||||
libmman.dll: mman.o
|
||||
$(CC) -shared -o libmman.dll mman.o -Wl,--out-implib,libmman.dll.a
|
||||
|
||||
header-install:
|
||||
mkdir -p $(DESTDIR)$(incdir)
|
||||
cp mman.h $(DESTDIR)$(incdir)
|
||||
|
||||
static-install: header-install
|
||||
mkdir -p $(DESTDIR)$(libdir)
|
||||
cp libmman.a $(DESTDIR)$(libdir)
|
||||
|
||||
shared-install: header-install
|
||||
mkdir -p $(DESTDIR)$(libdir)
|
||||
cp libmman.dll.a $(DESTDIR)$(libdir)
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
cp libmman.dll $(DESTDIR)$(bindir)
|
||||
|
||||
lib-install:
|
||||
mkdir -p $(DESTDIR)$(libdir)
|
||||
cp libmman.lib $(DESTDIR)$(libdir)
|
||||
|
||||
install: $(INSTALL)
|
||||
|
||||
test.exe: test.c mman.c mman.h
|
||||
$(CC) -o test.exe test.c -L. -lmman
|
||||
|
||||
test: $(TARGETS) test.exe
|
||||
test.exe
|
||||
|
||||
clean::
|
||||
rm -f mman.o libmman.a libmman.dll.a libmman.dll libmman.def libmman.lib test.exe *.dat
|
||||
|
||||
distclean: clean
|
||||
rm -f config.mak
|
||||
|
||||
.PHONY: clean distclean install test
|
|
@ -1,170 +0,0 @@
|
|||
#!/bin/sh
|
||||
# mmap-win32 configure script
|
||||
#
|
||||
# Parts copied from FFmpeg's configure
|
||||
#
|
||||
|
||||
set_all(){
|
||||
value=$1
|
||||
shift
|
||||
for var in $*; do
|
||||
eval $var=$value
|
||||
done
|
||||
}
|
||||
|
||||
enable(){
|
||||
set_all yes $*
|
||||
}
|
||||
|
||||
disable(){
|
||||
set_all no $*
|
||||
}
|
||||
|
||||
enabled(){
|
||||
eval test "x\$$1" = "xyes"
|
||||
}
|
||||
|
||||
disabled(){
|
||||
eval test "x\$$1" = "xno"
|
||||
}
|
||||
|
||||
show_help(){
|
||||
echo "Usage: configure [options]"
|
||||
echo "Options: [defaults in brackets after descriptions]"
|
||||
echo "All \"enable\" options have \"disable\" counterparts"
|
||||
echo
|
||||
echo " --help print this message"
|
||||
echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
|
||||
echo " --bindir=DIR install binaries in DIR [$PREFIX/bin]"
|
||||
echo " --libdir=DIR install libs in DIR [$PREFIX/lib]"
|
||||
echo " --incdir=DIR install includes in DIR [$PREFIX/include]"
|
||||
echo " --enable-static build static libraries [yes]"
|
||||
echo " --enable-shared build shared libraries [no]"
|
||||
echo " --enable-msvc create msvc-compatible import lib [auto]"
|
||||
echo
|
||||
echo " --cc=CC use C compiler CC [$cc_default]"
|
||||
echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
die_unknown(){
|
||||
echo "Unknown option \"$1\"."
|
||||
echo "See $0 --help for available options."
|
||||
exit 1
|
||||
}
|
||||
|
||||
PREFIX="/mingw"
|
||||
ar="ar"
|
||||
cc_default="gcc"
|
||||
ranlib="ranlib"
|
||||
strip="strip"
|
||||
|
||||
DEFAULT="msvc
|
||||
"
|
||||
|
||||
DEFAULT_YES="static
|
||||
stripping
|
||||
"
|
||||
|
||||
DEFAULT_NO="shared
|
||||
"
|
||||
|
||||
CMDLINE_SELECT="$DEFAULT
|
||||
$DEFAULT_NO
|
||||
$DEFAULT_YES
|
||||
"
|
||||
|
||||
enable $DEFAULT_YES
|
||||
disable $DEFAULT_NO
|
||||
|
||||
for opt do
|
||||
optval="${opt#*=}"
|
||||
case "$opt" in
|
||||
--help)
|
||||
show_help
|
||||
;;
|
||||
--prefix=*)
|
||||
PREFIX="$optval"
|
||||
;;
|
||||
--bindir=*)
|
||||
bindir="$optval"
|
||||
;;
|
||||
--libdir=*)
|
||||
libdir="$optval"
|
||||
;;
|
||||
--incdir=*)
|
||||
incdir="$optval"
|
||||
;;
|
||||
--cc=*)
|
||||
cc="$optval"
|
||||
;;
|
||||
--cross-prefix=*)
|
||||
cross_prefix="$optval"
|
||||
;;
|
||||
--enable-?*|--disable-?*)
|
||||
eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
|
||||
echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
|
||||
$action $option
|
||||
;;
|
||||
*)
|
||||
die_unknown $opt
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
bindir="${PREFIX}/bin"
|
||||
libdir="${PREFIX}/lib"
|
||||
incdir="${PREFIX}/include/sys"
|
||||
ar="${cross_prefix}${ar}"
|
||||
cc_default="${cross_prefix}${cc_default}"
|
||||
ranlib="${cross_prefix}${ranlib}"
|
||||
strip="${cross_prefix}${strip}"
|
||||
|
||||
if ! test -z $cc; then
|
||||
cc_default="${cc}"
|
||||
fi
|
||||
cc="${cc_default}"
|
||||
|
||||
disabled static && disabled shared && {
|
||||
echo "At least one library type must be set.";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if enabled msvc; then
|
||||
lib /? > /dev/null 2>&1 /dev/null || {
|
||||
echo "MSVC's lib command not found."
|
||||
echo "Make sure MSVC is installed and its bin folder is in your \$PATH."
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
if ! enabled stripping; then
|
||||
strip="echo ignoring strip"
|
||||
fi
|
||||
|
||||
enabled msvc && libcmd="lib" || libcmd="echo ignoring lib"
|
||||
|
||||
echo "# Automatically generated by configure" > config.mak
|
||||
echo "PREFIX=$PREFIX" >> config.mak
|
||||
echo "bindir=$bindir" >> config.mak
|
||||
echo "libdir=$libdir" >> config.mak
|
||||
echo "incdir=$incdir" >> config.mak
|
||||
echo "AR=$ar" >> config.mak
|
||||
echo "CC=$cc" >> config.mak
|
||||
echo "RANLIB=$ranlib" >> config.mak
|
||||
echo "STRIP=$strip" >> config.mak
|
||||
echo "BUILD_STATIC=$static" >> config.mak
|
||||
echo "BUILD_SHARED=$shared" >> config.mak
|
||||
echo "BUILD_MSVC=$msvc" >> config.mak
|
||||
echo "LIBCMD=$libcmd" >> config.mak
|
||||
|
||||
echo "prefix: $PREFIX"
|
||||
echo "bindir: $bindir"
|
||||
echo "libdir: $libdir"
|
||||
echo "incdir: $incdir"
|
||||
echo "ar: $ar"
|
||||
echo "cc: $cc"
|
||||
echo "ranlib: $ranlib"
|
||||
echo "strip: $strip"
|
||||
echo "static: $static"
|
||||
echo "shared: $shared"
|
|
@ -1,13 +0,0 @@
|
|||
QT -= core gui
|
||||
|
||||
TARGET = mman
|
||||
TEMPLATE = lib
|
||||
|
||||
DEFINES += MMAN_LIBRARY_DLL
|
||||
DEFINES += MMAN_LIBRARY
|
||||
|
||||
HEADERS += \
|
||||
mman.h
|
||||
|
||||
SOURCES += \
|
||||
mman.c
|
|
@ -1,28 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mman", "mman.vcxproj", "{592F578E-6F24-47C0-9F6C-07BC9B730E27}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{592F578E-6F24-47C0-9F6C-07BC9B730E27}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{592F578E-6F24-47C0-9F6C-07BC9B730E27}.Debug|x64.Build.0 = Debug|x64
|
||||
{592F578E-6F24-47C0-9F6C-07BC9B730E27}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{592F578E-6F24-47C0-9F6C-07BC9B730E27}.Debug|x86.Build.0 = Debug|Win32
|
||||
{592F578E-6F24-47C0-9F6C-07BC9B730E27}.Release|x64.ActiveCfg = Release|x64
|
||||
{592F578E-6F24-47C0-9F6C-07BC9B730E27}.Release|x64.Build.0 = Release|x64
|
||||
{592F578E-6F24-47C0-9F6C-07BC9B730E27}.Release|x86.ActiveCfg = Release|Win32
|
||||
{592F578E-6F24-47C0-9F6C-07BC9B730E27}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,122 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{592F578E-6F24-47C0-9F6C-07BC9B730E27}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="mman.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="mman.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="UpgradeLog.htm" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="mman.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="mman.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="UpgradeLog.htm" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
2
trantor
2
trantor
|
@ -1 +1 @@
|
|||
Subproject commit e052988f277d039e3392bd4d213a531e45b822a8
|
||||
Subproject commit f9a4de585fc996cb94c5edcadbec0d7d874a1aa1
|
Loading…
Reference in New Issue