Skip to content

Commit cb6ddc6

Browse files
committed
modified some build stuff
1 parent c6aabd8 commit cb6ddc6

8 files changed

+372
-21
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,6 @@ FodyWeavers.xsd
365365
lib
366366
bin
367367
build
368-
out
368+
out
369+
370+
.vscode

CMakeLists.txt

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cmake_minimum_required(VERSION 3.29)
22
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3-
set(CMAKE_BUILD_TYPE Debug)
43
# Enable Hot Reload for MSVC compilers if supported.
54
if (POLICY CMP0141)
65
cmake_policy(SET CMP0141 NEW)
@@ -11,17 +10,12 @@ endif()
1110
set(CMAKE_CXX_STANDARD 20)
1211
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1312
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Distribution")
13+
1414
if(NOT DEFINED TS_CUSTOM_CONFIGURATIONS)
1515
# The configurations we support
1616
#set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Distribution")
1717
endif()
1818

19-
# Set build type if not specified
20-
if(NOT CMAKE_BUILD_TYPE)
21-
set(CMAKE_BUILD_TYPE Release)
22-
endif()
23-
24-
2519
# Output directories
2620

2721
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # Static libraries
@@ -52,6 +46,20 @@ if (WIN32)
5246
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
5347
endif()
5448

49+
execute_process(
50+
COMMAND python3 build-scripts\TechstormConfigure.py
51+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\build-scripts
52+
RESULT_VARIABLE result
53+
OUTPUT_VARIABLE output
54+
ERROR_VARIABLE error
55+
)
56+
57+
if(NOT result EQUAL 0)
58+
message(FATAL_ERROR "Failed to configure Techstorm: ${error}")
59+
endif()
60+
61+
message(STATUS "Configuring Techstorm: ${output}")
62+
5563
# Set project name
5664
project(TechStorm LANGUAGES CXX C)
5765
set(CMAKE_EXPORT_COMPILE_COMMANDS True)

build-scripts/TechstormConfigure.py

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import subprocess
2+
import os
3+
import sys
4+
5+
def IsConanInstalled():
6+
try:
7+
subprocess.check_call(['conan', '--version'])
8+
print("Conan is already installed\n")
9+
return True
10+
except:
11+
print("Conan is not installed\n")
12+
return False
13+
14+
def InstallConan():
15+
print("Installing Conan...")
16+
subprocess.check_call(['pip', 'install', 'conan'])
17+
print("Conan is now installed.\n")
18+
19+
def DoesBuildFolderExist():
20+
return os.path.exists("build")
21+
22+
def RemoveBuildFolder():
23+
os.rmdir("build")
24+
25+
def CheckConanStep():
26+
print("Checking for Conan...")
27+
28+
if IsConanInstalled() == False:
29+
InstallConan()
30+
31+
print("Done checking for Conan.\n")
32+
33+
def InstallPackagesStep():
34+
print("Installing packages...")
35+
36+
packageConfigsInstalled = [False, False, False]
37+
removeBuildDir = False
38+
39+
40+
for i in range(len(sys.argv)):
41+
if sys.argv[i] == "--debug":
42+
packageConfigsInstalled[0] = True
43+
elif sys.argv[i] == "--release":
44+
packageConfigsInstalled[1] = True
45+
elif sys.argv[i] == "--distribution":
46+
packageConfigsInstalled[2] = True
47+
elif sys.argv[i] == "--remove-build-folder":
48+
removeBuildDir = True
49+
50+
if DoesBuildFolderExist() == True and removeBuildDir == True:
51+
print("Removing build folder...")
52+
RemoveBuildFolder()
53+
print("Done removing build folder.\n")
54+
55+
56+
if packageConfigsInstalled[0] == True:
57+
print("Installing debug packages...")
58+
subprocess.check_call(['conan', 'install', '.', '--output-folder=build', '--build=missing', '-s', 'build_type=Debug'])
59+
60+
print("Done installing debug packages.\n")
61+
62+
63+
64+
if packageConfigsInstalled[1] == True:
65+
print("Installing release packages...")
66+
subprocess.check_call(['conan', 'install', '.', '--output-folder=build', '--build=missing', '-s', 'build_type=Release'])
67+
68+
print("Done installing release packages.\n")
69+
70+
71+
if packageConfigsInstalled[2] == True:
72+
print("Installing distribution packages...")
73+
subprocess.check_call(['conan', 'install', '.', '--output-folder=build', '--build=missing', '-s', 'build_type=Distribution'])
74+
75+
print("Done installing distribution packages.\n")
76+
77+
print("Done installing packages.\n")
78+
return packageConfigsInstalled
79+
80+
def GenerateProjectStep():
81+
print("Generating project...")
82+
os.chdir("build")
83+
subprocess.check_call(['cmake', '..', '-G', 'Visual Studio 17 2022', '-DCMAKE_TOOLCHAIN_FILE=build\conan_toolchain.cmake'])
84+
print("Done generating project.\n")
85+
86+
def BuildProject(type):
87+
print("Building project of type " + type + "...")
88+
subprocess.check_call(['cmake', '--build', '.', '--config=' + type])
89+
print("Done building project.\n")
90+
91+
print("Configuring Techstorm...")
92+
93+
os.chdir("../")
94+
95+
CheckConanStep()
96+
conf = InstallPackagesStep()
97+
GenerateProjectStep()
98+
99+
print("Building project...")
100+
101+
installedDebug = conf[0]
102+
installedRelease = conf[1]
103+
installedDistribution = conf[2]
104+
105+
if installedDebug == True:
106+
print("Building debug packages and project...")
107+
BuildProject("Debug")
108+
print("Done building debug packages and project.\n")
109+
110+
if installedRelease == True:
111+
print("Building release packages and project...")
112+
BuildProject("Release")
113+
print("Done building release packages and project.\n")
114+
115+
if installedDistribution == True:
116+
print("Building distribution packages and project...")
117+
BuildProject("Distribution")
118+
print("Done building distribution packages and project.\n")
119+
120+
print("Done building project.\n")
121+
122+
os.chdir("..")
123+
124+
print("Techstorm is now configured and built. Go to the build folder, and click on the Techstorm.sln solution to begin working. Happy coding, you magnificent developer! :)")

build-scripts/build-linux.sh

Whitespace-only changes.

build-scripts/build-windows.bat

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@ECHO OFF
2+
3+
::set BASEDIR=%~dp0
4+
::PUSHD %BASEDIR%
5+
6+
::RMDIR /Q /S build
7+
8+
::@ECHO ON
9+
10+
::conan install . --output-folder=build --build=missing
11+
::cd build
12+
::cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=build\conan_toolchain.cmake
13+
::cmake --build . --config=Debug
14+
python3 TechstormConfigure.py

build.bat

-13
This file was deleted.

0 commit comments

Comments
 (0)