Skip to content

Instantly share code, notes, and snippets.

@VermeilChan
Last active September 18, 2024 17:03
Show Gist options
  • Save VermeilChan/3fd0188afeb8d49f219efb008b612197 to your computer and use it in GitHub Desktop.
Save VermeilChan/3fd0188afeb8d49f219efb008b612197 to your computer and use it in GitHub Desktop.
Compile Aseprite from source code for Windows 11/10 x64

Prerequisites

Download and Set Up Visual Studio Community 2022

Get The Source Code

Download and Set Up CMake

  • Get CMake cmake-3.xx.x-windows-x86_64.msi

  • Choose the option Add CMake To The PATH For environment variable

Download and Set Up Ninja

  • Download Ninja Build System.

  • Extract ninja-win.zip and copy ninja.exe to C:\Program Files\CMake\bin.

Download Skia

  • Download Skia Skia-Windows-Release-x64.zip.

  • In the C:\ directory, create a folder named deps.

  • Inside the deps directory, create another folder named skia.

  • Extract the contents of Skia-Windows-Release-x64.zip into the skia folder.

Compiling

  • In the C:\ directory, create a folder named aseprite.

  • Extract the contents of Aseprite-v1.x-Source.zip into the aseprite folder.

  • Search Command Prompt

  • Execute the following commands:

call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=x64
cd C:\aseprite
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_LIBRARY_DIR=C:\deps\skia\out\Release-x64 -DSKIA_LIBRARY=C:\deps\skia\out\Release-x64\skia.lib -G Ninja ..
ninja aseprite
  • If CMake is unable to detect the C/C++ compiler:

    • Execute the following command instead:
    cmake -DCMAKE_CXX_COMPILER="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\cl.exe" -DCMAKE_C_COMPILER="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\cl.exe" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_LIBRARY_DIR=C:\deps\skia\out\Release-x64 -DSKIA_LIBRARY=C:\deps\skia\out\Release-x64\skia.lib -G Ninja ..
  • The executable will be located at C:\aseprite\build\bin\aseprite.exe.

Tested With Aseprite v1.3.8.1

Please remember to support the creators of Aseprite. Only use this method to try the program or if you don't have access to funds or a credit card :)

@thekaz
Copy link

thekaz commented Apr 7, 2024

This might be a dumb or obvious prereq, but I think this process also requires git to be installed. Otherwise the error "error: could not find git for clone..." appears. If this is someone's first time trying to compile something, or if they're a starving artist with no dev experience, they may not know how to parse the error message.

@thekaz
Copy link

thekaz commented Apr 7, 2024

@KilkankB I figured out how to fix your error if you're still having it. From https://community.aseprite.org/t/cmake-error-webp-libraries-notfound/17305, double check your skia install directory, and where it is in your filesystem matches -DSKIA_DIR=C:\deps\skia. If it doesn't, either move the directory or update the flag to match where it actually is

@VermeilChan
Copy link
Author

sorry guys if i dont reply to ur problems
im not that smart 😭

@Dotsz-Vic-FLP
Copy link

Appreciate this guide. This is way easier to understand than the install.md included. Thank you for this.

@VermeilChan
Copy link
Author

Appreciate this guide. This is way easier to understand than the install.md included. Thank you for this.

thank you :)

@Remkich
Copy link

Remkich commented May 27, 2024

best tutorial ever tbh

@VermeilChan
Copy link
Author

best tutorial ever tbh

thank you :)

@vexCoder
Copy link

vexCoder commented May 29, 2024

Tnx, also how to make this work with powershell windows terminal??

@VermeilChan
Copy link
Author

Tnx, also how to make this work with powershell windows terminal??

image
change the default terminal to windows terminal

@NotTalKer
Copy link

Screenshot 2024-07-16 005242
how do i fix that?

@VermeilChan
Copy link
Author

Screenshot 2024-07-16 005242 how do i fix that?

Did you open the Command Prompt as an administrator? You don't need to do that. Also, it doesn't look like you used the command call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=x64

@agajgjsa592586
Copy link

Sadly. It didn't work for me... :(

@agajgjsa592586
Copy link

Sadly. It didn't work for me... :(

Here is the error I've got. CMake Error at build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:1 (set):
Syntax error in cmake code at

/c/aseprite/build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:1

when parsing string

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe

Invalid character escape '\P'.
Call Stack (most recent call first):
CMakeLists.txt:25 (project)

CMake Error at CMakeLists.txt:25 (project):
The CMAKE_CXX_COMPILER:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.

@VermeilChan
Copy link
Author

Sadly. It didn't work for me... :(

Here is the error I've got. CMake Error at build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:1 (set): Syntax error in cmake code at

/c/aseprite/build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:1

when parsing string

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe

Invalid character escape '\P'. Call Stack (most recent call first): CMakeLists.txt:25 (project)

CMake Error at CMakeLists.txt:25 (project): The CMAKE_CXX_COMPILER:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

I don't have this issue, it should automatically detect it. I'll add a new command in case this happens for more ppl

@agajgjsa592586
Copy link

Sadly. It didn't work for me... :(

Here is the error I've got. CMake Error at build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:1 (set): Syntax error in cmake code at

/c/aseprite/build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake:1

when parsing string

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe

Invalid character escape '\P'. Call Stack (most recent call first): CMakeLists.txt:25 (project)
CMake Error at CMakeLists.txt:25 (project): The CMAKE_CXX_COMPILER:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe

is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

I don't have this issue, it should automatically detect it. I'll add a new command in case this happens for more ppl

