CMakeLists.txt: Copy over data files and DLLs

This commit is contained in:
heinrich5991 2017-03-07 15:24:08 +01:00
parent 4389737288
commit a6983d329c
9 changed files with 53 additions and 2 deletions

View file

@ -35,9 +35,9 @@ endif()
function(set_extra_dirs VARIABLE NAME) function(set_extra_dirs VARIABLE NAME)
if(TARGET_BITS AND TARGET_OS) if(TARGET_BITS AND TARGET_OS)
set("EXTRA_${VARIABLE}_LIBDIR" "other/${NAME}/${TARGET_OS}/lib${TARGET_BITS}/" PARENT_SCOPE) set("EXTRA_${VARIABLE}_LIBDIR" "other/${NAME}/${TARGET_OS}/lib${TARGET_BITS}" PARENT_SCOPE)
endif() endif()
set("EXTRA_${VARIABLE}_INCLUDEDIR" "other/${NAME}/include/" PARENT_SCOPE) set("EXTRA_${VARIABLE}_INCLUDEDIR" "other/${NAME}/include" PARENT_SCOPE)
endfunction() endfunction()
# Check for PkgConfig once so all the other `find_package` calls can do it # Check for PkgConfig once so all the other `find_package` calls can do it
@ -166,6 +166,16 @@ if(CLIENT)
set(DEP_WAV $<TARGET_OBJECTS:wav>) set(DEP_WAV $<TARGET_OBJECTS:wav>)
endif() endif()
########################################################################
# COPY DATA AND DLLS
########################################################################
file(COPY data DESTINATION .)
file(COPY ${CURL_COPY_FILES} DESTINATION .)
file(COPY ${FREETYPE_COPY_FILES} DESTINATION .)
file(COPY ${OPUSFILE_COPY_FILES} DESTINATION .)
file(COPY ${SDL2_COPY_FILES} DESTINATION .)
######################################################################## ########################################################################
# CODE GENERATION # CODE GENERATION
######################################################################## ########################################################################
@ -383,6 +393,7 @@ set(TARGETS ${TARGETS_OWN} ${TARGETS_DEP})
foreach(target ${TARGETS}) foreach(target ${TARGETS})
if(MSVC) if(MSVC)
target_compile_options(${target} PRIVATE /EHsc) # Only catch C++ exceptions with catch.
target_compile_options(${target} PRIVATE /GS) # Protect the stack pointer. target_compile_options(${target} PRIVATE /GS) # Protect the stack pointer.
target_compile_options(${target} PRIVATE /wd4996) # Use of non-_s functions. target_compile_options(${target} PRIVATE /wd4996) # Use of non-_s functions.
elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU) elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU)

View file

@ -19,3 +19,16 @@ mark_as_advanced(CURL_LIBRARY CURL_INCLUDEDIR)
set(CURL_LIBRARIES ${CURL_LIBRARY}) set(CURL_LIBRARIES ${CURL_LIBRARY})
set(CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR}) set(CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR})
string(FIND "${CURL_LIBRARY}" "${PROJECT_SOURCE_DIR}" LOCAL_PATH_POS)
if(LOCAL_PATH_POS EQUAL 0 AND TARGET_OS STREQUAL "windows")
set(CURL_COPY_FILES
"${EXTRA_CURL_LIBDIR}/libcurl.dll"
"${EXTRA_CURL_LIBDIR}/libeay32.dll"
"${EXTRA_CURL_LIBDIR}/libidn-11.dll"
"${EXTRA_CURL_LIBDIR}/ssleay32.dll"
"${EXTRA_CURL_LIBDIR}/zlib1.dll"
)
else()
set(CURL_COPY_FILES)
endif()

View file

@ -20,3 +20,10 @@ mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDEDIR)
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY}) set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDEDIR}) set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDEDIR})
string(FIND "${FREETYPE_LIBRARY}" "${PROJECT_SOURCE_DIR}" LOCAL_PATH_POS)
if(LOCAL_PATH_POS EQUAL 0 AND TARGET_OS STREQUAL "windows")
set(FREETYPE_COPY_FILES "${EXTRA_FREETYPE_LIBDIR}/freetype.dll")
else()
set(FREETYPE_COPY_FILES)
endif()

View file

@ -20,3 +20,16 @@ mark_as_advanced(OPUSFILE_LIBRARY OPUSFILE_INCLUDEDIR)
set(OPUSFILE_LIBRARIES ${OPUSFILE_LIBRARY}) set(OPUSFILE_LIBRARIES ${OPUSFILE_LIBRARY})
set(OPUSFILE_INCLUDE_DIRS ${OPUSFILE_INCLUDEDIR}) set(OPUSFILE_INCLUDE_DIRS ${OPUSFILE_INCLUDEDIR})
string(FIND "${OPUSFILE_LIBRARY}" "${PROJECT_SOURCE_DIR}" LOCAL_PATH_POS)
if(LOCAL_PATH_POS EQUAL 0 AND TARGET_OS STREQUAL "windows")
set(OPUSFILE_COPY_FILES
"${EXTRA_OPUSFILE_LIBDIR}/libgcc_s_sjlj-1.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libogg-0.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libopus-0.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libopusfile-0.dll"
"${EXTRA_OPUSFILE_LIBDIR}/libwinpthread-1.dll"
)
else()
set(OPUSFILE_COPY_FILES)
endif()

View file

@ -21,3 +21,10 @@ mark_as_advanced(SDL2_LIBRARY SDL2_INCLUDEDIR)
set(SDL2_LIBRARIES ${SDL2_LIBRARY}) set(SDL2_LIBRARIES ${SDL2_LIBRARY})
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDEDIR}) set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDEDIR})
string(FIND "${SDL2_LIBRARY}" "${PROJECT_SOURCE_DIR}" LOCAL_PATH_POS)
if(LOCAL_PATH_POS EQUAL 0 AND TARGET_OS STREQUAL "windows")
set(SDL2_COPY_FILES "${EXTRA_SDL2_LIBDIR}/SDL2.dll")
else()
set(SDL2_COPY_FILES)
endif()

Binary file not shown.

Binary file not shown.

BIN
other/sdl/windows/lib32/SDL2.dll Executable file

Binary file not shown.

BIN
other/sdl/windows/lib64/SDL2.dll Executable file

Binary file not shown.