Skip to content
Snippets Groups Projects
Commit f0f4f2ad authored by xiyehu2's avatar xiyehu2
Browse files

Changed build structure to CMAKE

parent b4d9c21f
No related branches found
No related tags found
No related merge requests found
Showing
with 168 additions and 260 deletions
......@@ -143,3 +143,5 @@ _Pvt_Extensions
/Cpp/test.exe
/Cpp/lib/driver_header/spcm_win64_msvcpp_symbols.txt
/Cpp/lib/spcm_win64_msvcpp_symbols.txt
/Cpp/out
/Python/data
# CMakeList.txt : CMake project for Cpp, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.20)
# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
set(CMAKE_CXX_STANDARD 20)
project ("main")
add_library(wfmLib "")
add_library(AWGLib "")
add_subdirectory(lib)
include_directories(lib/driver_header)
set(MAINHEADERS
)
set(MAINSOURCES
run.cpp
)
add_executable(main ${MAINHEADERS} ${MAINSOURCES})
set(LIBS
wfmLib
AWGLib
)
target_link_libraries(main ${LIBS})
\ No newline at end of file
{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "x64-debug",
"displayName": "x64 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x64-release",
"displayName": "x64 Release",
"inherits": "x64-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "x86-debug",
"displayName": "x86 Debug",
"inherits": "windows-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "x86-release",
"displayName": "x86 Release",
"inherits": "x86-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "linux-debug",
"displayName": "Linux Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
},
{
"name": "macos-debug",
"displayName": "macOS Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
}
]
}

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34024.191
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cpp", "Cpp.vcxproj", "{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Debug|x64.ActiveCfg = Debug|x64
{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Debug|x64.Build.0 = Debug|x64
{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Debug|x86.ActiveCfg = Debug|Win32
{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Debug|x86.Build.0 = Debug|Win32
{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Release|x64.ActiveCfg = Release|x64
{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Release|x64.Build.0 = Release|x64
{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Release|x86.ActiveCfg = Release|Win32
{1CCAB617-6DEE-4B9D-A6D1-F3929CE9E0C9}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B586227A-0AA5-4AC8-8081-A18EC4A283FC}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{1ccab617-6dee-4b9d-a6d1-f3929ce9e0c9}</ProjectGuid>
<RootNamespace>Cpp</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<EnablePREfast>true</EnablePREfast>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>.\lib\driver_header;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>spcm_win64_msvcpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="lib\AWG.cpp" />
<ClCompile Include="run.cpp" />
<ClCompile Include="lib\Waveform.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="lib\AWG.h" />
<ClInclude Include="lib\driver_header\dlltyp.h" />
<ClInclude Include="lib\driver_header\errors.h" />
<ClInclude Include="lib\driver_header\regs.h" />
<ClInclude Include="lib\driver_header\spcerr.h" />
<ClInclude Include="lib\driver_header\spcm_drv.h" />
<ClInclude Include="lib\Waveform.h" />
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="run.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="lib\AWG.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="lib\Waveform.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="lib\AWG.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib\driver_header\dlltyp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib\driver_header\errors.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib\driver_header\regs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib\driver_header\spcerr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib\driver_header\spcm_drv.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="lib\Waveform.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
</Project>
\ No newline at end of file
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
// such as names of functions and macros.
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
#define drv_handle
#define int32
#define int64
......@@ -14,6 +14,8 @@ AWG::AWG() noexcept {
AWG::~AWG() {
// TODO: do this
if (this->isOpen()) { this->close(); }
this->pCardHandle = nullptr;
return;
}
......@@ -76,7 +78,7 @@ void AWG::open(int openIndex) {
* @param openIndex card index, 0 or 1
*/
if (!this->isOpen()) {
std::cout << "card already opened" << std::endl;
std::cout << "card open failed" << std::endl;
return;
}
......
target_sources(wfmLib
PRIVATE
waveform.cpp
PUBLIC
waveform.h
)
add_library(driverLib STATIC IMPORTED)
set_target_properties(driverLib PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/driver_header/spcm_win64_msvcpp.lib"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/driver_header"
)
target_link_libraries(AWGLib PUBLIC driverLib)
target_include_directories(wfmLib PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_sources(AWGLib
PRIVATE
AWG.cpp
PUBLIC
AWG.h
)
target_include_directories(AWGLib PUBLIC ${CMAKE_CURRENT_LIST_DIR})
#include "Waveform.h"
Waveform::Waveform() {
this->freqRes = 0;
}
......@@ -3,5 +3,7 @@ class Waveform {
public:
int freqRes; // frequency resolution
int samplingRate; // sampling rate
Waveform();
};
File deleted
File deleted
File deleted
File deleted
File deleted
File added
HEAD SpcInitPCIBoards (int16 *pnCount, int16 *pnPCIVersion);
HEAD SpcInitBoard (int16 nNr, int16 nTyp);
HEAD SpcSetParam (int16 nNr, int32 lReg, int32 lValue);
HEAD SpcGetParam (int16 nNr, int32 lReg, int32 *plValue);
HEAD SpcGetData (int16 nNr, int16 nCh, int32 lStart, int32 lLen, dataptr pvData);
HEAD SpcSetData (int16 nNr, int16 nCh, int32 lStart, int32 lLen, dataptr pvData);
HEAD SpcGetVersionInfo (char *pszBuffer, int nBufferLen);
// these functions are only needed under 64 bit Linux to set FIFO adresses
HEAD SpcSetAdr (int16 nNr, int32 lReg, void* pvAdr);
HEAD SpcGetAdr (int16 nNr, int32 lReg, void** ppvAdr);
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment