Skip to content

Commit

Permalink
perf: add crosscompiling settings (#43)
Browse files Browse the repository at this point in the history
Signed-off-by: msclock <msclock@qq.com>
  • Loading branch information
msclock authored Mar 12, 2024
1 parent 6460f00 commit 43ebaa4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/build/Default.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[[
Default to build.
]]
include_guard(GLOBAL)

# Create the compile command database for clang by default
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
1 change: 1 addition & 0 deletions cmake/configure/Default.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[[
Default to configuration.
]]
include_guard(GLOBAL)

# Put the include dirs which are in the source or build tree before all other
# include dirs, so the headers in the sources are preferred over the already
Expand Down
1 change: 1 addition & 0 deletions cmake/install/Default.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[[
Default to installation.
]]
include_guard(GLOBAL)
6 changes: 6 additions & 0 deletions cmake/install/InstallDependency.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This module provides tools to handle cmake installations painlessly.
include_guard(GLOBAL)
include(${CMAKE_CURRENT_LIST_DIR}/Runpath.cmake)

if(WIN32 AND NOT ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
# We're building for Windows on a different operating system. Set the platform
# for get_runtime_dependencies() to "windows+pe"
set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM "windows+pe")
endif()

#[[
A function to enable installation of dependencies as part of the
`make install` process.
Expand Down
24 changes: 24 additions & 0 deletions cmake/test/Default.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
#[[
Default to test
]]

include_guard(GLOBAL)

# This variable is only used when ``CMAKE_CROSSCOMPILING`` is on. It should
# point to a command on the host system that can run executable built for the
# target system.
if(WIN32 AND NOT ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
# We're building for Windows on a different operating system.
find_program(
WINE
NAMES "wine" "wine64" "wine-development"
DOC "Wine (to run tests)")

if(WINE)
message(
STATUS "The following Wine binary will be used to run tests: \"${WINE}\"")
set(CMAKE_CROSSCOMPILING_EMULATOR ${WINE})
else()
message(
WARNING
"You are cross-compiling for Windows but don't have Wine, you will not be able to run tests."
)
endif()
endif()

0 comments on commit 43ebaa4

Please # to comment.