Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,28 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: (Setup) Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Cache vcpkg
uses: actions/cache@v4
with:
path: |
vendor/vcpkg/installed
vendor/vcpkg/buildtrees
vendor/vcpkg/packages
key: vcpkg-windows-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-windows-${{ runner.os }}-

- name: (Setup) Semantic Release
run: npm install --save-dev semantic-release @semantic-release/github @semantic-release/exec @semantic-release/changelog @semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: (Setup) Get Next Version
run: . resources\version.ps1
run: . resources\versioning\version.ps1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build Millennium
run: |
cmake --preset=release
cmake --build build --config Release
cmake --preset=windows-release
cmake --build build
mkdir -p D:/a/build/unsigned
mv build/Release/Installer.exe D:/a/build/unsigned/MillenniumInstaller-Windows.exe
mv build/Installer.exe D:/a/build/unsigned/MillenniumInstaller-Windows.exe

- name: Upload Build Artifact
id: upload-unsigned-artifact
Expand Down Expand Up @@ -86,6 +73,6 @@ jobs:
path: "signed-millennium/MillenniumInstaller-Windows.exe"

- name: Create GitHub Release
run: npx semantic-release
run: cd resources/versioning && npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/build
/.vscode
/.vscode
/.zed
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

117 changes: 58 additions & 59 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
cmake_minimum_required(VERSION 3.31.6)
# Set the project name and version

project(Installer VERSION 1.0 LANGUAGES CXX)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "" FORCE)
set(CMAKE_MSVC_RUNTIME_LIBRARY
"MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "" FORCE
)

add_compile_definitions(UNICODE _UNICODE)
# Read the Millennium version from the version file
file(STRINGS "version" VERSION_LINES LIMIT_COUNT 2)

file(STRINGS "resources/versioning/version" VERSION_LINES LIMIT_COUNT 2)
list(GET VERSION_LINES 1 MILLENNIUM_VERSION)
string(STRIP "${MILLENNIUM_VERSION}" MILLENNIUM_VERSION)

# Make cmake re-run if the version file changes
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "version")
set_property(DIRECTORY
APPEND PROPERTY
CMAKE_CONFIGURE_DEPENDS "resources/versioning/version"
)

# Generate version.h from version.h.in
configure_file(src/include/version.h.in ${CMAKE_BINARY_DIR}/version.h)

add_compile_definitions(MILLENNIUM_VERSION="${MILLENNIUM_VERSION}")

# Specify the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(BUILD_SHARED_LIBS OFF)

set(GLFW_BUILD_DOCS OFF)
set(GLFW_BUILD_TESTS OFF)
set(GLFW_BUILD_EXAMPLES OFF)
set(GLFW_BUILD_STATIC ON)

add_compile_definitions(
CURL_STATICLIB
FMT_HEADER_ONLY
IMGUI_USE_WCHAR32
IMGUI_DEFINE_MATH_OPERATORS
)

# Additional size optimizations for release builds
if (CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_definitions(
IMGUI_DISABLE_DEMO_WINDOWS
Expand All @@ -42,14 +37,32 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release")
)
endif()

# Define source files
set(IMGUI_DIR "../..")
include(${CMAKE_CURRENT_SOURCE_DIR}/resources/cmake/bootstrap_deps.cmake)

add_library(imgui_lib STATIC
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp
${imgui_SOURCE_DIR}/misc/freetype/imgui_freetype.cpp
${imgui_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp
)
target_include_directories(imgui_lib SYSTEM PUBLIC
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
${imgui_SOURCE_DIR}/misc/cpp
)
target_link_libraries(imgui_lib PUBLIC freetype glfw)

set(SOURCES
src/main.cc
src/texture.cc
src/wndproc.cc
src/renderer.cc
src/updater.cc
src/window/texture.cc
src/window/wndproc.cc
src/window/renderer.cc
src/util/updater.cc
src/routes/router.cc
src/routes/home.cc
src/routes/install_prompt.cc
src/routes/installer.cc
Expand All @@ -58,48 +71,42 @@ set(SOURCES
src/components/checkbox.cc
src/components/bottombar.cc
src/components/message.cc
src/animate.cc
src/router.cc
src/dpi.cc
src/semver.cc
src/util/animate.cc
src/util/semver.cc
src/window/dpi.cc
src/installer/task_scheduler.cc
src/installer/unzip.cc
vendor/imgui/src/imgui.cpp
vendor/imgui/src/imgui_draw.cpp
vendor/imgui/src/imgui_tables.cpp
vendor/imgui/src/imgui_widgets.cpp
vendor/imgui/src/imgui_impl_glfw.cpp
vendor/imgui/src/imgui_impl_opengl3.cpp
vendor/imgui/include/misc/freetype/imgui_freetype.cpp
vendor/imgui/src/imgui_stdlib.cpp
src/util/worker.cc
)

# Add the executable
if(WIN32)
set(RESOURCE_FILE "${CMAKE_SOURCE_DIR}/resources/win32/Installer.rc")
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${RESOURCE_FILE})
else()
add_executable(${PROJECT_NAME} ${SOURCES})
endif()

# Include directories
include_directories(src/include)
include_directories(vendor/imgui/include)
include_directories(vendor/imgui/extern)
include_directories(vendor/nlohmann/include)
include_directories(vendor/ini/src)
include_directories(SYSTEM ${imgui_SOURCE_DIR})
include_directories(SYSTEM ${imgui_SOURCE_DIR}/backends)
include_directories(SYSTEM ${imgui_SOURCE_DIR}/misc/cpp)
include_directories(SYSTEM ${imgui_markdown_SOURCE_DIR})
include_directories(SYSTEM ${imspinner_SOURCE_DIR})
include_directories(SYSTEM ${nlohmann_json_SOURCE_DIR}/include)
include_directories(SYSTEM ${mini_SOURCE_DIR}/src)
include_directories(SYSTEM ${stb_SOURCE_DIR})
include_directories(SYSTEM ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})

target_link_libraries(${PROJECT_NAME} PRIVATE imgui_lib)
target_link_options(${PROJECT_NAME} PRIVATE /FORCE:MULTIPLE)

# Platform-specific settings
if(UNIX AND NOT APPLE)
message(STATUS "Building on Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLFW REQUIRED glfw3)

target_compile_options(${PROJECT_NAME} PRIVATE ${GLFW_CFLAGS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${GLFW_LDFLAGS} GL)

elseif(APPLE)
message(STATUS "Building on macOS")
find_library(COCOA_LIBRARY Cocoa REQUIRED)
find_library(IOKIT_LIBRARY IOKit REQUIRED)
find_library(COREVIDEO_LIBRARY CoreVideo REQUIRED)
Expand All @@ -113,28 +120,20 @@ elseif(APPLE)
${OPENGL_LIBRARY}
${GLFW_LIBRARY}
)

elseif(WIN32)
message(STATUS "Building on Windows")
find_package(Freetype REQUIRED)
find_package(Stb REQUIRED)
find_package(glfw3 CONFIG REQUIRED)
find_package(GLEW CONFIG REQUIRED)
find_package(CURL REQUIRED)
find_package(unofficial-minizip CONFIG REQUIRED) # used for extracting zip files

target_include_directories(${PROJECT_NAME} PRIVATE ${Stb_INCLUDE_DIR})

target_include_directories(${PROJECT_NAME}
SYSTEM PRIVATE ${minizip_ng_SOURCE_DIR}
)
target_link_libraries(${PROJECT_NAME} PRIVATE
Freetype::Freetype
freetype
glfw
gdi32
opengl32
GLEW::GLEW
libglew_static
imm32
CURL::libcurl
dwmapi
unofficial::minizip::minizip
minizip
winmm
bcrypt
)
Expand Down
63 changes: 53 additions & 10 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,72 @@
"configurePresets": [
{
"name": "default",
"generator": "Visual Studio 17 2022",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"hidden": true,
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "./vendor/vcpkg/scripts/buildsystems/vcpkg.cmake",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "debug",
"name": "windows",
"hidden": true,
"inherits": "default",
"generator": "Ninja",
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [
"Windows"
]
}
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
"CMAKE_C_COMPILER": "clang-cl.exe",
"CMAKE_CXX_COMPILER": "clang-cl.exe",
"CMAKE_CXX_FLAGS": "/EHsc"
},
"displayName": "windows"
},
{
"inherits": "windows",
"name": "windows-release",
"displayName": "windows-release",
"description": "windows release build.",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS_RELEASE": "/O1 /GL /GF /Gy /Zi /DNDEBUG",
"CMAKE_SHARED_LINKER_FLAGS_RELEASE": "/LTCG /OPT:REF /OPT:ICF /DEBUG:FULL"
}
},
{
"inherits": "windows",
"name": "windows-debug",
"displayName": "windows-debug",
"description": "windows debug build.",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_FLAGS_DEBUG": "/Z7 -fstandalone-debug",
"CMAKE_C_FLAGS_DEBUG": "/Z7 -fstandalone-debug"
}
},
{
"name": "release",
"inherits": "default",
"name": "osx-release",
"displayName": "osx-release",
"description": "MacOS release build.",
"binaryDir": "${sourceDir}/build/osx-release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_CXX_FLAGS_RELEASE": "/O1 /GL /GF /Gy /DNDEBUG",
"CMAKE_SHARED_LINKER_FLAGS_RELEASE": "/LTCG /OPT:REF /OPT:ICF /DEBUG:NONE"
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"inherits": "default",
"name": "osx-debug",
"displayName": "osx-debug",
"description": "MacOS debug build.",
"binaryDir": "${sourceDir}/build/osx-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
}
]
Expand Down
File renamed without changes.
Loading
Loading