mirror of
https://github.com/ModOrganizer2/mob.git
synced 2026-07-27 14:07:05 -07:00
Use CMake to build.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(mob)
|
||||
add_subdirectory(src)
|
||||
+5
-30
@@ -1,40 +1,15 @@
|
||||
$root = $PSScriptRoot
|
||||
if (!$root) {
|
||||
$root = "."
|
||||
$root = "."
|
||||
}
|
||||
|
||||
$installationPath = & $root\third-party\bin\vswhere.exe -products * -nologo -prerelease -latest -property installationPath
|
||||
if (! $?) {
|
||||
Write-Error "vswhere returned $LastExitCode"
|
||||
exit $LastExitCode
|
||||
}
|
||||
|
||||
if (! $installationPath) {
|
||||
Write-Error "Empty installation path"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$opts = ""
|
||||
$opts += " $root\vs\mob.sln"
|
||||
$opts += " -m"
|
||||
$opts += " -p:Configuration=Release"
|
||||
$opts += " -noLogo"
|
||||
$opts += " -p:UseMultiToolTask=true"
|
||||
$opts += " -p:EnforceProcessCountAcrossBuilds=true"
|
||||
$opts += " -clp:ErrorsOnly;Verbosity=minimal"
|
||||
|
||||
$vsDevCmd = "$installationPath\Common7\Tools\VsDevCmd.bat"
|
||||
if (!(Test-Path "$vsDevCmd")) {
|
||||
Write-Error "VdDevCmd.bat not found at $vsDevCmd"
|
||||
exit 1
|
||||
}
|
||||
|
||||
& "${env:COMSPEC}" /c "`"$vsDevCmd`" -no_logo -arch=amd64 -host_arch=amd64 && msbuild $opts"
|
||||
cmake -B build . | Out-Null
|
||||
cmake --build build --config Release -- "-p:UseMultiToolTask=true" "-noLogo" "-p:EnforceProcessCountAcrossBuilds=true" "-clp:ErrorsOnly;Verbosity=minimal"
|
||||
|
||||
if (! $?) {
|
||||
Write-Error "Build failed"
|
||||
exit $LastExitCode
|
||||
}
|
||||
|
||||
Copy-Item "$root\build\Release\x64\mob.exe" "$root\mob.exe"
|
||||
echo "run ``.\mob -d prefix/path build`` to start building"
|
||||
Copy-Item "$root\build\src\Release\mob.exe" "$root\mob.exe"
|
||||
Write-Output "run ``.\mob -d prefix/path build`` to start building"
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
file(GLOB_RECURSE src_files *.cpp)
|
||||
|
||||
add_executable(mob ${src_files})
|
||||
set_target_properties(mob PROPERTIES CXX_STANDARD 20)
|
||||
|
||||
target_compile_definitions(mob PUBLIC NOMINMAX)
|
||||
target_compile_options(mob PUBLIC "/MT")
|
||||
target_include_directories(mob PUBLIC ${CMAKE_SOURCE_DIR}/third-party/include)
|
||||
target_link_libraries(mob PUBLIC
|
||||
wsock32 ws2_32 crypt32 wldap32 dbghelp shlwapi version
|
||||
optimized ${CMAKE_SOURCE_DIR}/third-party/lib/libcurl.lib
|
||||
debug ${CMAKE_SOURCE_DIR}/third-party/lib/libcurl-d.lib
|
||||
optimized ${CMAKE_SOURCE_DIR}/third-party/lib/zlib.lib
|
||||
debug ${CMAKE_SOURCE_DIR}/third-party/lib/zlibd.lib)
|
||||
Reference in New Issue
Block a user