diff options
author | crupest <crupest@outlook.com> | 2019-03-28 18:29:47 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-03-28 18:29:47 +0800 |
commit | ae41f140bfe121274311e00ddd74f7bd9b192819 (patch) | |
tree | 666dcba9930fefe6c33b0b2e56a0d76cfc931a73 | |
parent | 8b1ec7c3f38eb8140f88a472184199b360e21c13 (diff) | |
download | cru-ae41f140bfe121274311e00ddd74f7bd9b192819.tar.gz cru-ae41f140bfe121274311e00ddd74f7bd9b192819.tar.bz2 cru-ae41f140bfe121274311e00ddd74f7bd9b192819.zip |
...
-rw-r--r-- | .gitignore | 230 | ||||
-rw-r--r-- | azure-pipelines.yml | 115 | ||||
-rw-r--r-- | src/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tools/build.py | 27 |
4 files changed, 252 insertions, 128 deletions
@@ -1,3 +1,194 @@ + +# Created by https://www.gitignore.io/api/c++,cmake,python,visualstudio,visualstudiocode +# Edit at https://www.gitignore.io/?templates=c++,cmake,python,visualstudio,visualstudiocode + +### C++ ### +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### CMake ### +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +### CMake Patch ### +# External projects +*-prefix/ + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don’t work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history + +### VisualStudio ### ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## @@ -13,6 +204,9 @@ # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs +# Mono auto generated files +mono_crash.* + # Build results [Dd]ebug/ [Dd]ebugPublic/ @@ -20,6 +214,8 @@ [Rr]eleases/ x64/ x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ bld/ [Bb]in/ [Oo]bj/ @@ -63,9 +259,7 @@ StyleCopReport.xml *_h.h *.ilk *.meta -*.obj *.iobj -*.pch *.pdb *.ipdb *.pgc @@ -78,7 +272,6 @@ StyleCopReport.xml *.tmp *.tmp_proj *_wpftmp.csproj -*.log *.vspscc *.vssscc .builds @@ -204,12 +397,14 @@ BundleArtifacts/ Package.StoreAssociation.xml _pkginfo.txt *.appx +*.appxbundle +*.appxupload # Visual Studio cache files # files ending in .cache can be ignored *.[Cc]ache # but keep track of directories ending in .cache -!*.[Cc]ache/ +!?*.[Cc]ache/ # Others ClientBin/ @@ -253,6 +448,7 @@ ServiceFabricBackup/ *.bim.layout *.bim_*.settings *.rptproj.rsuser +*- Backup*.rdl # Microsoft Fakes FakesAssemblies/ @@ -288,15 +484,10 @@ paket-files/ # FAKE - F# Make .fake/ -# JetBrains Rider -.idea/ -*.sln.iml - # CodeRush personal settings .cr/personal # Python Tools for Visual Studio (PTVS) -__pycache__/ *.pyc # Cake - Uncomment if you are using it @@ -333,21 +524,10 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ -### CMake ### -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -Makefile -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps +# BeatPulse healthcheck temp database +healthchecksdb -### CMake Patch ### -# External projects -*-prefix/ +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ -build +# End of https://www.gitignore.io/api/c++,cmake,python,visualstudio,visualstudiocode
\ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8936a242..6f3b8473 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,106 +1,27 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net +trigger: +- master jobs: - - job: x86_debug + - job: Windows_Build pool: vmImage: 'VS2017-Win2016' - - variables: - solution: '**/*.sln' - buildPlatform: 'x86' - buildConfiguration: 'Debug' - - steps: - - task: VSBuild@1 - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - - - task: CopyFiles@2 - inputs: - contents: '**\$(buildConfiguration)\**\?(*.exe|*.dll|*.pdb)' - targetFolder: '$(build.artifactStagingDirectory)' - - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: '$(build.artifactStagingDirectory)' - artifactName: 'executables' - - - job: x64_debug - pool: - vmImage: 'VS2017-Win2016' - - variables: - solution: '**/*.sln' - buildPlatform: 'x64' - buildConfiguration: 'Debug' + strategy: + matrix: + x86_debug: + buildPlatform: 'x86' + buildConfiguration: 'Debug' + x86_release: + buildPlatform: 'x86' + buildConfiguration: 'Release' + x64_debug: + buildPlatform: 'x64' + buildConfiguration: 'Debug' + x64_release: + buildPlatform: 'x64' + buildConfiguration: 'Release' steps: - - task: VSBuild@1 - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - - - task: CopyFiles@2 - inputs: - contents: '**\$(buildConfiguration)\**\?(*.exe|*.dll|*.pdb)' - targetFolder: '$(build.artifactStagingDirectory)' - - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: '$(build.artifactStagingDirectory)' - artifactName: 'executables' - - - job: x86_release - pool: - vmImage: 'VS2017-Win2016' - - dependsOn: x86_debug - - variables: - solution: '**/*.sln' - buildPlatform: 'x86' - buildConfiguration: 'Release' - - steps: - - task: VSBuild@1 - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - - - task: CopyFiles@2 - inputs: - contents: '**\$(buildConfiguration)\**\?(*.exe|*.dll|*.pdb)' - targetFolder: '$(build.artifactStagingDirectory)' - - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: '$(build.artifactStagingDirectory)' - artifactName: 'executables' - - - job: x64_release - pool: - vmImage: 'VS2017-Win2016' - - dependsOn: x64_debug - - variables: - solution: '**/*.sln' - buildPlatform: 'x64' - buildConfiguration: 'Release' - - steps: - - task: VSBuild@1 - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' + - script: python tools\build.py -a $(buildPlatform) -c $(buildConfiguration) - task: CopyFiles@2 inputs: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bc33c29d..81038370 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,14 +28,10 @@ add_library(cru_ui STATIC target_include_directories(cru_ui PUBLIC .) if(WIN32) -find_library(D3D11_LIB D3D11) -find_library(D2D1_LIB D2d1) -find_library(DWRITE_LIB DWrite) - -target_link_libraries(cru_ui PRIVATE ${D3D11_LIB} ${D2D1_LIB} ${DWRITE_LIB}) - +target_link_libraries(cru_ui PRIVATE D3D11 D2d1 DWrite) target_compile_definitions(cru_ui PUBLIC UNICODE _UNICODE) endif() add_executable(demo main.cpp) + target_link_libraries(demo PRIVATE cru_ui) diff --git a/tools/build.py b/tools/build.py new file mode 100644 index 00000000..ab7c1205 --- /dev/null +++ b/tools/build.py @@ -0,0 +1,27 @@ +import argparse +import os +import os.path +import subprocess +import sys + +parser = argparse.ArgumentParser() +parser.add_argument('-a', '--arch', choices=['x86', 'x64'], + required=True, help='specify target cpu architecture') +parser.add_argument('-c', '--config', choices=['Debug', 'Release'], + required=True, help='specify build configuration') +args = parser.parse_args() + + +project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +os.chdir(project_root) + +generater_vs_arch_map = { + 'x86': 'Win32', + 'x64': 'x64' +} + +subprocess.run('cmake -S . -B build -G "Visual Studio 15 2017" -A {arch}'.format(arch=generater_vs_arch_map[args.arch]), + stdout=sys.stdout, stderr=sys.stderr) + +subprocess.run('cmake --build build --target ALL_BUILD --config {config}'.format(config=args.config), + stdout=sys.stdout, stderr=sys.stderr) |