My laptop hates me when I compile something. Like GitHub/git...

@andrewshrout
Copy link

Why isn't there just a docker image to compile this?

@VermeilChan
Copy link
Author

Why isn't there just a docker image to compile this?

i dont how to use them and dont you think thats overkill?

@EngrIbrahimAdnan
Copy link

Awasome, It actually worked. If someone is still having issues, make sure the paths in the following:

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_LIBRARY_DIR=C:\deps\skia\out\Release-x64 -DSKIA_LIBRARY=C:\deps\skia\out\Release-x64\skia.lib -G Ninja ..
ninja aseprite

Actually point to the folder you set up. If it is on desktop or document, specify it will continue showing you "not found" when it attempts to search it.

@helcelira
Copy link

This was rlly useful ty

@agajgjsa592586
Copy link

Yeah, I can't build. I feel like I'm still getting this error message all of the time...

@Outwardwet
Copy link

i get this error

CMake Error at CMakeLists.txt:23 (project):
  Running

   'C:/deps/depot_tools/ninja' '--version'

  failed with:

   unknown error


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

@VermeilChan
Copy link
Author

i get this error

CMake Error at CMakeLists.txt:23 (project):
  Running

   'C:/deps/depot_tools/ninja' '--version'

  failed with:

   unknown error


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

did you install ninja?

@PYRONATOR
Copy link

image
I keep getting this lovely error each time I try to compile, I tried looking for ways to disable the compiler testing and I cant find a method that works here, if anyone could help I would be very greatful!!

@DanielTurner1865
Copy link

Hi there, I see some people have already had the issue of
` when parsing string

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe

Invalid character escape '\P'.`

I saw you added this code to fix the issue:
cmake -DCMAKE_CXX_COMPILER="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_LIBRARY_DIR=C:\deps\skia\out\Release-x64 -DSKIA_LIBRARY=C:\deps\skia\out\Release-x64\skia.lib -G Ninja ..

However I am still getting the issue regardless of which one i use.

Im clueless about this stuff so if you could help me i would really appreciate it.

@VermeilChan
Copy link
Author

Hi there, I see some people have already had the issue of ` when parsing string

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe

Invalid character escape '\P'.`

I saw you added this code to fix the issue: cmake -DCMAKE_CXX_COMPILER="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_LIBRARY_DIR=C:\deps\skia\out\Release-x64 -DSKIA_LIBRARY=C:\deps\skia\out\Release-x64\skia.lib -G Ninja ..

However I am still getting the issue regardless of which one i use.

Im clueless about this stuff so if you could help me i would really appreciate it.

I'm as clueless as you are I only know the basics too sorry :(

@kalmaguer
Copy link

Perfect instructions, worked with latest Aseprite v1.3.8.1 thank you!

I saw someone mention something about git. I'm not sure if it matters but I already had git installed.

@VermeilChan
Copy link
Author

Perfect instructions, worked with latest Aseprite v1.3.8.1 thank you!

I saw someone mention something about git. I'm not sure if it matters but I already had git installed.

u dont need git, unless you want to build a development build witch is unstable

@agajgjsa592586
Copy link

I feel like this.

-- Check for working C compiler: /c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/cl.exe
-- Check for working C compiler: /c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/cl.exe - broken
CMake Error at /opt/devkitpro/msys2/usr/share/cmake/Modules/CMakeTestCCompiler.cmake:70 (message):
The C compiler

"/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /c/aseprite/build/CMakeFiles/CMakeScratch/TryCompile-eKZVUg

Run Build Command(s):/c/Program Files/CMake/bin/ninja.exe cmTC_db81b && ninja: error: '/c/aseprite/build/CMakeFiles/CMakeScratch/TryCompile-eKZVUg/testCCompiler.c', needed by 'CMakeFiles/cmTC_db81b.dir/testCCompiler.c.o', missing and no known rule to make it

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:23 (project)

-- Configuring incomplete, errors occurred!
See also "/c/aseprite/build/CMakeFiles/CMakeOutput.log".
See also "/c/aseprite/build/CMakeFiles/CMakeError.log".

is broken for me...

@VermeilChan
Copy link
Author

I feel like this.

-- Check for working C compiler: /c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/cl.exe -- Check for working C compiler: /c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/cl.exe - broken CMake Error at /opt/devkitpro/msys2/usr/share/cmake/Modules/CMakeTestCCompiler.cmake:70 (message): The C compiler

"/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/HostX64/x64/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /c/aseprite/build/CMakeFiles/CMakeScratch/TryCompile-eKZVUg

Run Build Command(s):/c/Program Files/CMake/bin/ninja.exe cmTC_db81b && ninja: error: '/c/aseprite/build/CMakeFiles/CMakeScratch/TryCompile-eKZVUg/testCCompiler.c', needed by 'CMakeFiles/cmTC_db81b.dir/testCCompiler.c.o', missing and no known rule to make it

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:23 (project)

-- Configuring incomplete, errors occurred! See also "/c/aseprite/build/CMakeFiles/CMakeOutput.log". See also "/c/aseprite/build/CMakeFiles/CMakeError.log".

is broken for me...

as much as i want to help you, i dont really much about CMake

@Roslam24
Copy link

i get this error

CMake Error at CMakeLists.txt:23 (project):
  Running

   'C:/deps/depot_tools/ninja' '--version'

  failed with:

   unknown error


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

if u guys problem with this. maybe, u should use different ninja version. i was use x64 version of ninja and didn't work, then try the x86 version and it works.
so if u fail in x64 version then try x86 version of ninja, or vice versa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment