Skip to content

Commit 3ff6d91

Browse files
committed
For some reason CMake did not work on Windows. This should work.
1 parent 8e421a7 commit 3ff6d91

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

CMakeLists.txt

+16-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99
# See LICENSE.txt for the full license.
1010
#
1111
cmake_minimum_required(VERSION 3.15)
12-
set(CMAKE_INCLUDE_CURRENT_DIR ON)
12+
include(version.cmake)
13+
project(jabs
14+
VERSION "${BUILD_VERSION}"
15+
DESCRIPTION "Jaakko's Backscattering Simulator (JaBS)"
16+
LANGUAGES C
17+
)
18+
1319
if(WIN32 AND DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
1420
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
1521
CACHE STRING "")
@@ -20,15 +26,16 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
2026
set(CMAKE_BUILD_TYPE Release)
2127
endif()
2228

23-
add_subdirectory(gitwatcher)
2429

25-
include(version.cmake)
30+
option(DEBUG_MODE_ENABLE "Enable debug mode" OFF)
31+
if(DEBUG_MODE_ENABLE)
32+
if (MSVC)
33+
add_compile_options(/W4 /WX /DDEBUG)
34+
else()
35+
add_compile_options(-Wall -Wextra -pedantic -DDEBUG)
36+
endif()
37+
endif()
2638

27-
project(jabs
28-
VERSION "${BUILD_VERSION}"
29-
DESCRIPTION "Jaakko's Backscattering Simulator (JaBS)"
30-
LANGUAGES C
31-
)
32-
set(CMAKE_C_STANDARD 99)
39+
add_subdirectory(gitwatcher)
3340

3441
add_subdirectory(src)

release_scripts/deploy_win.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set QT6_DIR=C:\Qt\6.1.2
66
REM And vcpkg
77
set VCPKG_DIR=C:\vcpkg
88
REM Try to remove CMakeCache.txt files if your configuration (e.g. compiler) changes or you want to do a fresh build
9-
9+
cd ..
1010
mkdir build
1111
cd build
1212
REM del CMakeCache.txt
@@ -22,7 +22,7 @@ cmake -DCMAKE_PREFIX_PATH="%QT6_DIR%\msvc2019_64\lib\cmake" -G "Visual Studio 16
2222
cmake --build . --target ALL_BUILD --config Release
2323
REM Windeployqt will handle most dlls and other Qt dependencies
2424
%QT6_DIR%\msvc2019_64\bin\windeployqt.exe Release
25-
copy ..\..\build\Release\jabs.exe Release
25+
copy ..\..\build\src\Release\jabs.exe Release
2626
copy "%JIBAL_DIR%\bin\*.dll" Release
2727
del Release\jibal.conf
2828
(

src/CMakeLists.txt

+3-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# See LICENSE.txt for the full license.
1010
#
1111

12+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
13+
set(CMAKE_C_STANDARD 99)
14+
1215
configure_file(version.h.in version.h @ONLY)
1316
find_package(GSL 2.6 REQUIRED)
1417
find_package(Jibal 0.3.7 REQUIRED)
@@ -18,15 +21,6 @@ if(WIN32)
1821
find_library(GETOPT_LIBRARY getopt)
1922
endif()
2023

21-
option(DEBUG_MODE_ENABLE "Enable debug mode" OFF)
22-
if(DEBUG_MODE_ENABLE)
23-
if (MSVC)
24-
add_compile_options(/W4 /WX /DDEBUG)
25-
else()
26-
add_compile_options(-Wall -Wextra -pedantic -DDEBUG)
27-
endif()
28-
endif()
29-
3024
add_executable(jabs main.c sample.c sample.h brick.c ion.c ion.h simulation.c simulation.h reaction.c reaction.h
3125
options.c options.h spectrum.c spectrum.h fit.c fit.h rotate.c rotate.h detector.c detector.h jabs.c jabs.h
3226
roughness.c roughness.h script.c script.h generic.c generic.h message.c message.h aperture.c aperture.h

version.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#Read version from file
22
file(READ "${CMAKE_CURRENT_LIST_DIR}/version.txt" BUILD_VERSION)
33
string(STRIP "${BUILD_VERSION}" BUILD_VERSION)
4+
message(STATUS "JaBS version is ${BUILD_VERSION}")

0 commit comments

Comments
 (0)